diff --git a/lib/cartesian/Cartesian_base.h b/lib/cartesian/Cartesian_base.h index 8272ac71..6fac30e9 100644 --- a/lib/cartesian/Cartesian_base.h +++ b/lib/cartesian/Cartesian_base.h @@ -123,7 +123,7 @@ public: ////////////////////////////////////////////////////////// // SIMD lane addressing ////////////////////////////////////////////////////////// - inline int iIndex(std::vector &lcoor) + virtual int iIndex(std::vector &lcoor) { int idx=0; for(int d=0;d<_ndimension;d++) idx+=_istride[d]*(lcoor[d]/_rdimensions[d]); diff --git a/lib/cartesian/Cartesian_red_black.h b/lib/cartesian/Cartesian_red_black.h index 2424d8dc..d6b6afe6 100644 --- a/lib/cartesian/Cartesian_red_black.h +++ b/lib/cartesian/Cartesian_red_black.h @@ -224,9 +224,20 @@ protected: idx+=_ostride[d]*(coor[d]%_rdimensions[d]); } } - return idx; + return idx; }; - + virtual int iIndex(std::vector &lcoor) + { + int idx=0; + for(int d=0;d<_ndimension;d++) { + if( d==_checker_dim ) { + idx+=_istride[d]*(lcoor[d]/(2*_rdimensions[d])); + } else { + idx+=_istride[d]*(lcoor[d]/_rdimensions[d]); + } + } + return idx; + } }; } diff --git a/lib/tensors/Tensor_index.h b/lib/tensors/Tensor_index.h index bad9b1f1..7f34f3ac 100644 --- a/lib/tensors/Tensor_index.h +++ b/lib/tensors/Tensor_index.h @@ -146,14 +146,14 @@ class TensorIndexRecursion { } template inline static - void pokeIndex(iVector &ret, const iVector::peekIndex(ret._internal,0)),N> &arg, int i) + void pokeIndex(iVector &ret, const iVector::peekIndex(ret._internal[0],0)),N> &arg, int i) { for(int ii=0;ii::pokeIndex(ret._internal[ii],arg._internal[ii],i); } } template inline static - void pokeIndex(iVector &ret, const iVector::peekIndex(ret._internal,0)),N> &arg, int i,int j) + void pokeIndex(iVector &ret, const iVector::peekIndex(ret._internal[0],0)),N> &arg, int i,int j) { for(int ii=0;ii::pokeIndex(ret._internal[ii],arg._internal[ii],i,j); @@ -161,7 +161,7 @@ class TensorIndexRecursion { } template inline static - void pokeIndex(iMatrix &ret, const iMatrix::peekIndex(ret._internal,0)),N> &arg, int i) + void pokeIndex(iMatrix &ret, const iMatrix::peekIndex(ret._internal[0][0],0)),N> &arg, int i) { for(int ii=0;ii inline static - void pokeIndex(iMatrix &ret, const iMatrix::peekIndex(ret._internal,0)),N> &arg, int i,int j) + void pokeIndex(iMatrix &ret, const iMatrix::peekIndex(ret._internal[0][0],0)),N> &arg, int i,int j) { for(int ii=0;ii