mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-14 05:07:05 +01:00
_grid becomes private ; use Grid()§
This commit is contained in:
@ -141,9 +141,9 @@ template <class T1,
|
||||
inline void GridFromExpression(GridBase *&grid, const T1 &lat) // Lattice leaf
|
||||
{
|
||||
if (grid) {
|
||||
conformable(grid, lat._grid);
|
||||
conformable(grid, lat.Grid());
|
||||
}
|
||||
grid = lat._grid;
|
||||
grid = lat.Grid();
|
||||
}
|
||||
template <class T1,
|
||||
typename std::enable_if<!is_lattice<T1>::value, T1>::type * = nullptr>
|
||||
|
@ -106,9 +106,10 @@ void inline conformable(GridBase *lhs,GridBase *rhs)
|
||||
template<class vobj>
|
||||
class Lattice : public LatticeAccelerator<vobj>
|
||||
{
|
||||
public: // Move to private and fix
|
||||
protected: // Move to private and fix
|
||||
GridBase *_grid;
|
||||
public:
|
||||
GridBase *Grid(void) const { return _grid; }
|
||||
///////////////////////////////////////////////////
|
||||
// Member types
|
||||
///////////////////////////////////////////////////
|
||||
@ -328,7 +329,7 @@ public:
|
||||
}
|
||||
Lattice(const Lattice& r){ // copy constructor
|
||||
// std::cout << "Lattice constructor(const Lattice &) "<<this<<std::endl;
|
||||
_grid = r._grid;
|
||||
_grid = r.Grid();
|
||||
resize(r._odata_size);
|
||||
this->checkerboard = r.Checkerboard();
|
||||
accelerator_loop(ss,(*this),{
|
||||
@ -337,7 +338,7 @@ public:
|
||||
}
|
||||
Lattice(Lattice && r){ // move constructor
|
||||
// std::cout << "Lattice move constructor(Lattice &) "<<this<<std::endl;
|
||||
_grid = r._grid;
|
||||
_grid = r.Grid();
|
||||
this->_odata = r._odata;
|
||||
this->_odata_size = r._odata_size;
|
||||
this->checkerboard= r.Checkerboard();
|
||||
@ -370,7 +371,7 @@ public:
|
||||
// std::cout << "Lattice = (Lattice &&)"<<std::endl;
|
||||
resize(0); // delete if appropriate
|
||||
|
||||
this->_grid = r._grid;
|
||||
this->_grid = r.Grid();
|
||||
this->checkerboard = r.Checkerboard();
|
||||
|
||||
this->_odata = r._odata;
|
||||
@ -403,8 +404,8 @@ template<class vobj> std::ostream& operator<< (std::ostream& stream, const Latti
|
||||
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);
|
||||
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++){
|
||||
|
@ -46,7 +46,7 @@ NAMESPACE_BEGIN(Grid);
|
||||
template<class vfunctor,class lobj,class robj>
|
||||
inline Lattice<vInteger> LLComparison(vfunctor op,const Lattice<lobj> &lhs,const Lattice<robj> &rhs)
|
||||
{
|
||||
Lattice<vInteger> ret(rhs._grid);
|
||||
Lattice<vInteger> ret(rhs.Grid());
|
||||
accelerator_loop( ss, rhs, {
|
||||
ret[ss]=op(lhs[ss],rhs[ss]);
|
||||
});
|
||||
@ -58,7 +58,7 @@ inline Lattice<vInteger> LLComparison(vfunctor op,const Lattice<lobj> &lhs,const
|
||||
template<class vfunctor,class lobj,class robj>
|
||||
inline Lattice<vInteger> LSComparison(vfunctor op,const Lattice<lobj> &lhs,const robj &rhs)
|
||||
{
|
||||
Lattice<vInteger> ret(lhs._grid);
|
||||
Lattice<vInteger> ret(lhs.Grid());
|
||||
accelerator_loop( ss, lhs, {
|
||||
ret[ss]=op(lhs[ss],rhs);
|
||||
});
|
||||
@ -70,7 +70,7 @@ inline Lattice<vInteger> LSComparison(vfunctor op,const Lattice<lobj> &lhs,const
|
||||
template<class vfunctor,class lobj,class robj>
|
||||
inline Lattice<vInteger> SLComparison(vfunctor op,const lobj &lhs,const Lattice<robj> &rhs)
|
||||
{
|
||||
Lattice<vInteger> ret(rhs._grid);
|
||||
Lattice<vInteger> ret(rhs.Grid());
|
||||
accelerator_loop( ss, rhs, {
|
||||
ret[ss]=op(lhs[ss],rhs);
|
||||
});
|
||||
|
@ -32,7 +32,7 @@ NAMESPACE_BEGIN(Grid);
|
||||
|
||||
template<class obj1,class obj2> void conformable(const Lattice<obj1> &lhs,const Lattice<obj2> &rhs)
|
||||
{
|
||||
assert(lhs._grid == rhs._grid);
|
||||
assert(lhs.Grid() == rhs.Grid());
|
||||
assert(lhs.Checkerboard() == rhs.Checkerboard());
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ template<class iobj> inline void LatticeCoordinate(Lattice<iobj> &l,int mu)
|
||||
typedef typename iobj::scalar_type scalar_type;
|
||||
typedef typename iobj::vector_type vector_type;
|
||||
|
||||
GridBase *grid = l._grid;
|
||||
GridBase *grid = l.Grid();
|
||||
int Nsimd = grid->iSites();
|
||||
|
||||
std::vector<int> gcoor;
|
||||
@ -56,7 +56,7 @@ template<class iobj> inline void LatticeCoordinate(Lattice<iobj> &l,int mu)
|
||||
// FIXME for debug; deprecate this; made obscelete by
|
||||
template<class vobj> void lex_sites(Lattice<vobj> &l){
|
||||
Real *v_ptr = (Real *)&l[0];
|
||||
size_t o_len = l._grid->oSites();
|
||||
size_t o_len = l.Grid()->oSites();
|
||||
size_t v_len = sizeof(vobj)/sizeof(vRealF);
|
||||
size_t vec_len = vRealF::Nsimd();
|
||||
|
||||
|
@ -42,7 +42,7 @@ NAMESPACE_BEGIN(Grid);
|
||||
template<class vobj>
|
||||
inline auto localNorm2 (const Lattice<vobj> &rhs)-> Lattice<typename vobj::tensor_reduced>
|
||||
{
|
||||
Lattice<typename vobj::tensor_reduced> ret(rhs._grid);
|
||||
Lattice<typename vobj::tensor_reduced> ret(rhs.Grid());
|
||||
accelerator_loop(ss,rhs,{
|
||||
ret[ss]=innerProduct(rhs[ss],rhs[ss]);
|
||||
});
|
||||
@ -53,7 +53,7 @@ inline auto localNorm2 (const Lattice<vobj> &rhs)-> Lattice<typename vobj::tenso
|
||||
template<class vobj>
|
||||
inline auto localInnerProduct (const Lattice<vobj> &lhs,const Lattice<vobj> &rhs) -> Lattice<typename vobj::tensor_reduced>
|
||||
{
|
||||
Lattice<typename vobj::tensor_reduced> ret(rhs._grid);
|
||||
Lattice<typename vobj::tensor_reduced> ret(rhs.Grid());
|
||||
accelerator_loop(ss,rhs,{
|
||||
ret[ss]=innerProduct(lhs[ss],rhs[ss]);
|
||||
});
|
||||
@ -65,7 +65,7 @@ inline auto localInnerProduct (const Lattice<vobj> &lhs,const Lattice<vobj> &rhs
|
||||
template<class ll,class rr>
|
||||
inline auto outerProduct (const Lattice<ll> &lhs,const Lattice<rr> &rhs) -> Lattice<decltype(outerProduct(lhs[0],rhs[0]))>
|
||||
{
|
||||
Lattice<decltype(outerProduct(lhs[0],rhs[0]))> ret(rhs._grid);
|
||||
Lattice<decltype(outerProduct(lhs[0],rhs[0]))> ret(rhs.Grid());
|
||||
accelerator_loop(ss,rhs,{
|
||||
ret[ss]=outerProduct(lhs[ss],rhs[ss]);
|
||||
});
|
||||
|
@ -35,9 +35,9 @@ static void sliceMaddMatrix (Lattice<vobj> &R,Eigen::MatrixXcd &aa,const Lattice
|
||||
typedef typename vobj::scalar_type scalar_type;
|
||||
typedef typename vobj::vector_type vector_type;
|
||||
|
||||
int Nblock = X._grid->GlobalDimensions()[Orthog];
|
||||
int Nblock = X.Grid()->GlobalDimensions()[Orthog];
|
||||
|
||||
GridBase *FullGrid = X._grid;
|
||||
GridBase *FullGrid = X.Grid();
|
||||
// GridBase *SliceGrid = makeSubSliceGrid(FullGrid,Orthog);
|
||||
|
||||
// Lattice<vobj> Xslice(SliceGrid);
|
||||
@ -83,9 +83,9 @@ static void sliceMulMatrix (Lattice<vobj> &R,Eigen::MatrixXcd &aa,const Lattice<
|
||||
typedef typename vobj::scalar_type scalar_type;
|
||||
typedef typename vobj::vector_type vector_type;
|
||||
|
||||
int Nblock = X._grid->GlobalDimensions()[Orthog];
|
||||
int Nblock = X.Grid()->GlobalDimensions()[Orthog];
|
||||
|
||||
GridBase *FullGrid = X._grid;
|
||||
GridBase *FullGrid = X.Grid();
|
||||
// GridBase *SliceGrid = makeSubSliceGrid(FullGrid,Orthog);
|
||||
// Lattice<vobj> Xslice(SliceGrid);
|
||||
// Lattice<vobj> Rslice(SliceGrid);
|
||||
@ -135,7 +135,7 @@ static void sliceInnerProductMatrix( Eigen::MatrixXcd &mat, const Lattice<vobj>
|
||||
typedef typename vobj::scalar_type scalar_type;
|
||||
typedef typename vobj::vector_type vector_type;
|
||||
|
||||
GridBase *FullGrid = lhs._grid;
|
||||
GridBase *FullGrid = lhs.Grid();
|
||||
// GridBase *SliceGrid = makeSubSliceGrid(FullGrid,Orthog);
|
||||
|
||||
int Nblock = FullGrid->GlobalDimensions()[Orthog];
|
||||
|
@ -44,7 +44,7 @@ NAMESPACE_BEGIN(Grid);
|
||||
template<int Index,class vobj>
|
||||
auto PeekIndex(const Lattice<vobj> &lhs,int i) -> Lattice<decltype(peekIndex<Index>(lhs[0],i))>
|
||||
{
|
||||
Lattice<decltype(peekIndex<Index>(lhs[0],i))> ret(lhs._grid);
|
||||
Lattice<decltype(peekIndex<Index>(lhs[0],i))> ret(lhs.Grid());
|
||||
ret.Checkerboard()=lhs.Checkerboard();
|
||||
cpu_loop( ss, lhs, {
|
||||
ret[ss] = peekIndex<Index>(lhs[ss],i);
|
||||
@ -54,7 +54,7 @@ auto PeekIndex(const Lattice<vobj> &lhs,int i) -> Lattice<decltype(peekIndex<Ind
|
||||
template<int Index,class vobj>
|
||||
auto PeekIndex(const Lattice<vobj> &lhs,int i,int j) -> Lattice<decltype(peekIndex<Index>(lhs[0],i,j))>
|
||||
{
|
||||
Lattice<decltype(peekIndex<Index>(lhs[0],i,j))> ret(lhs._grid);
|
||||
Lattice<decltype(peekIndex<Index>(lhs[0],i,j))> ret(lhs.Grid());
|
||||
ret.Checkerboard()=lhs.Checkerboard();
|
||||
cpu_loop( ss, lhs, {
|
||||
ret[ss] = peekIndex<Index>(lhs[ss],i,j);
|
||||
@ -86,14 +86,14 @@ void PokeIndex(Lattice<vobj> &lhs,const Lattice<decltype(peekIndex<Index>(lhs[0]
|
||||
template<class vobj,class sobj>
|
||||
void pokeSite(const sobj &s,Lattice<vobj> &l,const std::vector<int> &site){
|
||||
|
||||
GridBase *grid=l._grid;
|
||||
GridBase *grid=l.Grid();
|
||||
|
||||
typedef typename vobj::scalar_type scalar_type;
|
||||
typedef typename vobj::vector_type vector_type;
|
||||
|
||||
int Nsimd = grid->Nsimd();
|
||||
|
||||
assert( l.Checkerboard()== l._grid->CheckerBoard(site));
|
||||
assert( l.Checkerboard()== l.Grid()->CheckerBoard(site));
|
||||
assert( sizeof(sobj)*Nsimd == sizeof(vobj));
|
||||
|
||||
int rank,odx,idx;
|
||||
@ -120,14 +120,14 @@ void pokeSite(const sobj &s,Lattice<vobj> &l,const std::vector<int> &site){
|
||||
template<class vobj,class sobj>
|
||||
void peekSite(sobj &s,const Lattice<vobj> &l,const std::vector<int> &site){
|
||||
|
||||
GridBase *grid=l._grid;
|
||||
GridBase *grid=l.Grid();
|
||||
|
||||
typedef typename vobj::scalar_type scalar_type;
|
||||
typedef typename vobj::vector_type vector_type;
|
||||
|
||||
int Nsimd = grid->Nsimd();
|
||||
|
||||
assert( l.Checkerboard() == l._grid->CheckerBoard(site));
|
||||
assert( l.Checkerboard() == l.Grid()->CheckerBoard(site));
|
||||
|
||||
int rank,odx,idx;
|
||||
grid->GlobalCoorToRankIndex(rank,odx,idx,site);
|
||||
@ -149,14 +149,14 @@ void peekSite(sobj &s,const Lattice<vobj> &l,const std::vector<int> &site){
|
||||
template<class vobj,class sobj>
|
||||
void peekLocalSite(sobj &s,const Lattice<vobj> &l,std::vector<int> &site){
|
||||
|
||||
GridBase *grid = l._grid;
|
||||
GridBase *grid = l.Grid();
|
||||
|
||||
typedef typename vobj::scalar_type scalar_type;
|
||||
typedef typename vobj::vector_type vector_type;
|
||||
|
||||
int Nsimd = grid->Nsimd();
|
||||
|
||||
assert( l.Checkerboard()== l._grid->CheckerBoard(site));
|
||||
assert( l.Checkerboard()== l.Grid()->CheckerBoard(site));
|
||||
assert( sizeof(sobj)*Nsimd == sizeof(vobj));
|
||||
|
||||
static const int words=sizeof(vobj)/sizeof(vector_type);
|
||||
@ -177,14 +177,14 @@ void peekLocalSite(sobj &s,const Lattice<vobj> &l,std::vector<int> &site){
|
||||
template<class vobj,class sobj>
|
||||
void pokeLocalSite(const sobj &s,Lattice<vobj> &l,std::vector<int> &site){
|
||||
|
||||
GridBase *grid=l._grid;
|
||||
GridBase *grid=l.Grid();
|
||||
|
||||
typedef typename vobj::scalar_type scalar_type;
|
||||
typedef typename vobj::vector_type vector_type;
|
||||
|
||||
int Nsimd = grid->Nsimd();
|
||||
|
||||
assert( l.Checkerboard()== l._grid->CheckerBoard(site));
|
||||
assert( l.Checkerboard()== l.Grid()->CheckerBoard(site));
|
||||
assert( sizeof(sobj)*Nsimd == sizeof(vobj));
|
||||
|
||||
static const int words=sizeof(vobj)/sizeof(vector_type);
|
||||
|
@ -39,7 +39,7 @@ Author: neo <cossu@post.kek.jp>
|
||||
NAMESPACE_BEGIN(Grid);
|
||||
|
||||
template<class vobj> inline Lattice<vobj> adj(const Lattice<vobj> &lhs){
|
||||
Lattice<vobj> ret(lhs._grid);
|
||||
Lattice<vobj> ret(lhs.Grid());
|
||||
accelerator_loop( ss, lhs, {
|
||||
ret[ss] = adj(lhs[ss]);
|
||||
});
|
||||
@ -47,7 +47,7 @@ template<class vobj> inline Lattice<vobj> adj(const Lattice<vobj> &lhs){
|
||||
};
|
||||
|
||||
template<class vobj> inline Lattice<vobj> conjugate(const Lattice<vobj> &lhs){
|
||||
Lattice<vobj> ret(lhs._grid);
|
||||
Lattice<vobj> ret(lhs.Grid());
|
||||
accelerator_loop( ss, lhs, {
|
||||
ret[ss] = conjugate(lhs[ss]);
|
||||
});
|
||||
|
@ -44,13 +44,13 @@ inline ComplexD innerProduct(const Lattice<vobj> &left,const Lattice<vobj> &righ
|
||||
typedef typename vobj::vector_typeD vector_type;
|
||||
scalar_type nrm;
|
||||
|
||||
GridBase *grid = left._grid;
|
||||
GridBase *grid = left.Grid();
|
||||
|
||||
std::vector<vector_type,alignedAllocator<vector_type> > sumarray(grid->SumArraySize());
|
||||
|
||||
parallel_for(int thr=0;thr<grid->SumArraySize();thr++){
|
||||
int mywork, myoff;
|
||||
GridThread::GetWork(left._grid->oSites(),thr,mywork,myoff);
|
||||
GridThread::GetWork(left.Grid()->oSites(),thr,mywork,myoff);
|
||||
|
||||
decltype(innerProductD(left[0],right[0])) vnrm=zero; // private to thread; sub summation
|
||||
for(int ss=myoff;ss<mywork+myoff; ss++){
|
||||
@ -64,7 +64,7 @@ inline ComplexD innerProduct(const Lattice<vobj> &left,const Lattice<vobj> &righ
|
||||
vvnrm = vvnrm+sumarray[i];
|
||||
}
|
||||
nrm = Reduce(vvnrm);// sum across simd
|
||||
right._grid->GlobalSum(nrm);
|
||||
right.Grid()->GlobalSum(nrm);
|
||||
return nrm;
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ inline auto sum(const LatticeTrinaryExpression<Op,T1,T2,T3> & expr)
|
||||
template<class vobj>
|
||||
inline typename vobj::scalar_object sum(const Lattice<vobj> &arg)
|
||||
{
|
||||
GridBase *grid=arg._grid;
|
||||
GridBase *grid=arg.Grid();
|
||||
int Nsimd = grid->Nsimd();
|
||||
|
||||
std::vector<vobj,alignedAllocator<vobj> > sumarray(grid->SumArraySize());
|
||||
@ -127,7 +127,7 @@ inline typename vobj::scalar_object sum(const Lattice<vobj> &arg)
|
||||
extract(vsum,buf);
|
||||
|
||||
for(int i=0;i<Nsimd;i++) ssum = ssum + buf[i];
|
||||
arg._grid->GlobalSum(ssum);
|
||||
arg.Grid()->GlobalSum(ssum);
|
||||
|
||||
return ssum;
|
||||
}
|
||||
@ -145,7 +145,7 @@ template<class vobj> inline void sliceSum(const Lattice<vobj> &Data,std::vector<
|
||||
// But easily avoided by using double precision fields
|
||||
///////////////////////////////////////////////////////
|
||||
typedef typename vobj::scalar_object sobj;
|
||||
GridBase *grid = Data._grid;
|
||||
GridBase *grid = Data.Grid();
|
||||
assert(grid!=NULL);
|
||||
|
||||
const int Nd = grid->_ndimension;
|
||||
@ -225,9 +225,9 @@ static void sliceInnerProductVector( std::vector<ComplexD> & result, const Latti
|
||||
{
|
||||
typedef typename vobj::vector_type vector_type;
|
||||
typedef typename vobj::scalar_type scalar_type;
|
||||
GridBase *grid = lhs._grid;
|
||||
GridBase *grid = lhs.Grid();
|
||||
assert(grid!=NULL);
|
||||
conformable(grid,rhs._grid);
|
||||
conformable(grid,rhs.Grid());
|
||||
|
||||
const int Nd = grid->_ndimension;
|
||||
const int Nsimd = grid->Nsimd();
|
||||
@ -307,7 +307,7 @@ static void sliceNorm (std::vector<RealD> &sn,const Lattice<vobj> &rhs,int Ortho
|
||||
typedef typename vobj::scalar_type scalar_type;
|
||||
typedef typename vobj::vector_type vector_type;
|
||||
|
||||
int Nblock = rhs._grid->GlobalDimensions()[Orthog];
|
||||
int Nblock = rhs.Grid()->GlobalDimensions()[Orthog];
|
||||
std::vector<ComplexD> ip(Nblock);
|
||||
sn.resize(Nblock);
|
||||
|
||||
@ -329,7 +329,7 @@ static void sliceMaddVector(Lattice<vobj> &R,std::vector<RealD> &a,const Lattice
|
||||
|
||||
scalar_type zscale(scale);
|
||||
|
||||
GridBase *grid = X._grid;
|
||||
GridBase *grid = X.Grid();
|
||||
|
||||
int Nsimd =grid->Nsimd();
|
||||
int Nblock =grid->GlobalDimensions()[orthogdim];
|
||||
|
@ -311,13 +311,13 @@ public:
|
||||
};
|
||||
|
||||
class GridParallelRNG : public GridRNGbase {
|
||||
|
||||
private:
|
||||
double _time_counter;
|
||||
|
||||
public:
|
||||
GridBase *_grid;
|
||||
unsigned int _vol;
|
||||
|
||||
public:
|
||||
GridBase *Grid(void) const { return _grid; }
|
||||
int generator_idx(int os,int is) {
|
||||
return is*_grid->oSites()+os;
|
||||
}
|
||||
@ -341,9 +341,9 @@ public:
|
||||
|
||||
double inner_time_counter = usecond();
|
||||
|
||||
int multiplicity = RNGfillable_general(_grid, l._grid); // l has finer or same grid
|
||||
int Nsimd = _grid->Nsimd(); // guaranteed to be the same for l._grid too
|
||||
int osites = _grid->oSites(); // guaranteed to be <= l._grid->oSites() by a factor multiplicity
|
||||
int multiplicity = RNGfillable_general(_grid, l.Grid()); // l has finer or same grid
|
||||
int Nsimd = _grid->Nsimd(); // guaranteed to be the same for l.Grid() too
|
||||
int osites = _grid->oSites(); // guaranteed to be <= l.Grid()->oSites() by a factor multiplicity
|
||||
int words = sizeof(scalar_object) / sizeof(scalar_type);
|
||||
|
||||
thread_loop( (int ss=0;ss<osites;ss++), {
|
||||
|
@ -41,7 +41,7 @@ template<class vobj>
|
||||
inline auto trace(const Lattice<vobj> &lhs)
|
||||
-> Lattice<decltype(trace(lhs[0]))>
|
||||
{
|
||||
Lattice<decltype(trace(lhs[0]))> ret(lhs._grid);
|
||||
Lattice<decltype(trace(lhs[0]))> ret(lhs.Grid());
|
||||
accelerator_loop( ss, lhs, {
|
||||
ret[ss] = trace(lhs[ss]);
|
||||
});
|
||||
@ -54,7 +54,7 @@ inline auto trace(const Lattice<vobj> &lhs)
|
||||
template<int Index,class vobj>
|
||||
inline auto TraceIndex(const Lattice<vobj> &lhs) -> Lattice<decltype(traceIndex<Index>(lhs[0]))>
|
||||
{
|
||||
Lattice<decltype(traceIndex<Index>(lhs[0]))> ret(lhs._grid);
|
||||
Lattice<decltype(traceIndex<Index>(lhs[0]))> ret(lhs.Grid());
|
||||
accelerator_loop( ss, lhs, {
|
||||
ret[ss] = traceIndex<Index>(lhs[ss]);
|
||||
});
|
||||
|
@ -51,29 +51,29 @@ inline void subdivides(GridBase *coarse,GridBase *fine)
|
||||
template<class vobj> inline void pickCheckerboard(int cb,Lattice<vobj> &half,const Lattice<vobj> &full){
|
||||
half.Checkerboard() = cb;
|
||||
|
||||
thread_loop( (int ss=0;ss<full._grid->oSites();ss++),{
|
||||
thread_loop( (int ss=0;ss<full.Grid()->oSites();ss++),{
|
||||
int cbos;
|
||||
std::vector<int> coor;
|
||||
full._grid->oCoorFromOindex(coor,ss);
|
||||
cbos=half._grid->CheckerBoard(coor);
|
||||
full.Grid()->oCoorFromOindex(coor,ss);
|
||||
cbos=half.Grid()->CheckerBoard(coor);
|
||||
|
||||
if (cbos==cb) {
|
||||
int ssh=half._grid->oIndex(coor);
|
||||
int ssh=half.Grid()->oIndex(coor);
|
||||
half[ssh] = full[ss];
|
||||
}
|
||||
});
|
||||
}
|
||||
template<class vobj> inline void setCheckerboard(Lattice<vobj> &full,const Lattice<vobj> &half){
|
||||
int cb = half.Checkerboard();
|
||||
thread_loop( (int ss=0;ss<full._grid->oSites();ss++), {
|
||||
thread_loop( (int ss=0;ss<full.Grid()->oSites();ss++), {
|
||||
std::vector<int> coor;
|
||||
int cbos;
|
||||
|
||||
full._grid->oCoorFromOindex(coor,ss);
|
||||
cbos=half._grid->CheckerBoard(coor);
|
||||
full.Grid()->oCoorFromOindex(coor,ss);
|
||||
cbos=half.Grid()->CheckerBoard(coor);
|
||||
|
||||
if (cbos==cb) {
|
||||
int ssh=half._grid->oIndex(coor);
|
||||
int ssh=half.Grid()->oIndex(coor);
|
||||
full[ss]=half[ssh];
|
||||
}
|
||||
});
|
||||
@ -85,8 +85,8 @@ inline void blockProject(Lattice<iVector<CComplex,nbasis > > &coarseData,
|
||||
const Lattice<vobj> &fineData,
|
||||
const std::vector<Lattice<vobj> > &Basis)
|
||||
{
|
||||
GridBase * fine = fineData._grid;
|
||||
GridBase * coarse= coarseData._grid;
|
||||
GridBase * fine = fineData.Grid();
|
||||
GridBase * coarse= coarseData.Grid();
|
||||
int _ndimension = coarse->_ndimension;
|
||||
|
||||
// checks
|
||||
@ -132,8 +132,8 @@ inline void blockZAXPY(Lattice<vobj> &fineZ,
|
||||
const Lattice<vobj> &fineX,
|
||||
const Lattice<vobj> &fineY)
|
||||
{
|
||||
GridBase * fine = fineZ._grid;
|
||||
GridBase * coarse= coarseA._grid;
|
||||
GridBase * fine = fineZ.Grid();
|
||||
GridBase * coarse= coarseA.Grid();
|
||||
|
||||
fineZ.Checkerboard()=fineX.Checkerboard();
|
||||
assert(fineX.Checkerboard()==fineY.Checkerboard());
|
||||
@ -175,8 +175,8 @@ inline void blockInnerProduct(Lattice<CComplex> &CoarseInner,
|
||||
{
|
||||
typedef decltype(innerProduct(fineX[0],fineY[0])) dotp;
|
||||
|
||||
GridBase *coarse(CoarseInner._grid);
|
||||
GridBase *fine (fineX._grid);
|
||||
GridBase *coarse(CoarseInner.Grid());
|
||||
GridBase *fine (fineX.Grid());
|
||||
|
||||
Lattice<dotp> fine_inner(fine); fine_inner.Checkerboard() = fineX.Checkerboard();
|
||||
Lattice<dotp> coarse_inner(coarse);
|
||||
@ -191,8 +191,8 @@ inline void blockInnerProduct(Lattice<CComplex> &CoarseInner,
|
||||
template<class vobj,class CComplex>
|
||||
inline void blockNormalise(Lattice<CComplex> &ip,Lattice<vobj> &fineX)
|
||||
{
|
||||
GridBase *coarse = ip._grid;
|
||||
Lattice<vobj> zz(fineX._grid); zz=zero; zz.Checkerboard()=fineX.Checkerboard();
|
||||
GridBase *coarse = ip.Grid();
|
||||
Lattice<vobj> zz(fineX.Grid()); zz=zero; zz.Checkerboard()=fineX.Checkerboard();
|
||||
blockInnerProduct(ip,fineX,fineX);
|
||||
ip = pow(ip,-0.5);
|
||||
blockZAXPY(fineX,ip,fineX,zz);
|
||||
@ -202,8 +202,8 @@ inline void blockNormalise(Lattice<CComplex> &ip,Lattice<vobj> &fineX)
|
||||
template<class vobj>
|
||||
inline void blockSum(Lattice<vobj> &coarseData,const Lattice<vobj> &fineData)
|
||||
{
|
||||
GridBase * fine = fineData._grid;
|
||||
GridBase * coarse= coarseData._grid;
|
||||
GridBase * fine = fineData.Grid();
|
||||
GridBase * coarse= coarseData.Grid();
|
||||
|
||||
subdivides(coarse,fine); // require they map
|
||||
|
||||
@ -242,7 +242,7 @@ inline void blockSum(Lattice<vobj> &coarseData,const Lattice<vobj> &fineData)
|
||||
template<class vobj>
|
||||
inline void blockPick(GridBase *coarse,const Lattice<vobj> &unpicked,Lattice<vobj> &picked,std::vector<int> coor)
|
||||
{
|
||||
GridBase * fine = unpicked._grid;
|
||||
GridBase * fine = unpicked.Grid();
|
||||
|
||||
Lattice<vobj> zz(fine); zz.Checkerboard() = unpicked.Checkerboard();
|
||||
Lattice<iScalar<vInteger> > fcoor(fine);
|
||||
@ -263,15 +263,15 @@ inline void blockPick(GridBase *coarse,const Lattice<vobj> &unpicked,Lattice<vob
|
||||
template<class vobj,class CComplex>
|
||||
inline void blockOrthogonalise(Lattice<CComplex> &ip,std::vector<Lattice<vobj> > &Basis)
|
||||
{
|
||||
GridBase *coarse = ip._grid;
|
||||
GridBase *fine = Basis[0]._grid;
|
||||
GridBase *coarse = ip.Grid();
|
||||
GridBase *fine = Basis[0].Grid();
|
||||
|
||||
int nbasis = Basis.size() ;
|
||||
|
||||
// checks
|
||||
subdivides(coarse,fine);
|
||||
for(int i=0;i<nbasis;i++){
|
||||
conformable(Basis[i]._grid,fine);
|
||||
conformable(Basis[i].Grid(),fine);
|
||||
}
|
||||
|
||||
for(int v=0;v<nbasis;v++) {
|
||||
@ -290,15 +290,15 @@ inline void blockPromote(const Lattice<iVector<CComplex,nbasis > > &coarseData,
|
||||
Lattice<vobj> &fineData,
|
||||
const std::vector<Lattice<vobj> > &Basis)
|
||||
{
|
||||
GridBase * fine = fineData._grid;
|
||||
GridBase * coarse= coarseData._grid;
|
||||
GridBase * fine = fineData.Grid();
|
||||
GridBase * coarse= coarseData.Grid();
|
||||
int _ndimension = coarse->_ndimension;
|
||||
|
||||
// checks
|
||||
assert( nbasis == Basis.size() );
|
||||
subdivides(coarse,fine);
|
||||
for(int i=0;i<nbasis;i++){
|
||||
conformable(Basis[i]._grid,fine);
|
||||
conformable(Basis[i].Grid(),fine);
|
||||
}
|
||||
|
||||
std::vector<int> block_r (_ndimension);
|
||||
@ -337,8 +337,8 @@ void localConvert(const Lattice<vobj> &in,Lattice<vvobj> &out)
|
||||
typedef typename vobj::scalar_object sobj;
|
||||
typedef typename vvobj::scalar_object ssobj;
|
||||
|
||||
GridBase *ig = in._grid;
|
||||
GridBase *og = out._grid;
|
||||
GridBase *ig = in.Grid();
|
||||
GridBase *og = out.Grid();
|
||||
|
||||
int ni = ig->_ndimension;
|
||||
int no = og->_ndimension;
|
||||
@ -369,8 +369,8 @@ void InsertSlice(const Lattice<vobj> &lowDim,Lattice<vobj> & higherDim,int slice
|
||||
{
|
||||
typedef typename vobj::scalar_object sobj;
|
||||
|
||||
GridBase *lg = lowDim._grid;
|
||||
GridBase *hg = higherDim._grid;
|
||||
GridBase *lg = lowDim.Grid();
|
||||
GridBase *hg = higherDim.Grid();
|
||||
int nl = lg->_ndimension;
|
||||
int nh = hg->_ndimension;
|
||||
|
||||
@ -411,8 +411,8 @@ void ExtractSlice(Lattice<vobj> &lowDim,const Lattice<vobj> & higherDim,int slic
|
||||
{
|
||||
typedef typename vobj::scalar_object sobj;
|
||||
|
||||
GridBase *lg = lowDim._grid;
|
||||
GridBase *hg = higherDim._grid;
|
||||
GridBase *lg = lowDim.Grid();
|
||||
GridBase *hg = higherDim.Grid();
|
||||
int nl = lg->_ndimension;
|
||||
int nh = hg->_ndimension;
|
||||
|
||||
@ -454,8 +454,8 @@ void InsertSliceLocal(const Lattice<vobj> &lowDim, Lattice<vobj> & higherDim,int
|
||||
{
|
||||
typedef typename vobj::scalar_object sobj;
|
||||
|
||||
GridBase *lg = lowDim._grid;
|
||||
GridBase *hg = higherDim._grid;
|
||||
GridBase *lg = lowDim.Grid();
|
||||
GridBase *hg = higherDim.Grid();
|
||||
int nl = lg->_ndimension;
|
||||
int nh = hg->_ndimension;
|
||||
|
||||
@ -489,8 +489,8 @@ void ExtractSliceLocal(Lattice<vobj> &lowDim, Lattice<vobj> & higherDim,int slic
|
||||
{
|
||||
typedef typename vobj::scalar_object sobj;
|
||||
|
||||
GridBase *lg = lowDim._grid;
|
||||
GridBase *hg = higherDim._grid;
|
||||
GridBase *lg = lowDim.Grid();
|
||||
GridBase *hg = higherDim.Grid();
|
||||
int nl = lg->_ndimension;
|
||||
int nh = hg->_ndimension;
|
||||
|
||||
@ -524,8 +524,8 @@ void Replicate(Lattice<vobj> &coarse,Lattice<vobj> & fine)
|
||||
{
|
||||
typedef typename vobj::scalar_object sobj;
|
||||
|
||||
GridBase *cg = coarse._grid;
|
||||
GridBase *fg = fine._grid;
|
||||
GridBase *cg = coarse.Grid();
|
||||
GridBase *fg = fine.Grid();
|
||||
|
||||
int nd = cg->_ndimension;
|
||||
|
||||
@ -563,7 +563,7 @@ unvectorizeToLexOrdArray(std::vector<sobj> &out, const Lattice<vobj> &in)
|
||||
|
||||
typedef typename vobj::vector_type vtype;
|
||||
|
||||
GridBase* in_grid = in._grid;
|
||||
GridBase* in_grid = in.Grid();
|
||||
out.resize(in_grid->lSites());
|
||||
|
||||
int ndim = in_grid->Nd();
|
||||
@ -609,7 +609,7 @@ vectorizeFromLexOrdArray( std::vector<sobj> &in, Lattice<vobj> &out)
|
||||
|
||||
typedef typename vobj::vector_type vtype;
|
||||
|
||||
GridBase* grid = out._grid;
|
||||
GridBase* grid = out.Grid();
|
||||
assert(in.size()==grid->lSites());
|
||||
|
||||
int ndim = grid->Nd();
|
||||
@ -653,15 +653,15 @@ vectorizeFromLexOrdArray( std::vector<sobj> &in, Lattice<vobj> &out)
|
||||
template<class VobjOut, class VobjIn>
|
||||
void precisionChange(Lattice<VobjOut> &out, const Lattice<VobjIn> &in){
|
||||
|
||||
assert(out._grid->Nd() == in._grid->Nd());
|
||||
assert(out.Grid()->Nd() == in.Grid()->Nd());
|
||||
out.Checkerboard() = in.Checkerboard();
|
||||
GridBase *in_grid=in._grid;
|
||||
GridBase *out_grid = out._grid;
|
||||
GridBase *in_grid=in.Grid();
|
||||
GridBase *out_grid = out.Grid();
|
||||
|
||||
typedef typename VobjOut::scalar_object SobjOut;
|
||||
typedef typename VobjIn::scalar_object SobjIn;
|
||||
|
||||
int ndim = out._grid->Nd();
|
||||
int ndim = out.Grid()->Nd();
|
||||
int out_nsimd = out_grid->Nsimd();
|
||||
|
||||
std::vector<std::vector<int> > out_icoor(out_nsimd);
|
||||
@ -749,8 +749,8 @@ void Grid_split(std::vector<Lattice<Vobj> > & full,Lattice<Vobj> & split)
|
||||
|
||||
assert(full_vecs>=1);
|
||||
|
||||
GridBase * full_grid = full[0]._grid;
|
||||
GridBase *split_grid = split._grid;
|
||||
GridBase * full_grid = full[0].Grid();
|
||||
GridBase *split_grid = split.Grid();
|
||||
|
||||
int ndim = full_grid->_ndimension;
|
||||
int full_nproc = full_grid->_Nprocessors;
|
||||
@ -769,8 +769,8 @@ void Grid_split(std::vector<Lattice<Vobj> > & full,Lattice<Vobj> & split)
|
||||
for(int n=0;n<full_vecs;n++){
|
||||
assert(full[n].Checkerboard() == cb);
|
||||
for(int d=0;d<ndim;d++){
|
||||
assert(full[n]._grid->_gdimensions[d]==split._grid->_gdimensions[d]);
|
||||
assert(full[n]._grid->_fdimensions[d]==split._grid->_fdimensions[d]);
|
||||
assert(full[n].Grid()->_gdimensions[d]==split.Grid()->_gdimensions[d]);
|
||||
assert(full[n].Grid()->_fdimensions[d]==split.Grid()->_fdimensions[d]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -858,8 +858,8 @@ void Grid_split(std::vector<Lattice<Vobj> > & full,Lattice<Vobj> & split)
|
||||
template<class Vobj>
|
||||
void Grid_split(Lattice<Vobj> &full,Lattice<Vobj> & split)
|
||||
{
|
||||
int nvector = full._grid->_Nprocessors / split._grid->_Nprocessors;
|
||||
std::vector<Lattice<Vobj> > full_v(nvector,full._grid);
|
||||
int nvector = full.Grid()->_Nprocessors / split.Grid()->_Nprocessors;
|
||||
std::vector<Lattice<Vobj> > full_v(nvector,full.Grid());
|
||||
for(int n=0;n<nvector;n++){
|
||||
full_v[n] = full;
|
||||
}
|
||||
@ -875,8 +875,8 @@ void Grid_unsplit(std::vector<Lattice<Vobj> > & full,Lattice<Vobj> & split)
|
||||
|
||||
assert(full_vecs>=1);
|
||||
|
||||
GridBase * full_grid = full[0]._grid;
|
||||
GridBase *split_grid = split._grid;
|
||||
GridBase * full_grid = full[0].Grid();
|
||||
GridBase *split_grid = split.Grid();
|
||||
|
||||
int ndim = full_grid->_ndimension;
|
||||
int full_nproc = full_grid->_Nprocessors;
|
||||
@ -895,8 +895,8 @@ void Grid_unsplit(std::vector<Lattice<Vobj> > & full,Lattice<Vobj> & split)
|
||||
for(int n=0;n<full_vecs;n++){
|
||||
assert(full[n].Checkerboard() == cb);
|
||||
for(int d=0;d<ndim;d++){
|
||||
assert(full[n]._grid->_gdimensions[d]==split._grid->_gdimensions[d]);
|
||||
assert(full[n]._grid->_fdimensions[d]==split._grid->_fdimensions[d]);
|
||||
assert(full[n].Grid()->_gdimensions[d]==split.Grid()->_gdimensions[d]);
|
||||
assert(full[n].Grid()->_fdimensions[d]==split.Grid()->_fdimensions[d]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ NAMESPACE_BEGIN(Grid);
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
template<class vobj>
|
||||
inline Lattice<vobj> transpose(const Lattice<vobj> &lhs){
|
||||
Lattice<vobj> ret(lhs._grid);
|
||||
Lattice<vobj> ret(lhs.Grid());
|
||||
accelerator_loop(ss,lhs,{
|
||||
ret[ss] = transpose(lhs[ss]);
|
||||
});
|
||||
@ -53,7 +53,7 @@ inline Lattice<vobj> transpose(const Lattice<vobj> &lhs){
|
||||
template<int Index,class vobj>
|
||||
inline auto TransposeIndex(const Lattice<vobj> &lhs) -> Lattice<decltype(transposeIndex<Index>(lhs[0]))>
|
||||
{
|
||||
Lattice<decltype(transposeIndex<Index>(lhs[0]))> ret(lhs._grid);
|
||||
Lattice<decltype(transposeIndex<Index>(lhs[0]))> ret(lhs.Grid());
|
||||
accelerator_loop(ss,lhs,{
|
||||
ret[ss] = transposeIndex<Index>(lhs[ss]);
|
||||
});
|
||||
|
@ -34,7 +34,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
|
||||
NAMESPACE_BEGIN(Grid);
|
||||
|
||||
template<class obj> Lattice<obj> pow(const Lattice<obj> &rhs,RealD y){
|
||||
Lattice<obj> ret(rhs._grid);
|
||||
Lattice<obj> ret(rhs.Grid());
|
||||
ret.Checkerboard() = rhs.Checkerboard();
|
||||
conformable(ret,rhs);
|
||||
accelerator_loop(ss,rhs,{
|
||||
@ -43,7 +43,7 @@ template<class obj> Lattice<obj> pow(const Lattice<obj> &rhs,RealD y){
|
||||
return ret;
|
||||
}
|
||||
template<class obj> Lattice<obj> mod(const Lattice<obj> &rhs,Integer y){
|
||||
Lattice<obj> ret(rhs._grid);
|
||||
Lattice<obj> ret(rhs.Grid());
|
||||
ret.Checkerboard() = rhs.Checkerboard();
|
||||
conformable(ret,rhs);
|
||||
accelerator_loop(ss,rhs,{
|
||||
@ -53,7 +53,7 @@ template<class obj> Lattice<obj> mod(const Lattice<obj> &rhs,Integer y){
|
||||
}
|
||||
|
||||
template<class obj> Lattice<obj> div(const Lattice<obj> &rhs,Integer y){
|
||||
Lattice<obj> ret(rhs._grid);
|
||||
Lattice<obj> ret(rhs.Grid());
|
||||
ret.Checkerboard() = rhs.Checkerboard();
|
||||
conformable(ret,rhs);
|
||||
accelerator_loop(ss,rhs,{
|
||||
@ -63,7 +63,7 @@ template<class obj> Lattice<obj> div(const Lattice<obj> &rhs,Integer y){
|
||||
}
|
||||
|
||||
template<class obj> Lattice<obj> expMat(const Lattice<obj> &rhs, RealD alpha, Integer Nexp = DEFAULT_MAT_EXP){
|
||||
Lattice<obj> ret(rhs._grid);
|
||||
Lattice<obj> ret(rhs.Grid());
|
||||
ret.Checkerboard() = rhs.Checkerboard();
|
||||
conformable(ret,rhs);
|
||||
accelerator_loop(ss,rhs,{
|
||||
|
@ -45,7 +45,7 @@ inline void whereWolf(Lattice<vobj> &ret,const Lattice<iobj> &predicate,Lattice<
|
||||
conformable(iftrue,predicate);
|
||||
conformable(iftrue,ret);
|
||||
|
||||
GridBase *grid=iftrue._grid;
|
||||
GridBase *grid=iftrue.Grid();
|
||||
|
||||
typedef typename vobj::scalar_object scalar_object;
|
||||
typedef typename vobj::scalar_type scalar_type;
|
||||
@ -79,7 +79,7 @@ inline Lattice<vobj> whereWolf(const Lattice<iobj> &predicate,Lattice<vobj> &ift
|
||||
conformable(iftrue,iffalse);
|
||||
conformable(iftrue,predicate);
|
||||
|
||||
Lattice<vobj> ret(iftrue._grid);
|
||||
Lattice<vobj> ret(iftrue.Grid());
|
||||
|
||||
where(ret,predicate,iftrue,iffalse);
|
||||
|
||||
|
Reference in New Issue
Block a user