various fixes + rindex: clear()
This commit is contained in:
parent
1743fd196a
commit
cb8d854f88
6 changed files with 32 additions and 17 deletions
|
@ -302,6 +302,10 @@ namespace CNORXZ
|
||||||
template <typename T, class IndexT>
|
template <typename T, class IndexT>
|
||||||
class OpRoot;
|
class OpRoot;
|
||||||
|
|
||||||
|
// definition: operation/op_types.h
|
||||||
|
template <class Index>
|
||||||
|
class PosOp;
|
||||||
|
|
||||||
// definition: operation/op_types.h
|
// definition: operation/op_types.h
|
||||||
template <class F, class... Ops>
|
template <class F, class... Ops>
|
||||||
class Operation;
|
class Operation;
|
||||||
|
|
|
@ -117,7 +117,7 @@ namespace CNORXZ
|
||||||
bool formatIsTrivial() const;
|
bool formatIsTrivial() const;
|
||||||
|
|
||||||
/** @copydoc IndexInterface::xpr() */
|
/** @copydoc IndexInterface::xpr() */
|
||||||
COpRoot<SizeT,CIndex> xpr(const Sptr<CIndex>& _this) const;
|
PosOp<CIndex> xpr(const Sptr<CIndex>& _this) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Sptr<RangeType> mRangePtr;
|
Sptr<RangeType> mRangePtr;
|
||||||
|
|
|
@ -119,17 +119,9 @@ namespace CNORXZ
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
COpRoot<SizeT,CIndex> CIndex::xpr(const Sptr<CIndex>& _this) const
|
PosOp<CIndex> CIndex::xpr(const Sptr<CIndex>& _this) const
|
||||||
{
|
{
|
||||||
// preliminary solution (TODO: implement xpr that simply returns PosT value):
|
return posop(_this);
|
||||||
static Vector<SizeT> m;
|
|
||||||
if(m.size() < _this->lmax().val()){
|
|
||||||
m.resize(_this->lmax().val());
|
|
||||||
for(SizeT i = 0; i != m.size(); ++i) {
|
|
||||||
m[i] = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return coproot(m.data(), _this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RangePtr CIndex::prange(const CIndex& last) const
|
RangePtr CIndex::prange(const CIndex& last) const
|
||||||
|
|
|
@ -110,7 +110,10 @@ namespace CNORXZ
|
||||||
|
|
||||||
inline decltype(auto) YIndex::mkIFor(SizeT i, const DXpr<None>& xpr, NoF&& f) const
|
inline decltype(auto) YIndex::mkIFor(SizeT i, const DXpr<None>& xpr, NoF&& f) const
|
||||||
{
|
{
|
||||||
if(i == mIs.size()-1){
|
if(i == mIs.size()){
|
||||||
|
return DXpr<None>(xpr);
|
||||||
|
}
|
||||||
|
else if(i == mIs.size()-1){
|
||||||
return mIs[i]->ifor( xpr, std::forward<NoF>(f) );
|
return mIs[i]->ifor( xpr, std::forward<NoF>(f) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -335,11 +338,16 @@ namespace CNORXZ
|
||||||
const String blim = "[";
|
const String blim = "[";
|
||||||
const String elim = "]";
|
const String elim = "]";
|
||||||
const String dlim = ",";
|
const String dlim = ",";
|
||||||
return blim +
|
if(mIs.size() == 0){
|
||||||
std::accumulate(std::next(mIs.all().begin()), mIs.all().end(), mIs[0]->stringMeta(),
|
return blim + elim;
|
||||||
[&](const auto& s, const auto& e)
|
}
|
||||||
{ return s + dlim + e->stringMeta(); } ) +
|
else {
|
||||||
elim;
|
return blim +
|
||||||
|
std::accumulate(std::next(mIs.all().begin()), mIs.all().end(), mIs[0]->stringMeta(),
|
||||||
|
[&](const auto& s, const auto& e)
|
||||||
|
{ return s + dlim + e->stringMeta(); } ) +
|
||||||
|
elim;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<DType> YIndex::meta() const
|
Vector<DType> YIndex::meta() const
|
||||||
|
|
|
@ -248,6 +248,13 @@ namespace CNORXZ
|
||||||
const SizeT blocks = i->pmax().val();
|
const SizeT blocks = i->pmax().val();
|
||||||
setupBuffer(ai, required, *mA, mBuf, mMap, blocks);
|
setupBuffer(ai, required, *mA, mBuf, mMap, blocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void RCArray<T>::clear() const
|
||||||
|
{
|
||||||
|
mBuf.resize(0);
|
||||||
|
mMap.resize(0);
|
||||||
|
}
|
||||||
|
|
||||||
/*==============+
|
/*==============+
|
||||||
| RArray |
|
| RArray |
|
||||||
|
|
|
@ -134,6 +134,9 @@ namespace CNORXZ
|
||||||
const Sptr<I>& i, const Vector<bool>& required) const;
|
const Sptr<I>& i, const Vector<bool>& required) const;
|
||||||
|
|
||||||
|
|
||||||
|
/** Clear data loaded from other ranks. */
|
||||||
|
void clear() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ObjHandle<CArrayBase<T>> mA;
|
ObjHandle<CArrayBase<T>> mA;
|
||||||
RangePtr mGeom;
|
RangePtr mGeom;
|
||||||
|
@ -165,6 +168,7 @@ namespace CNORXZ
|
||||||
using RCA::cbegin;
|
using RCA::cbegin;
|
||||||
using RCA::cend;
|
using RCA::cend;
|
||||||
using RCA::sl;
|
using RCA::sl;
|
||||||
|
using RCA::local;
|
||||||
|
|
||||||
DEFAULT_C(RArray);
|
DEFAULT_C(RArray);
|
||||||
DEFAULT_MOVE(RArray);
|
DEFAULT_MOVE(RArray);
|
||||||
|
|
Loading…
Reference in a new issue