1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Hide internal data

This commit is contained in:
paboyle 2018-01-26 23:05:32 +00:00
parent 85771e97e9
commit 2b4067bb71
6 changed files with 66 additions and 66 deletions

View File

@ -356,35 +356,35 @@ template<class vobj> auto peekLorentz(const Lattice<vobj> &rhs,int i) -> decltyp
//////////////////////////////////////////////
template<class vobj>
void pokeColour(Lattice<vobj> &lhs,
const Lattice<decltype(peekIndex<ColourIndex>(lhs._odata[0],0))> & rhs,
const Lattice<decltype(peekIndex<ColourIndex>(lhs[0],0))> & rhs,
int i)
{
PokeIndex<ColourIndex>(lhs,rhs,i);
}
template<class vobj>
void pokeColour(Lattice<vobj> &lhs,
const Lattice<decltype(peekIndex<ColourIndex>(lhs._odata[0],0,0))> & rhs,
const Lattice<decltype(peekIndex<ColourIndex>(lhs[0],0,0))> & rhs,
int i,int j)
{
PokeIndex<ColourIndex>(lhs,rhs,i,j);
}
template<class vobj>
void pokeSpin(Lattice<vobj> &lhs,
const Lattice<decltype(peekIndex<SpinIndex>(lhs._odata[0],0))> & rhs,
const Lattice<decltype(peekIndex<SpinIndex>(lhs[0],0))> & rhs,
int i)
{
PokeIndex<SpinIndex>(lhs,rhs,i);
}
template<class vobj>
void pokeSpin(Lattice<vobj> &lhs,
const Lattice<decltype(peekIndex<SpinIndex>(lhs._odata[0],0,0))> & rhs,
const Lattice<decltype(peekIndex<SpinIndex>(lhs[0],0,0))> & rhs,
int i,int j)
{
PokeIndex<SpinIndex>(lhs,rhs,i,j);
}
template<class vobj>
void pokeLorentz(Lattice<vobj> &lhs,
const Lattice<decltype(peekIndex<LorentzIndex>(lhs._odata[0],0))> & rhs,
const Lattice<decltype(peekIndex<LorentzIndex>(lhs[0],0))> & rhs,
int i)
{
PokeIndex<LorentzIndex>(lhs,rhs,i);
@ -471,12 +471,12 @@ template<int Index,class vobj> inline vobj transposeColour(const vobj &lhs){
// Trace lattice and non-lattice
//////////////////////////////////////////
template<int Index,class vobj>
inline auto traceSpin(const Lattice<vobj> &lhs) -> Lattice<decltype(traceIndex<SpinIndex>(lhs._odata[0]))>
inline auto traceSpin(const Lattice<vobj> &lhs) -> Lattice<decltype(traceIndex<SpinIndex>(lhs[0]))>
{
return traceIndex<SpinIndex>(lhs);
}
template<int Index,class vobj>
inline auto traceColour(const Lattice<vobj> &lhs) -> Lattice<decltype(traceIndex<ColourIndex>(lhs._odata[0]))>
inline auto traceColour(const Lattice<vobj> &lhs) -> Lattice<decltype(traceIndex<ColourIndex>(lhs[0]))>
{
return traceIndex<ColourIndex>(lhs);
}

View File

@ -77,8 +77,8 @@ public:
static inline void AddLink(Field &U, LinkField &W,
int mu) { // U[mu] += W
thread_loop ( (auto ss = 0; ss < U._grid->oSites(); ss++),{
U._odata[ss]._internal[mu] =
U._odata[ss]._internal[mu] + W._odata[ss]._internal;
U[ss]._internal[mu] =
U[ss]._internal[mu] + W[ss]._internal;
});
}

View File

@ -61,8 +61,8 @@ public:
conformable(fcbgrid,V._grid);
// Assert the checkerboard?? or code for either
assert(U.checkerboard==Odd);
assert(V.checkerboard==U.checkerboard);
assert(U.Checkerboard()==Odd);
assert(V.Checkerboard()==U.Checkerboard());
// NOTE Guido: WE DO NOT WANT TO USE THE ucbgrid GRID FOR THE FORCE
// it is not conformable with the HMC force field
@ -83,8 +83,8 @@ public:
this->_Mat.MooeeInvDag(tmp1,tmp2); // even->even
this->_Mat.MeoDeriv(ForceE,tmp2,V,DaggerNo);
assert(ForceE.checkerboard==Even);
assert(ForceO.checkerboard==Odd);
assert(ForceE.Checkerboard()==Even);
assert(ForceO.Checkerboard()==Odd);
setCheckerboard(Force,ForceE);
setCheckerboard(Force,ForceO);
@ -106,8 +106,8 @@ public:
conformable(fcbgrid,V._grid);
// Assert the checkerboard?? or code for either
assert(V.checkerboard==Odd);
assert(V.checkerboard==V.checkerboard);
assert(V.Checkerboard()==Odd);
assert(V.Checkerboard()==V.Checkerboard());
// NOTE Guido: WE DO NOT WANT TO USE THE ucbgrid GRID FOR THE FORCE
// it is not conformable with the HMC force field
@ -127,8 +127,8 @@ public:
this->_Mat.MooeeInv(tmp1,tmp2); // even->even
this->_Mat.MeoDeriv(ForceE,tmp2,V,DaggerYes);
assert(ForceE.checkerboard==Even);
assert(ForceO.checkerboard==Odd);
assert(ForceE.Checkerboard()==Even);
assert(ForceO.Checkerboard()==Odd);
setCheckerboard(Force,ForceE);
setCheckerboard(Force,ForceO);

View File

@ -89,17 +89,17 @@ public:
const vobj *temp, *t_p;
SE = phiStencil.GetEntry(permute_type, mu, i);
t_p = &p._odata[i];
t_p = &p[i];
if ( SE->_is_local ) {
temp = &p._odata[SE->_offset];
temp = &p[SE->_offset];
if ( SE->_permute ) {
permute(temp2, *temp, permute_type);
action._odata[i] -= temp2*(*t_p) + (*t_p)*temp2;
action[i] -= temp2*(*t_p) + (*t_p)*temp2;
} else {
action._odata[i] -= (*temp)*(*t_p) + (*t_p)*(*temp);
action[i] -= (*temp)*(*t_p) + (*t_p)*(*temp);
}
} else {
action._odata[i] -= phiStencil.CommBuf()[SE->_offset]*(*t_p) + (*t_p)*phiStencil.CommBuf()[SE->_offset];
action[i] -= phiStencil.CommBuf()[SE->_offset]*(*t_p) + (*t_p)*phiStencil.CommBuf()[SE->_offset];
}
}
// action -= pshift*p + p*pshift;
@ -126,15 +126,15 @@ public:
SE = phiStencil.GetEntry(permute_type, point, i);
if ( SE->_is_local ) {
temp = &p._odata[SE->_offset];
temp = &p[SE->_offset];
if ( SE->_permute ) {
permute(temp2, *temp, permute_type);
force._odata[i] -= temp2;
force[i] -= temp2;
} else {
force._odata[i] -= *temp;
force[i] -= *temp;
}
} else {
force._odata[i] -= phiStencil.CommBuf()[SE->_offset];
force[i] -= phiStencil.CommBuf()[SE->_offset];
}
}
}

