mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 05:54:32 +00:00 
			
		
		
		
	Fix to iVector and iMatrix pokeIndex and checkerboard local site indexing.
This commit is contained in:
		@@ -123,7 +123,7 @@ public:
 | 
			
		||||
    //////////////////////////////////////////////////////////
 | 
			
		||||
    // SIMD lane addressing
 | 
			
		||||
    //////////////////////////////////////////////////////////
 | 
			
		||||
    inline int iIndex(std::vector<int> &lcoor)
 | 
			
		||||
    virtual int iIndex(std::vector<int> &lcoor)
 | 
			
		||||
    {
 | 
			
		||||
        int idx=0;
 | 
			
		||||
        for(int d=0;d<_ndimension;d++) idx+=_istride[d]*(lcoor[d]/_rdimensions[d]);
 | 
			
		||||
 
 | 
			
		||||
@@ -224,9 +224,20 @@ protected:
 | 
			
		||||
	  idx+=_ostride[d]*(coor[d]%_rdimensions[d]);
 | 
			
		||||
	}
 | 
			
		||||
      }
 | 
			
		||||
        return idx;
 | 
			
		||||
      return idx;
 | 
			
		||||
    };
 | 
			
		||||
        
 | 
			
		||||
    virtual int iIndex(std::vector<int> &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;
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -146,14 +146,14 @@ class TensorIndexRecursion {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  template<class vtype,int N> inline static 
 | 
			
		||||
    void pokeIndex(iVector<vtype,N> &ret, const iVector<decltype(TensorIndexRecursion<Level-1>::peekIndex(ret._internal,0)),N> &arg, int i)
 | 
			
		||||
    void pokeIndex(iVector<vtype,N> &ret, const iVector<decltype(TensorIndexRecursion<Level-1>::peekIndex(ret._internal[0],0)),N> &arg, int i)
 | 
			
		||||
    {
 | 
			
		||||
      for(int ii=0;ii<N;ii++){
 | 
			
		||||
	TensorIndexRecursion<Level-1>::pokeIndex(ret._internal[ii],arg._internal[ii],i);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  template<class vtype,int N> inline static 
 | 
			
		||||
    void pokeIndex(iVector<vtype,N> &ret, const iVector<decltype(TensorIndexRecursion<Level-1>::peekIndex(ret._internal,0)),N> &arg, int i,int j)
 | 
			
		||||
    void pokeIndex(iVector<vtype,N> &ret, const iVector<decltype(TensorIndexRecursion<Level-1>::peekIndex(ret._internal[0],0)),N> &arg, int i,int j)
 | 
			
		||||
    {
 | 
			
		||||
      for(int ii=0;ii<N;ii++){
 | 
			
		||||
	TensorIndexRecursion<Level-1>::pokeIndex(ret._internal[ii],arg._internal[ii],i,j);
 | 
			
		||||
@@ -161,7 +161,7 @@ class TensorIndexRecursion {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  template<class vtype,int N> inline static 
 | 
			
		||||
    void pokeIndex(iMatrix<vtype,N> &ret, const iMatrix<decltype(TensorIndexRecursion<Level-1>::peekIndex(ret._internal,0)),N> &arg, int i)
 | 
			
		||||
    void pokeIndex(iMatrix<vtype,N> &ret, const iMatrix<decltype(TensorIndexRecursion<Level-1>::peekIndex(ret._internal[0][0],0)),N> &arg, int i)
 | 
			
		||||
    {
 | 
			
		||||
      for(int ii=0;ii<N;ii++){
 | 
			
		||||
      for(int jj=0;jj<N;jj++){
 | 
			
		||||
@@ -169,7 +169,7 @@ class TensorIndexRecursion {
 | 
			
		||||
      }}
 | 
			
		||||
    }
 | 
			
		||||
  template<class vtype,int N> inline static 
 | 
			
		||||
    void pokeIndex(iMatrix<vtype,N> &ret, const iMatrix<decltype(TensorIndexRecursion<Level-1>::peekIndex(ret._internal,0)),N> &arg, int i,int j)
 | 
			
		||||
    void pokeIndex(iMatrix<vtype,N> &ret, const iMatrix<decltype(TensorIndexRecursion<Level-1>::peekIndex(ret._internal[0][0],0)),N> &arg, int i,int j)
 | 
			
		||||
    {
 | 
			
		||||
      for(int ii=0;ii<N;ii++){
 | 
			
		||||
      for(int jj=0;jj<N;jj++){
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user