Replace FramesToCompare enum by MaxNumFrames
[alexxy/gromacs.git] / src / programs / mdrun / tests / energycomparison.h
index b43d45692d670b4e48e103cbd38c866fcecad942..c33f66331b260d9c52af6506da4f9aefe754598f 100644 (file)
@@ -71,7 +71,7 @@ public:
     //! Defaults for energy comparisons
     static EnergyTermsToCompare defaultEnergyTermsToCompare();
     //! Constructor
-    EnergyComparison(const EnergyTermsToCompare& energyTermsToCompare, FramesToCompare framesToCompare);
+    EnergyComparison(const EnergyTermsToCompare& energyTermsToCompare, MaxNumFrames maxNumFrames);
     /*! \brief Return the names of energies that will be compared
      *
      * This function can be used to provide an input for
@@ -94,15 +94,15 @@ public:
 private:
     //! Energy terms to match with given tolerances.
     EnergyTermsToCompare energyTermsToCompare_;
-    //! Which frames should be compared.
-    FramesToCompare framesToCompare_ = FramesToCompare::AllFrames;
-    /*! \brief Whether the first frame has been compared yet
+    //! How many frames should be compared.
+    MaxNumFrames maxNumFrames_ = MaxNumFrames::compareAllFrames();
+    /*! \brief The number of frames that have been compared until now
      *
      * This field is mutable because the need to update the flag
-     * after the first frame is merely an implementation detail,
+     * when checking frames is merely an implementation detail,
      * rather than a proper change of internal state triggered
      * by the caller. */
-    mutable bool firstFrameHasBeenCompared_ = false;
+    mutable unsigned int numComparedFrames_ = 0;
 };
 
 /*! \brief Check a subset of the energies found in an energy file
@@ -114,10 +114,24 @@ private:
  * \param[in]  energyFilename        The name of an energy file.
  * \param[in]  energyTermsToCompare  Set of energies to match at given tolerances.
  * \param[in]  checker               Root checker for reference data.
+ * \param[in]  maxNumEnergyFrames    The maximum number of frames to check
  *
  * \todo This is quite similar to the functionality used in PmeTest,
  * and we should consider reducing the duplication.
  */
+void checkEnergiesAgainstReferenceData(const std::string&          energyFilename,
+                                       const EnergyTermsToCompare& energyTermsToCompare,
+                                       TestReferenceChecker*       checker,
+                                       MaxNumFrames                maxNumEnergyFrames);
+
+/*!
+ * \brief Check a subset of the energies found in an energy file
+ * against reference data.
+ *
+ * Convenience overload using all frames
+ *
+ * \see checkEnergiesAgainstReferenceData(const std::string&, const EnergyTermsToCompare&, TestReferenceChecker*, MaxNumFrames)
+ */
 void checkEnergiesAgainstReferenceData(const std::string&          energyFilename,
                                        const EnergyTermsToCompare& energyTermsToCompare,
                                        TestReferenceChecker*       checker);