further lib fixes...
This commit is contained in:
parent
de43a2658c
commit
ddc1a518d2
4 changed files with 83 additions and 78 deletions
|
@ -66,81 +66,6 @@ namespace MultiArrayTools
|
|||
typedef SingleRangeFactory<size_t,SpaceType::SPIN> SpinRF;
|
||||
}
|
||||
|
||||
/* ========================= *
|
||||
* --- TEMPLATE CODE --- *
|
||||
* ========================= */
|
||||
|
||||
namespace MultiArrayTools
|
||||
{
|
||||
/********************
|
||||
* SingleRange *
|
||||
********************/
|
||||
|
||||
SingleRangeFactory<size_t,SpaceType::SPIN>::SingleRangeFactory()
|
||||
{
|
||||
// Quasi Singleton
|
||||
if(not mProd){
|
||||
mProd = std::shared_ptr<oType>( new SingleRange<size_t,SpaceType::SPIN>() );
|
||||
setSelf();
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<RangeBase> SingleRangeFactory<size_t,SpaceType::SPIN>::create()
|
||||
{
|
||||
return mProd;
|
||||
}
|
||||
|
||||
/********************
|
||||
* SingleRange *
|
||||
********************/
|
||||
|
||||
size_t SingleRange<size_t,SpaceType::SPIN>::get(size_t pos) const
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
size_t SingleRange<size_t,SpaceType::SPIN>::getMeta(size_t metaPos) const
|
||||
{
|
||||
return metaPos;
|
||||
}
|
||||
|
||||
size_t SingleRange<size_t,SpaceType::SPIN>::size() const
|
||||
{
|
||||
return mSpinNum;
|
||||
}
|
||||
|
||||
size_t SingleRange<size_t,SpaceType::SPIN>::dim() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
typename SingleRange<size_t,SpaceType::SPIN>::IndexType SingleRange<size_t,SpaceType::SPIN>::begin() const
|
||||
{
|
||||
SingleIndex<size_t,SpaceType::SPIN> i( std::dynamic_pointer_cast<SingleRange<size_t,SpaceType::SPIN> >
|
||||
( std::shared_ptr<RangeBase>( RB::mThis ) ) );
|
||||
i = 0;
|
||||
return i;
|
||||
}
|
||||
|
||||
typename SingleRange<size_t,SpaceType::SPIN>::IndexType SingleRange<size_t,SpaceType::SPIN>::end() const
|
||||
{
|
||||
SingleIndex<size_t,SpaceType::SPIN> i( std::dynamic_pointer_cast<SingleRange<size_t,SpaceType::SPIN> >
|
||||
( std::shared_ptr<RangeBase>( RB::mThis ) ) );
|
||||
i = size();
|
||||
return i;
|
||||
}
|
||||
|
||||
// put this in the interface class !!!
|
||||
std::shared_ptr<VIWB> SingleRange<size_t,SpaceType::SPIN>::index() const
|
||||
{
|
||||
typedef IndexWrapper<IndexType> IW;
|
||||
return std::make_shared<IW>
|
||||
( std::make_shared<IndexType>
|
||||
( std::dynamic_pointer_cast<SingleRange<size_t,SpaceType::SPIN> >
|
||||
( std::shared_ptr<RangeBase>( RB::mThis ) ) ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//#endif // #ifndef __spin_range_h__
|
||||
|
||||
|
|
|
@ -94,10 +94,10 @@ namespace MultiArrayHelper
|
|||
};
|
||||
|
||||
template <size_t N>
|
||||
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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
75
src/lib/ranges/range_types/spin_range.cc
Normal file
75
src/lib/ranges/range_types/spin_range.cc
Normal file
|
@ -0,0 +1,75 @@
|
|||
|
||||
#include "ranges/rheader.h"
|
||||
|
||||
namespace MultiArrayTools
|
||||
{
|
||||
/********************
|
||||
* SingleRange *
|
||||
********************/
|
||||
|
||||
SingleRangeFactory<size_t,SpaceType::SPIN>::SingleRangeFactory()
|
||||
{
|
||||
// Quasi Singleton
|
||||
if(not mProd){
|
||||
mProd = std::shared_ptr<oType>( new SingleRange<size_t,SpaceType::SPIN>() );
|
||||
setSelf();
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<RangeBase> SingleRangeFactory<size_t,SpaceType::SPIN>::create()
|
||||
{
|
||||
return mProd;
|
||||
}
|
||||
|
||||
/********************
|
||||
* SingleRange *
|
||||
********************/
|
||||
|
||||
size_t SingleRange<size_t,SpaceType::SPIN>::get(size_t pos) const
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
size_t SingleRange<size_t,SpaceType::SPIN>::getMeta(size_t metaPos) const
|
||||
{
|
||||
return metaPos;
|
||||
}
|
||||
|
||||
size_t SingleRange<size_t,SpaceType::SPIN>::size() const
|
||||
{
|
||||
return mSpinNum;
|
||||
}
|
||||
|
||||
size_t SingleRange<size_t,SpaceType::SPIN>::dim() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
typename SingleRange<size_t,SpaceType::SPIN>::IndexType SingleRange<size_t,SpaceType::SPIN>::begin() const
|
||||
{
|
||||
SingleIndex<size_t,SpaceType::SPIN> i( std::dynamic_pointer_cast<SingleRange<size_t,SpaceType::SPIN> >
|
||||
( std::shared_ptr<RangeBase>( RB::mThis ) ) );
|
||||
i = 0;
|
||||
return i;
|
||||
}
|
||||
|
||||
typename SingleRange<size_t,SpaceType::SPIN>::IndexType SingleRange<size_t,SpaceType::SPIN>::end() const
|
||||
{
|
||||
SingleIndex<size_t,SpaceType::SPIN> i( std::dynamic_pointer_cast<SingleRange<size_t,SpaceType::SPIN> >
|
||||
( std::shared_ptr<RangeBase>( RB::mThis ) ) );
|
||||
i = size();
|
||||
return i;
|
||||
}
|
||||
|
||||
// put this in the interface class !!!
|
||||
std::shared_ptr<VIWB> SingleRange<size_t,SpaceType::SPIN>::index() const
|
||||
{
|
||||
typedef IndexWrapper<IndexType> IW;
|
||||
return std::make_shared<IW>
|
||||
( std::make_shared<IndexType>
|
||||
( std::dynamic_pointer_cast<SingleRange<size_t,SpaceType::SPIN> >
|
||||
( std::shared_ptr<RangeBase>( RB::mThis ) ) ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in a new issue