From b6fe03eb26a8725d4f52d3215104ea9743c071b0 Mon Sep 17 00:00:00 2001 From: Vera Guelpers Date: Fri, 2 Feb 2018 15:29:38 +0000 Subject: [PATCH] BugFix: Now the stochatic EM potential weight is generated when calling for the first time --- extras/Hadrons/Modules/MGauge/StochEm.cc | 6 ++++-- extras/Hadrons/Modules/MGauge/StochEm.hpp | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/extras/Hadrons/Modules/MGauge/StochEm.cc b/extras/Hadrons/Modules/MGauge/StochEm.cc index 21b7f626..cfbd28ef 100644 --- a/extras/Hadrons/Modules/MGauge/StochEm.cc +++ b/extras/Hadrons/Modules/MGauge/StochEm.cc @@ -57,9 +57,11 @@ std::vector TStochEm::getOutput(void) // setup /////////////////////////////////////////////////////////////////////// void TStochEm::setup(void) { + create_weight = false; if (!env().hasCreatedObject("_" + getName() + "_weight")) { envCacheLat(EmComp, "_" + getName() + "_weight"); + create_weight = true; } envCreateLat(EmField, getName()); } @@ -67,13 +69,13 @@ void TStochEm::setup(void) // execution /////////////////////////////////////////////////////////////////// void TStochEm::execute(void) { - LOG(Message) << "Generating stochatic EM potential..." << std::endl; + LOG(Message) << "Generating stochastic EM potential..." << std::endl; PhotonR photon(par().gauge, par().zmScheme); auto &a = envGet(EmField, getName()); auto &w = envGet(EmComp, "_" + getName() + "_weight"); - if (!env().hasCreatedObject("_" + getName() + "_weight")) + if (create_weight) { LOG(Message) << "Caching stochatic EM potential weight (gauge: " << par().gauge << ", zero-mode scheme: " diff --git a/extras/Hadrons/Modules/MGauge/StochEm.hpp b/extras/Hadrons/Modules/MGauge/StochEm.hpp index 87b70880..05162443 100644 --- a/extras/Hadrons/Modules/MGauge/StochEm.hpp +++ b/extras/Hadrons/Modules/MGauge/StochEm.hpp @@ -60,6 +60,8 @@ public: // dependency relation virtual std::vector getInput(void); virtual std::vector getOutput(void); +private: + bool create_weight; protected: // setup virtual void setup(void);