small adjustments
This commit is contained in:
parent
9e5c51428a
commit
91acb873e1
3 changed files with 67 additions and 1 deletions
|
@ -59,6 +59,9 @@ namespace MultiArrayTools
|
|||
|
||||
virtual std::shared_ptr<MultiArrayBase<T,AnonymousRange> > anonymous(bool slice = false) const = 0;
|
||||
|
||||
virtual ConstOperationRoot<T,SRanges...>
|
||||
op(const std::shared_ptr<IndexType>& ind) const;
|
||||
|
||||
virtual ConstOperationRoot<T,SRanges...>
|
||||
operator()(const std::shared_ptr<typename SRanges::IndexType>&... inds) const;
|
||||
|
||||
|
@ -105,9 +108,15 @@ namespace MultiArrayTools
|
|||
|
||||
virtual std::shared_ptr<MultiArrayBase<T,AnonymousRange> > anonymousMove() = 0;
|
||||
|
||||
virtual ConstOperationRoot<T,SRanges...>
|
||||
op(const std::shared_ptr<IndexType>& ind) const override;
|
||||
|
||||
virtual ConstOperationRoot<T,SRanges...>
|
||||
operator()(const std::shared_ptr<typename SRanges::IndexType>&... inds) const override;
|
||||
|
||||
virtual OperationRoot<T,SRanges...>
|
||||
op(const std::shared_ptr<IndexType>& ind);
|
||||
|
||||
virtual OperationRoot<T,SRanges...> operator()(const std::shared_ptr<typename SRanges::IndexType>&... inds);
|
||||
|
||||
template <class... MappedRanges>
|
||||
|
@ -212,6 +221,13 @@ namespace MultiArrayTools
|
|||
return ConstOperationRoot<T,SRanges...>(*this, inds...);
|
||||
}
|
||||
|
||||
template <typename T, class... SRanges>
|
||||
ConstOperationRoot<T,SRanges...>
|
||||
MultiArrayBase<T,SRanges...>::op(const std::shared_ptr<IndexType>& ind) const
|
||||
{
|
||||
return ConstOperationRoot<T,SRanges...>(data(), *ind);
|
||||
}
|
||||
|
||||
template <typename T, class... SRanges>
|
||||
template <class... MappedRanges>
|
||||
ConstOperationRoot<T,MappedRanges...>
|
||||
|
@ -276,6 +292,13 @@ namespace MultiArrayTools
|
|||
return OperationRoot<T,SRanges...>(*this, inds...);
|
||||
}
|
||||
|
||||
template <typename T, class... SRanges>
|
||||
OperationRoot<T,SRanges...>
|
||||
MutableMultiArrayBase<T,SRanges...>::op(const std::shared_ptr<IndexType>& ind)
|
||||
{
|
||||
return OperationRoot<T,SRanges...>(data(), *ind);
|
||||
}
|
||||
|
||||
template <typename T, class... SRanges>
|
||||
ConstOperationRoot<T,SRanges...>
|
||||
MutableMultiArrayBase<T,SRanges...>::operator()(const std::shared_ptr<typename SRanges::IndexType>&... inds) const
|
||||
|
@ -283,6 +306,13 @@ namespace MultiArrayTools
|
|||
return ConstOperationRoot<T,SRanges...>(*this, inds...);
|
||||
}
|
||||
|
||||
template <typename T, class... SRanges>
|
||||
ConstOperationRoot<T,SRanges...>
|
||||
MutableMultiArrayBase<T,SRanges...>::op(const std::shared_ptr<IndexType>& ind) const
|
||||
{
|
||||
return ConstOperationRoot<T,SRanges...>(data(), *ind);
|
||||
}
|
||||
|
||||
template <typename T, class... SRanges>
|
||||
template <class... MappedRanges>
|
||||
OperationRoot<T,MappedRanges...>
|
||||
|
|
|
@ -120,6 +120,8 @@ namespace MultiArrayTools
|
|||
|
||||
const T& operator*() const;
|
||||
const T* operator->() const;
|
||||
//T& operator*();
|
||||
//T* operator->();
|
||||
|
||||
ContainerIndex operator++(int);
|
||||
ContainerIndex operator--(int);
|
||||
|
@ -476,7 +478,21 @@ namespace MultiArrayTools
|
|||
//return &mMa[*this];
|
||||
return &mData[IB::mPos];
|
||||
}
|
||||
/*
|
||||
template <typename T, class... Indices>
|
||||
T& ContainerIndex<T,Indices...>::operator*()
|
||||
{
|
||||
//return mMa[*this];
|
||||
return mData[IB::mPos];
|
||||
}
|
||||
|
||||
template <typename T, class... Indices>
|
||||
T* ContainerIndex<T,Indices...>::operator->()
|
||||
{
|
||||
//return &mMa[*this];
|
||||
return &mData[IB::mPos];
|
||||
}
|
||||
*/
|
||||
template <typename T, class... Indices>
|
||||
ContainerIndex<T,Indices...> ContainerIndex<T,Indices...>::operator++(int)
|
||||
{
|
||||
|
|
|
@ -92,6 +92,19 @@ namespace MultiArrayTools
|
|||
public:
|
||||
typedef ContainerIndex<T,typename SRanges::IndexType...> IType;
|
||||
|
||||
template <class Op>
|
||||
static ConstSlice<T,SRanges...> mkSlice( const typename ConstSlice<T,SRanges...>::IndexType& ind,
|
||||
const Op& op )
|
||||
{
|
||||
ConstSlice<T,SRanges...> out(ind->range()->space(), &*ind);
|
||||
std::array<size_t,sizeof...(SRanges)+1> ff;
|
||||
for(size_t i = 0; i != sizeof...(SRanges)+1; ++i){
|
||||
PackNum<sizeof...(SRanges)-1>::mkSliceBlocks(ff, ind, op);
|
||||
}
|
||||
out.format(ff);
|
||||
return out;
|
||||
}
|
||||
|
||||
private:
|
||||
IType mIndex;
|
||||
Slice<T,SRanges...>* mSlPtr = nullptr;
|
||||
|
@ -109,6 +122,13 @@ namespace MultiArrayTools
|
|||
SliceDef& operator=(const OperationRoot<T,ORanges...>& op);
|
||||
};
|
||||
|
||||
template <typename T, class Op, class... Ranges>
|
||||
ConstSlice<T,Ranges...> mkSlice( const typename ConstSlice<T,Ranges...>::IndexType& ind,
|
||||
const Op& op )
|
||||
{
|
||||
return SliceDef<T,Ranges...>::mkSlice(ind, op);
|
||||
}
|
||||
|
||||
} // end namespace MultiArrayTools
|
||||
|
||||
/* ========================= *
|
||||
|
|
Loading…
Reference in a new issue