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

Cleaing up

This commit is contained in:
Peter Boyle 2015-04-18 16:42:47 +01:00
parent b47d33c4f1
commit eb0925d702
3 changed files with 59 additions and 2 deletions

View File

@ -1,5 +1,6 @@
#ifndef GRID_COMMUNICATOR_H
#define GRID_COMMUNICATOR_H
///////////////////////////////////
// Processor layout information
///////////////////////////////////

View File

@ -18,6 +18,7 @@ namespace QCD {
static const int ColourIndex = 1;
static const int SpinIndex = 2;
static const int LorentzIndex= 3;
// ChrisK very keen to add extra space for Gparity doubling.
//
@ -83,8 +84,62 @@ namespace QCD {
typedef Lattice<vLorentzColourMatrix> LatticeGaugeField;
//////////////////////////////////////////////////////////////////////////////
// Peek and Poke named after physics attributes
//////////////////////////////////////////////////////////////////////////////
//spin
template<class vobj> auto peekSpin(const vobj &rhs,int i) -> decltype(peekIndex<SpinIndex>(rhs,0))
{
return peekIndex<SpinIndex>(rhs,i);
}
template<class vobj> auto peekSpin(const vobj &rhs,int i,int j) -> decltype(peekIndex<SpinIndex>(rhs,0,0))
{
return peekIndex<SpinIndex>(rhs,i,j);
}
template<class vobj> auto peekSpin(const Lattice<vobj> &rhs,int i) -> decltype(peekIndex<SpinIndex>(rhs,0))
{
return peekIndex<SpinIndex>(rhs,i);
}
template<class vobj> auto peekSpin(const Lattice<vobj> &rhs,int i,int j) -> decltype(peekIndex<SpinIndex>(rhs,0,0))
{
return peekIndex<SpinIndex>(rhs,i,j);
}
//colour
template<class vobj> auto peekColour(const vobj &rhs,int i) -> decltype(peekIndex<ColourIndex>(rhs,0))
{
return peekIndex<ColourIndex>(rhs,i);
}
template<class vobj> auto peekColour(const vobj &rhs,int i,int j) -> decltype(peekIndex<ColourIndex>(rhs,0,0))
{
return peekIndex<ColourIndex>(rhs,i,j);
}
template<class vobj> auto peekColour(const Lattice<vobj> &rhs,int i) -> decltype(peekIndex<ColourIndex>(rhs,0))
{
return peekIndex<ColourIndex>(rhs,i);
}
template<class vobj> auto peekColour(const Lattice<vobj> &rhs,int i,int j) -> decltype(peekIndex<ColourIndex>(rhs,0,0))
{
return peekIndex<ColourIndex>(rhs,i,j);
}
//lorentz
template<class vobj> auto peekLorentz(const vobj &rhs,int i) -> decltype(peekIndex<LorentzIndex>(rhs,0))
{
return peekIndex<LorentzIndex>(rhs,i);
}
template<class vobj> auto peekLorentz(const vobj &rhs,int i,int j) -> decltype(peekIndex<LorentzIndex>(rhs,0,0))
{
return peekIndex<LorentzIndex>(rhs,i,j);
}
template<class vobj> auto peekLorentz(const Lattice<vobj> &rhs,int i) -> decltype(peekIndex<LorentzIndex>(rhs,0))
{
return peekIndex<LorentzIndex>(rhs,i);
}
template<class vobj> auto peekLorentz(const Lattice<vobj> &rhs,int i,int j) -> decltype(peekIndex<LorentzIndex>(rhs,0,0))
{
return peekIndex<LorentzIndex>(rhs,i,j);
}
// FIXME this is rather generic and should find a way to place it earlier.
inline void LatticeCoordinate(LatticeInteger &l,int mu){
GridBase *grid = l._grid;
int Nsimd = grid->iSites();

View File

@ -222,6 +222,7 @@ int main (int argc, char ** argv)
s_m = peekIndex<1>(scm,0,0);
c_m = peekIndex<2>(scm,1,2);
c_m = peekSpin(scm,1,2);
printf("c. Level %d\n",c_m.TensorLevel);
printf("c. Level %d\n",c_m().TensorLevel);
@ -299,7 +300,7 @@ int main (int argc, char ** argv)
int Nc = Grid::QCD::Nc;
LatticeGaugeField U(&Fine);
// LatticeColourMatrix Uy = U(yDir);
LatticeColourMatrix Uy = peekLorentz(U,1);
flops = ncall*1.0*volume*(8*Nc*Nc*Nc);
bytes = ncall*1.0*volume*Nc*Nc *2*3*sizeof(Grid::Real);