diff --git a/src/include/ranges/range_types/spin_range.h b/src/include/ranges/range_types/spin_range.h index 77be683..2e330ed 100644 --- a/src/include/ranges/range_types/spin_range.h +++ b/src/include/ranges/range_types/spin_range.h @@ -66,81 +66,6 @@ namespace MultiArrayTools typedef SingleRangeFactory SpinRF; } -/* ========================= * - * --- TEMPLATE CODE --- * - * ========================= */ - -namespace MultiArrayTools -{ - /******************** - * SingleRange * - ********************/ - - SingleRangeFactory::SingleRangeFactory() - { - // Quasi Singleton - if(not mProd){ - mProd = std::shared_ptr( new SingleRange() ); - setSelf(); - } - } - - std::shared_ptr SingleRangeFactory::create() - { - return mProd; - } - - /******************** - * SingleRange * - ********************/ - - size_t SingleRange::get(size_t pos) const - { - return pos; - } - - size_t SingleRange::getMeta(size_t metaPos) const - { - return metaPos; - } - - size_t SingleRange::size() const - { - return mSpinNum; - } - - size_t SingleRange::dim() const - { - return 1; - } - - typename SingleRange::IndexType SingleRange::begin() const - { - SingleIndex i( std::dynamic_pointer_cast > - ( std::shared_ptr( RB::mThis ) ) ); - i = 0; - return i; - } - - typename SingleRange::IndexType SingleRange::end() const - { - SingleIndex i( std::dynamic_pointer_cast > - ( std::shared_ptr( RB::mThis ) ) ); - i = size(); - return i; - } - - // put this in the interface class !!! - std::shared_ptr SingleRange::index() const - { - typedef IndexWrapper IW; - return std::make_shared - ( std::make_shared - ( std::dynamic_pointer_cast > - ( std::shared_ptr( RB::mThis ) ) ) ); - } - -} //#endif // #ifndef __spin_range_h__ diff --git a/src/include/xfor/xfor.h b/src/include/xfor/xfor.h index cec68a4..6936da2 100644 --- a/src/include/xfor/xfor.h +++ b/src/include/xfor/xfor.h @@ -94,10 +94,10 @@ namespace MultiArrayHelper }; template - size_t exceptMax(size_t max) { return max; } + inline size_t exceptMax(size_t max) { return max; } template <> - size_t exceptMax<1>(size_t max) { return 1; } + inline size_t exceptMax<1>(size_t max) { return 1; } } // namespace MultiArrayHelper diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 4de9551..e0b0e96 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -2,9 +2,14 @@ set(libmultiarray_a_SOURCES ${CMAKE_SOURCE_DIR}/src/lib/ranges/range_base.cc ${CMAKE_SOURCE_DIR}/src/lib/ranges/index_info.cc - #${CMAKE_SOURCE_DIR}/src/lib/operation_utils.cc ) +file(GLOB cc_files "${CMAKE_SOURCE_DIR}/src/lib/ranges/range_types/*.cc") +foreach(ccfile ${cc_files}) + set(libmultiarray_a_SOURCES ${libmultiarray_a_SOURCES} + ${ccfile}) +endforeach(ccfile) + add_library(multiarray STATIC ${libmultiarray_a_SOURCES}) install(TARGETS multiarray ARCHIVE DESTINATION ${INSTALL_PATH}/lib diff --git a/src/lib/ranges/range_types/spin_range.cc b/src/lib/ranges/range_types/spin_range.cc new file mode 100644 index 0000000..cdc8f5f --- /dev/null +++ b/src/lib/ranges/range_types/spin_range.cc @@ -0,0 +1,75 @@ + +#include "ranges/rheader.h" + +namespace MultiArrayTools +{ + /******************** + * SingleRange * + ********************/ + + SingleRangeFactory::SingleRangeFactory() + { + // Quasi Singleton + if(not mProd){ + mProd = std::shared_ptr( new SingleRange() ); + setSelf(); + } + } + + std::shared_ptr SingleRangeFactory::create() + { + return mProd; + } + + /******************** + * SingleRange * + ********************/ + + size_t SingleRange::get(size_t pos) const + { + return pos; + } + + size_t SingleRange::getMeta(size_t metaPos) const + { + return metaPos; + } + + size_t SingleRange::size() const + { + return mSpinNum; + } + + size_t SingleRange::dim() const + { + return 1; + } + + typename SingleRange::IndexType SingleRange::begin() const + { + SingleIndex i( std::dynamic_pointer_cast > + ( std::shared_ptr( RB::mThis ) ) ); + i = 0; + return i; + } + + typename SingleRange::IndexType SingleRange::end() const + { + SingleIndex i( std::dynamic_pointer_cast > + ( std::shared_ptr( RB::mThis ) ) ); + i = size(); + return i; + } + + // put this in the interface class !!! + std::shared_ptr SingleRange::index() const + { + typedef IndexWrapper IW; + return std::make_shared + ( std::make_shared + ( std::dynamic_pointer_cast > + ( std::shared_ptr( RB::mThis ) ) ) ); + } + +} +