1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-07-29 02:37:07 +01:00

_grid becomes private ; use Grid()§

This commit is contained in:
paboyle
2018-01-27 00:04:12 +00:00
parent 3f9654e397
commit c4f82e072b
116 changed files with 731 additions and 728 deletions

View File

@@ -48,7 +48,7 @@ namespace PeriodicBC {
int mu,
const Lattice<covariant> &field)
{
Lattice<covariant> tmp(field._grid);
Lattice<covariant> tmp(field.Grid());
tmp = adj(Link)*field;
return Cshift(tmp,mu,-1);// moves towards positive mu
}
@@ -87,7 +87,7 @@ namespace ConjugateBC {
int mu,
const Lattice<covariant> &field)
{
GridBase * grid = Link._grid;
GridBase * grid = Link.Grid();
int Lmu = grid->GlobalDimensions()[mu]-1;
@@ -106,7 +106,7 @@ namespace ConjugateBC {
int mu,
const Lattice<covariant> &field)
{
GridBase * grid = field._grid;
GridBase * grid = field.Grid();
int Lmu = grid->GlobalDimensions()[mu]-1;

View File

@@ -108,14 +108,14 @@ public:
//GaugeField herm = in + adj(in);
//std::cout << "AHermiticity: " << norm2(herm) << std::endl;
GaugeLinkField tmp(in._grid);
GaugeLinkField tmp2(in._grid);
GaugeLinkField sum(in._grid);
GaugeLinkField tmp(in.Grid());
GaugeLinkField tmp2(in.Grid());
GaugeLinkField sum(in.Grid());
for (int nu = 0; nu < Nd; nu++) {
sum = zero;
GaugeLinkField in_nu = PeekIndex<LorentzIndex>(in, nu);
GaugeLinkField out_nu(out._grid);
GaugeLinkField out_nu(out.Grid());
for (int mu = 0; mu < Nd; mu++) {
tmp = U[mu] * Cshift(in_nu, mu, +1) * adj(U[mu]);
tmp2 = adj(U[mu]) * in_nu * U[mu];
@@ -131,7 +131,7 @@ public:
RealD factor = -kappa / (double(4 * Nd));
for (int mu = 0; mu < Nd; mu++){
GaugeLinkField der_mu(der._grid);
GaugeLinkField der_mu(der.Grid());
der_mu = zero;
for (int nu = 0; nu < Nd; nu++){
GaugeLinkField in_nu = PeekIndex<LorentzIndex>(in, nu);
@@ -150,7 +150,7 @@ public:
RealD factor = -kappa / (double(4 * Nd));
for (int mu = 0; mu < Nd; mu++) {
GaugeLinkField der_mu(der._grid);
GaugeLinkField der_mu(der.Grid());
der_mu = zero;
for (int nu = 0; nu < Nd; nu++) {
GaugeLinkField left_nu = PeekIndex<LorentzIndex>(left, nu);
@@ -168,7 +168,7 @@ public:
}
void MSquareRoot(GaugeField& P){
GaugeField Gp(P._grid);
GaugeField Gp(P.Grid());
HermitianLinearOperator<LaplacianAdjointField<Impl>,GaugeField> HermOp(*this);
ConjugateGradientMultiShift<GaugeField> msCG(param.MaxIter,PowerHalf);
msCG(HermOp,P,Gp);
@@ -176,7 +176,7 @@ public:
}
void MInvSquareRoot(GaugeField& P){
GaugeField Gp(P._grid);
GaugeField Gp(P.Grid());
HermitianLinearOperator<LaplacianAdjointField<Impl>,GaugeField> HermOp(*this);
ConjugateGradientMultiShift<GaugeField> msCG(param.MaxIter,PowerInvHalf);
msCG(HermOp,P,Gp);

View File

@@ -52,7 +52,7 @@ public:
}
}
static void SteepestDescentGaugeFix(GaugeLorentz &Umu,Real & alpha,int maxiter,Real Omega_tol, Real Phi_tol,bool Fourier=false) {
GridBase *grid = Umu._grid;
GridBase *grid = Umu.Grid();
Real org_plaq =WilsonLoops<Gimpl>::avgPlaquette(Umu);
Real org_link_trace=WilsonLoops<Gimpl>::linkTrace(Umu);
@@ -97,7 +97,7 @@ public:
}
};
static Real SteepestDescentStep(std::vector<GaugeMat> &U,Real & alpha, GaugeMat & dmuAmu) {
GridBase *grid = U[0]._grid;
GridBase *grid = U[0].Grid();
std::vector<GaugeMat> A(Nd,grid);
GaugeMat g(grid);
@@ -116,7 +116,7 @@ public:
static Real FourierAccelSteepestDescentStep(std::vector<GaugeMat> &U,Real & alpha, GaugeMat & dmuAmu) {
GridBase *grid = U[0]._grid;
GridBase *grid = U[0].Grid();
Real vol = grid->gSites();
@@ -179,7 +179,7 @@ public:
}
static void ExpiAlphaDmuAmu(const std::vector<GaugeMat> &A,GaugeMat &g,Real & alpha, GaugeMat &dmuAmu) {
GridBase *grid = g._grid;
GridBase *grid = g.Grid();
Complex cialpha(0.0,-alpha);
GaugeMat ciadmam(grid);
DmuAmu(A,dmuAmu);

View File

@@ -45,7 +45,7 @@ void axpibg5x(Lattice<vobj> &z,const Lattice<vobj> &x,Coeff a,Coeff b)
z.Checkerboard() = x.Checkerboard();
conformable(x,z);
GridBase *grid=x._grid;
GridBase *grid=x.Grid();
Gamma G5(Gamma::Algebra::Gamma5);
parallel_for(int ss=0;ss<grid->oSites();ss++){
@@ -62,7 +62,7 @@ void axpby_ssp(Lattice<vobj> &z, Coeff a,const Lattice<vobj> &x,Coeff b,const La
z.Checkerboard() = x.Checkerboard();
conformable(x,y);
conformable(x,z);
GridBase *grid=x._grid;
GridBase *grid=x.Grid();
int Ls = grid->_rdimensions[0];
parallel_for(int ss=0;ss<grid->oSites();ss+=Ls){ // adds Ls
vobj tmp = a*x[ss+s]+b*y[ss+sp];
@@ -76,7 +76,7 @@ void ag5xpby_ssp(Lattice<vobj> &z,Coeff a,const Lattice<vobj> &x,Coeff b,const L
z.Checkerboard() = x.Checkerboard();
conformable(x,y);
conformable(x,z);
GridBase *grid=x._grid;
GridBase *grid=x.Grid();
int Ls = grid->_rdimensions[0];
Gamma G5(Gamma::Algebra::Gamma5);
@@ -94,7 +94,7 @@ void axpbg5y_ssp(Lattice<vobj> &z,Coeff a,const Lattice<vobj> &x,Coeff b,const L
z.Checkerboard() = x.Checkerboard();
conformable(x,y);
conformable(x,z);
GridBase *grid=x._grid;
GridBase *grid=x.Grid();
int Ls = grid->_rdimensions[0];
Gamma G5(Gamma::Algebra::Gamma5);
parallel_for(int ss=0;ss<grid->oSites();ss+=Ls){ // adds Ls
@@ -111,7 +111,7 @@ void ag5xpbg5y_ssp(Lattice<vobj> &z,Coeff a,const Lattice<vobj> &x,Coeff b,const
z.Checkerboard() = x.Checkerboard();
conformable(x,y);
conformable(x,z);
GridBase *grid=x._grid;
GridBase *grid=x.Grid();
int Ls = grid->_rdimensions[0];
Gamma G5(Gamma::Algebra::Gamma5);
@@ -130,7 +130,7 @@ void axpby_ssp_pminus(Lattice<vobj> &z,Coeff a,const Lattice<vobj> &x,Coeff b,co
z.Checkerboard() = x.Checkerboard();
conformable(x,y);
conformable(x,z);
GridBase *grid=x._grid;
GridBase *grid=x.Grid();
int Ls = grid->_rdimensions[0];
parallel_for(int ss=0;ss<grid->oSites();ss+=Ls){ // adds Ls
vobj tmp;
@@ -146,7 +146,7 @@ void axpby_ssp_pplus(Lattice<vobj> &z,Coeff a,const Lattice<vobj> &x,Coeff b,con
z.Checkerboard() = x.Checkerboard();
conformable(x,y);
conformable(x,z);
GridBase *grid=x._grid;
GridBase *grid=x.Grid();
int Ls = grid->_rdimensions[0];
parallel_for(int ss=0;ss<grid->oSites();ss+=Ls){ // adds Ls
vobj tmp;
@@ -159,7 +159,7 @@ void axpby_ssp_pplus(Lattice<vobj> &z,Coeff a,const Lattice<vobj> &x,Coeff b,con
template<class vobj>
void G5R5(Lattice<vobj> &z,const Lattice<vobj> &x)
{
GridBase *grid=x._grid;
GridBase *grid=x.Grid();
z.Checkerboard() = x.Checkerboard();
conformable(x,z);
int Ls = grid->_rdimensions[0];

View File

@@ -107,7 +107,7 @@ public:
if (1) {
// Auxiliary momenta
// do nothing if trivial, so hide in the metric
MomentaField AuxMomTemp(Mom._grid);
MomentaField AuxMomTemp(Mom.Grid());
Implementation::generate_momenta(AuxMom, pRNG);
Implementation::generate_momenta(AuxField, pRNG);
// Modify the distribution with the metric
@@ -118,10 +118,10 @@ public:
// Correct
RealD MomentaAction(){
MomentaField inv(Mom._grid);
MomentaField inv(Mom.Grid());
inv = zero;
M.Minv(Mom, inv);
LatticeComplex Hloc(Mom._grid);
LatticeComplex Hloc(Mom.Grid());
Hloc = zero;
for (int mu = 0; mu < Nd; mu++) {
// This is not very general
@@ -155,8 +155,8 @@ public:
// Compute the derivative of the kinetic term
// with respect to the gauge field
MomentaField MDer(in._grid);
MomentaField X(in._grid);
MomentaField MDer(in.Grid());
MomentaField X(in.Grid());
X = zero;
M.Minv(in, X); // X = G in
M.MDeriv(X, MDer); // MDer = U * dS/dU
@@ -168,8 +168,8 @@ public:
der = zero;
if (1){
// Auxiliary fields
MomentaField der_temp(der._grid);
MomentaField X(der._grid);
MomentaField der_temp(der.Grid());
MomentaField X(der.Grid());
X=zero;
//M.M(AuxMom, X); // X = M Aux
// Two derivative terms
@@ -200,8 +200,8 @@ public:
void update_auxiliary_fields(RealD ep){
if (1) {
MomentaField tmp(AuxMom._grid);
MomentaField tmp2(AuxMom._grid);
MomentaField tmp(AuxMom.Grid());
MomentaField tmp2(AuxMom.Grid());
M.M(AuxMom, tmp);
// M.M(tmp, tmp2);
AuxField += ep * tmp; // M^2 AuxMom

View File

@@ -217,7 +217,7 @@ public:
Lattice<iSU2Matrix<vcplx> > &subgroup,
const Lattice<iSUnMatrix<vcplx> > &source,
int su2_index) {
GridBase *grid(source._grid);
GridBase *grid(source.Grid());
conformable(subgroup, source);
conformable(subgroup, Determinant);
int i0, i1;
@@ -247,7 +247,7 @@ public:
template <class vcplx>
static void su2Insert(const Lattice<iSU2Matrix<vcplx> > &subgroup,
Lattice<iSUnMatrix<vcplx> > &dest, int su2_index) {
GridBase *grid(dest._grid);
GridBase *grid(dest.Grid());
conformable(subgroup, dest);
int i0, i1;
su2SubGroupIndex(i0, i1, su2_index);
@@ -277,7 +277,7 @@ public:
LatticeMatrix &link,
const LatticeMatrix &barestaple, // multiplied by action coeffs so th
int su2_subgroup, int nheatbath, LatticeInteger &wheremask) {
GridBase *grid = link._grid;
GridBase *grid = link.Grid();
const RealD twopi = 2.0 * M_PI;
@@ -604,7 +604,7 @@ public:
template <typename LatticeMatrixType>
static void LieRandomize(GridParallelRNG &pRNG, LatticeMatrixType &out,
double scale = 1.0) {
GridBase *grid = out._grid;
GridBase *grid = out.Grid();
typedef typename LatticeMatrixType::vector_type vector_type;
typedef typename LatticeMatrixType::scalar_type scalar_type;
@@ -641,7 +641,7 @@ public:
static void GaussianFundamentalLieAlgebraMatrix(GridParallelRNG &pRNG,
LatticeMatrix &out,
Real scale = 1.0) {
GridBase *grid = out._grid;
GridBase *grid = out.Grid();
LatticeReal ca(grid);
LatticeMatrix la(grid);
Complex ci(0.0, scale);
@@ -661,7 +661,7 @@ public:
LatticeMatrix &out,
Real scale = 1.0) {
conformable(h, out);
GridBase *grid = out._grid;
GridBase *grid = out.Grid();
LatticeMatrix la(grid);
Matrix ta;
@@ -678,8 +678,8 @@ public:
template<typename GaugeField,typename GaugeMat>
static void GaugeTransform( GaugeField &Umu, GaugeMat &g){
GridBase *grid = Umu._grid;
conformable(grid,g._grid);
GridBase *grid = Umu.Grid();
conformable(grid,g.Grid());
GaugeMat U(grid);
GaugeMat ag(grid); ag = adj(g);
@@ -692,7 +692,7 @@ public:
}
template<typename GaugeMat>
static void GaugeTransform( std::vector<GaugeMat> &U, GaugeMat &g){
GridBase *grid = g._grid;
GridBase *grid = g.Grid();
GaugeMat ag(grid); ag = adj(g);
for(int mu=0;mu<Nd;mu++){
U[mu] = g*U[mu]*Cshift(ag, mu, 1);
@@ -724,7 +724,7 @@ public:
typedef iSUnMatrix<vector_type> vMatrixType;
typedef Lattice<vMatrixType> LatticeMatrixType;
LatticeMatrixType Umu(out._grid);
LatticeMatrixType Umu(out.Grid());
for (int mu = 0; mu < Nd; mu++) {
LieRandomize(pRNG, Umu, 1.0);
PokeIndex<LorentzIndex>(out, Umu, mu);
@@ -736,7 +736,7 @@ public:
typedef iSUnMatrix<vector_type> vMatrixType;
typedef Lattice<vMatrixType> LatticeMatrixType;
LatticeMatrixType Umu(out._grid);
LatticeMatrixType Umu(out.Grid());
for(int mu=0;mu<Nd;mu++){
LieRandomize(pRNG,Umu,0.01);
PokeIndex<LorentzIndex>(out,Umu,mu);
@@ -748,7 +748,7 @@ public:
typedef iSUnMatrix<vector_type> vMatrixType;
typedef Lattice<vMatrixType> LatticeMatrixType;
LatticeMatrixType Umu(out._grid);
LatticeMatrixType Umu(out.Grid());
Umu=1.0;
for(int mu=0;mu<Nd;mu++){
PokeIndex<LorentzIndex>(out,Umu,mu);
@@ -767,7 +767,7 @@ public:
static void taExp(const LatticeMatrixType &x, LatticeMatrixType &ex) {
typedef typename LatticeMatrixType::scalar_type ComplexType;
LatticeMatrixType xn(x._grid);
LatticeMatrixType xn(x.Grid());
RealD nfac = 1.0;
xn = x;

View File

@@ -114,7 +114,7 @@ public:
const typename SU<ncolour>::LatticeAlgebraVector &h,
LatticeAdjMatrix &out, Real scale = 1.0) {
conformable(h, out);
GridBase *grid = out._grid;
GridBase *grid = out.Grid();
LatticeAdjMatrix la(grid);
AMatrix iTa;

View File

@@ -199,7 +199,7 @@ public:
const typename SU<ncolour>::LatticeAlgebraVector &h,
LatticeTwoIndexMatrix &out, Real scale = 1.0) {
conformable(h, out);
GridBase *grid = out._grid;
GridBase *grid = out.Grid();
LatticeTwoIndexMatrix la(grid);
TIMatrix i2indTa;

View File

@@ -67,7 +67,7 @@ public:
//////////////////////////////////////////////////
static RealD sumphider(const typename Impl::Field &f) {
typename Impl::Field tmp(f._grid);
typename Impl::Field tmp(f.Grid());
tmp = Cshift(f, 0, -1) * f;
for (int mu = 1; mu < Nd; mu++) {
tmp += Cshift(f, mu, -1) * f;
@@ -76,13 +76,13 @@ public:
}
static RealD sumphisquared(const typename Impl::Field &f) {
typename Impl::Field tmp(f._grid);
typename Impl::Field tmp(f.Grid());
tmp = f * f;
return sum(trace(tmp));
}
static RealD sumphifourth(const typename Impl::Field &f) {
typename Impl::Field tmp(f._grid);
typename Impl::Field tmp(f.Grid());
phifourth(tmp, f);
return sum(trace(tmp));
}

View File

@@ -76,7 +76,7 @@ public:
static void traceDirPlaquette(ComplexField &plaq,
const std::vector<GaugeMat> &U, const int mu,
const int nu) {
GaugeMat sp(U[0]._grid);
GaugeMat sp(U[0].Grid());
dirPlaquette(sp, U, mu, nu);
plaq = trace(sp);
}
@@ -85,7 +85,7 @@ public:
//////////////////////////////////////////////////
static void sitePlaquette(ComplexField &Plaq,
const std::vector<GaugeMat> &U) {
ComplexField sitePlaq(U[0]._grid);
ComplexField sitePlaq(U[0].Grid());
Plaq = zero;
for (int mu = 1; mu < Nd; mu++) {
for (int nu = 0; nu < mu; nu++) {
@@ -98,13 +98,13 @@ public:
// sum over all x,y,z,t and over all planes of plaquette
//////////////////////////////////////////////////
static RealD sumPlaquette(const GaugeLorentz &Umu) {
std::vector<GaugeMat> U(Nd, Umu._grid);
std::vector<GaugeMat> U(Nd, Umu.Grid());
// inefficient here
for (int mu = 0; mu < Nd; mu++) {
U[mu] = PeekIndex<LorentzIndex>(Umu, mu);
}
ComplexField Plaq(Umu._grid);
ComplexField Plaq(Umu.Grid());
sitePlaquette(Plaq, U);
auto Tp = sum(Plaq);
@@ -118,7 +118,7 @@ public:
//////////////////////////////////////////////////
static RealD avgPlaquette(const GaugeLorentz &Umu) {
RealD sumplaq = sumPlaquette(Umu);
double vol = Umu._grid->gSites();
double vol = Umu.Grid()->gSites();
double faces = (1.0 * Nd * (Nd - 1)) / 2.0;
return sumplaq / vol / faces / Nc; // Nd , Nc dependent... FIXME
}
@@ -127,9 +127,9 @@ public:
// average over traced single links
//////////////////////////////////////////////////
static RealD linkTrace(const GaugeLorentz &Umu) {
std::vector<GaugeMat> U(Nd, Umu._grid);
std::vector<GaugeMat> U(Nd, Umu.Grid());
ComplexField Tr(Umu._grid);
ComplexField Tr(Umu.Grid());
Tr = zero;
for (int mu = 0; mu < Nd; mu++) {
U[mu] = PeekIndex<LorentzIndex>(Umu, mu);
@@ -139,7 +139,7 @@ public:
auto Tp = sum(Tr);
auto p = TensorRemove(Tp);
double vol = Umu._grid->gSites();
double vol = Umu.Grid()->gSites();
return p.real() / vol / 4.0 / 3.0;
};
@@ -150,7 +150,7 @@ public:
static void Staple(GaugeMat &staple, const GaugeLorentz &Umu, int mu,
int nu) {
GridBase *grid = Umu._grid;
GridBase *grid = Umu.Grid();
std::vector<GaugeMat> U(Nd, grid);
for (int d = 0; d < Nd; d++) {
@@ -191,7 +191,7 @@ public:
// For the force term
static void StapleMult(GaugeMat &staple, const GaugeLorentz &Umu, int mu) {
GridBase *grid = Umu._grid;
GridBase *grid = Umu.Grid();
std::vector<GaugeMat> U(Nd, grid);
for (int d = 0; d < Nd; d++) {
// this operation is taking too much time
@@ -219,7 +219,7 @@ public:
//////////////////////////////////////////////////
static void Staple(GaugeMat &staple, const GaugeLorentz &Umu, int mu) {
GridBase *grid = Umu._grid;
GridBase *grid = Umu.Grid();
std::vector<GaugeMat> U(Nd, grid);
for (int d = 0; d < Nd; d++) {
@@ -266,7 +266,7 @@ public:
static void StapleUpper(GaugeMat &staple, const GaugeLorentz &Umu, int mu,
int nu) {
if (nu != mu) {
GridBase *grid = Umu._grid;
GridBase *grid = Umu.Grid();
std::vector<GaugeMat> U(Nd, grid);
for (int d = 0; d < Nd; d++) {
@@ -297,7 +297,7 @@ public:
static void StapleLower(GaugeMat &staple, const GaugeLorentz &Umu, int mu,
int nu) {
if (nu != mu) {
GridBase *grid = Umu._grid;
GridBase *grid = Umu.Grid();
std::vector<GaugeMat> U(Nd, grid);
for (int d = 0; d < Nd; d++) {
@@ -329,7 +329,7 @@ public:
// | | | |
// +--<--+ +--<--+
GaugeMat Vup(Umu._grid), Vdn(Umu._grid);
GaugeMat Vup(Umu.Grid()), Vdn(Umu.Grid());
StapleUpper(Vup, Umu, mu, nu);
StapleLower(Vdn, Umu, mu, nu);
GaugeMat v = Vup - Vdn;
@@ -342,13 +342,13 @@ public:
// 4d topological charge
assert(Nd==4);
// Bx = -iF(y,z), By = -iF(z,y), Bz = -iF(x,y)
GaugeMat Bx(U._grid), By(U._grid), Bz(U._grid);
GaugeMat Bx(U.Grid()), By(U.Grid()), Bz(U.Grid());
FieldStrength(Bx, U, Ydir, Zdir);
FieldStrength(By, U, Zdir, Xdir);
FieldStrength(Bz, U, Xdir, Ydir);
// Ex = -iF(t,x), Ey = -iF(t,y), Ez = -iF(t,z)
GaugeMat Ex(U._grid), Ey(U._grid), Ez(U._grid);
GaugeMat Ex(U.Grid()), Ey(U.Grid()), Ez(U.Grid());
FieldStrength(Ex, U, Tdir, Xdir);
FieldStrength(Ey, U, Tdir, Ydir);
FieldStrength(Ez, U, Tdir, Zdir);
@@ -378,13 +378,13 @@ public:
static void traceDirRectangle(ComplexField &rect,
const std::vector<GaugeMat> &U, const int mu,
const int nu) {
GaugeMat sp(U[0]._grid);
GaugeMat sp(U[0].Grid());
dirRectangle(sp, U, mu, nu);
rect = trace(sp);
}
static void siteRectangle(ComplexField &Rect,
const std::vector<GaugeMat> &U) {
ComplexField siteRect(U[0]._grid);
ComplexField siteRect(U[0].Grid());
Rect = zero;
for (int mu = 1; mu < Nd; mu++) {
for (int nu = 0; nu < mu; nu++) {
@@ -398,13 +398,13 @@ public:
// sum over all x,y,z,t and over all planes of plaquette
//////////////////////////////////////////////////
static RealD sumRectangle(const GaugeLorentz &Umu) {
std::vector<GaugeMat> U(Nd, Umu._grid);
std::vector<GaugeMat> U(Nd, Umu.Grid());
for (int mu = 0; mu < Nd; mu++) {
U[mu] = PeekIndex<LorentzIndex>(Umu, mu);
}
ComplexField Rect(Umu._grid);
ComplexField Rect(Umu.Grid());
siteRectangle(Rect, U);
@@ -419,7 +419,7 @@ public:
RealD sumrect = sumRectangle(Umu);
double vol = Umu._grid->gSites();
double vol = Umu.Grid()->gSites();
double faces = (1.0 * Nd * (Nd - 1)); // 2 distinct orientations summed
@@ -445,7 +445,7 @@ public:
Stap = zero;
GridBase *grid = U[0]._grid;
GridBase *grid = U[0].Grid();
GaugeMat Staple2x1(grid);
GaugeMat tmp(grid);
@@ -522,7 +522,7 @@ public:
static void RectStapleUnoptimised(GaugeMat &Stap, const GaugeLorentz &Umu,
int mu) {
GridBase *grid = Umu._grid;
GridBase *grid = Umu.Grid();
std::vector<GaugeMat> U(Nd, grid);
for (int d = 0; d < Nd; d++) {