mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-13 01:05:36 +00:00
Hadrons: improvement on PR #176
This commit is contained in:
parent
62173395b8
commit
febe41cc1d
@ -56,7 +56,6 @@ public:
|
|||||||
GridCartesian *getGrid(void) const;
|
GridCartesian *getGrid(void) const;
|
||||||
// generate noise (pure virtual)
|
// generate noise (pure virtual)
|
||||||
virtual void generateNoise(GridParallelRNG &rng) = 0;
|
virtual void generateNoise(GridParallelRNG &rng) = 0;
|
||||||
virtual void generateNoise(GridParallelRNG &rng, unsigned int n_src) = 0;
|
|
||||||
private:
|
private:
|
||||||
std::vector<FermionField> noise_;
|
std::vector<FermionField> noise_;
|
||||||
GridCartesian *grid_;
|
GridCartesian *grid_;
|
||||||
@ -74,7 +73,6 @@ public:
|
|||||||
virtual ~TimeDilutedSpinColorDiagonalNoise(void) = default;
|
virtual ~TimeDilutedSpinColorDiagonalNoise(void) = default;
|
||||||
// generate noise
|
// generate noise
|
||||||
virtual void generateNoise(GridParallelRNG &rng);
|
virtual void generateNoise(GridParallelRNG &rng);
|
||||||
virtual void generateNoise(GridParallelRNG &rng, unsigned int n_src);
|
|
||||||
private:
|
private:
|
||||||
unsigned int nt_;
|
unsigned int nt_;
|
||||||
};
|
};
|
||||||
@ -90,9 +88,8 @@ public:
|
|||||||
virtual ~FullVolumeSpinColorDiagonalNoise(void) = default;
|
virtual ~FullVolumeSpinColorDiagonalNoise(void) = default;
|
||||||
// generate noise
|
// generate noise
|
||||||
virtual void generateNoise(GridParallelRNG &rng);
|
virtual void generateNoise(GridParallelRNG &rng);
|
||||||
virtual void generateNoise(GridParallelRNG &rng, unsigned int n_src);
|
private:
|
||||||
public:
|
unsigned int nSrc_;
|
||||||
unsigned int n_src;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -206,31 +203,17 @@ void TimeDilutedSpinColorDiagonalNoise<FImpl>::generateNoise(GridParallelRNG &rn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename FImpl>
|
|
||||||
void TimeDilutedSpinColorDiagonalNoise<FImpl>::generateNoise(GridParallelRNG &rng, unsigned int n_src)
|
|
||||||
{
|
|
||||||
assert(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* FullVolumeSpinColorDiagonalNoise template implementation *
|
* FullVolumeSpinColorDiagonalNoise template implementation *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
template <typename FImpl>
|
template <typename FImpl>
|
||||||
FullVolumeSpinColorDiagonalNoise<FImpl>::
|
FullVolumeSpinColorDiagonalNoise<FImpl>::
|
||||||
FullVolumeSpinColorDiagonalNoise(GridCartesian *g, unsigned int n_src)
|
FullVolumeSpinColorDiagonalNoise(GridCartesian *g, unsigned int nSrc)
|
||||||
: DilutedNoise<FImpl>(g)
|
: DilutedNoise<FImpl>(g, nSrc*Ns*FImpl::Dimension), nSrc_(nSrc)
|
||||||
{
|
{}
|
||||||
this->resize(n_src*Ns*FImpl::Dimension);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename FImpl>
|
template <typename FImpl>
|
||||||
void FullVolumeSpinColorDiagonalNoise<FImpl>::generateNoise(GridParallelRNG &rng)
|
void FullVolumeSpinColorDiagonalNoise<FImpl>::generateNoise(GridParallelRNG &rng)
|
||||||
{
|
|
||||||
assert(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename FImpl>
|
|
||||||
void FullVolumeSpinColorDiagonalNoise<FImpl>::generateNoise(GridParallelRNG &rng,unsigned int n_src)
|
|
||||||
{
|
{
|
||||||
typedef decltype(peekColour((*this)[0], 0)) SpinField;
|
typedef decltype(peekColour((*this)[0], 0)) SpinField;
|
||||||
|
|
||||||
@ -245,7 +228,7 @@ void FullVolumeSpinColorDiagonalNoise<FImpl>::generateNoise(GridParallelRNG &rng
|
|||||||
|
|
||||||
bernoulli(rng, eta);
|
bernoulli(rng, eta);
|
||||||
eta = (2.*eta - shift)*(1./::sqrt(2.));
|
eta = (2.*eta - shift)*(1./::sqrt(2.));
|
||||||
for (unsigned int n = 0; n < n_src; ++n)
|
for (unsigned int n = 0; n < nSrc_; ++n)
|
||||||
{
|
{
|
||||||
for (unsigned int s = 0; s < Ns; ++s)
|
for (unsigned int s = 0; s < Ns; ++s)
|
||||||
{
|
{
|
||||||
|
@ -111,7 +111,7 @@ void TFullVolumeSpinColorDiagonal<FImpl>::execute(void)
|
|||||||
{
|
{
|
||||||
auto &noise = envGet(DilutedNoise<FImpl>, getName());
|
auto &noise = envGet(DilutedNoise<FImpl>, getName());
|
||||||
LOG(Message) << "Generating full volume, spin-color diagonal noise" << std::endl;
|
LOG(Message) << "Generating full volume, spin-color diagonal noise" << std::endl;
|
||||||
noise.generateNoise(rng4d(),par().nsrc);
|
noise.generateNoise(rng4d());
|
||||||
}
|
}
|
||||||
|
|
||||||
END_MODULE_NAMESPACE
|
END_MODULE_NAMESPACE
|
||||||
|
Loading…
Reference in New Issue
Block a user