mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
Namespace nd indentation
This commit is contained in:
parent
edb79dc088
commit
550b905bb8
@ -27,13 +27,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
See the full license in the file "LICENSE" in the top level distribution
|
See the full license in the file "LICENSE" in the top level distribution
|
||||||
directory
|
directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#ifndef GRID_LATTICE_BASE_H
|
#ifndef GRID_LATTICE_BASE_H
|
||||||
#define GRID_LATTICE_BASE_H
|
#define GRID_LATTICE_BASE_H
|
||||||
|
|
||||||
#define STREAMING_STORES
|
#define STREAMING_STORES
|
||||||
|
|
||||||
namespace Grid {
|
NAMESPACE_BEGIN(Grid);
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// mac,real,imag
|
// mac,real,imag
|
||||||
@ -59,28 +59,28 @@ extern int GridCshiftPermuteMap[4][16];
|
|||||||
class LatticeBase
|
class LatticeBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~LatticeBase(void) = default;
|
virtual ~LatticeBase(void) = default;
|
||||||
GridBase *_grid;
|
GridBase *_grid;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LatticeExpressionBase {};
|
class LatticeExpressionBase {};
|
||||||
|
|
||||||
template <typename Op, typename T1>
|
template <typename Op, typename T1>
|
||||||
class LatticeUnaryExpression : public std::pair<Op,std::tuple<T1> > , public LatticeExpressionBase {
|
class LatticeUnaryExpression : public std::pair<Op,std::tuple<T1> > , public LatticeExpressionBase {
|
||||||
public:
|
public:
|
||||||
LatticeUnaryExpression(const std::pair<Op,std::tuple<T1> > &arg): std::pair<Op,std::tuple<T1> >(arg) {};
|
LatticeUnaryExpression(const std::pair<Op,std::tuple<T1> > &arg): std::pair<Op,std::tuple<T1> >(arg) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Op, typename T1, typename T2>
|
template <typename Op, typename T1, typename T2>
|
||||||
class LatticeBinaryExpression : public std::pair<Op,std::tuple<T1,T2> > , public LatticeExpressionBase {
|
class LatticeBinaryExpression : public std::pair<Op,std::tuple<T1,T2> > , public LatticeExpressionBase {
|
||||||
public:
|
public:
|
||||||
LatticeBinaryExpression(const std::pair<Op,std::tuple<T1,T2> > &arg): std::pair<Op,std::tuple<T1,T2> >(arg) {};
|
LatticeBinaryExpression(const std::pair<Op,std::tuple<T1,T2> > &arg): std::pair<Op,std::tuple<T1,T2> >(arg) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Op, typename T1, typename T2, typename T3>
|
template <typename Op, typename T1, typename T2, typename T3>
|
||||||
class LatticeTrinaryExpression :public std::pair<Op,std::tuple<T1,T2,T3> >, public LatticeExpressionBase {
|
class LatticeTrinaryExpression :public std::pair<Op,std::tuple<T1,T2,T3> >, public LatticeExpressionBase {
|
||||||
public:
|
public:
|
||||||
LatticeTrinaryExpression(const std::pair<Op,std::tuple<T1,T2,T3> > &arg): std::pair<Op,std::tuple<T1,T2,T3> >(arg) {};
|
LatticeTrinaryExpression(const std::pair<Op,std::tuple<T1,T2,T3> > &arg): std::pair<Op,std::tuple<T1,T2,T3> >(arg) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
void inline conformable(GridBase *lhs,GridBase *rhs)
|
void inline conformable(GridBase *lhs,GridBase *rhs)
|
||||||
@ -92,19 +92,19 @@ template<class vobj>
|
|||||||
class Lattice : public LatticeBase
|
class Lattice : public LatticeBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int checkerboard;
|
int checkerboard;
|
||||||
Vector<vobj> _odata;
|
Vector<vobj> _odata;
|
||||||
|
|
||||||
// to pthread need a computable loop where loop induction is not required
|
// to pthread need a computable loop where loop induction is not required
|
||||||
int begin(void) { return 0;};
|
int begin(void) { return 0;};
|
||||||
int end(void) { return _odata.size(); }
|
int end(void) { return _odata.size(); }
|
||||||
vobj & operator[](int i) { return _odata[i]; };
|
vobj & operator[](int i) { return _odata[i]; };
|
||||||
const vobj & operator[](int i) const { return _odata[i]; };
|
const vobj & operator[](int i) const { return _odata[i]; };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename vobj::scalar_type scalar_type;
|
typedef typename vobj::scalar_type scalar_type;
|
||||||
typedef typename vobj::vector_type vector_type;
|
typedef typename vobj::vector_type vector_type;
|
||||||
typedef vobj vector_object;
|
typedef vobj vector_object;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Expression Template closure support
|
// Expression Template closure support
|
||||||
@ -177,7 +177,7 @@ public:
|
|||||||
}
|
}
|
||||||
//GridFromExpression is tricky to do
|
//GridFromExpression is tricky to do
|
||||||
template<class Op,class T1>
|
template<class Op,class T1>
|
||||||
Lattice(const LatticeUnaryExpression<Op,T1> & expr) {
|
Lattice(const LatticeUnaryExpression<Op,T1> & expr) {
|
||||||
_grid = nullptr;
|
_grid = nullptr;
|
||||||
GridFromExpression(_grid,expr);
|
GridFromExpression(_grid,expr);
|
||||||
assert(_grid!=nullptr);
|
assert(_grid!=nullptr);
|
||||||
@ -303,25 +303,25 @@ public:
|
|||||||
}
|
}
|
||||||
}; // class Lattice
|
}; // class Lattice
|
||||||
|
|
||||||
template<class vobj> std::ostream& operator<< (std::ostream& stream, const Lattice<vobj> &o){
|
template<class vobj> std::ostream& operator<< (std::ostream& stream, const Lattice<vobj> &o){
|
||||||
std::vector<int> gcoor;
|
std::vector<int> gcoor;
|
||||||
typedef typename vobj::scalar_object sobj;
|
typedef typename vobj::scalar_object sobj;
|
||||||
sobj ss;
|
sobj ss;
|
||||||
for(int g=0;g<o._grid->_gsites;g++){
|
for(int g=0;g<o._grid->_gsites;g++){
|
||||||
o._grid->GlobalIndexToGlobalCoor(g,gcoor);
|
o._grid->GlobalIndexToGlobalCoor(g,gcoor);
|
||||||
peekSite(ss,o,gcoor);
|
peekSite(ss,o,gcoor);
|
||||||
stream<<"[";
|
stream<<"[";
|
||||||
for(int d=0;d<gcoor.size();d++){
|
for(int d=0;d<gcoor.size();d++){
|
||||||
stream<<gcoor[d];
|
stream<<gcoor[d];
|
||||||
if(d!=gcoor.size()-1) stream<<",";
|
if(d!=gcoor.size()-1) stream<<",";
|
||||||
}
|
|
||||||
stream<<"]\t";
|
|
||||||
stream<<ss<<std::endl;
|
|
||||||
}
|
}
|
||||||
return stream;
|
stream<<"]\t";
|
||||||
|
stream<<ss<<std::endl;
|
||||||
}
|
}
|
||||||
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NAMESPACE_END(Grid);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user