mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-10 06:00:45 +01:00
Namespace, indent
This commit is contained in:
parent
b4bb428d9b
commit
c8c1d36710
@ -1,4 +1,4 @@
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
@ -23,52 +23,51 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#ifndef GRID_LATTICE_COORDINATE_H
|
#ifndef GRID_LATTICE_COORDINATE_H
|
||||||
#define GRID_LATTICE_COORDINATE_H
|
#define GRID_LATTICE_COORDINATE_H
|
||||||
|
|
||||||
namespace Grid {
|
NAMESPACE_BEGIN(Grid);
|
||||||
|
|
||||||
template<class iobj> inline void LatticeCoordinate(Lattice<iobj> &l,int mu)
|
template<class iobj> inline void LatticeCoordinate(Lattice<iobj> &l,int mu)
|
||||||
{
|
{
|
||||||
typedef typename iobj::scalar_type scalar_type;
|
typedef typename iobj::scalar_type scalar_type;
|
||||||
typedef typename iobj::vector_type vector_type;
|
typedef typename iobj::vector_type vector_type;
|
||||||
|
|
||||||
GridBase *grid = l._grid;
|
GridBase *grid = l._grid;
|
||||||
int Nsimd = grid->iSites();
|
int Nsimd = grid->iSites();
|
||||||
|
|
||||||
std::vector<int> gcoor;
|
std::vector<int> gcoor;
|
||||||
std::vector<scalar_type> mergebuf(Nsimd);
|
std::vector<scalar_type> mergebuf(Nsimd);
|
||||||
|
|
||||||
vector_type vI;
|
vector_type vI;
|
||||||
for(int o=0;o<grid->oSites();o++){
|
for(int o=0;o<grid->oSites();o++){
|
||||||
for(int i=0;i<grid->iSites();i++){
|
for(int i=0;i<grid->iSites();i++){
|
||||||
grid->RankIndexToGlobalCoor(grid->ThisRank(),o,i,gcoor);
|
grid->RankIndexToGlobalCoor(grid->ThisRank(),o,i,gcoor);
|
||||||
mergebuf[i]=(Integer)gcoor[mu];
|
mergebuf[i]=(Integer)gcoor[mu];
|
||||||
}
|
|
||||||
merge<vector_type,scalar_type>(vI,mergebuf);
|
|
||||||
l._odata[o]=vI;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
}
|
}
|
||||||
|
merge<vector_type,scalar_type>(vI,mergebuf);
|
||||||
|
l._odata[o]=vI;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NAMESPACE_END(Grid);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user