Shortified names, instead of state.getEclipseConfig().getSummaryConfig(), use state.cfg().summary()
This commit is contained in:
@@ -46,10 +46,32 @@ namespace Opm {
|
||||
m_ioConfig->initFirstRFTOutput(schedule);
|
||||
}
|
||||
|
||||
const SummaryConfig& EclipseConfig::getSummaryConfig() const {
|
||||
|
||||
const InitConfig& EclipseConfig::init() const {
|
||||
return m_initConfig;
|
||||
}
|
||||
|
||||
const IOConfig& EclipseConfig::io() const {
|
||||
return *m_ioConfig;
|
||||
}
|
||||
|
||||
IOConfig& EclipseConfig::io() {
|
||||
return *m_ioConfig;
|
||||
}
|
||||
|
||||
const SimulationConfig& EclipseConfig::simulation() const {
|
||||
return m_simulationConfig;
|
||||
}
|
||||
|
||||
const SummaryConfig& EclipseConfig::summary() const {
|
||||
return m_summaryConfig;
|
||||
}
|
||||
|
||||
// [[deprecated]] --- use summary()
|
||||
const SummaryConfig& EclipseConfig::getSummaryConfig() const {
|
||||
return summary();
|
||||
}
|
||||
|
||||
IOConfigConstPtr EclipseConfig::getIOConfigConst() const {
|
||||
return m_ioConfig;
|
||||
}
|
||||
@@ -58,11 +80,13 @@ namespace Opm {
|
||||
return m_ioConfig;
|
||||
}
|
||||
|
||||
// [[deprecated]] --- use init()
|
||||
const InitConfig& EclipseConfig::getInitConfig() const {
|
||||
return m_initConfig;
|
||||
return init();
|
||||
}
|
||||
|
||||
// [[deprecated]] --- use simulation()
|
||||
const SimulationConfig& EclipseConfig::getSimulationConfig() const {
|
||||
return m_simulationConfig;
|
||||
return simulation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,14 @@ namespace Opm {
|
||||
const Schedule& schedule,
|
||||
const ParseContext& parseContext);
|
||||
|
||||
std::shared_ptr< const IOConfig > getIOConfigConst() const;
|
||||
std::shared_ptr< IOConfig > getIOConfig() const;
|
||||
const InitConfig& init() const;
|
||||
const IOConfig& io() const;
|
||||
IOConfig& io();
|
||||
const SimulationConfig & simulation() const;
|
||||
const SummaryConfig& summary() const;
|
||||
|
||||
std::shared_ptr<const IOConfig> getIOConfigConst() const;
|
||||
std::shared_ptr<IOConfig> getIOConfig() const;
|
||||
const InitConfig& getInitConfig() const;
|
||||
const SimulationConfig & getSimulationConfig() const;
|
||||
const SummaryConfig& getSummaryConfig() const;
|
||||
|
||||
@@ -137,22 +137,31 @@ namespace Opm {
|
||||
return m_schedule;
|
||||
}
|
||||
|
||||
/// [[deprecated]] --- use cfg().io()
|
||||
IOConfigConstPtr EclipseState::getIOConfigConst() const {
|
||||
return m_eclipseConfig.getIOConfigConst();
|
||||
}
|
||||
|
||||
/// [[deprecated]] --- use cfg().io()
|
||||
IOConfigPtr EclipseState::getIOConfig() const {
|
||||
return m_eclipseConfig.getIOConfig();
|
||||
}
|
||||
|
||||
/// [[deprecated]] --- use cfg().init()
|
||||
const InitConfig& EclipseState::getInitConfig() const {
|
||||
return m_eclipseConfig.getInitConfig();
|
||||
}
|
||||
|
||||
/// [[deprecated]] --- use cfg()
|
||||
const EclipseConfig& EclipseState::getEclipseConfig() const {
|
||||
return cfg();
|
||||
}
|
||||
|
||||
const EclipseConfig& EclipseState::cfg() const {
|
||||
return m_eclipseConfig;
|
||||
}
|
||||
|
||||
/// [[deprecated]] --- use cfg().simulation()
|
||||
const SimulationConfig& EclipseState::getSimulationConfig() const {
|
||||
return m_eclipseConfig.getSimulationConfig();
|
||||
}
|
||||
|
||||
@@ -92,6 +92,7 @@ namespace Opm {
|
||||
|
||||
const TableManager& getTableManager() const;
|
||||
const EclipseConfig& getEclipseConfig() const;
|
||||
const EclipseConfig& cfg() const;
|
||||
|
||||
// the unit system used by the deck. note that it is rarely needed to convert
|
||||
// units because internally to opm-parser everything is represented by SI
|
||||
|
||||
@@ -212,7 +212,7 @@ namespace Opm {
|
||||
m_output_enabled = enabled;
|
||||
}
|
||||
|
||||
std::string IOConfig::getOutputDir() {
|
||||
std::string IOConfig::getOutputDir() const {
|
||||
return m_output_dir;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace Opm {
|
||||
bool getOutputEnabled();
|
||||
void setOutputEnabled(bool enabled);
|
||||
|
||||
std::string getOutputDir();
|
||||
std::string getOutputDir() const;
|
||||
void setOutputDir(const std::string& outputDir);
|
||||
|
||||
const std::string& getBaseName() const;
|
||||
|
||||
@@ -163,10 +163,10 @@ static DeckPtr createDeck(const std::string& input) {
|
||||
BOOST_AUTO_TEST_CASE( RFT_TIME) {
|
||||
DeckPtr deck = createDeck(deckStr_RFT);
|
||||
EclipseState state( *deck , Opm::ParseContext() );
|
||||
std::shared_ptr<const IOConfig> ioConfig = state.getIOConfigConst();
|
||||
const IOConfig& ioConfig = state.cfg().io();
|
||||
|
||||
|
||||
BOOST_CHECK_EQUAL( ioConfig->getFirstRFTStep() , 2 );
|
||||
BOOST_CHECK_EQUAL( ioConfig.getFirstRFTStep() , 2 );
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(RPTRST_mixed_mnemonics_int_list) {
|
||||
|
||||
@@ -448,14 +448,16 @@ BOOST_AUTO_TEST_CASE(TestIOConfigBaseName) {
|
||||
ParserPtr parser(new Parser());
|
||||
DeckConstPtr deck = parser->parseFile("testdata/integration_tests/IOConfig/SPE1CASE2.DATA", parseContext);
|
||||
EclipseState state(*deck, parseContext);
|
||||
BOOST_CHECK_EQUAL(state.getIOConfig()->getBaseName(), "SPE1CASE2");
|
||||
BOOST_CHECK_EQUAL(state.getIOConfig()->getOutputDir(), "testdata/integration_tests/IOConfig");
|
||||
const auto& io = state.cfg().io();
|
||||
BOOST_CHECK_EQUAL(io.getBaseName(), "SPE1CASE2");
|
||||
BOOST_CHECK_EQUAL(io.getOutputDir(), "testdata/integration_tests/IOConfig");
|
||||
|
||||
ParserPtr parser2(new Parser());
|
||||
DeckConstPtr deck2 = createDeckWithGridOpts();
|
||||
EclipseState state2(*deck2, parseContext);
|
||||
BOOST_CHECK_EQUAL(state2.getIOConfig()->getBaseName(), "");
|
||||
BOOST_CHECK_EQUAL(state2.getIOConfig()->getOutputDir(), ".");
|
||||
const auto& io2 = state2.cfg().io();
|
||||
BOOST_CHECK_EQUAL(io2.getBaseName(), "");
|
||||
BOOST_CHECK_EQUAL(io2.getOutputDir(), ".");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(TestIOConfigCreation) {
|
||||
@@ -495,8 +497,8 @@ BOOST_AUTO_TEST_CASE(TestIOConfigCreation) {
|
||||
DeckPtr deck = parser->parseString(deckData, ParseContext()) ;
|
||||
EclipseState state(*deck , ParseContext());
|
||||
|
||||
IOConfigConstPtr ioConfig = state.getIOConfigConst();
|
||||
const RestartConfig& rstConfig = ioConfig->restartConfig();
|
||||
const IOConfig& ioConfig = state.cfg().io();
|
||||
const RestartConfig& rstConfig = ioConfig.restartConfig();
|
||||
|
||||
BOOST_CHECK_EQUAL(false, rstConfig.getWriteRestartFile(0));
|
||||
BOOST_CHECK_EQUAL(false, rstConfig.getWriteRestartFile(1));
|
||||
@@ -547,8 +549,8 @@ BOOST_AUTO_TEST_CASE(TestIOConfigCreationWithSolutionRPTRST) {
|
||||
DeckPtr deck = parser->parseString(deckData, parseContext) ;
|
||||
EclipseState state(*deck, parseContext);
|
||||
|
||||
IOConfigConstPtr ioConfig = state.getIOConfigConst();
|
||||
const RestartConfig& rstConfig = ioConfig->restartConfig();
|
||||
const IOConfig& ioConfig = state.cfg().io();
|
||||
const RestartConfig& rstConfig = ioConfig.restartConfig();
|
||||
|
||||
BOOST_CHECK_EQUAL(true , rstConfig.getWriteRestartFile(0));
|
||||
BOOST_CHECK_EQUAL(false , rstConfig.getWriteRestartFile(1));
|
||||
@@ -639,8 +641,8 @@ BOOST_AUTO_TEST_CASE(TestIOConfigCreationWithSolutionRPTSOL) {
|
||||
DeckPtr deck = parser->parseString(deckData, parseContext) ;
|
||||
EclipseState state(*deck, parseContext);
|
||||
|
||||
IOConfigConstPtr ioConfig = state.getIOConfigConst();
|
||||
const RestartConfig& rstConfig = ioConfig->restartConfig();
|
||||
const IOConfig& ioConfig = state.cfg().io();
|
||||
const RestartConfig& rstConfig = ioConfig.restartConfig();
|
||||
|
||||
BOOST_CHECK_EQUAL(true, rstConfig.getWriteRestartFile(0));
|
||||
}
|
||||
@@ -649,8 +651,8 @@ BOOST_AUTO_TEST_CASE(TestIOConfigCreationWithSolutionRPTSOL) {
|
||||
DeckPtr deck = parser->parseString(deckData2, parseContext) ;
|
||||
EclipseState state(*deck, parseContext);
|
||||
|
||||
IOConfigConstPtr ioConfig = state.getIOConfigConst();
|
||||
const RestartConfig& rstConfig = ioConfig->restartConfig();
|
||||
const IOConfig& ioConfig = state.cfg().io();
|
||||
const RestartConfig& rstConfig = ioConfig.restartConfig();
|
||||
|
||||
BOOST_CHECK_EQUAL(true, rstConfig.getWriteRestartFile(0));
|
||||
}
|
||||
|
||||
@@ -36,16 +36,16 @@
|
||||
|
||||
using namespace Opm;
|
||||
|
||||
inline void verifyRestartConfig(IOConfigConstPtr ioconfig, std::vector<std::tuple<int , bool, boost::gregorian::date>>& rptConfig) {
|
||||
inline void verifyRestartConfig(const IOConfig& io, std::vector<std::tuple<int , bool, boost::gregorian::date>>& rptConfig) {
|
||||
|
||||
for (auto rptrst : rptConfig) {
|
||||
int report_step = std::get<0>(rptrst);
|
||||
bool save = std::get<1>(rptrst);
|
||||
boost::gregorian::date report_date = std::get<2>(rptrst);
|
||||
|
||||
BOOST_CHECK_EQUAL( save , ioconfig->restartConfig().getWriteRestartFile( report_step ));
|
||||
BOOST_CHECK_EQUAL( save , io.restartConfig().getWriteRestartFile( report_step ));
|
||||
if (save) {
|
||||
BOOST_CHECK_EQUAL( report_date, ioconfig->getTimestepDate( report_step ));
|
||||
BOOST_CHECK_EQUAL( report_date, io.getTimestepDate( report_step ));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -297,7 +297,7 @@ BOOST_AUTO_TEST_CASE( NorneRestartConfig ) {
|
||||
|
||||
|
||||
auto state = Parser::parse("testdata/integration_tests/IOConfig/RPTRST_DECK.DATA");
|
||||
verifyRestartConfig(state.getIOConfigConst(), rptConfig);
|
||||
verifyRestartConfig(state.cfg().io(), rptConfig);
|
||||
}
|
||||
|
||||
|
||||
@@ -339,10 +339,10 @@ BOOST_AUTO_TEST_CASE( RestartConfig2 ) {
|
||||
ParserPtr parser(new Parser());
|
||||
DeckConstPtr deck = parser->parseFile("testdata/integration_tests/IOConfig/RPT_TEST2.DATA", parseContext);
|
||||
EclipseState state( *deck , parseContext );
|
||||
std::shared_ptr<const IOConfig> ioConfig = state.getIOConfigConst();
|
||||
const IOConfig& ioConfig = state.cfg().io();
|
||||
verifyRestartConfig(ioConfig, rptConfig);
|
||||
|
||||
BOOST_CHECK_EQUAL( ioConfig->getFirstRestartStep() , 0 );
|
||||
BOOST_CHECK_EQUAL( ioConfig.getFirstRestartStep() , 0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -625,8 +625,9 @@ bool parseState( ParserState& parserState, const Parser& parser ) {
|
||||
EclipseState Parser::parse(const std::string &filename, const ParseContext& context) {
|
||||
assertFullDeck(context);
|
||||
Parser p;
|
||||
auto deck = p.parseFile(filename, context);
|
||||
return EclipseState(deck, context);
|
||||
DeckPtr deck = p.parseFile(filename, context);
|
||||
EclipseState es(deck, context);
|
||||
return es;
|
||||
}
|
||||
|
||||
EclipseState Parser::parse(const Deck& deck, const ParseContext& context) {
|
||||
|
||||
Reference in New Issue
Block a user