fix: correct use of mOrigDataPtr and mDataPtr in Operation classes

This commit is contained in:
Christian Zimmermann 2019-02-27 21:37:20 +01:00
parent 9fec5d6354
commit c75c585ce6

View file

@ -283,7 +283,7 @@ namespace MultiArrayTools
const T* ConstOperationRoot<T,Ranges...>::data() const const T* ConstOperationRoot<T,Ranges...>::data() const
{ {
auto i = mIndex; auto i = mIndex;
return mDataPtr + i().pos(); return mOrigDataPtr + i().pos();
} }
template <typename T, class... Ranges> template <typename T, class... Ranges>
@ -416,7 +416,7 @@ namespace MultiArrayTools
OperationRoot<T,Ranges...>& OperationRoot<T,Ranges...>::operator=(const OpClass& in) OperationRoot<T,Ranges...>& OperationRoot<T,Ranges...>::operator=(const OpClass& in)
//OperationMaster<T,SelfIdentity<T>,OpClass,Ranges...> OperationRoot<T,Ranges...>::operator=(const OpClass& in) //OperationMaster<T,SelfIdentity<T>,OpClass,Ranges...> OperationRoot<T,Ranges...>::operator=(const OpClass& in)
{ {
typename OperationMaster<T,SelfIdentity<T>,OpClass,Ranges...>::AssignmentExpr ae(mDataPtr, in); typename OperationMaster<T,SelfIdentity<T>,OpClass,Ranges...>::AssignmentExpr ae(mOrigDataPtr, in);
// Expression to be executed within loop // Expression to be executed within loop
if(mDoParallel){ if(mDoParallel){
auto ploop = mIndex.pifor( 1, in.loop(ae) ); auto ploop = mIndex.pifor( 1, in.loop(ae) );
@ -435,7 +435,7 @@ namespace MultiArrayTools
OperationRoot<T,Ranges...>& OperationRoot<T,Ranges...>::operator+=(const OpClass& in) OperationRoot<T,Ranges...>& OperationRoot<T,Ranges...>::operator+=(const OpClass& in)
//OperationMaster<T,plus<T>,OpClass,Ranges...> OperationRoot<T,Ranges...>::operator+=(const OpClass& in) //OperationMaster<T,plus<T>,OpClass,Ranges...> OperationRoot<T,Ranges...>::operator+=(const OpClass& in)
{ {
typename OperationMaster<T,plus<T>,OpClass,Ranges...>::AddExpr ae(mDataPtr, in); typename OperationMaster<T,plus<T>,OpClass,Ranges...>::AddExpr ae(mOrigDataPtr, in);
// Expression to be executed within loop // Expression to be executed within loop
if(mDoParallel){ if(mDoParallel){
auto ploop = mIndex.pifor( 1, in.loop(ae) ); auto ploop = mIndex.pifor( 1, in.loop(ae) );
@ -498,7 +498,7 @@ namespace MultiArrayTools
T* OperationRoot<T,Ranges...>::data() const T* OperationRoot<T,Ranges...>::data() const
{ {
auto i = mIndex; auto i = mIndex;
return mDataPtr + i().pos(); return mOrigDataPtr + i().pos();
} }
template <typename T, class... Ranges> template <typename T, class... Ranges>