From 21a29448850377f252ee3f1d2f8f35827050ebde Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Mon, 2 Oct 2017 12:40:28 +0200 Subject: [PATCH] Extract Schedule and SummaryConfig. --- opm/output/eclipse/EclipseIO.hpp | 13 +- opm/output/eclipse/RegionCache.hpp | 5 +- opm/output/eclipse/RestartIO.hpp | 2 + opm/output/eclipse/Summary.hpp | 8 +- src/opm/output/eclipse/EclipseIO.cpp | 31 +++-- src/opm/output/eclipse/RegionCache.cpp | 4 +- src/opm/output/eclipse/RestartIO.cpp | 16 +-- src/opm/output/eclipse/Summary.cpp | 17 +-- tests/test_EclipseIO.cpp | 8 +- tests/test_RFT.cpp | 27 +++-- tests/test_Restart.cpp | 82 ++++++++----- tests/test_Summary.cpp | 158 +++++++++++++------------ tests/test_regionCache.cpp | 4 +- tests/test_writenumwells.cpp | 19 +-- 14 files changed, 227 insertions(+), 167 deletions(-) diff --git a/opm/output/eclipse/EclipseIO.hpp b/opm/output/eclipse/EclipseIO.hpp index d6954ccad..c0863ee59 100644 --- a/opm/output/eclipse/EclipseIO.hpp +++ b/opm/output/eclipse/EclipseIO.hpp @@ -22,15 +22,15 @@ #ifndef OPM_ECLIPSE_WRITER_HPP #define OPM_ECLIPSE_WRITER_HPP -#include -#include - #include #include #include #include #include +#include +#include + #include #include #include @@ -39,6 +39,8 @@ namespace Opm { class EclipseState; +class SummaryConfig; +class Schedule; /*! * \brief A class to write the reservoir state and the well state of a @@ -50,7 +52,10 @@ public: * \brief Sets the common attributes required to write eclipse * binary files using ERT. */ - EclipseIO( const EclipseState&, EclipseGrid ); + EclipseIO( const EclipseState& es, + EclipseGrid grid, + const Schedule& schedule, + const SummaryConfig& summary_config); diff --git a/opm/output/eclipse/RegionCache.hpp b/opm/output/eclipse/RegionCache.hpp index 58be3a6c0..7d9597fc9 100644 --- a/opm/output/eclipse/RegionCache.hpp +++ b/opm/output/eclipse/RegionCache.hpp @@ -23,14 +23,15 @@ #include namespace Opm { - class EclipseState; + class Eclipse3DProperties; + class Schedule; class EclipseGrid; namespace out { class RegionCache { public: RegionCache() = default; - RegionCache(const EclipseState& state, const EclipseGrid& grid); + RegionCache(const Eclipse3DProperties& properties, const EclipseGrid& grid, const Schedule& schedule); const std::vector& cells( int region_id ) const; const std::vector>& completions( int region_id ) const; diff --git a/opm/output/eclipse/RestartIO.hpp b/opm/output/eclipse/RestartIO.hpp index 0a33abf33..c8688db37 100644 --- a/opm/output/eclipse/RestartIO.hpp +++ b/opm/output/eclipse/RestartIO.hpp @@ -79,6 +79,7 @@ void save(const std::string& filename, data::Wells wells, const EclipseState& es, const EclipseGrid& grid, + const Schedule& schedule, std::map> extra_data = {}, bool write_double = false); @@ -88,6 +89,7 @@ RestartValue load( const std::string& filename, const std::map& keys, const EclipseState& es, const EclipseGrid& grid, + const Schedule& schedule, const std::map& extra_keys = {}); } diff --git a/opm/output/eclipse/Summary.hpp b/opm/output/eclipse/Summary.hpp index a9b5117ea..1c3e91d98 100644 --- a/opm/output/eclipse/Summary.hpp +++ b/opm/output/eclipse/Summary.hpp @@ -40,18 +40,20 @@ namespace Opm { class Schedule; class SummaryConfig; class EclipseGrid; + class Schedule; namespace out { class Summary { public: - Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid& ); - Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid&, const std::string& ); - Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid&, const char* basename ); + Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid&, const Schedule& ); + Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid&, const Schedule&, const std::string& ); + Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid&, const Schedule&, const char* basename ); void add_timestep( int report_step, double secs_elapsed, const EclipseState& es, + const Schedule& schedule, const data::Wells&, const data::Solution&, const std::map& misc_values); diff --git a/src/opm/output/eclipse/EclipseIO.cpp b/src/opm/output/eclipse/EclipseIO.cpp index 343d1585e..b030bd1fd 100644 --- a/src/opm/output/eclipse/EclipseIO.cpp +++ b/src/opm/output/eclipse/EclipseIO.cpp @@ -191,12 +191,13 @@ inline std::string uppercase( std::string x ) { class EclipseIO::Impl { public: - Impl( const EclipseState& es, EclipseGrid grid ); + Impl( const EclipseState&, EclipseGrid, const Schedule&, const SummaryConfig& ); void writeINITFile( const data::Solution& simProps, const NNC& nnc) const; void writeEGRIDFile( const NNC& nnc ) const; const EclipseState& es; EclipseGrid grid; + const Schedule& schedule; std::string outputDir; std::string baseName; out::Summary summary; @@ -205,12 +206,15 @@ class EclipseIO::Impl { }; EclipseIO::Impl::Impl( const EclipseState& eclipseState, - EclipseGrid grid_) + EclipseGrid grid_, + const Schedule& schedule_, + const SummaryConfig& summary_config) : es( eclipseState ) , grid( std::move( grid_ ) ) + , schedule( schedule_ ) , outputDir( eclipseState.getIOConfig().getOutputDir() ) , baseName( uppercase( eclipseState.getIOConfig().getBaseName() ) ) - , summary( eclipseState, eclipseState.getSummaryConfig() , grid ) + , summary( eclipseState, summary_config, grid , schedule ) , rft( outputDir.c_str(), baseName.c_str(), es.getIOConfig().getFMTOUT() ) , output_enabled( eclipseState.getIOConfig().getOutputEnabled() ) {} @@ -253,7 +257,7 @@ void EclipseIO::Impl::writeINITFile( const data::Solution& simProps, const NNC& NULL, units.getEclType(), this->es.runspec( ).eclPhaseMask( ), - this->es.getSchedule().posixStartTime( )); + this->schedule.posixStartTime( )); units.from_si( UnitSystem::measure::volume, ecl_data ); writeKeyword( fortio, "PORV" , ecl_data ); @@ -406,6 +410,7 @@ void EclipseIO::writeTimeStep(int report_step, const auto& es = this->impl->es; const auto& grid = this->impl->grid; + const auto& schedule = this->impl->schedule; const auto& units = es.getUnits(); const auto& ioConfig = es.getIOConfig(); const auto& restart = es.cfg().restart(); @@ -419,6 +424,7 @@ void EclipseIO::writeTimeStep(int report_step, this->impl->summary.add_timestep( report_step, secs_elapsed, es, + schedule, wells , cells , misc_summary_values ); @@ -439,7 +445,7 @@ void EclipseIO::writeTimeStep(int report_step, report_step, ioConfig.getFMTOUT() ); - RestartIO::save( filename , report_step, secs_elapsed, cells, wells, es , grid , extra_restart , write_double); + RestartIO::save( filename , report_step, secs_elapsed, cells, wells, es , grid , schedule, extra_restart , write_double); } @@ -450,14 +456,13 @@ void EclipseIO::writeTimeStep(int report_step, return; { - const auto& schedule = es.getSchedule(); - std::vector sched_wells = schedule.getWells( report_step ); + std::vector sched_wells = this->impl->schedule.getWells( report_step ); const auto rft_active = [report_step] (const Well* w) { return w->getRFTActive( report_step ) || w->getPLTActive( report_step ); }; if (std::any_of(sched_wells.begin(), sched_wells.end(), rft_active)) { this->impl->rft.writeTimeStep( sched_wells, grid, report_step, - secs_elapsed + schedule.posixStartTime(), + secs_elapsed + this->impl->schedule.posixStartTime(), units.from_si( UnitSystem::measure::time, secs_elapsed ), units, cells ); @@ -471,6 +476,7 @@ void EclipseIO::writeTimeStep(int report_step, RestartValue EclipseIO::loadRestart(const std::map& keys, const std::map& extra_keys) const { const auto& es = this->impl->es; const auto& grid = this->impl->grid; + const auto& schedule = this->impl->schedule; const InitConfig& initConfig = es.getInitConfig(); const auto& ioConfig = es.getIOConfig(); const int report_step = initConfig.getRestartStep(); @@ -478,11 +484,14 @@ RestartValue EclipseIO::loadRestart(const std::map& key report_step, false ); - return RestartIO::load( filename , report_step , keys , es, grid , extra_keys); + return RestartIO::load( filename , report_step , keys , es, grid , schedule, extra_keys); } -EclipseIO::EclipseIO( const EclipseState& es, EclipseGrid grid) - : impl( new Impl( es, std::move( grid ) ) ) +EclipseIO::EclipseIO( const EclipseState& es, + EclipseGrid grid, + const Schedule& schedule, + const SummaryConfig& summary_config) + : impl( new Impl( es, std::move( grid ), schedule , summary_config) ) { if( !this->impl->output_enabled ) return; diff --git a/src/opm/output/eclipse/RegionCache.cpp b/src/opm/output/eclipse/RegionCache.cpp index 109ed4cdd..ce40363d7 100644 --- a/src/opm/output/eclipse/RegionCache.cpp +++ b/src/opm/output/eclipse/RegionCache.cpp @@ -30,8 +30,7 @@ namespace Opm { namespace out { - RegionCache::RegionCache(const EclipseState& state, const EclipseGrid& grid) { - const auto& properties = state.get3DProperties(); + RegionCache::RegionCache(const Eclipse3DProperties& properties, const EclipseGrid& grid, const Schedule& schedule) { const auto& fipnum = properties.getIntGridProperty("FIPNUM"); const auto& region_values = properties.getRegions( "FIPNUM" ); @@ -40,7 +39,6 @@ namespace out { { - const auto& schedule = state.getSchedule(); const auto& wells = schedule.getWells(); for (const auto& well : wells) { const auto& completions = well->getCompletions( ); diff --git a/src/opm/output/eclipse/RestartIO.cpp b/src/opm/output/eclipse/RestartIO.cpp index 985162fa5..e5c0d4337 100644 --- a/src/opm/output/eclipse/RestartIO.cpp +++ b/src/opm/output/eclipse/RestartIO.cpp @@ -144,9 +144,10 @@ data::Wells restore_wells( const ecl_kw_type * opm_xwel, const ecl_kw_type * opm_iwel, int restart_step, const EclipseState& es, - const EclipseGrid& grid) { + const EclipseGrid& grid, + const Schedule& schedule) { - const auto& sched_wells = es.getSchedule().getWells( restart_step ); + const auto& sched_wells = schedule.getWells( restart_step ); std::vector< rt > phases; { const auto& phase = es.runspec().phases(); @@ -222,6 +223,7 @@ RestartValue load( const std::string& filename, const std::map& keys, const EclipseState& es, const EclipseGrid& grid, + const Schedule& schedule, const std::map& extra_keys) { const bool unified = ( ERT::EclFiletype( filename ) == ECL_UNIFIED_RESTART_FILE ); @@ -246,7 +248,7 @@ RestartValue load( const std::string& filename, UnitSystem units( static_cast(ecl_kw_iget_int( intehead , INTEHEAD_UNIT_INDEX ))); RestartValue rst_value( restoreSOLUTION( file_view, keys, units , grid.getNumActive( )), - restore_wells( opm_xwel, opm_iwel, report_step , es, grid)); + restore_wells( opm_xwel, opm_iwel, report_step , es, grid, schedule)); for (const auto& pair : extra_keys) { const std::string& key = pair.first; @@ -515,9 +517,7 @@ void writeExtraData(ecl_rst_file_type* rst_file, const std::map> extra_data, bool write_double) { checkSaveArguments( cells, grid, extra_data ); { int ert_phase_mask = es.runspec().eclPhaseMask( ); - const Schedule& schedule = es.getSchedule(); const auto& units = es.getUnits(); time_t posix_time = schedule.posixStartTime() + seconds_elapsed; const auto sim_time = units.from_si( UnitSystem::measure::time, seconds_elapsed ); @@ -587,7 +587,7 @@ void save(const std::string& filename, cells.convertFromSI( units ); writeHeader( rst_file.get() , report_step, posix_time , sim_time, ert_phase_mask, units, schedule , grid ); - writeWell( rst_file.get() , report_step, es , grid, wells); + writeWell( rst_file.get() , report_step, es , grid, schedule, wells); writeSolution( rst_file.get() , cells , write_double ); writeExtraData( rst_file.get() , extra_data ); } diff --git a/src/opm/output/eclipse/Summary.cpp b/src/opm/output/eclipse/Summary.cpp index 07d7e9cf8..19c966565 100644 --- a/src/opm/output/eclipse/Summary.cpp +++ b/src/opm/output/eclipse/Summary.cpp @@ -809,24 +809,26 @@ class Summary::keyword_handlers { Summary::Summary( const EclipseState& st, const SummaryConfig& sum , - const EclipseGrid& grid_arg) : - Summary( st, sum, grid_arg, st.getIOConfig().fullBasePath().c_str() ) + const EclipseGrid& grid_arg, + const Schedule& schedule) : + Summary( st, sum, grid_arg, schedule, st.getIOConfig().fullBasePath().c_str() ) {} Summary::Summary( const EclipseState& st, const SummaryConfig& sum, const EclipseGrid& grid_arg, + const Schedule& schedule, const std::string& basename ) : - Summary( st, sum, grid_arg, basename.c_str() ) + Summary( st, sum, grid_arg, schedule, basename.c_str() ) {} Summary::Summary( const EclipseState& st, const SummaryConfig& sum, const EclipseGrid& grid_arg, + const Schedule& schedule, const char* basename ) : grid( grid_arg ), - regionCache( st , grid_arg ), - + regionCache( st.get3DProperties( ) , grid_arg, schedule ), handlers( new keyword_handlers() ), porv( st.get3DProperties().getDoubleGridProperty("PORV").compressedCopy(grid_arg)) { @@ -845,7 +847,7 @@ Summary::Summary( const EclipseState& st, st.getIOConfig().getFMTOUT(), st.getIOConfig().getUNIFOUT(), ":", - st.getSchedule().posixStartTime(), + schedule.posixStartTime(), true, st.getInputGrid().getNX(), st.getInputGrid().getNY(), @@ -916,15 +918,14 @@ Summary::Summary( const EclipseState& st, void Summary::add_timestep( int report_step, double secs_elapsed, const EclipseState& es, + const Schedule& schedule, const data::Wells& wells , const data::Solution& state, const std::map& misc_values) { auto* tstep = ecl_sum_add_tstep( this->ecl_sum.get(), report_step, secs_elapsed ); const double duration = secs_elapsed - this->prev_time_elapsed; - const size_t timestep = report_step; - const auto& schedule = es.getSchedule(); for( auto& f : this->handlers->handlers ) { const int num = smspec_node_get_num( f.first ); diff --git a/tests/test_EclipseIO.cpp b/tests/test_EclipseIO.cpp index be15a0ab3..858d25fd8 100644 --- a/tests/test_EclipseIO.cpp +++ b/tests/test_EclipseIO.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -291,12 +292,15 @@ BOOST_AUTO_TEST_CASE(EclipseIOIntegration) { ERT::TestArea ta("test_ecl_writer"); auto write_and_check = [&]( int first = 1, int last = 5 ) { - auto deck = Parser().parseString( deckString, ParseContext() ); + ParseContext parse_context; + auto deck = Parser().parseString( deckString, parse_context ); auto es = Parser::parse( deck ); auto& eclGrid = es.getInputGrid(); + Schedule schedule(deck, eclGrid, es.get3DProperties(), es.runspec().phases(), parse_context); + SummaryConfig summary_config( deck, schedule, es.getTableManager( ), parse_context); es.getIOConfig().setBaseName( "FOO" ); - EclipseIO eclWriter( es, eclGrid ); + EclipseIO eclWriter( es, eclGrid , schedule, summary_config); using measure = UnitSystem::measure; using TargetType = data::TargetType; diff --git a/tests/test_RFT.cpp b/tests/test_RFT.cpp index 8ffd7a2a5..4042c770d 100755 --- a/tests/test_RFT.cpp +++ b/tests/test_RFT.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -104,12 +105,13 @@ data::Solution createBlackoilState( int timeStepIdx, int numCells ) { } BOOST_AUTO_TEST_CASE(test_RFT) { - + ParseContext parse_context; std::string eclipse_data_filename = "testRFT.DATA"; ERT::TestArea test_area("test_RFT"); test_area.copyFile( eclipse_data_filename ); - auto eclipseState = Parser::parse( eclipse_data_filename ); + auto deck = Parser().parseFile( eclipse_data_filename, parse_context ); + auto eclipseState = Parser::parse( deck ); { /* eclipseWriter is scoped here to ensure it is destroyed after the * file itself has been written, because we're going to reload it @@ -119,10 +121,10 @@ BOOST_AUTO_TEST_CASE(test_RFT) { const auto& grid = eclipseState.getInputGrid(); const auto numCells = grid.getCartesianSize( ); - - EclipseIO eclipseWriter( eclipseState, grid); - time_t start_time = eclipseState.getSchedule().posixStartTime(); - /* step time read from deck and hard-coded here */ + Schedule schedule(deck, grid, eclipseState.get3DProperties(), eclipseState.runspec().phases(), parse_context); + SummaryConfig summary_config( deck, schedule, eclipseState.getTableManager( ), parse_context); + EclipseIO eclipseWriter( eclipseState, grid, schedule, summary_config ); + time_t start_time = schedule.posixStartTime(); time_t step_time = ecl_util_make_date(10, 10, 2008 ); data::Rates r1, r2; @@ -174,12 +176,13 @@ void verifyRFTFile2(const std::string& rft_filename) { BOOST_AUTO_TEST_CASE(test_RFT2) { - + ParseContext parse_context; std::string eclipse_data_filename = "testRFT.DATA"; ERT::TestArea test_area("test_RFT"); test_area.copyFile( eclipse_data_filename ); - auto eclipseState = Parser::parse( eclipse_data_filename ); + auto deck = Parser().parseFile( eclipse_data_filename, parse_context ); + auto eclipseState = Parser::parse( deck ); { /* eclipseWriter is scoped here to ensure it is destroyed after the * file itself has been written, because we're going to reload it @@ -190,9 +193,11 @@ BOOST_AUTO_TEST_CASE(test_RFT2) { const auto& grid = eclipseState.getInputGrid(); const auto numCells = grid.getCartesianSize( ); - EclipseIO eclipseWriter( eclipseState, grid); - time_t start_time = eclipseState.getSchedule().posixStartTime(); - const auto& time_map = eclipseState.getSchedule().getTimeMap( ); + Schedule schedule(deck, grid, eclipseState.get3DProperties(), eclipseState.runspec().phases(), parse_context); + SummaryConfig summary_config( deck, schedule, eclipseState.getTableManager( ), parse_context); + EclipseIO eclipseWriter( eclipseState, grid, schedule, summary_config ); + time_t start_time = schedule.posixStartTime(); + const auto& time_map = schedule.getTimeMap( ); for (int counter = 0; counter < 2; counter++) { for (size_t step = 0; step < time_map.size(); step++) { diff --git a/tests/test_Restart.cpp b/tests/test_Restart.cpp index 0488e097d..2e2487a2d 100644 --- a/tests/test_Restart.cpp +++ b/tests/test_Restart.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -388,6 +389,27 @@ void compare( const RestartValue& fst, BOOST_CHECK_EQUAL( fst.wells, snd.wells ); } + +struct Setup { + Deck deck; + EclipseState es; + const EclipseGrid& grid; + Schedule schedule; + SummaryConfig summary_config; + + Setup( const char* path, const ParseContext& parseContext = ParseContext( )) : + deck( Parser().parseFile( path, parseContext ) ), + es( deck, parseContext ), + grid( es.getInputGrid( ) ), + schedule( deck, grid, es.get3DProperties(), es.runspec().phases(), parseContext), + summary_config( deck, schedule, es.getTableManager( ), parseContext) + { + } + +}; + + + BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData) { std::map keys {{"PRESSURE" , RestartKey(UnitSystem::measure::pressure)}, {"SWAT" , RestartKey(UnitSystem::measure::identity)}, @@ -396,10 +418,9 @@ BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData) { ERT::TestArea testArea("test_Restart"); testArea.copyFile( "FIRST_SIM.DATA" ); - auto eclipseState = Parser::parse( "FIRST_SIM.DATA" ); - const auto& grid = eclipseState.getInputGrid(); - EclipseIO eclWriter( eclipseState, grid); - auto state1 = first_sim( eclipseState , eclWriter , false ); + Setup setup("FIRST_SIM.DATA"); + EclipseIO eclWriter( setup.es, setup.grid, setup.schedule, setup.summary_config); + auto state1 = first_sim( setup.es , eclWriter , false ); auto state2 = second_sim( eclWriter , keys ); compare(state1, state2 , keys); @@ -440,10 +461,10 @@ BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData_double) { ERT::TestArea testArea("test_Restart"); testArea.copyFile( "FIRST_SIM.DATA" ); - auto eclipseState = Parser::parse( "FIRST_SIM.DATA" ); - const auto& grid = eclipseState.getInputGrid(); - EclipseIO eclWriter( eclipseState, grid); - auto state1 = first_sim( eclipseState , eclWriter , true); + Setup setup("FIRST_SIM.DATA"); + EclipseIO eclWriter( setup.es, setup.grid, setup.schedule, setup.summary_config); + + auto state1 = first_sim( setup.es , eclWriter , true); auto state2 = second_sim( eclWriter , keys ); compare_equal( state1 , state2 , keys); } @@ -454,11 +475,10 @@ BOOST_AUTO_TEST_CASE(WriteWrongSOlutionSize) { if (std::getenv("TRAVIS_CI")) return; - const auto eclipseState = Parser::parse( "FIRST_SIM.DATA" ); - const auto& grid = eclipseState.getInputGrid(); + Setup setup("FIRST_SIM.DATA"); { ERT::TestArea testArea("test_Restart"); - auto num_cells = grid.getNumActive( ) + 1; + auto num_cells = setup.grid.getNumActive( ) + 1; auto cells = mkSolution( num_cells ); auto wells = mkWells(); @@ -466,18 +486,19 @@ BOOST_AUTO_TEST_CASE(WriteWrongSOlutionSize) { 100, cells , wells , - eclipseState , - grid ), std::runtime_error); + setup.es, + setup.grid , + setup.schedule), + std::runtime_error); } } BOOST_AUTO_TEST_CASE(ExtraData_KEYS) { - auto eclipseState = Parser::parse( "FIRST_SIM.DATA" ); - const auto& grid = eclipseState.getInputGrid(); + Setup setup("FIRST_SIM.DATA"); { ERT::TestArea testArea("test_Restart"); - auto num_cells = grid.getNumActive( ); + auto num_cells = setup.grid.getNumActive( ); auto cells = mkSolution( num_cells ); auto wells = mkWells(); @@ -489,8 +510,9 @@ BOOST_AUTO_TEST_CASE(ExtraData_KEYS) { 100, cells , wells , - eclipseState , - grid, + setup.es, + setup.grid, + setup.schedule, extra), std::runtime_error); } @@ -503,8 +525,9 @@ BOOST_AUTO_TEST_CASE(ExtraData_KEYS) { 100, cells , wells , - eclipseState , - grid, + setup.es, + setup.grid, + setup.schedule, extra), std::runtime_error); } @@ -517,8 +540,9 @@ BOOST_AUTO_TEST_CASE(ExtraData_KEYS) { 100, cells , wells , - eclipseState , - grid, + setup.es, + setup.grid, + setup.schedule, extra), std::runtime_error); } @@ -526,11 +550,10 @@ BOOST_AUTO_TEST_CASE(ExtraData_KEYS) { } BOOST_AUTO_TEST_CASE(ExtraData_content) { - auto eclipseState = Parser::parse( "FIRST_SIM.DATA" ); - const auto& grid = eclipseState.getInputGrid(); + Setup setup("FIRST_SIM.DATA"); { ERT::TestArea testArea("test_Restart"); - auto num_cells = grid.getNumActive( ); + auto num_cells = setup.grid.getNumActive( ); auto cells = mkSolution( num_cells ); auto wells = mkWells(); { @@ -540,8 +563,9 @@ BOOST_AUTO_TEST_CASE(ExtraData_content) { 100, cells , wells , - eclipseState , - grid, + setup.es, + setup.grid, + setup.schedule, extra); { @@ -557,11 +581,11 @@ BOOST_AUTO_TEST_CASE(ExtraData_content) { ecl_file_close( f ); } - BOOST_CHECK_THROW( RestartIO::load( "FILE.UNRST" , 1 , {}, eclipseState, grid , {{"NOT-THIS", true}}) , std::runtime_error ); + BOOST_CHECK_THROW( RestartIO::load( "FILE.UNRST" , 1 , {}, setup.es, setup.grid , setup.schedule, {{"NOT-THIS", true}}) , std::runtime_error ); { const auto rst_value = RestartIO::load( "FILE.UNRST" , 1 , {{"SWAT" , RestartKey(UnitSystem::measure::identity)}, {"NO" , {UnitSystem::measure::identity, false}}}, - eclipseState, grid , {{"EXTRA", true}, {"EXTRA2", false}}); + setup.es, setup.grid , setup.schedule, {{"EXTRA", true}, {"EXTRA2", false}}); const auto pair = rst_value.extra.find( "EXTRA" ); const std::vector extraval = pair->second; const std::vector expected = {0,1,2,3}; diff --git a/tests/test_Summary.cpp b/tests/test_Summary.cpp index 5c93f2c40..c5c07ac38 100644 --- a/tests/test_Summary.cpp +++ b/tests/test_Summary.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -203,8 +204,9 @@ ERT::ert_unique_ptr< ecl_sum_type, ecl_sum_free > readsum( const std::string& ba struct setup { Deck deck; EclipseState es; - SummaryConfig config; const EclipseGrid& grid; + Schedule schedule; + SummaryConfig config; data::Wells wells; std::string name; ERT::TestArea ta; @@ -217,14 +219,14 @@ struct setup { setup( const std::string& fname , const char* path = "summary_deck.DATA", const ParseContext& parseContext = ParseContext( )) : deck( Parser().parseFile( path, parseContext ) ), es( deck, ParseContext() ), - config( deck, es.getSchedule(), es.getTableManager(), parseContext ), grid( es.getInputGrid() ), + schedule( deck, grid, es.get3DProperties(), es.runspec().phases(), parseContext), + config( deck, schedule, es.getTableManager(), parseContext ), wells( result_wells() ), name( fname ), ta( ERT::TestArea("test_summary") ), - solution( make_solution( es.getInputGrid() ) ) + solution( make_solution( grid ) ) { - solution = make_solution( es.getInputGrid()); } }; @@ -242,10 +244,10 @@ BOOST_AUTO_TEST_CASE(well_keywords) { util_make_path( "PATH" ); cfg.name = "PATH/CASE"; - out::Summary writer( cfg.es, cfg.config, cfg.grid , cfg.name ); - writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution , {}); - writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution , {}); - writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution , {}); + out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name ); + writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution , {}); + writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution , {}); + writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution , {}); writer.write(); auto res = readsum( cfg.name ); @@ -378,10 +380,10 @@ BOOST_AUTO_TEST_CASE(well_keywords) { BOOST_AUTO_TEST_CASE(group_keywords) { setup cfg( "test_Summary_group" ); - out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name ); - writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution , {}); - writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution , {}); - writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution , {}); + out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); + writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution , {}); + writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution , {}); + writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution , {}); writer.write(); auto res = readsum( cfg.name ); @@ -476,10 +478,10 @@ BOOST_AUTO_TEST_CASE(group_keywords) { BOOST_AUTO_TEST_CASE(group_group) { setup cfg( "test_Summary_group_group" , "group_group.DATA"); - out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name ); - writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution , {}); - writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution , {}); - writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution , {}); + out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); + writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution , {}); + writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution , {}); + writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution , {}); writer.write(); auto res = readsum( cfg.name ); @@ -528,10 +530,10 @@ BOOST_AUTO_TEST_CASE(group_group) { BOOST_AUTO_TEST_CASE(completion_kewords) { setup cfg( "test_Summary_completion" ); - out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name ); - writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution, {}); + out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); + writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); writer.write(); auto res = readsum( cfg.name ); @@ -581,10 +583,10 @@ BOOST_AUTO_TEST_CASE(completion_kewords) { BOOST_AUTO_TEST_CASE(field_keywords) { setup cfg( "test_Summary_field" ); - out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name ); - writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution, {}); + out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); + writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); writer.write(); auto res = readsum( cfg.name ); @@ -678,11 +680,11 @@ BOOST_AUTO_TEST_CASE(foe_test) { data::Solution sol; sol.insert( "OIP", UnitSystem::measure::volume, oip, data::TargetType::RESTART_AUXILIARY ); - out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name ); + out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); writer.set_initial( sol ); - writer.add_timestep( 1, 2 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 1, 5 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 2, 10 * day, cfg.es, cfg.wells , cfg.solution, {}); + writer.add_timestep( 1, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 1, 5 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 2, 10 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); writer.write(); auto res = readsum( cfg.name ); @@ -699,10 +701,10 @@ BOOST_AUTO_TEST_CASE(foe_test) { BOOST_AUTO_TEST_CASE(report_steps_time) { setup cfg( "test_Summary_report_steps_time" ); - out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name ); - writer.add_timestep( 1, 2 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 1, 5 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 2, 10 * day, cfg.es, cfg.wells , cfg.solution, {}); + out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); + writer.add_timestep( 1, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 1, 5 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 2, 10 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); writer.write(); auto res = readsum( cfg.name ); @@ -721,10 +723,10 @@ BOOST_AUTO_TEST_CASE(report_steps_time) { BOOST_AUTO_TEST_CASE(skip_unknown_var) { setup cfg( "test_Summary_skip_unknown_var" ); - out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name ); - writer.add_timestep( 1, 2 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 1, 5 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 2, 10 * day, cfg.es, cfg.wells , cfg.solution, {}); + out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); + writer.add_timestep( 1, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 1, 5 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 2, 10 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); writer.write(); auto res = readsum( cfg.name ); @@ -741,10 +743,10 @@ BOOST_AUTO_TEST_CASE(region_vars) { setup cfg( "region_vars" ); { - out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name ); - writer.add_timestep( 1, 2 * day, cfg.es, cfg.wells, cfg.solution, {}); - writer.add_timestep( 1, 5 * day, cfg.es, cfg.wells, cfg.solution, {}); - writer.add_timestep( 2, 10 * day, cfg.es, cfg.wells, cfg.solution, {}); + out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); + writer.add_timestep( 1, 2 * day, cfg.es, cfg.schedule, cfg.wells, cfg.solution, {}); + writer.add_timestep( 1, 5 * day, cfg.es, cfg.schedule, cfg.wells, cfg.solution, {}); + writer.add_timestep( 2, 10 * day, cfg.es, cfg.schedule, cfg.wells, cfg.solution, {}); writer.write(); } @@ -788,10 +790,10 @@ BOOST_AUTO_TEST_CASE(region_production) { setup cfg( "region_production" ); { - out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name ); - writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution, {}); + out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); + writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); writer.write(); } @@ -816,10 +818,10 @@ BOOST_AUTO_TEST_CASE(region_production) { BOOST_AUTO_TEST_CASE(region_injection) { setup cfg( "region_injection" ); - out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name ); - writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution, {}); + out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); + writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); writer.write(); auto res = readsum( cfg.name ); @@ -845,10 +847,10 @@ BOOST_AUTO_TEST_CASE(region_injection) { BOOST_AUTO_TEST_CASE(BLOCK_VARIABLES) { setup cfg( "region_injection" ); - out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name ); - writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution, {}); + out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); + writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); writer.write(); auto res = readsum( cfg.name ); @@ -891,7 +893,7 @@ BOOST_AUTO_TEST_CASE(BLOCK_VARIABLES) { BOOST_AUTO_TEST_CASE( require3D ) { setup cfg( "XXXX" ); - const auto summaryConfig = cfg.es.getSummaryConfig( ); + const auto summaryConfig = cfg.config; BOOST_CHECK( summaryConfig.require3DField( "PRESSURE" )); BOOST_CHECK( summaryConfig.require3DField( "SGAS" )); @@ -911,10 +913,10 @@ BOOST_AUTO_TEST_CASE( require3D ) BOOST_AUTO_TEST_CASE(fpr) { setup cfg( "test_fpr", "summary_deck_non_constant_porosity.DATA"); - out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name ); - writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution, {}); + out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); + writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); writer.write(); auto res = readsum( cfg.name ); @@ -940,10 +942,10 @@ BOOST_AUTO_TEST_CASE(fpr) { } } - out::Summary writer2( cfg.es, cfg.config, cfg.grid, cfg.name ); - writer2.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer2.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer2.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution, {}); + out::Summary writer2( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); + writer2.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer2.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer2.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); writer2.write(); auto res2 = readsum( cfg.name ); @@ -958,10 +960,10 @@ BOOST_AUTO_TEST_CASE(rpr) { setup cfg( "test_rpr", "summary_deck_non_constant_porosity.DATA"); { - out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name ); - writer.add_timestep( 1, 2 * day, cfg.es, cfg.wells, cfg.solution, {}); - writer.add_timestep( 1, 5 * day, cfg.es, cfg.wells, cfg.solution, {}); - writer.add_timestep( 2, 10 * day, cfg.es, cfg.wells, cfg.solution, {}); + out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); + writer.add_timestep( 1, 2 * day, cfg.es, cfg.schedule, cfg.wells, cfg.solution, {}); + writer.add_timestep( 1, 5 * day, cfg.es, cfg.schedule, cfg.wells, cfg.solution, {}); + writer.add_timestep( 2, 10 * day, cfg.es, cfg.schedule, cfg.wells, cfg.solution, {}); writer.write(); } @@ -998,10 +1000,10 @@ BOOST_AUTO_TEST_CASE(rpr) { BOOST_AUTO_TEST_CASE(MISC) { setup cfg( "test_MISC"); - out::Summary writer( cfg.es, cfg.config, cfg.grid , cfg.name ); - writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution, {}); - writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution, {}); + out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name ); + writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); + writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {}); writer.write(); auto res = readsum( cfg.name ); @@ -1014,17 +1016,17 @@ BOOST_AUTO_TEST_CASE(EXTRA) { setup cfg( "test_EXTRA"); { - out::Summary writer( cfg.es, cfg.config, cfg.grid , cfg.name ); - writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution, { {"TCPU" , 0 }}); - writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution, { {"TCPU" , 1 }}); - writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution, { {"TCPU" , 2}}); + out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name ); + writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, { {"TCPU" , 0 }}); + writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, { {"TCPU" , 1 }}); + writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, { {"TCPU" , 2}}); - /* Add a not-recognized key; that is OK */ - BOOST_CHECK_NO_THROW( writer.add_timestep( 3, 3 * day, cfg.es, cfg.wells , cfg.solution, { {"MISSING" , 2 }})); + /* Add a not-recognized key; that is OK */ + BOOST_CHECK_NO_THROW( writer.add_timestep( 3, 3 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, { {"MISSING" , 2 }})); - /* Override a NOT MISC variable - ignored. */ - writer.add_timestep( 4, 4 * day, cfg.es, cfg.wells , cfg.solution, { {"FOPR" , -1 }}); - writer.write(); + /* Override a NOT MISC variable - ignored. */ + writer.add_timestep( 4, 4 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, { {"FOPR" , -1 }}); + writer.write(); } auto res = readsum( cfg.name ); diff --git a/tests/test_regionCache.cpp b/tests/test_regionCache.cpp index 1ab428705..dfbdf868c 100644 --- a/tests/test_regionCache.cpp +++ b/tests/test_regionCache.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -47,7 +48,8 @@ BOOST_AUTO_TEST_CASE(create) { Deck deck( parser.parseFile( path, parseContext )); EclipseState es(deck , parseContext ); const EclipseGrid& grid = es.getInputGrid(); - out::RegionCache rc(es , grid); + Schedule schedule( deck, grid, es.get3DProperties(), es.runspec().phases(), ParseContext() ); + out::RegionCache rc(es.get3DProperties() , grid, schedule); const auto& c1 = rc.cells( 1 ); diff --git a/tests/test_writenumwells.cpp b/tests/test_writenumwells.cpp index 15c4c33d4..f45cf3791 100644 --- a/tests/test_writenumwells.cpp +++ b/tests/test_writenumwells.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -134,15 +135,19 @@ void verifyWellState(const std::string& rst_filename, BOOST_AUTO_TEST_CASE(EclipseWriteRestartWellInfo) { std::string eclipse_data_filename = "testBlackoilState3.DATA"; std::string eclipse_restart_filename = "TESTBLACKOILSTATE3.X0004"; - test_work_area_type * test_area = test_work_area_alloc("TEST_EclipseWriteNumWells"); test_work_area_copy_file(test_area, eclipse_data_filename.c_str()); - auto es = Parser::parse( eclipse_data_filename, ParseContext() ); - const auto num_cells = es.getInputGrid().getCartesianSize(); - EclipseIO eclipseWriter( es, es.getInputGrid() ); - - int countTimeStep = es.getSchedule().getTimeMap().numTimesteps(); + ParseContext parseContext; + Parser parser; + Deck deck( parser.parseFile( eclipse_data_filename, parseContext )); + EclipseState es(deck , parseContext ); + const EclipseGrid& grid = es.getInputGrid(); + Schedule schedule( deck, grid, es.get3DProperties(), es.runspec().phases(), parseContext); + SummaryConfig summary_config( deck, schedule, es.getTableManager( ), parseContext); + const auto num_cells = grid.getCartesianSize(); + EclipseIO eclipseWriter( es, grid , schedule, summary_config); + int countTimeStep = schedule.getTimeMap().numTimesteps(); data::Solution solution; solution.insert( "PRESSURE",UnitSystem::measure::pressure , std::vector< double >( num_cells, 1 ) , data::TargetType::RESTART_SOLUTION); @@ -159,7 +164,7 @@ BOOST_AUTO_TEST_CASE(EclipseWriteRestartWellInfo) { {} ); } - verifyWellState(eclipse_restart_filename, es.getInputGrid(), es.getSchedule()); + verifyWellState(eclipse_restart_filename, grid, schedule); test_work_area_free(test_area); }