fix bug from previous commit

This commit is contained in:
Christian Zimmermann 2021-07-14 22:01:07 +02:00
parent bf4633054d
commit 8bde2d7250
2 changed files with 15 additions and 19 deletions

View file

@ -187,7 +187,7 @@ namespace MultiArrayTools
*/
template <typename T, class IOp, class AT, class Target, class OpClass, OpIndexAff OIA>
AssignmentExpr<T,IOp,AT,Target,OpClass,OIA>::AssignmentExpr(T* dataPtr, const AccessTemplate<AT>& dataAcc, const Target& tar, const OpClass& sec) :
mTar(tar), mSec(sec), mDataAcc(dataAcc), mDataPtr(dataPtr) {}
mTar(tar), mSec(sec), mDataAcc(static_cast<const AT&>(dataAcc)), mDataPtr(dataPtr) {}
template <typename T, class IOp, class AT, class Target, class OpClass, OpIndexAff OIA>
inline void AssignmentExpr<T,IOp,AT,Target,OpClass,OIA>::operator()(size_t start)
@ -195,25 +195,13 @@ namespace MultiArrayTools
ExtType last = rootSteps();
last.zero();
// TODO: ask MA container for data (ptr)!!!
//mDataAcc.template exec<typename IOp::Func>(opIndexResolve<OIA>(start,last),mSec,last.next());
assert(mDataAcc.get(0) != nullptr);
assert(mDataAcc.oget(0) != nullptr);
assert(mDataPtr == mDataAcc.oget(0));
IOp::f(mDataAcc.oget(0),opIndexResolve<OIA>(start,last),mSec,last.next());
//IOp::f(mDataPtr,opIndexResolve<OIA>(start,last),mSec,last.next());
mDataAcc.template exec<typename IOp::Func>(opIndexResolve<OIA>(start,last),mSec,last.next());
}
template <typename T, class IOp, class AT, class Target, class OpClass, OpIndexAff OIA>
inline void AssignmentExpr<T,IOp,AT,Target,OpClass,OIA>::operator()(size_t start, ExtType last)
{
//PointerAccess<T> pa(mDataPtr, mDataPtr);
//pa.template exec<IOp::Func>(opIndexResolve<OIA>(start,last),mSec,last.next());
//mDataAcc.template exec<typename IOp::Func>(opIndexResolve<OIA>(start,last),mSec,last.next());
assert(mDataAcc.get(0) != nullptr);
assert(mDataAcc.oget(0) != nullptr);
assert(mDataPtr == mDataAcc.oget(0));
IOp::f(mDataAcc.oget(0),opIndexResolve<OIA>(start,last),mSec,last.next());
//IOp::f(mDataPtr,opIndexResolve<OIA>(start,last),mSec,last.next());
mDataAcc.template exec<typename IOp::Func>(opIndexResolve<OIA>(start,last),mSec,last.next());
}
template <typename T, class IOp, class AT, class Target, class OpClass, OpIndexAff OIA>

View file

@ -220,6 +220,11 @@ namespace MultiArrayTools
public:
typedef AccessClass AC;
AccessTemplate(const AccessTemplate& in) = default;
AccessTemplate(AccessTemplate&& in) = default;
AccessTemplate& operator=(const AccessTemplate& in) = default;
AccessTemplate& operator=(AccessTemplate&& in) = default;
AccessClass& THIS() { return static_cast<AccessClass&>(*this); }
const AccessClass& THIS() const { return static_cast<const AccessClass&>(*this); }
@ -240,6 +245,8 @@ namespace MultiArrayTools
public:
typedef T value_type;
typedef T in_type;
friend class AccessTemplate<PointerAccess<T>>;
private:
PointerAccess() = default;
@ -247,7 +254,8 @@ namespace MultiArrayTools
T* mOrigPtr = nullptr;
public:
PointerAccess(T* ptr, T* origPtr) : mPtr(ptr), mOrigPtr(origPtr) {}
PointerAccess(T* ptr, T* origPtr) : mPtr(ptr), mOrigPtr(origPtr)
{ assert(mPtr != nullptr); assert(mOrigPtr != nullptr); }
PointerAccess(const PointerAccess& in) = default;
PointerAccess(PointerAccess&& in) = default;
PointerAccess& operator=(const PointerAccess& in) = default;
@ -292,7 +300,7 @@ namespace MultiArrayTools
Target mTar;
OpClass mSec;
AccessTemplate<AT> mDataAcc;
AT mDataAcc;
T* mDataPtr;
public: