Completes RPTConfig to pass tests.
This commit is contained in:
@@ -22,11 +22,20 @@
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class RPTConfig: public std::unordered_map<std::string,unsigned> {
|
||||
#if __cplusplus <= 201703L
|
||||
public:
|
||||
bool contains(const std::string&) const;
|
||||
#endif
|
||||
|
||||
public:
|
||||
using std::unordered_map<std::string,unsigned>::unordered_map;
|
||||
|
||||
RPTConfig(const DeckKeyword&);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/RPTConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
||||
@@ -101,6 +100,7 @@ namespace Opm
|
||||
class FieldPropsManager;
|
||||
class Python;
|
||||
class Runspec;
|
||||
class RPTConfig;
|
||||
class SCHEDULESection;
|
||||
class SummaryState;
|
||||
class TimeMap;
|
||||
@@ -428,6 +428,7 @@ namespace Opm
|
||||
void handleWECON( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleWHISTCTL(const DeckKeyword& keyword, std::size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleMESSAGES(const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleRPTSCHED(const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleVFPPROD(const DeckKeyword& vfpprodKeyword, const UnitSystem& unit_system, size_t currentStep);
|
||||
void handleVFPINJ(const DeckKeyword& vfpprodKeyword, const UnitSystem& unit_system, size_t currentStep);
|
||||
void checkUnhandledKeywords( const SCHEDULESection& ) const;
|
||||
|
||||
@@ -19,10 +19,43 @@
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/RPTConfig.hpp>
|
||||
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
|
||||
namespace {
|
||||
|
||||
std::pair<std::string, unsigned> parse_mnemonic(const std::string& mnemonic) {
|
||||
const auto pivot { mnemonic.find('=') } ;
|
||||
|
||||
if (pivot == std::string::npos) {
|
||||
return { mnemonic, 1 } ;
|
||||
} else {
|
||||
const auto int_value { std::stoi(mnemonic.substr(pivot + 1)) } ;
|
||||
|
||||
if (!(int_value >= 0)) {
|
||||
OPM_THROW(std::invalid_argument, "RPTSCHED - " + mnemonic + " - mnemonic value must be an integer greater than 1");
|
||||
}
|
||||
|
||||
return { mnemonic.substr(0, pivot), int_value } ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Opm::RPTConfig::RPTConfig(const DeckKeyword& keyword) :
|
||||
std::unordered_map<std::string,unsigned> {}
|
||||
{
|
||||
const auto& mnemonics { keyword.getStringData() } ;
|
||||
for (const auto& mnemonic : mnemonics) {
|
||||
if (mnemonic == "NOTHING") {
|
||||
clear();
|
||||
} else {
|
||||
emplace(parse_mnemonic(mnemonic));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if __cplusplus <= 201703L
|
||||
bool Opm::RPTConfig::contains(const std::string& key) const {
|
||||
return find(key) != end();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/RPTConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp>
|
||||
@@ -453,6 +454,9 @@ Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext&
|
||||
else if (keyword.name() == "MESSAGES")
|
||||
handleMESSAGES(keyword, currentStep);
|
||||
|
||||
else if (keyword.name() == "RPTSCHED")
|
||||
handleRPTSCHED(keyword, currentStep);
|
||||
|
||||
else if (keyword.name() == "WEFAC")
|
||||
handleWEFAC(keyword, currentStep, parseContext, errors);
|
||||
|
||||
@@ -1948,6 +1952,10 @@ void Schedule::iterateScheduleSection(const std::string& input_path, const Parse
|
||||
}
|
||||
}
|
||||
|
||||
void Schedule::handleRPTSCHED( const DeckKeyword& keyword, size_t currentStep) {
|
||||
this->rpt_config.update(currentStep, std::make_shared<RPTConfig>(keyword));
|
||||
}
|
||||
|
||||
void Schedule::handleCOMPDAT( const DeckKeyword& keyword, size_t currentStep, const EclipseGrid& grid, const FieldPropsManager& fp, const ParseContext& parseContext, ErrorGuard& errors) {
|
||||
for (const auto& record : keyword) {
|
||||
const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#define BOOST_TEST_MODULE ReportConfigTest
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/RPTConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
|
||||
Reference in New Issue
Block a user