add some useful functions
This commit is contained in:
parent
871a9be383
commit
b050ea4466
7 changed files with 52 additions and 1 deletions
|
@ -546,6 +546,12 @@ namespace MultiArrayTools
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, class Range>
|
||||||
|
const T* MultiArray<T,Range>::data() const
|
||||||
|
{
|
||||||
|
return mCont.data();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
template <typename T, class Range>
|
template <typename T, class Range>
|
||||||
void MultiArray<T,Range>::manipulate(ManipulatorBase<T>& mb,
|
void MultiArray<T,Range>::manipulate(ManipulatorBase<T>& mb,
|
||||||
|
|
|
@ -224,6 +224,8 @@ namespace MultiArrayTools
|
||||||
virtual bool isConst() const override;
|
virtual bool isConst() const override;
|
||||||
virtual bool isSlice() const override;
|
virtual bool isSlice() const override;
|
||||||
|
|
||||||
|
const T* data() const;
|
||||||
|
|
||||||
// virtual void manipulate(ManipulatorBase<T>& mb,
|
// virtual void manipulate(ManipulatorBase<T>& mb,
|
||||||
// const typename Range::IndexType& manBegin,
|
// const typename Range::IndexType& manBegin,
|
||||||
// const typename Range::IndexType& manEnd);
|
// const typename Range::IndexType& manEnd);
|
||||||
|
|
|
@ -31,6 +31,8 @@ namespace MultiArrayTools
|
||||||
typedef SingleIndex<int,RangeType::SPACE> Space1dNI;
|
typedef SingleIndex<int,RangeType::SPACE> Space1dNI;
|
||||||
typedef SingleIndex<int,RangeType::MOMENTUM> Mom1dNI;
|
typedef SingleIndex<int,RangeType::MOMENTUM> Mom1dNI;
|
||||||
typedef SingleIndex<size_t,RangeType::ENSEMBLE> EnsI;
|
typedef SingleIndex<size_t,RangeType::ENSEMBLE> EnsI;
|
||||||
|
typedef SingleIndex<std::array<int,3>, RangeType::MOMENTUM> LinMomI;
|
||||||
|
typedef SingleIndex<std::array<int,4>, RangeType::MOMENTUM> LinMom4dI;
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
// ===== Range Types =====
|
// ===== Range Types =====
|
||||||
|
@ -45,6 +47,8 @@ namespace MultiArrayTools
|
||||||
typedef MultiRange<Space1dNR,Space1dNR,Space1dNR> Space3dNR;
|
typedef MultiRange<Space1dNR,Space1dNR,Space1dNR> Space3dNR;
|
||||||
typedef MultiRange<Mom1dNR,Mom1dNR,Mom1dNR> Mom3dNR;
|
typedef MultiRange<Mom1dNR,Mom1dNR,Mom1dNR> Mom3dNR;
|
||||||
typedef SingleRange<VET, RangeType::VALUE_ERROR> ValErrR;
|
typedef SingleRange<VET, RangeType::VALUE_ERROR> ValErrR;
|
||||||
|
typedef SingleRange<std::array<int,3>, RangeType::MOMENTUM> LinMomR;
|
||||||
|
typedef SingleRange<std::array<int,4>, RangeType::MOMENTUM> LinMom4dR;
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,6 +124,28 @@ namespace MultiArrayTools
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, class Range>
|
||||||
|
template <class Range2>
|
||||||
|
MultiArrayOperationRoot<T,Range>&
|
||||||
|
MultiArrayOperationRoot<T,Range>::operator=(ConstMultiArrayOperationRoot<T,Range2>& in)
|
||||||
|
{
|
||||||
|
performAssignment(in);
|
||||||
|
freeIndex();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <typename T, class Range>
|
||||||
|
template <class Range2>
|
||||||
|
const MultiArrayOperationRoot<T,Range>&
|
||||||
|
MultiArrayOperationRoot<T,Range>::operator=(const ConstMultiArrayOperationRoot<T,Range2>& in)
|
||||||
|
{
|
||||||
|
performAssignment(in);
|
||||||
|
freeIndex();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename T, class Range>
|
template <typename T, class Range>
|
||||||
template <class Operation, class... MAOps>
|
template <class Operation, class... MAOps>
|
||||||
MultiArrayOperationRoot<T,Range>&
|
MultiArrayOperationRoot<T,Range>&
|
||||||
|
|
|
@ -68,10 +68,16 @@ namespace MultiArrayTools
|
||||||
template <class Range2>
|
template <class Range2>
|
||||||
MultiArrayOperationRoot& operator=(MultiArrayOperationRoot<T,Range2>& in);
|
MultiArrayOperationRoot& operator=(MultiArrayOperationRoot<T,Range2>& in);
|
||||||
|
|
||||||
|
|
||||||
template <class Range2>
|
template <class Range2>
|
||||||
const MultiArrayOperationRoot& operator=(const MultiArrayOperationRoot<T,Range2>& in);
|
const MultiArrayOperationRoot& operator=(const MultiArrayOperationRoot<T,Range2>& in);
|
||||||
|
|
||||||
|
template <class Range2>
|
||||||
|
MultiArrayOperationRoot& operator=(ConstMultiArrayOperationRoot<T,Range2>& in);
|
||||||
|
|
||||||
|
template <class Range2>
|
||||||
|
const MultiArrayOperationRoot& operator=(const ConstMultiArrayOperationRoot<T,Range2>& in);
|
||||||
|
|
||||||
|
|
||||||
template <class Operation, class... MAOps>
|
template <class Operation, class... MAOps>
|
||||||
MultiArrayOperationRoot& operator=(const MultiArrayOperation<T,Operation,MAOps...>& in);
|
MultiArrayOperationRoot& operator=(const MultiArrayOperation<T,Operation,MAOps...>& in);
|
||||||
|
|
||||||
|
|
10
src/name.cc
10
src/name.cc
|
@ -63,6 +63,16 @@ namespace MultiArrayTools
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Name::remove(const std::string& s)
|
||||||
|
{
|
||||||
|
for(size_t i = 0; i != mSub.size(); ++i){
|
||||||
|
if(mSub[i].own() == s){
|
||||||
|
mSub.erase(mSub.begin()+i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
size_t Name::size() const
|
size_t Name::size() const
|
||||||
{
|
{
|
||||||
return mSub.size();
|
return mSub.size();
|
||||||
|
|
|
@ -27,6 +27,7 @@ namespace MultiArrayTools
|
||||||
const Name& get(size_t n) const;
|
const Name& get(size_t n) const;
|
||||||
|
|
||||||
void autoName(size_t newSize);
|
void autoName(size_t newSize);
|
||||||
|
void remove(const std::string& s);
|
||||||
size_t size() const;
|
size_t size() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue