Grid 0.7.0
DDHMCFilter.h
Go to the documentation of this file.
1/*************************************************************************************
2
3Grid physics library, www.github.com/paboyle/Grid
4
5Source file: ./lib/qcd/hmc/integrators/DirichletFilter.h
6
7Copyright (C) 2015
8
9Author: Peter Boyle <paboyle@ph.ed.ac.uk>
10
11This program is free software; you can redistribute it and/or modify
12it under the terms of the GNU General Public License as published by
13the Free Software Foundation; either version 2 of the License, or
14(at your option) any later version.
15
16This program is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19GNU General Public License for more details.
20
21You should have received a copy of the GNU General Public License along
22with this program; if not, write to the Free Software Foundation, Inc.,
2351 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
25See the full license in the file "LICENSE" in the top level distribution
26directory
27*************************************************************************************/
28/* END LEGAL */
29//--------------------------------------------------------------------
30#pragma once
31
34// DDHMC filter with sub-block size B[mu]
36
37template<typename GaugeField>
38struct DDHMCFilter: public MomentumFilterBase<GaugeField>
39{
41 int Width;
42
43 DDHMCFilter(const Coordinate &_Block,int _Width=2): Block(_Block) { Width=_Width; }
44
45 void applyFilter(GaugeField &U) const override
46 {
47 GridBase *grid = U.Grid();
48 Coordinate Global=grid->GlobalDimensions();
49 GaugeField zzz(grid); zzz = Zero();
50 LatticeInteger coor(grid);
51
52 auto zzz_mu = PeekIndex<LorentzIndex>(zzz,0);
54 // Zero BDY layers
56 std::cout<<GridLogMessage<<" DDHMC Force Filter Block "<<Block<<" width " <<Width<<std::endl;
57 for(int mu=0;mu<Nd;mu++) {
58
59 Integer B1 = Block[mu];
60 if ( B1 && (B1 <= Global[mu]) ) {
61 LatticeCoordinate(coor,mu);
62
64 // OmegaBar - zero all links contained in slice B-1,0 and
65 // mu links connecting to Omega
67 if ( Width==1) {
68 U = where(mod(coor,B1)==Integer(B1-1),zzz,U);
69 U = where(mod(coor,B1)==Integer(0) ,zzz,U);
70 auto U_mu = PeekIndex<LorentzIndex>(U,mu);
71 U_mu = where(mod(coor,B1)==Integer(B1-2),zzz_mu,U_mu);
72 PokeIndex<LorentzIndex>(U, U_mu, mu);
73 }
74 if ( Width==2) {
75 U = where(mod(coor,B1)==Integer(B1-2),zzz,U);
76 U = where(mod(coor,B1)==Integer(B1-1),zzz,U);
77 U = where(mod(coor,B1)==Integer(0) ,zzz,U);
78 U = where(mod(coor,B1)==Integer(1) ,zzz,U);
79 auto U_mu = PeekIndex<LorentzIndex>(U,mu);
80 U_mu = where(mod(coor,B1)==Integer(B1-3),zzz_mu,U_mu);
81 PokeIndex<LorentzIndex>(U, U_mu, mu);
82 }
83 if ( Width==3) {
84 U = where(mod(coor,B1)==Integer(B1-3),zzz,U);
85 U = where(mod(coor,B1)==Integer(B1-2),zzz,U);
86 U = where(mod(coor,B1)==Integer(B1-1),zzz,U);
87 U = where(mod(coor,B1)==Integer(0) ,zzz,U);
88 U = where(mod(coor,B1)==Integer(1) ,zzz,U);
89 U = where(mod(coor,B1)==Integer(2) ,zzz,U);
90 auto U_mu = PeekIndex<LorentzIndex>(U,mu);
91 U_mu = where(mod(coor,B1)==Integer(B1-4),zzz_mu,U_mu);
92 PokeIndex<LorentzIndex>(U, U_mu, mu);
93 }
94 if ( Width==4) {
95 U = where(mod(coor,B1)==Integer(B1-4),zzz,U);
96 U = where(mod(coor,B1)==Integer(B1-3),zzz,U);
97 U = where(mod(coor,B1)==Integer(B1-2),zzz,U);
98 U = where(mod(coor,B1)==Integer(B1-1),zzz,U);
99 U = where(mod(coor,B1)==Integer(0) ,zzz,U);
100 U = where(mod(coor,B1)==Integer(1) ,zzz,U);
101 U = where(mod(coor,B1)==Integer(2) ,zzz,U);
102 U = where(mod(coor,B1)==Integer(3) ,zzz,U);
103 auto U_mu = PeekIndex<LorentzIndex>(U,mu);
104 U_mu = where(mod(coor,B1)==Integer(B1-5),zzz_mu,U_mu);
105 PokeIndex<LorentzIndex>(U, U_mu, mu);
106 }
107 }
108
109 }
110
111 }
112};
113
115
AcceleratorVector< int, MaxDims > Coordinate
Definition Coordinate.h:95
void LatticeCoordinate(Lattice< iobj > &l, int mu)
void PokeIndex(Lattice< vobj > &lhs, const Lattice< decltype(peekIndex< Index >(vobj(), 0))> &rhs, int i)
auto PeekIndex(const Lattice< vobj > &lhs, int i) -> Lattice< decltype(peekIndex< Index >(vobj(), i))>
Lattice< obj > mod(const Lattice< obj > &rhs_i, Integer y)
GridLogger GridLogMessage(1, "Message", GridLogColours, "NORMAL")
#define NAMESPACE_BEGIN(A)
Definition Namespace.h:35
#define NAMESPACE_END(A)
Definition Namespace.h:36
Lattice< vTInteger > LatticeInteger
Definition QCD.h:364
static constexpr int Nd
Definition QCD.h:52
uint32_t Integer
Definition Simd.h:58
static INTERNAL_PRECISION U
Definition Zolotarev.cc:230
const Coordinate & GlobalDimensions(void)
Definition Simd.h:194
void applyFilter(GaugeField &U) const override
Definition DDHMCFilter.h:45
DDHMCFilter(const Coordinate &_Block, int _Width=2)
Definition DDHMCFilter.h:43
Coordinate Block
Definition DDHMCFilter.h:40