View File

@ -42,7 +42,7 @@ NAMESPACE_BEGIN(Grid);
template<class vobj,class Coeff>
void axpibg5x(Lattice<vobj> &z,const Lattice<vobj> &x,Coeff a,Coeff b)
{
z.checkerboard = x.checkerboard;
z.Checkerboard() = x.Checkerboard();
conformable(x,z);
GridBase *grid=x._grid;
@ -50,30 +50,30 @@ void axpibg5x(Lattice<vobj> &z,const Lattice<vobj> &x,Coeff a,Coeff b)
Gamma G5(Gamma::Algebra::Gamma5);
parallel_for(int ss=0;ss<grid->oSites();ss++){
vobj tmp;
tmp = a*x._odata[ss];
tmp = tmp + G5*(b*timesI(x._odata[ss]));
vstream(z._odata[ss],tmp);
tmp = a*x[ss];
tmp = tmp + G5*(b*timesI(x[ss]));
vstream(z[ss],tmp);
}
}
template<class vobj,class Coeff>
void axpby_ssp(Lattice<vobj> &z, Coeff a,const Lattice<vobj> &x,Coeff b,const Lattice<vobj> &y,int s,int sp)
{
z.checkerboard = x.checkerboard;
z.Checkerboard() = x.Checkerboard();
conformable(x,y);
conformable(x,z);
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._odata[ss+s]+b*y._odata[ss+sp];
vstream(z._odata[ss+s],tmp);
vobj tmp = a*x[ss+s]+b*y[ss+sp];
vstream(z[ss+s],tmp);
}
}
template<class vobj,class Coeff>
void ag5xpby_ssp(Lattice<vobj> &z,Coeff a,const Lattice<vobj> &x,Coeff b,const Lattice<vobj> &y,int s,int sp)
{
z.checkerboard = x.checkerboard;
z.Checkerboard() = x.Checkerboard();
conformable(x,y);
conformable(x,z);
GridBase *grid=x._grid;
@ -82,16 +82,16 @@ void ag5xpby_ssp(Lattice<vobj> &z,Coeff a,const Lattice<vobj> &x,Coeff b,const L
Gamma G5(Gamma::Algebra::Gamma5);
parallel_for(int ss=0;ss<grid->oSites();ss+=Ls){ // adds Ls
vobj tmp;
tmp = G5*x._odata[ss+s]*a;
tmp = tmp + b*y._odata[ss+sp];
vstream(z._odata[ss+s],tmp);
tmp = G5*x[ss+s]*a;
tmp = tmp + b*y[ss+sp];
vstream(z[ss+s],tmp);
}
}
template<class vobj,class Coeff>
void axpbg5y_ssp(Lattice<vobj> &z,Coeff a,const Lattice<vobj> &x,Coeff b,const Lattice<vobj> &y,int s,int sp)
{
z.checkerboard = x.checkerboard;
z.Checkerboard() = x.Checkerboard();
conformable(x,y);
conformable(x,z);
GridBase *grid=x._grid;
@ -99,16 +99,16 @@ void axpbg5y_ssp(Lattice<vobj> &z,Coeff a,const Lattice<vobj> &x,Coeff b,const L
Gamma G5(Gamma::Algebra::Gamma5);
parallel_for(int ss=0;ss<grid->oSites();ss+=Ls){ // adds Ls
vobj tmp;
tmp = G5*y._odata[ss+sp]*b;
tmp = tmp + a*x._odata[ss+s];
vstream(z._odata[ss+s],tmp);
tmp = G5*y[ss+sp]*b;
tmp = tmp + a*x[ss+s];
vstream(z[ss+s],tmp);
}
}
template<class vobj,class Coeff>
void ag5xpbg5y_ssp(Lattice<vobj> &z,Coeff a,const Lattice<vobj> &x,Coeff b,const Lattice<vobj> &y,int s,int sp)
{
z.checkerboard = x.checkerboard;
z.Checkerboard() = x.Checkerboard();
conformable(x,y);
conformable(x,z);
GridBase *grid=x._grid;
@ -118,41 +118,41 @@ void ag5xpbg5y_ssp(Lattice<vobj> &z,Coeff a,const Lattice<vobj> &x,Coeff b,const
parallel_for(int ss=0;ss<grid->oSites();ss+=Ls){ // adds Ls
vobj tmp1;
vobj tmp2;
tmp1 = a*x._odata[ss+s]+b*y._odata[ss+sp];
tmp1 = a*x[ss+s]+b*y[ss+sp];
tmp2 = G5*tmp1;
vstream(z._odata[ss+s],tmp2);
vstream(z[ss+s],tmp2);
}
}
template<class vobj,class Coeff>
void axpby_ssp_pminus(Lattice<vobj> &z,Coeff a,const Lattice<vobj> &x,Coeff b,const Lattice<vobj> &y,int s,int sp)
{
z.checkerboard = x.checkerboard;
z.Checkerboard() = x.Checkerboard();
conformable(x,y);
conformable(x,z);
GridBase *grid=x._grid;
int Ls = grid->_rdimensions[0];
parallel_for(int ss=0;ss<grid->oSites();ss+=Ls){ // adds Ls
vobj tmp;
spProj5m(tmp,y._odata[ss+sp]);
tmp = a*x._odata[ss+s]+b*tmp;
vstream(z._odata[ss+s],tmp);
spProj5m(tmp,y[ss+sp]);
tmp = a*x[ss+s]+b*tmp;
vstream(z[ss+s],tmp);
}
}
template<class vobj,class Coeff>
void axpby_ssp_pplus(Lattice<vobj> &z,Coeff a,const Lattice<vobj> &x,Coeff b,const Lattice<vobj> &y,int s,int sp)
{
z.checkerboard = x.checkerboard;
z.Checkerboard() = x.Checkerboard();
conformable(x,y);
conformable(x,z);
GridBase *grid=x._grid;
int Ls = grid->_rdimensions[0];
parallel_for(int ss=0;ss<grid->oSites();ss+=Ls){ // adds Ls
vobj tmp;
spProj5p(tmp,y._odata[ss+sp]);
tmp = a*x._odata[ss+s]+b*tmp;
vstream(z._odata[ss+s],tmp);
spProj5p(tmp,y[ss+sp]);
tmp = a*x[ss+s]+b*tmp;
vstream(z[ss+s],tmp);
}
}
@ -160,7 +160,7 @@ template<class vobj>
void G5R5(Lattice<vobj> &z,const Lattice<vobj> &x)
{
GridBase *grid=x._grid;
z.checkerboard = x.checkerboard;
z.Checkerboard() = x.Checkerboard();
conformable(x,z);
int Ls = grid->_rdimensions[0];
Gamma G5(Gamma::Algebra::Gamma5);
@ -168,8 +168,8 @@ void G5R5(Lattice<vobj> &z,const Lattice<vobj> &x)
vobj tmp;
for(int s=0;s<Ls;s++){
int sp = Ls-1-s;
tmp = G5*x._odata[ss+s];
vstream(z._odata[ss+sp],tmp);
tmp = G5*x[ss+s];
vstream(z[ss+sp],tmp);
}
}
}

View File

@ -224,19 +224,19 @@ public:
su2SubGroupIndex(i0, i1, su2_index);
parallel_for (int ss = 0; ss < grid->oSites(); ss++) {
subgroup._odata[ss]()()(0, 0) = source._odata[ss]()()(i0, i0);
subgroup._odata[ss]()()(0, 1) = source._odata[ss]()()(i0, i1);
subgroup._odata[ss]()()(1, 0) = source._odata[ss]()()(i1, i0);
subgroup._odata[ss]()()(1, 1) = source._odata[ss]()()(i1, i1);
subgroup[ss]()()(0, 0) = source[ss]()()(i0, i0);
subgroup[ss]()()(0, 1) = source[ss]()()(i0, i1);
subgroup[ss]()()(1, 0) = source[ss]()()(i1, i0);
subgroup[ss]()()(1, 1) = source[ss]()()(i1, i1);
iSU2Matrix<vcplx> Sigma = subgroup._odata[ss];
iSU2Matrix<vcplx> Sigma = subgroup[ss];
Sigma = Sigma - adj(Sigma) + trace(adj(Sigma));
subgroup._odata[ss] = Sigma;
subgroup[ss] = Sigma;
// this should be purely real
Determinant._odata[ss] =
Determinant[ss] =
Sigma()()(0, 0) * Sigma()()(1, 1) - Sigma()()(0, 1) * Sigma()()(1, 0);
}
}
@ -254,10 +254,10 @@ public:
dest = 1.0; // start out with identity
parallel_for (int ss = 0; ss < grid->oSites(); ss++) {
dest._odata[ss]()()(i0, i0) = subgroup._odata[ss]()()(0, 0);
dest._odata[ss]()()(i0, i1) = subgroup._odata[ss]()()(0, 1);
dest._odata[ss]()()(i1, i0) = subgroup._odata[ss]()()(1, 0);
dest._odata[ss]()()(i1, i1) = subgroup._odata[ss]()()(1, 1);
dest[ss]()()(i0, i0) = subgroup[ss]()()(0, 0);
dest[ss]()()(i0, i1) = subgroup[ss]()()(0, 1);
dest[ss]()()(i1, i0) = subgroup[ss]()()(1, 0);
dest[ss]()()(i1, i1) = subgroup[ss]()()(1, 1);
}
}