1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-14 01:35:36 +00:00

WilsonMG: Implement Mdir & Mdiag in CoarsenedMatrix

This commit is contained in:
Daniel Richtmann 2018-05-16 16:07:58 +02:00
parent df8c208f5c
commit c48b69ca81

View File

@ -297,11 +297,47 @@ namespace Grid {
RealD Mdag (const CoarseVector &in, CoarseVector &out){ RealD Mdag (const CoarseVector &in, CoarseVector &out){
return M(in,out); return M(in,out);
void Mdir(const CoarseVector &in, CoarseVector &out, int dir, int disp){
conformable(_grid,in._grid);
conformable(in._grid,out._grid);
SimpleCompressor<siteVector> compressor;
Stencil.HaloExchange(in,compressor);
auto point = [dir, disp](){
if(dir == 0 and disp == 0)
return 8;
else
return (4 * dir + 1 - disp) / 2;
}();
parallel_for(int ss=0;ss<Grid()->oSites();ss++){
siteVector res = zero;
siteVector nbr;
int ptype;
StencilEntry *SE;
SE=Stencil.GetEntry(ptype,point,ss);
if(SE->_is_local&&SE->_permute) {
permute(nbr,in._odata[SE->_offset],ptype);
} else if(SE->_is_local) {
nbr = in._odata[SE->_offset];
} else {
nbr = Stencil.CommBuf()[SE->_offset];
}
res = res + A[point]._odata[ss]*nbr;
vstream(out._odata[ss],res);
}
}; };
// Defer support for further coarsening for now void Mdiag(const CoarseVector &in, CoarseVector &out){
void Mdiag (const CoarseVector &in, CoarseVector &out){}; Mdir(in, out, 0, 0); // use the self coupling (= last) point of the stencil
void Mdir (const CoarseVector &in, CoarseVector &out,int dir, int disp){}; };
CoarsenedMatrix(GridCartesian &CoarseGrid) : CoarsenedMatrix(GridCartesian &CoarseGrid) :