2015-04-18 20:44:19 +01:00
|
|
|
#ifndef GRID_LATTICE_COORDINATE_H
|
|
|
|
#define GRID_LATTICE_COORDINATE_H
|
|
|
|
|
|
|
|
namespace Grid {
|
|
|
|
|
|
|
|
template<class iobj> inline void LatticeCoordinate(Lattice<iobj> &l,int mu)
|
|
|
|
{
|
2015-04-22 22:46:48 +01:00
|
|
|
typedef typename iobj::scalar_type scalar_type;
|
|
|
|
typedef typename iobj::vector_type vector_type;
|
2015-04-28 08:11:59 +01:00
|
|
|
|
2015-04-18 20:44:19 +01:00
|
|
|
GridBase *grid = l._grid;
|
|
|
|
int Nsimd = grid->iSites();
|
2015-04-28 08:11:59 +01:00
|
|
|
|
2015-04-18 20:44:19 +01:00
|
|
|
std::vector<int> gcoor;
|
2015-04-22 22:46:48 +01:00
|
|
|
std::vector<scalar_type> mergebuf(Nsimd);
|
2015-04-28 08:11:59 +01:00
|
|
|
|
2015-04-22 22:46:48 +01:00
|
|
|
vector_type vI;
|
2015-04-18 20:44:19 +01:00
|
|
|
for(int o=0;o<grid->oSites();o++){
|
|
|
|
for(int i=0;i<grid->iSites();i++){
|
|
|
|
grid->RankIndexToGlobalCoor(grid->ThisRank(),o,i,gcoor);
|
2015-04-28 08:11:59 +01:00
|
|
|
mergebuf[i]=(Integer)gcoor[mu];
|
2015-04-18 20:44:19 +01:00
|
|
|
}
|
2015-05-10 23:29:21 +01:00
|
|
|
merge<vector_type,scalar_type>(vI,mergebuf);
|
2015-06-09 10:26:19 +01:00
|
|
|
l._odata[o]=vI;
|
2015-04-18 20:44:19 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// LatticeCoordinate();
|
|
|
|
// FIXME for debug; deprecate this; made obscelete by
|
|
|
|
template<class vobj> void lex_sites(Lattice<vobj> &l){
|
|
|
|
Real *v_ptr = (Real *)&l._odata[0];
|
|
|
|
size_t o_len = l._grid->oSites();
|
|
|
|
size_t v_len = sizeof(vobj)/sizeof(vRealF);
|
|
|
|
size_t vec_len = vRealF::Nsimd();
|
|
|
|
|
|
|
|
for(int i=0;i<o_len;i++){
|
|
|
|
for(int j=0;j<v_len;j++){
|
|
|
|
for(int vv=0;vv<vec_len;vv+=2){
|
|
|
|
v_ptr[i*v_len*vec_len+j*vec_len+vv ]= i+vv*500;
|
|
|
|
v_ptr[i*v_len*vec_len+j*vec_len+vv+1]= i+vv*500;
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|