diff --git a/opm/parser/eclipse/EclipseState/EclipseState.cpp b/opm/parser/eclipse/EclipseState/EclipseState.cpp index bd5071e37..ec74852e4 100644 --- a/opm/parser/eclipse/EclipseState/EclipseState.cpp +++ b/opm/parser/eclipse/EclipseState/EclipseState.cpp @@ -73,7 +73,7 @@ namespace Opm { m_inputGrid( std::make_shared(deck, nullptr) ), m_eclipseProperties( deck, m_tables, *m_inputGrid ), m_schedule( std::make_shared( m_parseContext, m_inputGrid, deck, m_ioConfig ) ), - m_simulationConfig( std::make_shared( m_parseContext, deck, m_eclipseProperties ) ), + m_simulationConfig( std::make_shared( deck, m_eclipseProperties ) ), m_summaryConfig( deck, *m_schedule, m_eclipseProperties, m_inputGrid->getNXYZ() ), m_nnc( deck, m_inputGrid ), m_deckUnitSystem( deck.getActiveUnitSystem() ) diff --git a/opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.cpp b/opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.cpp index c9796dfa3..add001f24 100644 --- a/opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.cpp +++ b/opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.cpp @@ -46,8 +46,7 @@ namespace Opm { - SimulationConfig::SimulationConfig(const ParseContext& parseContext, - const Deck& deck, + SimulationConfig::SimulationConfig(const Deck& deck, const Eclipse3DProperties& eclipseProperties) : m_useCPR(false), m_DISGAS(false), @@ -70,14 +69,13 @@ namespace Opm { } } - initThresholdPressure(parseContext , deck, eclipseProperties); + initThresholdPressure(deck, eclipseProperties); } - void SimulationConfig::initThresholdPressure(const ParseContext& parseContext, - const Deck& deck, + void SimulationConfig::initThresholdPressure(const Deck& deck, const Eclipse3DProperties& eclipseProperties) { - m_ThresholdPressure = std::make_shared(parseContext , deck, eclipseProperties); + m_ThresholdPressure = std::make_shared(deck, eclipseProperties); } diff --git a/opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp b/opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp index 0593ab804..57ed15ea0 100644 --- a/opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp +++ b/opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp @@ -26,14 +26,12 @@ namespace Opm { class ThresholdPressure; - class ParseContext; class SimulationConfig { public: - SimulationConfig(const ParseContext& parseContext, - const Deck& deck, + SimulationConfig(const Deck& deck, const Eclipse3DProperties& gridProperties); std::shared_ptr getThresholdPressure() const; @@ -44,8 +42,7 @@ namespace Opm { private: - void initThresholdPressure(const ParseContext& parseContext, - const Deck& deck, + void initThresholdPressure(const Deck& deck, const Eclipse3DProperties& gridProperties); std::shared_ptr< const ThresholdPressure > m_ThresholdPressure; diff --git a/opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.cpp b/opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.cpp index af456bbac..6e4e5c06d 100644 --- a/opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.cpp +++ b/opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -29,16 +28,14 @@ namespace Opm { - ThresholdPressure::ThresholdPressure(const ParseContext& parseContext, - const Deck& deck, - const Eclipse3DProperties& eclipseProperties) : - m_parseContext( parseContext ) + ThresholdPressure::ThresholdPressure(const Deck& deck, + const Eclipse3DProperties& eclipseProperties) { if (Section::hasRUNSPEC( deck ) && Section::hasSOLUTION( deck )) { std::shared_ptr runspecSection = std::make_shared( deck ); std::shared_ptr solutionSection = std::make_shared( deck ); - initThresholdPressure( parseContext, runspecSection, solutionSection, eclipseProperties ); + initThresholdPressure( runspecSection, solutionSection, eclipseProperties ); } } @@ -66,8 +63,7 @@ namespace Opm { } - void ThresholdPressure::initThresholdPressure(const ParseContext& /* parseContext */, - std::shared_ptr runspecSection, + void ThresholdPressure::initThresholdPressure(std::shared_ptr runspecSection, std::shared_ptr solutionSection, const Eclipse3DProperties& eclipseProperties) { @@ -164,7 +160,7 @@ namespace Opm { return value; else { std::string msg = "The THPRES value for regions " + std::to_string(r1) + " and " + std::to_string(r2) + " has not been initialized. Using 0.0"; - m_parseContext.handleError(ParseContext::INTERNAL_ERROR_UNINITIALIZED_THPRES, msg); + throw std::invalid_argument(msg); return 0; } } diff --git a/opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp b/opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp index 838fbb775..5f5a9446a 100644 --- a/opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp +++ b/opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp @@ -29,7 +29,6 @@ namespace Opm { class Deck; - class ParseContext; class RUNSPECSection; class SOLUTIONSection; @@ -37,8 +36,7 @@ namespace Opm { public: - ThresholdPressure(const ParseContext& parseContext, - const Deck& deck, + ThresholdPressure(const Deck& deck, const Eclipse3DProperties& eclipseProperties); @@ -69,8 +67,7 @@ namespace Opm { double getThresholdPressure(int r1 , int r2) const; size_t size() const; private: - void initThresholdPressure(const ParseContext& parseContext, - std::shared_ptr runspecSection, + void initThresholdPressure(std::shared_ptr runspecSection, std::shared_ptr solutionSection, const Eclipse3DProperties& eclipseProperties); @@ -81,7 +78,6 @@ namespace Opm { std::vector> m_thresholdPressureTable; std::map , std::pair > m_pressureTable; - const ParseContext& m_parseContext; }; diff --git a/opm/parser/eclipse/EclipseState/SimulationConfig/tests/SimulationConfigTest.cpp b/opm/parser/eclipse/EclipseState/SimulationConfig/tests/SimulationConfigTest.cpp index 760be109c..9ad4434ed 100644 --- a/opm/parser/eclipse/EclipseState/SimulationConfig/tests/SimulationConfigTest.cpp +++ b/opm/parser/eclipse/EclipseState/SimulationConfig/tests/SimulationConfigTest.cpp @@ -119,7 +119,7 @@ BOOST_AUTO_TEST_CASE(SimulationConfigGetThresholdPressureTableTest) { Eclipse3DProperties ep(*deck, tm, eg); SimulationConfigConstPtr simulationConfigPtr; BOOST_CHECK_NO_THROW(simulationConfigPtr = std::make_shared - (parseContext , *deck, ep)); + (*deck, ep)); } @@ -129,7 +129,7 @@ BOOST_AUTO_TEST_CASE(SimulationConfigNOTHPRES) { TableManager tm(*deck); EclipseGrid eg(10, 3, 4); Eclipse3DProperties ep(*deck, tm, eg); - SimulationConfig simulationConfig(parseContext , *deck, ep); + SimulationConfig simulationConfig(*deck, ep); BOOST_CHECK( !simulationConfig.hasThresholdPressure() ); } @@ -139,18 +139,18 @@ BOOST_AUTO_TEST_CASE(SimulationConfigCPRNotUsed) { TableManager tm(*deck); EclipseGrid eg(10, 3, 4); Eclipse3DProperties ep(*deck, tm, eg); - SimulationConfig simulationConfig(parseContext , *deck, ep); + SimulationConfig simulationConfig(*deck, ep); BOOST_CHECK( ! simulationConfig.useCPR()); } BOOST_AUTO_TEST_CASE(SimulationConfigCPRUsed) { - ParseContext parseContext; + ParseContext parseContext; DeckPtr deck = createDeck(parseContext, inputStr_cpr); TableManager tm(*deck); EclipseGrid eg(10, 3, 4); Eclipse3DProperties ep(*deck, tm, eg); SUMMARYSection summary(*deck); - SimulationConfig simulationConfig(parseContext , *deck, ep); + SimulationConfig simulationConfig(*deck, ep); BOOST_CHECK( simulationConfig.useCPR() ); BOOST_CHECK( ! summary.hasKeyword("CPR") ); } @@ -163,7 +163,7 @@ BOOST_AUTO_TEST_CASE(SimulationConfigCPRInSUMMARYSection) { EclipseGrid eg(10, 3, 4); Eclipse3DProperties ep(*deck, tm, eg); SUMMARYSection summary(*deck); - SimulationConfig simulationConfig(parseContext , *deck, ep); + SimulationConfig simulationConfig(*deck, ep); BOOST_CHECK( ! simulationConfig.useCPR()); BOOST_CHECK( summary.hasKeyword("CPR")); } @@ -176,7 +176,7 @@ BOOST_AUTO_TEST_CASE(SimulationConfigCPRBoth) { EclipseGrid eg(10, 3, 4); Eclipse3DProperties ep(*deck, tm, eg); SUMMARYSection summary(*deck); - SimulationConfig simulationConfig(parseContext , *deck, ep); + SimulationConfig simulationConfig(*deck, ep); BOOST_CHECK( simulationConfig.useCPR()); BOOST_CHECK( summary.hasKeyword("CPR")); @@ -202,7 +202,7 @@ BOOST_AUTO_TEST_CASE(SimulationConfig_VAPOIL_DISGAS) { TableManager tm(*deck); EclipseGrid eg(10, 3, 4); Eclipse3DProperties ep(*deck, tm, eg); - SimulationConfig simulationConfig(parseContext , *deck, ep); + SimulationConfig simulationConfig(*deck, ep); BOOST_CHECK_EQUAL( false , simulationConfig.hasDISGAS()); BOOST_CHECK_EQUAL( false , simulationConfig.hasVAPOIL()); @@ -210,7 +210,7 @@ BOOST_AUTO_TEST_CASE(SimulationConfig_VAPOIL_DISGAS) { TableManager tm_vd(*deck_vd); EclipseGrid eg_vd(10, 3, 4); Eclipse3DProperties ep_vd(*deck_vd, tm, eg); - SimulationConfig simulationConfig_vd(parseContext , *deck_vd, ep_vd); + SimulationConfig simulationConfig_vd(*deck_vd, ep_vd); BOOST_CHECK_EQUAL( true , simulationConfig_vd.hasDISGAS()); BOOST_CHECK_EQUAL( true , simulationConfig_vd.hasVAPOIL()); } diff --git a/opm/parser/eclipse/EclipseState/SimulationConfig/tests/ThresholdPressureTest.cpp b/opm/parser/eclipse/EclipseState/SimulationConfig/tests/ThresholdPressureTest.cpp index a15791240..fc1593685 100644 --- a/opm/parser/eclipse/EclipseState/SimulationConfig/tests/ThresholdPressureTest.cpp +++ b/opm/parser/eclipse/EclipseState/SimulationConfig/tests/ThresholdPressureTest.cpp @@ -194,7 +194,7 @@ struct Setup tablemanager(*deck), grid(10, 3, 4), props(*deck, tablemanager, grid), - threshPres(parseContext, *deck, props) + threshPres(*deck, props) { } explicit Setup(const std::string& input, ParseContext& parseContextArg) : @@ -203,7 +203,7 @@ struct Setup tablemanager(*deck), grid(10, 3, 4), props(*deck, tablemanager, grid), - threshPres(parseContextArg, *deck, props) + threshPres(*deck, props) { }