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

cout IO for all types

This commit is contained in:
Peter Boyle
2015-05-13 09:24:10 +01:00
parent 48f425d31c
commit a108d5d3b0
6 changed files with 118 additions and 8 deletions

View File

@@ -176,7 +176,27 @@ PARALLEL_FOR_LOOP
}
return ret;
};
}; // class Lattice
template<class vobj> inline std::ostream& operator<< (std::ostream& stream, const Lattice<vobj> &o){
std::vector<int> gcoor;
typedef typename vobj::scalar_object sobj;
sobj ss;
for(int g=0;g<o._grid->_gsites;g++){
o._grid->GlobalIndexToGlobalCoor(g,gcoor);
peekSite(ss,o,gcoor);
stream<<"[";
for(int d=0;d<gcoor.size();d++){
stream<<gcoor[d];
if(d!=gcoor.size()-1) stream<<",";
}
stream<<"]\t";
stream<<ss<<std::endl;
}
return stream;
}
}

View File

@@ -110,7 +110,7 @@ PARALLEL_FOR_LOOP
// Peek a scalar object from the SIMD array
//////////////////////////////////////////////////////////
template<class vobj,class sobj>
void peekSite(sobj &s,Lattice<vobj> &l,std::vector<int> &site){
void peekSite(sobj &s,const Lattice<vobj> &l,std::vector<int> &site){
GridBase *grid=l._grid;