diff --git a/src/include/functional_multi_array.h b/src/include/functional_multi_array.h index b2a8251..3652e24 100644 --- a/src/include/functional_multi_array.h +++ b/src/include/functional_multi_array.h @@ -7,72 +7,6 @@ namespace MultiArrayTools { - - template - struct ToMAObject - { - template - static auto mk(const std::shared_ptr& i) - -> MultiArray - { - assert(0); // deprecated - vector vv(i->range()->size()); - for(Index j = (*i); j.pos() != j.max(); ++j){ - vv[j.pos()] = j.meta(); - } - return MultiArray( i->range(), vv ); - } - }; - - template <> - struct ToMAObject - { - template - static auto mk(const std::shared_ptr& i) - -> ConstSlice - { - return ConstSlice( i->range(), i->metaPtr() ); - } - }; - - template - auto mkMAObject(const std::shared_ptr& i) - -> std::shared_ptr::mk(i))> - { - return std::make_shared::mk(i))> - (ToMAObject::mk(i)); - } - - template - struct ToOpObject - { - template - static auto mk(const std::shared_ptr& ind) - -> ConstOperationRoot - { - return ConstOperationRoot( mkMAObject(ind), ind); - } - }; - - template <> - struct ToOpObject - { - template - static auto mk(const std::shared_ptr& ind) - -> MetaOperationRoot - { - return MetaOperationRoot( ind ); - } - }; - - template - auto mkOpObject(const std::shared_ptr& i) - -> decltype(ToOpObject::mk(i)) - { - return ToOpObject::mk(i); - } template class FunctionalMultiArray : public MultiArrayBase diff --git a/src/include/high_level_operation.h b/src/include/high_level_operation.h index fa1ffc1..d3acf1f 100644 --- a/src/include/high_level_operation.h +++ b/src/include/high_level_operation.h @@ -54,7 +54,10 @@ namespace MultiArrayTools #define reg_ind3(I1,I2,I3) virtual RetT create \ (const std::shared_ptr& ind1,const std::shared_ptr& ind2,const std::shared_ptr& ind3) = 0 -#include "hl_reg_ind.h" + //#include "hl_reg_ind.h" + reg_ind1(ClassicRange::IndexType); + reg_ind2(ClassicRange::IndexType,ClassicRange::IndexType); + reg_ind3(ClassicRange::IndexType,ClassicRange::IndexType,ClassicRange::IndexType); #undef reg_ind1 #undef reg_ind2 @@ -92,7 +95,10 @@ namespace MultiArrayTools (const std::shared_ptr& ind1, const std::shared_ptr& ind2, const std::shared_ptr& ind3) \ override final { return xcreate(ind1,ind2,ind3); } -#include "hl_reg_ind.h" + //#include "hl_reg_ind.h" + reg_ind1(ClassicRange::IndexType); + reg_ind2(ClassicRange::IndexType,ClassicRange::IndexType); + reg_ind3(ClassicRange::IndexType,ClassicRange::IndexType,ClassicRange::IndexType); virtual ROP* get() override final; virtual VOP* vget() override final; @@ -121,7 +127,10 @@ namespace MultiArrayTools virtual bool root() const override final; -#include "hl_reg_ind.h" + //#include "hl_reg_ind.h" + reg_ind1(ClassicRange::IndexType); + reg_ind2(ClassicRange::IndexType,ClassicRange::IndexType); + reg_ind3(ClassicRange::IndexType,ClassicRange::IndexType,ClassicRange::IndexType); virtual ROP* get() override final; virtual VOP* vget() override final; @@ -158,7 +167,10 @@ namespace MultiArrayTools virtual ROP* get() override final; virtual VOP* vget() override final; -#include "hl_reg_ind.h" + //#include "hl_reg_ind.h" + reg_ind1(ClassicRange::IndexType); + reg_ind2(ClassicRange::IndexType,ClassicRange::IndexType); + reg_ind3(ClassicRange::IndexType,ClassicRange::IndexType,ClassicRange::IndexType); #undef reg_ind1 #undef reg_ind2 diff --git a/src/include/hl_reg_ind.h b/src/include/hl_reg_ind.h deleted file mode 100644 index 144c5e0..0000000 --- a/src/include/hl_reg_ind.h +++ /dev/null @@ -1,52 +0,0 @@ - -#ifndef __hl_reg_ind_h__ -#define __hl_reg_ind_h__ - -#include "ranges/rheader.h" - -namespace MultiArrayTools -{ - - template - struct RegIndNum - { - static constexpr size_t VALUE = -1; - static constexpr size_t DEPTH = 0; - }; - - template <> - struct RegIndNum - { - static constexpr size_t VALUE = 0; - static constexpr size_t DEPTH = 3; - }; - - // to be returned by IndexWrapper - struct RegIndInfo - { - size_t type; - size_t depth; - - template - RegIndInfo& set(const std::shared_ptr& i) - { - type = RegIndNum::VALUE; - depth = RegIndNum::DEPTH; - return *this; - } - }; -} - -#endif - -#ifdef reg_ind1 -#ifdef reg_ind2 -#ifdef reg_ind3 - -reg_ind1(ClassicRange::IndexType); -reg_ind2(ClassicRange::IndexType,ClassicRange::IndexType); -reg_ind3(ClassicRange::IndexType,ClassicRange::IndexType,ClassicRange::IndexType); - -#endif -#endif -#endif diff --git a/src/include/ranges/index_wrapper.cc.h b/src/include/ranges/index_wrapper.cc.h index fd23a05..9b734e9 100644 --- a/src/include/ranges/index_wrapper.cc.h +++ b/src/include/ranges/index_wrapper.cc.h @@ -153,14 +153,7 @@ namespace MultiArrayTools { return std::make_shared( std::make_shared( *mI ) ); } - /* - template - RegIndInfo IndexWrapper::regN() const - { - RegIndInfo out; - return out.set(mI); - } - */ + template std::shared_ptr IndexWrapper::getIndex() const { diff --git a/src/include/ranges/index_wrapper.h b/src/include/ranges/index_wrapper.h index 0df33ff..3a58fd6 100644 --- a/src/include/ranges/index_wrapper.h +++ b/src/include/ranges/index_wrapper.h @@ -4,7 +4,7 @@ #include "ranges/rbase_def.h" #include "xfor/xfor.h" -#include "hl_reg_ind.h" +#include "ranges/rheader.h" namespace MultiArrayTools { @@ -50,13 +50,6 @@ namespace MultiArrayTools virtual std::shared_ptr duplicate() const = 0; - //virtual RegIndInfo regN() const = 0; - //virtual DynamicMetaT meta() const = 0; - //virtual const DynamicMetaT* metaPtr() const = 0; - //virtual AbstractIW& at(const U& metaPos) = 0; - //virtual size_t posAt(const U& metaPos) const = 0; - - //virtual bool isMeta(const U& metaPos) const = 0; inline IndexWrapperBase& at(const std::string smeta) { // ignore spaces, " and ' (string identifiers) @@ -150,7 +143,6 @@ namespace MultiArrayTools virtual DynamicExpression iforh(size_t step, DynamicExpression ex) const override final; virtual std::shared_ptr duplicate() const override final; - //virtual RegIndInfo regN() const override final; std::shared_ptr getIndex() const; virtual std::shared_ptr reduced() const override final;