override -> final + MetaOperationRoot (which does not work so far)
This commit is contained in:
parent
15f4f38e48
commit
aceffc1af6
8 changed files with 215 additions and 51 deletions
|
@ -18,8 +18,9 @@ namespace MultiArrayTools
|
||||||
std::vector<typename Index::MetaType> vv(i->range()->size());
|
std::vector<typename Index::MetaType> vv(i->range()->size());
|
||||||
for(Index j = (*i); j.pos() != j.max(); ++j){
|
for(Index j = (*i); j.pos() != j.max(); ++j){
|
||||||
vv[j.pos()] = j.meta();
|
vv[j.pos()] = j.meta();
|
||||||
}
|
VCHECK(j.meta());
|
||||||
return MultiArray<typename Index::MetaType, typename Index::RangeType>( i->range(), std::move( vv ) );
|
}
|
||||||
|
return MultiArray<typename Index::MetaType, typename Index::RangeType>( i->range(), vv );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -33,14 +34,65 @@ namespace MultiArrayTools
|
||||||
return ConstSlice<typename Index::MetaType, typename Index::RangeType>( i->range(), i->metaPtr() );
|
return ConstSlice<typename Index::MetaType, typename Index::RangeType>( i->range(), i->metaPtr() );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Index>
|
template <class Index>
|
||||||
auto mkMAObject(const std::shared_ptr<Index>& i)
|
auto mkMAObject(const std::shared_ptr<Index>& i)
|
||||||
-> decltype(ToMAObject<Index::RangeType::HASMETACONT>::mk(i))
|
-> std::shared_ptr<decltype(ToMAObject<Index::RangeType::HASMETACONT>::mk(i))>
|
||||||
{
|
{
|
||||||
return 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)
|
||||||
|
-> MetaOperationRoot<typename Index::RangeType>
|
||||||
|
{
|
||||||
|
typedef typename Index::RangeType RangeType;
|
||||||
|
MultiRangeFactory<RangeType> mrf(ind->range());
|
||||||
|
auto mr = std::dynamic_pointer_cast<RangeType>( mrf.create() );
|
||||||
|
typedef typename MultiRange<RangeType>::IndexType::MetaType value_type;
|
||||||
|
ContainerIndex<value_type,Index> ci(mr,0);
|
||||||
|
return MetaOperationRoot<typename Index::RangeType>(ci);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct ToOpObject<true>
|
||||||
|
{
|
||||||
|
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 <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 <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>
|
template <typename T, class Function, class... SRanges>
|
||||||
class FunctionalMultiArray : public MultiArrayBase<T,SRanges...>
|
class FunctionalMultiArray : public MultiArrayBase<T,SRanges...>
|
||||||
|
@ -78,8 +130,9 @@ namespace MultiArrayTools
|
||||||
// EVALUTAION CLASS ??!!!!
|
// EVALUTAION CLASS ??!!!!
|
||||||
|
|
||||||
auto exec(const std::shared_ptr<typename SRanges::IndexType>&... inds) const
|
auto exec(const std::shared_ptr<typename SRanges::IndexType>&... inds) const
|
||||||
-> decltype( mkOperation( mFunc, ConstOperationRoot<typename SRanges::IndexType::MetaType,SRanges>( mkMAObject( inds ), inds) ... ) );
|
// -> decltype( mkOperation( mFunc, ConstOperationRoot<typename SRanges::IndexType::MetaType,SRanges>( mkMAObject( inds ), inds) ... ) );
|
||||||
|
-> decltype( mkOperation( mFunc, mkOpObject(inds) ... ) );
|
||||||
|
|
||||||
virtual ConstOperationRoot<T,SRanges...>
|
virtual ConstOperationRoot<T,SRanges...>
|
||||||
operator()(const std::shared_ptr<typename SRanges::IndexType>&... inds) const override;
|
operator()(const std::shared_ptr<typename SRanges::IndexType>&... inds) const override;
|
||||||
|
|
||||||
|
@ -184,7 +237,7 @@ namespace MultiArrayTools
|
||||||
return ConstOperationRoot<T,SRanges...>( *mMaPtr, inds... );
|
return ConstOperationRoot<T,SRanges...>( *mMaPtr, inds... );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
template <typename T, class Function, class... SRanges>
|
template <typename T, class Function, class... SRanges>
|
||||||
auto FunctionalMultiArray<T,Function,SRanges...>::
|
auto FunctionalMultiArray<T,Function,SRanges...>::
|
||||||
exec(const std::shared_ptr<typename SRanges::IndexType>&... inds) const
|
exec(const std::shared_ptr<typename SRanges::IndexType>&... inds) const
|
||||||
|
@ -192,8 +245,16 @@ namespace MultiArrayTools
|
||||||
{
|
{
|
||||||
return mkOperation( mFunc, ConstOperationRoot<typename SRanges::IndexType::MetaType,SRanges>( mkMAObject( inds ), inds ) ... );
|
return mkOperation( mFunc, ConstOperationRoot<typename SRanges::IndexType::MetaType,SRanges>( mkMAObject( inds ), inds ) ... );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
template <typename T, class Function, class... SRanges>
|
||||||
|
auto FunctionalMultiArray<T,Function,SRanges...>::
|
||||||
|
exec(const std::shared_ptr<typename SRanges::IndexType>&... inds) const
|
||||||
|
-> decltype( mkOperation( mFunc, mkOpObject(inds) ... ) )
|
||||||
|
{
|
||||||
|
return mkOperation( mFunc, mkOpObject(inds) ... );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace MultiArrayTools
|
} // namespace MultiArrayTools
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -141,6 +141,9 @@ namespace MultiArrayTools
|
||||||
ConstOperationRoot(const MultiArrayBase<T,Ranges...>& ma,
|
ConstOperationRoot(const MultiArrayBase<T,Ranges...>& ma,
|
||||||
const std::shared_ptr<typename Ranges::IndexType>&... indices);
|
const std::shared_ptr<typename Ranges::IndexType>&... indices);
|
||||||
|
|
||||||
|
ConstOperationRoot(std::shared_ptr<MultiArrayBase<T,Ranges...> > maptr,
|
||||||
|
const std::shared_ptr<typename Ranges::IndexType>&... indices);
|
||||||
|
|
||||||
ConstOperationRoot(const T* data, const IndexType& ind);
|
ConstOperationRoot(const T* data, const IndexType& ind);
|
||||||
|
|
||||||
template <class ET>
|
template <class ET>
|
||||||
|
@ -156,8 +159,40 @@ namespace MultiArrayTools
|
||||||
//MultiArrayBase<T,Ranges...> const& mArrayRef;
|
//MultiArrayBase<T,Ranges...> const& mArrayRef;
|
||||||
const T* mDataPtr;
|
const T* mDataPtr;
|
||||||
IndexType mIndex;
|
IndexType mIndex;
|
||||||
|
std::shared_ptr<MultiArrayBase<T,Ranges...> > mMaPtr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class... Ranges>
|
||||||
|
class MetaOperationRoot : public OperationTemplate<std::tuple<typename Ranges::IndexType...>,
|
||||||
|
MetaOperationRoot<Ranges...> >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef ContainerIndex<std::tuple<typename Ranges::IndexType::MetaType...>,
|
||||||
|
typename Ranges::IndexType...> IndexType;
|
||||||
|
typedef typename IndexType::MetaType value_type;
|
||||||
|
typedef OperationBase<value_type,MetaOperationRoot<Ranges...> > OT;
|
||||||
|
typedef ContainerRange<value_type,Ranges...> CRange;
|
||||||
|
|
||||||
|
static constexpr size_t SIZE = 1;
|
||||||
|
|
||||||
|
MetaOperationRoot(const IndexType& ind);
|
||||||
|
|
||||||
|
template <class ET>
|
||||||
|
inline value_type get(ET pos) const;
|
||||||
|
|
||||||
|
MExt<void> rootSteps(std::intptr_t iPtrNum = 0) const; // nullptr for simple usage with decltype
|
||||||
|
|
||||||
|
template <class Expr>
|
||||||
|
Expr loop(Expr exp) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
//MultiArrayBase<T,Ranges...> const& mArrayRef;
|
||||||
|
//const T* mDataPtr;
|
||||||
|
IndexType mIndex;
|
||||||
|
};
|
||||||
|
|
||||||
template <typename T, class... Ranges>
|
template <typename T, class... Ranges>
|
||||||
class OperationRoot : public OperationTemplate<T,OperationRoot<T,Ranges...> >
|
class OperationRoot : public OperationTemplate<T,OperationRoot<T,Ranges...> >
|
||||||
{
|
{
|
||||||
|
@ -466,6 +501,18 @@ namespace MultiArrayTools
|
||||||
const std::shared_ptr<typename Ranges::IndexType>&... indices) :
|
const std::shared_ptr<typename Ranges::IndexType>&... indices) :
|
||||||
mDataPtr(ma.data()),
|
mDataPtr(ma.data()),
|
||||||
mIndex( ma.begin() )
|
mIndex( ma.begin() )
|
||||||
|
{
|
||||||
|
//VCHECK(ma.data());
|
||||||
|
mIndex(indices...);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, class... Ranges>
|
||||||
|
ConstOperationRoot<T,Ranges...>::
|
||||||
|
ConstOperationRoot(std::shared_ptr<MultiArrayBase<T,Ranges...> > maptr,
|
||||||
|
const std::shared_ptr<typename Ranges::IndexType>&... indices) :
|
||||||
|
mDataPtr(maptr->data()),
|
||||||
|
mIndex(maptr->begin()),
|
||||||
|
mMaPtr(maptr)
|
||||||
{
|
{
|
||||||
mIndex(indices...);
|
mIndex(indices...);
|
||||||
}
|
}
|
||||||
|
@ -480,6 +527,9 @@ namespace MultiArrayTools
|
||||||
template <class ET>
|
template <class ET>
|
||||||
inline T ConstOperationRoot<T,Ranges...>::get(ET pos) const
|
inline T ConstOperationRoot<T,Ranges...>::get(ET pos) const
|
||||||
{
|
{
|
||||||
|
//VCHECK(pos.val());
|
||||||
|
//VCHECK(mDataPtr);
|
||||||
|
//VCHECK(mDataPtr[pos.val()])
|
||||||
return mDataPtr[pos.val()];
|
return mDataPtr[pos.val()];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,7 +547,42 @@ namespace MultiArrayTools
|
||||||
{
|
{
|
||||||
return exp;
|
return exp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************
|
||||||
|
* MetaOperationRoot *
|
||||||
|
****************************/
|
||||||
|
|
||||||
|
template <class... Ranges>
|
||||||
|
MetaOperationRoot<Ranges...>::
|
||||||
|
MetaOperationRoot(const IndexType& ind) :
|
||||||
|
mIndex( ind ) { }
|
||||||
|
|
||||||
|
template <class... Ranges>
|
||||||
|
template <class ET>
|
||||||
|
inline typename MetaOperationRoot<Ranges...>::value_type
|
||||||
|
MetaOperationRoot<Ranges...>::get(ET pos) const
|
||||||
|
{
|
||||||
|
//VCHECK(pos.val());
|
||||||
|
//VCHECK(mDataPtr);
|
||||||
|
//VCHECK(mDataPtr[pos.val()])
|
||||||
|
return mIndex.meta(pos.val());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class... Ranges>
|
||||||
|
MExt<void> MetaOperationRoot<Ranges...>::rootSteps(std::intptr_t iPtrNum) const
|
||||||
|
{
|
||||||
|
return MExt<void>(getStepSize( mIndex, iPtrNum ));
|
||||||
|
//return MExt<void>(getStepSize( getRootIndices( mIndex->info() ), iPtrNum ));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class... Ranges>
|
||||||
|
template <class Expr>
|
||||||
|
Expr MetaOperationRoot<Ranges...>::loop(Expr exp) const
|
||||||
|
{
|
||||||
|
return exp;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************
|
/***********************
|
||||||
* OperationRoot *
|
* OperationRoot *
|
||||||
***********************/
|
***********************/
|
||||||
|
|
|
@ -35,20 +35,20 @@ namespace MultiArrayTools
|
||||||
typedef SingleRange<size_t,SpaceType::NONE> RangeType;
|
typedef SingleRange<size_t,SpaceType::NONE> RangeType;
|
||||||
typedef size_t MetaType;
|
typedef size_t MetaType;
|
||||||
|
|
||||||
virtual size_t size() const override;
|
virtual size_t size() const final;
|
||||||
virtual size_t dim() const override;
|
virtual size_t dim() const final;
|
||||||
|
|
||||||
virtual SpaceType spaceType() const override;
|
virtual SpaceType spaceType() const final;
|
||||||
|
|
||||||
virtual std::string stringMeta(size_t pos) const override;
|
virtual std::string stringMeta(size_t pos) const final;
|
||||||
virtual std::vector<char> data() const override;
|
virtual std::vector<char> data() const final;
|
||||||
|
|
||||||
size_t get(size_t pos) const;
|
size_t get(size_t pos) const;
|
||||||
size_t getMeta(size_t metaPos) const;
|
size_t getMeta(size_t metaPos) const;
|
||||||
|
|
||||||
virtual IndexType begin() const override;
|
virtual IndexType begin() const final;
|
||||||
virtual IndexType end() const override;
|
virtual IndexType end() const final;
|
||||||
//virtual std::shared_ptr<VIWB> index() const override;
|
//virtual std::shared_ptr<VIWB> index() const final;
|
||||||
|
|
||||||
friend SingleRangeFactory<size_t,SpaceType::NONE>;
|
friend SingleRangeFactory<size_t,SpaceType::NONE>;
|
||||||
|
|
||||||
|
|
|
@ -42,20 +42,20 @@ namespace MultiArrayTools
|
||||||
typedef SingleRange<size_t,SpaceType::NUL> RangeType;
|
typedef SingleRange<size_t,SpaceType::NUL> RangeType;
|
||||||
typedef size_t MetaType;
|
typedef size_t MetaType;
|
||||||
|
|
||||||
virtual size_t size() const override;
|
virtual size_t size() const final;
|
||||||
virtual size_t dim() const override;
|
virtual size_t dim() const final;
|
||||||
|
|
||||||
virtual std::string stringMeta(size_t pos) const override;
|
virtual std::string stringMeta(size_t pos) const final;
|
||||||
virtual std::vector<char> data() const override;
|
virtual std::vector<char> data() const final;
|
||||||
|
|
||||||
virtual SpaceType spaceType() const override;
|
virtual SpaceType spaceType() const final;
|
||||||
|
|
||||||
size_t get(size_t pos) const;
|
size_t get(size_t pos) const;
|
||||||
size_t getMeta(size_t metapos) const;
|
size_t getMeta(size_t metapos) const;
|
||||||
|
|
||||||
virtual IndexType begin() const override;
|
virtual IndexType begin() const final;
|
||||||
virtual IndexType end() const override;
|
virtual IndexType end() const final;
|
||||||
//virtual std::shared_ptr<VIWB> index() const override;
|
//virtual std::shared_ptr<VIWB> index() const final;
|
||||||
|
|
||||||
friend SingleRangeFactory<size_t,SpaceType::NUL>;
|
friend SingleRangeFactory<size_t,SpaceType::NUL>;
|
||||||
|
|
||||||
|
|
|
@ -34,19 +34,19 @@ namespace MultiArrayTools
|
||||||
typedef SingleRange<int,SpaceType::PSPACE> RangeType;
|
typedef SingleRange<int,SpaceType::PSPACE> RangeType;
|
||||||
typedef int MetaType;
|
typedef int MetaType;
|
||||||
|
|
||||||
virtual size_t size() const override;
|
virtual size_t size() const final;
|
||||||
virtual size_t dim() const override;
|
virtual size_t dim() const final;
|
||||||
|
|
||||||
virtual std::string stringMeta(size_t pos) const override;
|
virtual std::string stringMeta(size_t pos) const final;
|
||||||
virtual std::vector<char> data() const override;
|
virtual std::vector<char> data() const final;
|
||||||
|
|
||||||
virtual SpaceType spaceType() const override;
|
virtual SpaceType spaceType() const final;
|
||||||
|
|
||||||
int get(size_t pos) const;
|
int get(size_t pos) const;
|
||||||
size_t getMeta(int metaPos) const;
|
size_t getMeta(int metaPos) const;
|
||||||
|
|
||||||
virtual IndexType begin() const override;
|
virtual IndexType begin() const final;
|
||||||
virtual IndexType end() const override;
|
virtual IndexType end() const final;
|
||||||
|
|
||||||
friend SingleRangeFactory<int,SpaceType::PSPACE>;
|
friend SingleRangeFactory<int,SpaceType::PSPACE>;
|
||||||
|
|
||||||
|
|
|
@ -35,20 +35,20 @@ namespace MultiArrayTools
|
||||||
typedef SingleRange<size_t,SpaceType::SPIN> RangeType;
|
typedef SingleRange<size_t,SpaceType::SPIN> RangeType;
|
||||||
typedef size_t MetaType;
|
typedef size_t MetaType;
|
||||||
|
|
||||||
virtual size_t size() const override;
|
virtual size_t size() const final;
|
||||||
virtual size_t dim() const override;
|
virtual size_t dim() const final;
|
||||||
|
|
||||||
virtual std::string stringMeta(size_t pos) const override;
|
virtual std::string stringMeta(size_t pos) const final;
|
||||||
virtual std::vector<char> data() const override;
|
virtual std::vector<char> data() const final;
|
||||||
|
|
||||||
virtual SpaceType spaceType() const override;
|
virtual SpaceType spaceType() const final;
|
||||||
|
|
||||||
size_t get(size_t pos) const;
|
size_t get(size_t pos) const;
|
||||||
size_t getMeta(size_t metaPos) const;
|
size_t getMeta(size_t metaPos) const;
|
||||||
|
|
||||||
virtual IndexType begin() const override;
|
virtual IndexType begin() const final;
|
||||||
virtual IndexType end() const override;
|
virtual IndexType end() const final;
|
||||||
//virtual std::shared_ptr<VIWB> index() const override;
|
//virtual std::shared_ptr<VIWB> index() const final;
|
||||||
|
|
||||||
friend SingleRangeFactory<size_t,SpaceType::SPIN>;
|
friend SingleRangeFactory<size_t,SpaceType::SPIN>;
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,7 @@ namespace MultiArrayTools
|
||||||
-> For<SingleIndex<U,TYPE>,Expr,ForType::HIDDEN>;
|
-> For<SingleIndex<U,TYPE>,Expr,ForType::HIDDEN>;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::shared_ptr<RangeType> mExplicitRangePtr;
|
||||||
const U* mMetaPtr;
|
const U* mMetaPtr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -106,19 +107,19 @@ namespace MultiArrayTools
|
||||||
typedef U MetaType;
|
typedef U MetaType;
|
||||||
//typedef typename RangeInterface<SingleIndex<U,TYPE> >::IndexType IndexType;
|
//typedef typename RangeInterface<SingleIndex<U,TYPE> >::IndexType IndexType;
|
||||||
|
|
||||||
virtual size_t size() const override;
|
virtual size_t size() const final;
|
||||||
virtual size_t dim() const override;
|
virtual size_t dim() const final;
|
||||||
|
|
||||||
virtual SpaceType spaceType() const override;
|
virtual SpaceType spaceType() const final;
|
||||||
|
|
||||||
virtual std::string stringMeta(size_t pos) const override;
|
virtual std::string stringMeta(size_t pos) const final;
|
||||||
virtual std::vector<char> data() const override;
|
virtual std::vector<char> data() const final;
|
||||||
|
|
||||||
const U& get(size_t pos) const;
|
const U& get(size_t pos) const;
|
||||||
size_t getMeta(const U& metaPos) const;
|
size_t getMeta(const U& metaPos) const;
|
||||||
|
|
||||||
virtual IndexType begin() const override;
|
virtual IndexType begin() const final;
|
||||||
virtual IndexType end() const override;
|
virtual IndexType end() const final;
|
||||||
|
|
||||||
friend SingleRangeFactory<U,TYPE>;
|
friend SingleRangeFactory<U,TYPE>;
|
||||||
|
|
||||||
|
@ -184,6 +185,7 @@ namespace MultiArrayTools
|
||||||
template <typename U, SpaceType TYPE>
|
template <typename U, SpaceType TYPE>
|
||||||
SingleIndex<U,TYPE>::SingleIndex(const std::shared_ptr<SingleRange<U,TYPE> >& range) :
|
SingleIndex<U,TYPE>::SingleIndex(const std::shared_ptr<SingleRange<U,TYPE> >& range) :
|
||||||
IndexInterface<SingleIndex<U,TYPE>,U>(range, 0),
|
IndexInterface<SingleIndex<U,TYPE>,U>(range, 0),
|
||||||
|
mExplicitRangePtr(std::dynamic_pointer_cast<RangeType>(IB::mRangePtr)),
|
||||||
mMetaPtr(MetaPtrHandle<SingleIndex<U,TYPE>::RangeType::HASMETACONT>::set
|
mMetaPtr(MetaPtrHandle<SingleIndex<U,TYPE>::RangeType::HASMETACONT>::set
|
||||||
( dynamic_cast<RangeType*>(IB::mRangePtr.get() ) ) ) {}
|
( dynamic_cast<RangeType*>(IB::mRangePtr.get() ) ) ) {}
|
||||||
|
|
||||||
|
@ -238,8 +240,7 @@ namespace MultiArrayTools
|
||||||
U SingleIndex<U,TYPE>::meta() const
|
U SingleIndex<U,TYPE>::meta() const
|
||||||
{
|
{
|
||||||
return MetaPtrHandle<SingleIndex<U,TYPE>::RangeType::HASMETACONT>::getMeta
|
return MetaPtrHandle<SingleIndex<U,TYPE>::RangeType::HASMETACONT>::getMeta
|
||||||
( mMetaPtr, IB::mPos,
|
( mMetaPtr, IB::mPos, mExplicitRangePtr );
|
||||||
std::dynamic_pointer_cast<SingleRange<U,TYPE> const>( IB::mRangePtr ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename U, SpaceType TYPE>
|
template <typename U, SpaceType TYPE>
|
||||||
|
|
|
@ -531,6 +531,23 @@ namespace {
|
||||||
EXPECT_EQ( xround( res.at(mkt(mkt('3','b'),'B')) ), xround(2.911 + 4.790 - 2.210) );
|
EXPECT_EQ( xround( res.at(mkt(mkt('3','b'),'B')) ), xround(2.911 + 4.790 - 2.210) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(OpTest_MDim, ExecOpAnon)
|
||||||
|
{
|
||||||
|
MultiArray<double,MRange> ma1(mr1ptr, v3);
|
||||||
|
MultiArray<double,AnonymousRange> maa
|
||||||
|
= *std::dynamic_pointer_cast<MultiArray<double,AnonymousRange>>( ma1.anonymous() );
|
||||||
|
MultiArray<double,AnonymousRange> maa2( maa.template getRangePtr<0>() );
|
||||||
|
|
||||||
|
auto ar = maa.template getRangePtr<0>();
|
||||||
|
auto i1 = MAT::getIndex( ar );
|
||||||
|
|
||||||
|
maa2(i1) = maa(i1) * maa(i1);
|
||||||
|
EXPECT_EQ( xround( maa2.at(0) ), xround( v3[0]*v3[0] ) );
|
||||||
|
for((*i1) = 0; i1->pos() != i1->max(); ++(*i1) ){
|
||||||
|
EXPECT_EQ( xround( maa2.at(i1->meta()) ), xround( maa.at(i1->meta()) * maa.at(i1->meta()) ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct Monopole
|
struct Monopole
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue