ESmry: Add Way of Retrieving Ministep Index at Start of Report Step
This commit introduces a new member function int ESmry::miniStepIdxAtReportStep(rptStep) which returns the zero-based ministep corresponding to the start of the given report step (one-based indexing). This will simplify decoupling a few unit tests from libecl.
This commit is contained in:
parent
112e698d0a
commit
c69a111e7a
@ -39,6 +39,8 @@ public:
|
||||
|
||||
const std::vector<std::string>& keywordList() const { return keyword; }
|
||||
|
||||
int timestepIdxAtReportstepStart(const int reportStep) const;
|
||||
|
||||
private:
|
||||
int nVect, nI, nJ, nK;
|
||||
std::string path="";
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include <opm/io/eclipse/ESmry.hpp>
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
@ -28,6 +29,7 @@
|
||||
#include <limits>
|
||||
#include <limits.h>
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <opm/io/eclipse/EclFile.hpp>
|
||||
|
||||
@ -442,4 +444,18 @@ std::vector<float> ESmry::get_at_rstep(const std::string& name) const
|
||||
return rstep_vector;
|
||||
}
|
||||
|
||||
int ESmry::timestepIdxAtReportstepStart(const int reportStep) const
|
||||
{
|
||||
const auto nReport = static_cast<int>(seqIndex.size());
|
||||
|
||||
if ((reportStep < 1) || (reportStep > nReport)) {
|
||||
throw std::invalid_argument {
|
||||
"Report step " + std::to_string(reportStep)
|
||||
+ " outside valid range 1 .. " + std::to_string(nReport)
|
||||
};
|
||||
}
|
||||
|
||||
return seqIndex[reportStep - 1];
|
||||
}
|
||||
|
||||
}} // namespace Opm::ecl
|
||||
|
Loading…
Reference in New Issue
Block a user