mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-28 06:35:55 +01:00
Namespace indent
This commit is contained in:
parent
c19ccdad7c
commit
7e00f643f8
@ -1,4 +1,4 @@
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
@ -24,8 +24,8 @@
|
|||||||
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_RNG_H
|
#ifndef GRID_LATTICE_RNG_H
|
||||||
#define GRID_LATTICE_RNG_H
|
#define GRID_LATTICE_RNG_H
|
||||||
|
|
||||||
@ -41,13 +41,13 @@
|
|||||||
#undef RNG_FAST_DISCARD
|
#undef RNG_FAST_DISCARD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Grid {
|
NAMESPACE_BEGIN(Grid);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
// Allow the RNG state to be less dense than the fine grid
|
// Allow the RNG state to be less dense than the fine grid
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
inline int RNGfillable(GridBase *coarse,GridBase *fine)
|
inline int RNGfillable(GridBase *coarse,GridBase *fine)
|
||||||
{
|
{
|
||||||
|
|
||||||
int rngdims = coarse->_ndimension;
|
int rngdims = coarse->_ndimension;
|
||||||
|
|
||||||
@ -73,13 +73,13 @@ namespace Grid {
|
|||||||
multiplicity = multiplicity *fine->_rdimensions[fd] / coarse->_rdimensions[d];
|
multiplicity = multiplicity *fine->_rdimensions[fd] / coarse->_rdimensions[d];
|
||||||
}
|
}
|
||||||
return multiplicity;
|
return multiplicity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// merge of April 11 2017
|
// merge of April 11 2017
|
||||||
// this function is necessary for the LS vectorised field
|
// this function is necessary for the LS vectorised field
|
||||||
inline int RNGfillable_general(GridBase *coarse,GridBase *fine)
|
inline int RNGfillable_general(GridBase *coarse,GridBase *fine)
|
||||||
{
|
{
|
||||||
int rngdims = coarse->_ndimension;
|
int rngdims = coarse->_ndimension;
|
||||||
|
|
||||||
// trivially extended in higher dims, with locality guaranteeing RNG state is local to node
|
// trivially extended in higher dims, with locality guaranteeing RNG state is local to node
|
||||||
@ -97,27 +97,27 @@ namespace Grid {
|
|||||||
assert( (fine->lSites() / coarse->lSites() ) * coarse->lSites() == fine->lSites() );
|
assert( (fine->lSites() / coarse->lSites() ) * coarse->lSites() == fine->lSites() );
|
||||||
|
|
||||||
return fine->lSites() / coarse->lSites();
|
return fine->lSites() / coarse->lSites();
|
||||||
}
|
}
|
||||||
|
|
||||||
// real scalars are one component
|
// real scalars are one component
|
||||||
template<class scalar,class distribution,class generator>
|
template<class scalar,class distribution,class generator>
|
||||||
void fillScalar(scalar &s,distribution &dist,generator & gen)
|
void fillScalar(scalar &s,distribution &dist,generator & gen)
|
||||||
{
|
{
|
||||||
s=dist(gen);
|
s=dist(gen);
|
||||||
}
|
}
|
||||||
template<class distribution,class generator>
|
template<class distribution,class generator>
|
||||||
void fillScalar(ComplexF &s,distribution &dist, generator &gen)
|
void fillScalar(ComplexF &s,distribution &dist, generator &gen)
|
||||||
{
|
{
|
||||||
s=ComplexF(dist(gen),dist(gen));
|
s=ComplexF(dist(gen),dist(gen));
|
||||||
}
|
}
|
||||||
template<class distribution,class generator>
|
template<class distribution,class generator>
|
||||||
void fillScalar(ComplexD &s,distribution &dist,generator &gen)
|
void fillScalar(ComplexD &s,distribution &dist,generator &gen)
|
||||||
{
|
{
|
||||||
s=ComplexD(dist(gen),dist(gen));
|
s=ComplexD(dist(gen),dist(gen));
|
||||||
}
|
}
|
||||||
|
|
||||||
class GridRNGbase {
|
class GridRNGbase {
|
||||||
public:
|
public:
|
||||||
// One generator per site.
|
// One generator per site.
|
||||||
// Uniform and Gaussian distributions from these generators.
|
// Uniform and Gaussian distributions from these generators.
|
||||||
#ifdef RNG_RANLUX
|
#ifdef RNG_RANLUX
|
||||||
@ -219,10 +219,10 @@ namespace Grid {
|
|||||||
{
|
{
|
||||||
_generators[gen] = RngEngine(src);
|
_generators[gen] = RngEngine(src);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class GridSerialRNG : public GridRNGbase {
|
class GridSerialRNG : public GridRNGbase {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
GridSerialRNG() : GridRNGbase() {
|
GridSerialRNG() : GridRNGbase() {
|
||||||
_generators.resize(1);
|
_generators.resize(1);
|
||||||
@ -308,13 +308,13 @@ namespace Grid {
|
|||||||
std::seed_seq src(seeds.begin(),seeds.end());
|
std::seed_seq src(seeds.begin(),seeds.end());
|
||||||
Seed(src,0);
|
Seed(src,0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class GridParallelRNG : public GridRNGbase {
|
class GridParallelRNG : public GridRNGbase {
|
||||||
|
|
||||||
double _time_counter;
|
double _time_counter;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GridBase *_grid;
|
GridBase *_grid;
|
||||||
unsigned int _vol;
|
unsigned int _vol;
|
||||||
|
|
||||||
@ -472,15 +472,15 @@ namespace Grid {
|
|||||||
return the_number;
|
return the_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class vobj> inline void random(GridParallelRNG &rng,Lattice<vobj> &l) { rng.fill(l,rng._uniform); }
|
template <class vobj> inline void random(GridParallelRNG &rng,Lattice<vobj> &l) { rng.fill(l,rng._uniform); }
|
||||||
template <class vobj> inline void gaussian(GridParallelRNG &rng,Lattice<vobj> &l) { rng.fill(l,rng._gaussian); }
|
template <class vobj> inline void gaussian(GridParallelRNG &rng,Lattice<vobj> &l) { rng.fill(l,rng._gaussian); }
|
||||||
template <class vobj> inline void bernoulli(GridParallelRNG &rng,Lattice<vobj> &l){ rng.fill(l,rng._bernoulli);}
|
template <class vobj> inline void bernoulli(GridParallelRNG &rng,Lattice<vobj> &l){ rng.fill(l,rng._bernoulli);}
|
||||||
|
|
||||||
template <class sobj> inline void random(GridSerialRNG &rng,sobj &l) { rng.fill(l,rng._uniform ); }
|
template <class sobj> inline void random(GridSerialRNG &rng,sobj &l) { rng.fill(l,rng._uniform ); }
|
||||||
template <class sobj> inline void gaussian(GridSerialRNG &rng,sobj &l) { rng.fill(l,rng._gaussian ); }
|
template <class sobj> inline void gaussian(GridSerialRNG &rng,sobj &l) { rng.fill(l,rng._gaussian ); }
|
||||||
template <class sobj> inline void bernoulli(GridSerialRNG &rng,sobj &l){ rng.fill(l,rng._bernoulli); }
|
template <class sobj> inline void bernoulli(GridSerialRNG &rng,sobj &l){ rng.fill(l,rng._bernoulli); }
|
||||||
|
|
||||||
}
|
NAMESPACE_END(Grid);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user