Merge branch 'restructure-rename' of rqcd.ur.de:czimmermann/multi_array into restructure-rename
This commit is contained in:
commit
c282cf683d
5 changed files with 18 additions and 139 deletions
|
@ -8,72 +8,6 @@
|
|||
namespace MultiArrayTools
|
||||
{
|
||||
|
||||
template <bool HASMETACONT>
|
||||
struct ToMAObject
|
||||
{
|
||||
template <class Index>
|
||||
static auto mk(const std::shared_ptr<Index>& i)
|
||||
-> MultiArray<typename Index::MetaType, typename Index::RangeType>
|
||||
{
|
||||
assert(0); // deprecated
|
||||
vector<typename Index::MetaType> vv(i->range()->size());
|
||||
for(Index j = (*i); j.pos() != j.max(); ++j){
|
||||
vv[j.pos()] = j.meta();
|
||||
}
|
||||
return MultiArray<typename Index::MetaType, typename Index::RangeType>( i->range(), vv );
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ToMAObject<true>
|
||||
{
|
||||
template <class Index>
|
||||
static auto mk(const std::shared_ptr<Index>& i)
|
||||
-> ConstSlice<typename Index::MetaType, typename Index::RangeType>
|
||||
{
|
||||
return ConstSlice<typename Index::MetaType, typename Index::RangeType>( i->range(), i->metaPtr() );
|
||||
}
|
||||
};
|
||||
|
||||
template <class Index>
|
||||
auto mkMAObject(const std::shared_ptr<Index>& i)
|
||||
-> std::shared_ptr<decltype(ToMAObject<Index::RangeType::HASMETACONT>::mk(i))>
|
||||
{
|
||||
return std::make_shared<decltype(ToMAObject<Index::RangeType::HASMETACONT>::mk(i))>
|
||||
(ToMAObject<Index::RangeType::HASMETACONT>::mk(i));
|
||||
}
|
||||
|
||||
template <bool HASMETACONT>
|
||||
struct ToOpObject
|
||||
{
|
||||
template <class Index>
|
||||
static auto mk(const std::shared_ptr<Index>& ind)
|
||||
-> ConstOperationRoot<typename Index::MetaType,
|
||||
typename Index::RangeType>
|
||||
{
|
||||
return ConstOperationRoot<typename Index::MetaType,
|
||||
typename Index::RangeType>( mkMAObject(ind), ind);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ToOpObject<false>
|
||||
{
|
||||
template <class Index>
|
||||
static auto mk(const std::shared_ptr<Index>& ind)
|
||||
-> MetaOperationRoot<typename Index::RangeType>
|
||||
{
|
||||
return MetaOperationRoot<typename Index::RangeType>( ind );
|
||||
}
|
||||
};
|
||||
|
||||
template <class Index>
|
||||
auto mkOpObject(const std::shared_ptr<Index>& i)
|
||||
-> decltype(ToOpObject<Index::RangeType::HASMETACONT>::mk(i))
|
||||
{
|
||||
return ToOpObject<Index::RangeType::HASMETACONT>::mk(i);
|
||||
}
|
||||
|
||||
template <typename T, class Function, class... SRanges>
|
||||
class FunctionalMultiArray : public MultiArrayBase<T,SRanges...>
|
||||
{
|
||||
|
|
|
@ -54,7 +54,10 @@ namespace MultiArrayTools
|
|||
#define reg_ind3(I1,I2,I3) virtual RetT<I1,I2,I3> create \
|
||||
(const std::shared_ptr<I1>& ind1,const std::shared_ptr<I2>& ind2,const std::shared_ptr<I3>& 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<I1>& ind1, const std::shared_ptr<I2>& ind2, const std::shared_ptr<I3>& 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
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
|
||||
#ifndef __hl_reg_ind_h__
|
||||
#define __hl_reg_ind_h__
|
||||
|
||||
#include "ranges/rheader.h"
|
||||
|
||||
namespace MultiArrayTools
|
||||
{
|
||||
|
||||
template <class Index>
|
||||
struct RegIndNum
|
||||
{
|
||||
static constexpr size_t VALUE = -1;
|
||||
static constexpr size_t DEPTH = 0;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct RegIndNum<ClassicRange::IndexType>
|
||||
{
|
||||
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 <class Index>
|
||||
RegIndInfo& set(const std::shared_ptr<Index>& i)
|
||||
{
|
||||
type = RegIndNum<Index>::VALUE;
|
||||
depth = RegIndNum<Index>::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
|
|
@ -153,14 +153,7 @@ namespace MultiArrayTools
|
|||
{
|
||||
return std::make_shared<IndexWrapper>( std::make_shared<Index>( *mI ) );
|
||||
}
|
||||
/*
|
||||
template <class Index>
|
||||
RegIndInfo IndexWrapper<Index>::regN() const
|
||||
{
|
||||
RegIndInfo out;
|
||||
return out.set(mI);
|
||||
}
|
||||
*/
|
||||
|
||||
template <class Index>
|
||||
std::shared_ptr<Index> IndexWrapper<Index>::getIndex() const
|
||||
{
|
||||
|
|
|
@ -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<IndexWrapperBase> 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<IndexWrapperBase> duplicate() const override final;
|
||||
//virtual RegIndInfo regN() const override final;
|
||||
|
||||
std::shared_ptr<Index> getIndex() const;
|
||||
virtual std::shared_ptr<ClassicIndex> reduced() const override final;
|
||||
|
|
Loading…
Reference in a new issue