diff --git a/lib/lattice/Lattice_transfer.h b/lib/lattice/Lattice_transfer.h index f39b4bab..eb6d6515 100644 --- a/lib/lattice/Lattice_transfer.h +++ b/lib/lattice/Lattice_transfer.h @@ -44,7 +44,7 @@ inline void subdivides(GridBase *coarse,GridBase *fine) } } - + //////////////////////////////////////////////////////////////////////////////////////////// // remove and insert a half checkerboard //////////////////////////////////////////////////////////////////////////////////////////// @@ -325,6 +325,89 @@ inline void blockPromote(const Lattice > &coarseData, } +template +void InsertSlice(const Lattice &lowDim,Lattice & higherDim,int slice, int orthog) +{ + typedef typename vobj::scalar_object sobj; + sobj s; + + GridBase *lg = lowdim._grid; + GridBase *hg = higherdim._grid; + int nl = lg->_ndimension; + int nh = hg->_ndimension; + + assert(nl+1 == nh); + assert(orthog=0); + assert(hg->_processors[orthog]==0); + + int dl; dl = 0; + for(int d=0;d_processors[dl] == hg->_processors[d]); + assert(lg->_ldimensions[dl] == hg->_ldimensions[d]); + dl++; + } + } + + // the above should guarantee that the operations are local + std::vector lcoor(nl); + std::vector hcoor(nh); + hcoor[orthog] = slice; + for(int idx=0;idxlSites();idx++){ + lg->LocalIndexToLocalCoor(idx,lcoor); + dl=0; + for(int d=0;d +void ExtractSlice(Lattice &lowDim,const Lattice & higherDim,int slice, int dir) +{ + typedef typename vobj::scalar_object sobj; + sobj s; + + GridBase *lg = lowdim._grid; + GridBase *hg = higherdim._grid; + int nl = lg->_ndimension; + int nh = hg->_ndimension; + + assert(nl+1 == nh); + assert(orthog=0); + assert(hg->_processors[orthog]==0); + + int dl; dl = 0; + for(int d=0;d_processors[dl] == hg->_processors[d]); + assert(lg->_ldimensions[dl] == hg->_ldimensions[d]); + dl++; + } + } + // the above should guarantee that the operations are local + std::vector lcoor(nl); + std::vector hcoor(nh); + hcoor[orthog] = slice; + for(int idx=0;idxlSites();idx++){ + lg->LocalIndexToLocalCoor(idx,lcoor); + dl=0; + for(int d=0;d void Replicate(Lattice &coarse,Lattice & fine)