Rename class BiasReader to struct BiasOutputSetup
authorAleksei Iupinov <a.yupinov@gmail.com>
Fri, 19 Jan 2018 10:05:20 +0000 (11:05 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Fri, 19 Jan 2018 14:01:42 +0000 (15:01 +0100)
Change-Id: Id3b2eb7405b88633914be50d3c41c7ced861238d

src/gromacs/gmxana/gmx_awh.cpp

index 3655ac9d4437cf144c85433ad186cf30c149e791..fa7804d961f93924e30c3a89b2815089a5954f86 100644 (file)
@@ -177,38 +177,37 @@ class OutputFile
 };
 
 /*! \brief All meta-data that is shared for all output files for one bias */
-class BiasReader
+struct BiasOutputSetup
 {
-    public:
-        //! Constructor.
-        BiasReader(int                         subblockStart,
-                   std::unique_ptr<OutputFile> awhOutputFile,
-                   std::unique_ptr<OutputFile> frictionOutputFile) :
-            subblockStart_(subblockStart),
-            awhOutputFile_(std::move(awhOutputFile)),
-            frictionOutputFile_(std::move(frictionOutputFile))
-        {
-        }
+    //! Constructor.
+    BiasOutputSetup(int                         subblockStart,
+                    std::unique_ptr<OutputFile> awhOutputFile,
+                    std::unique_ptr<OutputFile> frictionOutputFile) :
+        subblockStart_(subblockStart),
+        awhOutputFile_(std::move(awhOutputFile)),
+        frictionOutputFile_(std::move(frictionOutputFile))
+    {
+    }
 
-        //! Return the AWH output file data.
-        const OutputFile &awhOutputFile() const
-        {
-            GMX_RELEASE_ASSERT(awhOutputFile_ != nullptr, "awhOutputFile() called without initialized AWH output file");
+    //! Return the AWH output file data.
+    const OutputFile &awhOutputFile() const
+    {
+        GMX_RELEASE_ASSERT(awhOutputFile_ != nullptr, "awhOutputFile() called without initialized AWH output file");
 
-            return *awhOutputFile_.get();
-        }
+        return *awhOutputFile_.get();
+    }
 
-        //! Return the a pointer to the friction output file data, can return nullptr
-        const OutputFile *frictionOutputFile() const
-        {
-            return frictionOutputFile_.get();
-        }
+    //! Return the a pointer to the friction output file data, can return nullptr
+    const OutputFile *frictionOutputFile() const
+    {
+        return frictionOutputFile_.get();
+    }
 
-        //! Return the starting subblock.
-        int subblockStart() const
-        {
-            return subblockStart_;
-        }
+    //! Return the starting subblock.
+    int subblockStart() const
+    {
+        return subblockStart_;
+    }
 
     private:
         const int                   subblockStart_;      /**< The start index of the subblocks to read. */
@@ -235,9 +234,9 @@ class AwhReader
                              const gmx_output_env_t *oenv) const;
 
     private:
-        std::vector<BiasReader> biasReader_; /**< The readers, one for each AWH bias. */
+        std::vector<BiasOutputSetup> biasOutputSetups_; /**< The output setups, one for each AWH bias. */
     public:
-        const real              kT_;         /**< kB*T in kJ/mol. */
+        const real                   kT_;               /**< kB*T in kJ/mol. */
 };
 
 namespace
@@ -449,9 +448,9 @@ AwhReader::AwhReader(const AwhParams  *awhParams,
             frictionOutputFile->initializeFrictionOutputFile(subblockStart, numSubBlocks, awhBiasParams, energyUnit, kT);
         }
 
-        biasReader_.emplace_back(BiasReader(subblockStart,
-                                            std::move(awhOutputFile),
-                                            std::move(frictionOutputFile)));
+        biasOutputSetups_.emplace_back(BiasOutputSetup(subblockStart,
+                                                       std::move(awhOutputFile),
+                                                       std::move(frictionOutputFile)));
 
         subblockStart += numSubBlocks;
     }
@@ -498,13 +497,13 @@ void AwhReader::processAwhFrame(const t_enxblock       &block,
 {
     /* We look for AWH data every energy frame and count the no of AWH frames found. We only extract every 'skip' AWH frame. */
 
-    for (auto &biasReader : biasReader_)
+    for (const auto &setup : biasOutputSetups_)
     {
-        const int subStart = biasReader.subblockStart();
+        const int subStart = setup.subblockStart();
 
         /* Each frame and AWH instance extracted generates one xvg file. */
         {
-            const OutputFile &awhOutputFile = biasReader.awhOutputFile();
+            const OutputFile &awhOutputFile = setup.awhOutputFile();
 
             FILE             *fpAwh = awhOutputFile.openBiasOutputFile(time, oenv);
 
@@ -521,7 +520,7 @@ void AwhReader::processAwhFrame(const t_enxblock       &block,
             gmx_ffclose(fpAwh);
         }
 
-        const OutputFile *frictionOutputFile = biasReader.frictionOutputFile();
+        const OutputFile *frictionOutputFile = setup.frictionOutputFile();
         if (frictionOutputFile != nullptr)
         {
             FILE *fpFriction = frictionOutputFile->openBiasOutputFile(time, oenv);