diff --git a/lib/qcd/action/fermion/ImprovedStaggeredFermion.cc b/lib/qcd/action/fermion/ImprovedStaggeredFermion.cc index 545af639..73232911 100644 --- a/lib/qcd/action/fermion/ImprovedStaggeredFermion.cc +++ b/lib/qcd/action/fermion/ImprovedStaggeredFermion.cc @@ -84,15 +84,6 @@ ImprovedStaggeredFermion::ImprovedStaggeredFermion(GaugeField &_Uthin, Gau { ImportGauge(_Uthin,_Ufat); } -template -ImprovedStaggeredFermion::ImprovedStaggeredFermion(GaugeField &_Utriple, GaugeField &_Ufat, GridCartesian &Fgrid, - GridRedBlackCartesian &Hgrid, RealD _mass, - const ImplParams &p) - : ImprovedStaggeredFermion(Fgrid,Hgrid,_mass,1.0,1.0,1.0,p) -{ - ImportGaugeSimple(_Utriple,_Ufat); -} - //////////////////////////////////////////////////////////// // Momentum space propagator should be @@ -106,11 +97,6 @@ ImprovedStaggeredFermion::ImprovedStaggeredFermion(GaugeField &_Utriple, G // of above link to implmement fourier based solver. //////////////////////////////////////////////////////////// template -void ImprovedStaggeredFermion::ImportGauge(const GaugeField &_Uthin) -{ - ImportGauge(_Uthin,_Uthin); -}; -template void ImprovedStaggeredFermion::ImportGaugeSimple(const GaugeField &_Utriple,const GaugeField &_Ufat) { ///////////////////////////////////////////////////////////////// @@ -133,6 +119,20 @@ void ImprovedStaggeredFermion::ImportGaugeSimple(const GaugeField &_Utripl PokeIndex(Umu, -U, mu+4); } + CopyGaugeCheckerboards(); +} +template +void ImprovedStaggeredFermion::ImportGaugeSimple(const DoubledGaugeField &_UUU,const DoubledGaugeField &_U) +{ + + Umu = _U; + UUUmu = _UUU; + CopyGaugeCheckerboards(); +} + +template +void ImprovedStaggeredFermion::CopyGaugeCheckerboards(void) +{ pickCheckerboard(Even, UmuEven, Umu); pickCheckerboard(Odd, UmuOdd , Umu); pickCheckerboard(Even, UUUmuEven,UUUmu); @@ -168,10 +168,7 @@ void ImprovedStaggeredFermion::ImportGauge(const GaugeField &_Uthin,const PokeIndex(UUUmu, U*(-0.5*c2/u0/u0/u0), mu+4); } - pickCheckerboard(Even, UmuEven, Umu); - pickCheckerboard(Odd, UmuOdd , Umu); - pickCheckerboard(Even, UUUmuEven, UUUmu); - pickCheckerboard(Odd, UUUmuOdd, UUUmu); + CopyGaugeCheckerboards(); } ///////////////////////////// diff --git a/lib/qcd/action/fermion/ImprovedStaggeredFermion.h b/lib/qcd/action/fermion/ImprovedStaggeredFermion.h index 750d29c6..5b6effb8 100644 --- a/lib/qcd/action/fermion/ImprovedStaggeredFermion.h +++ b/lib/qcd/action/fermion/ImprovedStaggeredFermion.h @@ -122,30 +122,29 @@ class ImprovedStaggeredFermion : public StaggeredKernels, public ImprovedS void DhopInternalOverlappedComms(StencilImpl &st, LebesgueOrder &lo, DoubledGaugeField &U,DoubledGaugeField &UUU, const FermionField &in, FermionField &out, int dag); - // Constructor + ////////////////////////////////////////////////////////////////////////// + // Grid own interface Constructor + ////////////////////////////////////////////////////////////////////////// ImprovedStaggeredFermion(GaugeField &_Uthin, GaugeField &_Ufat, GridCartesian &Fgrid, GridRedBlackCartesian &Hgrid, RealD _mass, RealD _c1, RealD _c2,RealD _u0, const ImplParams &p = ImplParams()); ////////////////////////////////////////////////////////////////////////// - // MILC constructor no coefficients; premultiply links by desired scaling - ////////////////////////////////////////////////////////////////////////// - ImprovedStaggeredFermion(GaugeField &_Utriple, GaugeField &_Ufat, GridCartesian &Fgrid, - GridRedBlackCartesian &Hgrid, RealD _mass, - const ImplParams &p = ImplParams()); - - ////////////////////////////////////////////////////////////////////////// - // A don't initialise the gauge field constructor; largely internal + // MILC constructor no gauge fields ////////////////////////////////////////////////////////////////////////// ImprovedStaggeredFermion(GridCartesian &Fgrid, GridRedBlackCartesian &Hgrid, RealD _mass, - RealD _c1, RealD _c2,RealD _u0, + RealD _c1=1.0, RealD _c2=1.0,RealD _u0=1.0, const ImplParams &p = ImplParams()); // DoubleStore impl dependent - void ImportGaugeSimple(const GaugeField &_Utriple, const GaugeField &_Ufat); - void ImportGauge(const GaugeField &_Uthin, const GaugeField &_Ufat); - void ImportGauge(const GaugeField &_Uthin); + void ImportGauge (const GaugeField &_Uthin ) { assert(0); } + void ImportGauge (const GaugeField &_Uthin ,const GaugeField &_Ufat); + void ImportGaugeSimple(const GaugeField &_UUU ,const GaugeField &_U); + void ImportGaugeSimple(const DoubledGaugeField &_UUU,const DoubledGaugeField &_U); + DoubledGaugeField &GetU(void) { return Umu ; } ; + DoubledGaugeField &GetUUU(void) { return UUUmu; }; + void CopyGaugeCheckerboards(void); /////////////////////////////////////////////////////////////// // Data members require to support the functionality diff --git a/lib/qcd/action/fermion/ImprovedStaggeredFermion5D.cc b/lib/qcd/action/fermion/ImprovedStaggeredFermion5D.cc index ab9c9c48..ab42b080 100644 --- a/lib/qcd/action/fermion/ImprovedStaggeredFermion5D.cc +++ b/lib/qcd/action/fermion/ImprovedStaggeredFermion5D.cc @@ -128,7 +128,14 @@ ImprovedStaggeredFermion5D::ImprovedStaggeredFermion5D(GridCartesian StencilEven.BuildSurfaceList(LLs,vol4); StencilOdd.BuildSurfaceList(LLs,vol4); } - +template +void ImprovedStaggeredFermion5D::CopyGaugeCheckerboards(void) +{ + pickCheckerboard(Even, UmuEven, Umu); + pickCheckerboard(Odd, UmuOdd , Umu); + pickCheckerboard(Even, UUUmuEven,UUUmu); + pickCheckerboard(Odd, UUUmuOdd, UUUmu); +} template ImprovedStaggeredFermion5D::ImprovedStaggeredFermion5D(GaugeField &_Uthin,GaugeField &_Ufat, GridCartesian &FiveDimGrid, @@ -144,26 +151,7 @@ ImprovedStaggeredFermion5D::ImprovedStaggeredFermion5D(GaugeField &_Uthin, { ImportGauge(_Uthin,_Ufat); } -template -ImprovedStaggeredFermion5D::ImprovedStaggeredFermion5D(GaugeField &_Utriple,GaugeField &_Ufat, - GridCartesian &FiveDimGrid, - GridRedBlackCartesian &FiveDimRedBlackGrid, - GridCartesian &FourDimGrid, - GridRedBlackCartesian &FourDimRedBlackGrid, - RealD _mass, - const ImplParams &p) : - ImprovedStaggeredFermion5D(FiveDimGrid,FiveDimRedBlackGrid, - FourDimGrid,FourDimRedBlackGrid, - _mass,1.0,1.0,1.0,p) -{ - ImportGaugeSimple(_Utriple,_Ufat); -} -template -void ImprovedStaggeredFermion5D::ImportGauge(const GaugeField &_Uthin) -{ - ImportGauge(_Uthin,_Uthin); -}; /////////////////////////////////////////////////// // For MILC use; pass three link U's and 1 link U /////////////////////////////////////////////////// @@ -188,10 +176,17 @@ void ImprovedStaggeredFermion5D::ImportGaugeSimple(const GaugeField &_Utri Impl::InsertGaugeField(Umu,-U,mu+4); } - pickCheckerboard(Even, UmuEven, Umu); - pickCheckerboard(Odd, UmuOdd , Umu); - pickCheckerboard(Even, UUUmuEven,UUUmu); - pickCheckerboard(Odd, UUUmuOdd, UUUmu); + CopyGaugeCheckerboards(); +} +template +void ImprovedStaggeredFermion5D::ImportGaugeSimple(const DoubledGaugeField &_UUU,const DoubledGaugeField &_U) +{ + ///////////////////////////////////////////////////////////////// + // Trivial import; phases and fattening and such like preapplied + ///////////////////////////////////////////////////////////////// + Umu = _U; + UUUmu = _UUU; + CopyGaugeCheckerboards(); } template void ImprovedStaggeredFermion5D::ImportGauge(const GaugeField &_Uthin,const GaugeField &_Ufat) @@ -221,10 +216,7 @@ void ImprovedStaggeredFermion5D::ImportGauge(const GaugeField &_Uthin,cons PokeIndex(UUUmu, U*(-0.5*c2/u0/u0/u0), mu+4); } - pickCheckerboard(Even, UmuEven, Umu); - pickCheckerboard(Odd, UmuOdd , Umu); - pickCheckerboard(Even, UUUmuEven, UUUmu); - pickCheckerboard(Odd, UUUmuOdd, UUUmu); + CopyGaugeCheckerboards(); } template void ImprovedStaggeredFermion5D::DhopDir(const FermionField &in, FermionField &out,int dir5,int disp) diff --git a/lib/qcd/action/fermion/ImprovedStaggeredFermion5D.h b/lib/qcd/action/fermion/ImprovedStaggeredFermion5D.h index 4024b472..7acc1e32 100644 --- a/lib/qcd/action/fermion/ImprovedStaggeredFermion5D.h +++ b/lib/qcd/action/fermion/ImprovedStaggeredFermion5D.h @@ -139,15 +139,9 @@ namespace QCD { // Constructors - // -- No Gauge field - ImprovedStaggeredFermion5D(GridCartesian &FiveDimGrid, - GridRedBlackCartesian &FiveDimRedBlackGrid, - GridCartesian &FourDimGrid, - GridRedBlackCartesian &FourDimRedBlackGrid, - double _mass, - RealD _c1, RealD _c2,RealD _u0, - const ImplParams &p= ImplParams()); - // -- Thin link and fat link, with coefficients + //////////////////////////////////////////////////////////////////////////////////////////////// + // Grid internal interface -- Thin link and fat link, with coefficients + //////////////////////////////////////////////////////////////////////////////////////////////// ImprovedStaggeredFermion5D(GaugeField &_Uthin, GaugeField &_Ufat, GridCartesian &FiveDimGrid, @@ -160,19 +154,24 @@ namespace QCD { //////////////////////////////////////////////////////////////////////////////////////////////// // MILC constructor ; triple links, no rescale factors; must be externally pre multiplied //////////////////////////////////////////////////////////////////////////////////////////////// - ImprovedStaggeredFermion5D(GaugeField &_Utriple, - GaugeField &_Ufat, - GridCartesian &FiveDimGrid, + ImprovedStaggeredFermion5D(GridCartesian &FiveDimGrid, GridRedBlackCartesian &FiveDimRedBlackGrid, GridCartesian &FourDimGrid, GridRedBlackCartesian &FourDimRedBlackGrid, double _mass, + RealD _c1=1.0, RealD _c2=1.0,RealD _u0=1.0, const ImplParams &p= ImplParams()); - - // DoubleStore - void ImportGauge(const GaugeField &_U); - void ImportGauge(const GaugeField &_Uthin,const GaugeField &_Ufat); - void ImportGaugeSimple(const GaugeField &_Uthin,const GaugeField &_Ufat); + + // DoubleStore gauge field in operator + void ImportGauge (const GaugeField &_Uthin ) { assert(0); } + void ImportGauge (const GaugeField &_Uthin ,const GaugeField &_Ufat); + void ImportGaugeSimple(const GaugeField &_UUU,const GaugeField &_U); + void ImportGaugeSimple(const DoubledGaugeField &_UUU,const DoubledGaugeField &_U); + // Give a reference; can be used to do an assignment or copy back out after import + // if Carleton wants to cache them and not use the ImportSimple + DoubledGaugeField &GetU(void) { return Umu ; } ; + DoubledGaugeField &GetUUU(void) { return UUUmu; }; + void CopyGaugeCheckerboards(void); /////////////////////////////////////////////////////////////// // Data members require to support the functionality diff --git a/tests/core/Test_staggered5Dvec.cc b/tests/core/Test_staggered5Dvec.cc index db76f792..2720c24c 100644 --- a/tests/core/Test_staggered5Dvec.cc +++ b/tests/core/Test_staggered5Dvec.cc @@ -141,6 +141,7 @@ int main (int argc, char ** argv) t1=usecond(); std::cout<