fix bug from previous commit
This commit is contained in:
parent
bf4633054d
commit
8bde2d7250
2 changed files with 15 additions and 19 deletions
|
@ -187,7 +187,7 @@ namespace MultiArrayTools
|
||||||
*/
|
*/
|
||||||
template <typename T, class IOp, class AT, class Target, class OpClass, OpIndexAff OIA>
|
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) :
|
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>
|
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)
|
inline void AssignmentExpr<T,IOp,AT,Target,OpClass,OIA>::operator()(size_t start)
|
||||||
|
@ -195,25 +195,13 @@ namespace MultiArrayTools
|
||||||
ExtType last = rootSteps();
|
ExtType last = rootSteps();
|
||||||
last.zero();
|
last.zero();
|
||||||
// TODO: ask MA container for data (ptr)!!!
|
// TODO: ask MA container for data (ptr)!!!
|
||||||
//mDataAcc.template exec<typename 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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class IOp, class AT, class Target, class OpClass, OpIndexAff OIA>
|
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)
|
inline void AssignmentExpr<T,IOp,AT,Target,OpClass,OIA>::operator()(size_t start, ExtType last)
|
||||||
{
|
{
|
||||||
//PointerAccess<T> pa(mDataPtr, mDataPtr);
|
mDataAcc.template exec<typename IOp::Func>(opIndexResolve<OIA>(start,last),mSec,last.next());
|
||||||
//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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class IOp, class AT, class Target, class OpClass, OpIndexAff OIA>
|
template <typename T, class IOp, class AT, class Target, class OpClass, OpIndexAff OIA>
|
||||||
|
|
|
@ -219,7 +219,12 @@ namespace MultiArrayTools
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef AccessClass AC;
|
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); }
|
AccessClass& THIS() { return static_cast<AccessClass&>(*this); }
|
||||||
const AccessClass& THIS() const { return static_cast<const AccessClass&>(*this); }
|
const AccessClass& THIS() const { return static_cast<const AccessClass&>(*this); }
|
||||||
|
|
||||||
|
@ -240,6 +245,8 @@ namespace MultiArrayTools
|
||||||
public:
|
public:
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
typedef T in_type;
|
typedef T in_type;
|
||||||
|
|
||||||
|
friend class AccessTemplate<PointerAccess<T>>;
|
||||||
private:
|
private:
|
||||||
PointerAccess() = default;
|
PointerAccess() = default;
|
||||||
|
|
||||||
|
@ -247,12 +254,13 @@ namespace MultiArrayTools
|
||||||
T* mOrigPtr = nullptr;
|
T* mOrigPtr = nullptr;
|
||||||
|
|
||||||
public:
|
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(const PointerAccess& in) = default;
|
||||||
PointerAccess(PointerAccess&& in) = default;
|
PointerAccess(PointerAccess&& in) = default;
|
||||||
PointerAccess& operator=(const PointerAccess& in) = default;
|
PointerAccess& operator=(const PointerAccess& in) = default;
|
||||||
PointerAccess& operator=(PointerAccess&& in) = default;
|
PointerAccess& operator=(PointerAccess&& in) = default;
|
||||||
|
|
||||||
T* get(size_t pos) { return mPtr+pos; }
|
T* get(size_t pos) { return mPtr+pos; }
|
||||||
T* get(size_t pos) const { return mPtr+pos; }
|
T* get(size_t pos) const { return mPtr+pos; }
|
||||||
PointerAccess<T>& set(size_t pos) { mPtr = mOrigPtr + pos; return *this; }
|
PointerAccess<T>& set(size_t pos) { mPtr = mOrigPtr + pos; return *this; }
|
||||||
|
@ -292,7 +300,7 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
Target mTar;
|
Target mTar;
|
||||||
OpClass mSec;
|
OpClass mSec;
|
||||||
AccessTemplate<AT> mDataAcc;
|
AT mDataAcc;
|
||||||
T* mDataPtr;
|
T* mDataPtr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in a new issue