From e3164d4c7b86dd997bd178ead6604010deca5cc9 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Mon, 28 May 2018 11:39:17 +0200 Subject: [PATCH] Hadrons: env function to get volume in double --- extras/Hadrons/Environment.cc | 11 +++++------ extras/Hadrons/Environment.hpp | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/extras/Hadrons/Environment.cc b/extras/Hadrons/Environment.cc index 990a717e..bb12a036 100644 --- a/extras/Hadrons/Environment.cc +++ b/extras/Hadrons/Environment.cc @@ -49,11 +49,10 @@ Environment::Environment(void) dim_, GridDefaultSimd(nd_, vComplex::Nsimd()), GridDefaultMpi())); gridRb4d_.reset(SpaceTimeGrid::makeFourDimRedBlackGrid(grid4d_.get())); - auto loc = getGrid()->LocalDimensions(); - locVol_ = 1; - for (unsigned int d = 0; d < loc.size(); ++d) + vol_ = 1.; + for (auto d: dim_) { - locVol_ *= loc[d]; + vol_ *= d; } rng4d_.reset(new GridParallelRNG(grid4d_.get())); } @@ -190,9 +189,9 @@ int Environment::getDim(const unsigned int mu) const return dim_[mu]; } -unsigned long int Environment::getLocalVolume(void) const +double Environment::getVolume(void) const { - return locVol_; + return vol_; } // random number generator ///////////////////////////////////////////////////// diff --git a/extras/Hadrons/Environment.hpp b/extras/Hadrons/Environment.hpp index a9c3c724..13a7dfe6 100644 --- a/extras/Hadrons/Environment.hpp +++ b/extras/Hadrons/Environment.hpp @@ -94,8 +94,8 @@ public: const unsigned int Ls = 1) const; std::vector getDim(void) const; int getDim(const unsigned int mu) const; - unsigned long int getLocalVolume(void) const; unsigned int getNd(void) const; + double getVolume(void) const; // random number generator void setSeed(const std::vector &seed); GridParallelRNG * get4dRng(void) const; @@ -155,7 +155,7 @@ public: void printContent(void) const; private: // general - unsigned long int locVol_; + double vol_; bool protect_{true}; // grids std::vector dim_;