1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Hadrons: diluted noise polish

This commit is contained in:
Antonin Portelli 2018-08-05 01:44:37 +01:00
parent 830168ec37
commit 2962123cba
2 changed files with 34 additions and 25 deletions

View File

@ -19,14 +19,15 @@ public:
DilutedNoise(GridCartesian *g, const unsigned int nNoise);
virtual ~DilutedNoise(void) = default;
// access
const FermionField & operator[](const unsigned int i) const;
FermionField & operator[](const unsigned int i);
void resize(const unsigned int nNoise);
unsigned int size(void) const;
unsigned int getNNoise(void) const;
GridCartesian *getGrid(void) const;
std::vector<FermionField> & getNoise(void);
const std::vector<FermionField> & getNoise(void) const;
const FermionField & operator[](const unsigned int i) const;
FermionField & operator[](const unsigned int i);
void resize(const unsigned int nNoise);
unsigned int size(void) const;
GridCartesian *getGrid(void) const;
// generate noise (pure virtual)
virtual void generateNoise(GridParallelRNG &rng) = 0;
virtual void generateNoise(GridParallelRNG &rng) = 0;
private:
std::vector<FermionField> noise_;
GridCartesian *grid_;
@ -65,28 +66,17 @@ DilutedNoise<FImpl>::DilutedNoise(GridCartesian *g,
}
template <typename FImpl>
void DilutedNoise<FImpl>::resize(const unsigned int nNoise)
std::vector<typename DilutedNoise<FImpl>::FermionField> & DilutedNoise<FImpl>::
getNoise(void)
{
nNoise_ = nNoise;
noise_.resize(nNoise, grid_);
return noise_;
}
template <typename FImpl>
unsigned int DilutedNoise<FImpl>::size(void) const
{
return noise_.size();
}
template <typename FImpl>
unsigned int DilutedNoise<FImpl>::getNNoise(void) const
const std::vector<typename DilutedNoise<FImpl>::FermionField> & DilutedNoise<FImpl>::
getNoise(void) const
{
return nNoise_;
}
template <typename FImpl>
GridCartesian * DilutedNoise<FImpl>::getGrid(void) const
{
return grid_;
return noise_;
}
template <typename FImpl>
@ -103,6 +93,25 @@ DilutedNoise<FImpl>::operator[](const unsigned int i)
return noise_[i];
}
template <typename FImpl>
void DilutedNoise<FImpl>::resize(const unsigned int nNoise)
{
nNoise_ = nNoise;
noise_.resize(nNoise, grid_);
}
template <typename FImpl>
unsigned int DilutedNoise<FImpl>::size(void) const
{
return noise_.size();
}
template <typename FImpl>
GridCartesian * DilutedNoise<FImpl>::getGrid(void) const
{
return grid_;
}
/******************************************************************************
* TimeDilutedSpinColorDiagonalNoise template implementation *
******************************************************************************/

View File

@ -33,7 +33,7 @@ public:
MODULE_REGISTER_TMP(TimeDilutedSpinColorDiagonal, TTimeDilutedSpinColorDiagonal<FIMPL>, MNoise);
/******************************************************************************
* TTimeDilutedSpinColorDiagonal implementation *
* TTimeDilutedSpinColorDiagonal implementation *
******************************************************************************/
// constructor /////////////////////////////////////////////////////////////////
template <typename FImpl>