From 1057e6d3d0ad303f68269eccce47209e23c82c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Kvalsvik?= Date: Thu, 13 Oct 2016 16:03:35 +0200 Subject: [PATCH] Update to shared_ptr-less parser interface. --- examples/compute_initial_state.cpp | 8 +-- examples/compute_tof.cpp | 6 +- examples/diagnose_relperm.cpp | 9 ++- examples/mirror_grid.cpp | 46 +++++++-------- examples/wells_example.cpp | 8 +-- opm/core/doxygen_main.hpp | 2 +- opm/core/grid/GridManager.cpp | 22 ++++---- opm/core/grid/GridManager.hpp | 2 +- opm/core/props/BlackoilPropertiesFromDeck.cpp | 38 ++++++------- opm/core/props/BlackoilPropertiesFromDeck.hpp | 30 +++++----- opm/core/props/IncompPropertiesFromDeck.cpp | 4 +- opm/core/props/IncompPropertiesFromDeck.hpp | 4 +- .../props/IncompPropertiesSinglePhase.cpp | 12 ++-- .../props/IncompPropertiesSinglePhase.hpp | 4 +- opm/core/props/phaseUsageFromDeck.hpp | 12 ++-- .../props/pvt/PvtPropertiesIncompFromDeck.cpp | 14 ++--- .../props/pvt/PvtPropertiesIncompFromDeck.hpp | 2 +- opm/core/props/pvt/ThermalGasPvtWrapper.hpp | 4 +- opm/core/props/pvt/ThermalOilPvtWrapper.hpp | 4 +- opm/core/props/pvt/ThermalWaterPvtWrapper.hpp | 4 +- opm/core/props/rock/RockCompressibility.cpp | 10 ++-- opm/core/props/rock/RockCompressibility.hpp | 4 +- opm/core/props/rock/RockFromDeck.cpp | 24 ++++---- opm/core/props/rock/RockFromDeck.hpp | 6 +- opm/core/props/satfunc/RelpermDiagnostics.cpp | 56 +++++++++---------- opm/core/props/satfunc/RelpermDiagnostics.hpp | 20 +++---- .../props/satfunc/RelpermDiagnostics_impl.hpp | 12 ++-- .../props/satfunc/SaturationPropsFromDeck.hpp | 2 +- opm/core/simulator/SimulatorTimer.cpp | 12 ++-- opm/core/simulator/SimulatorTimer.hpp | 2 +- opm/core/simulator/initState.hpp | 6 +- opm/core/simulator/initStateEquil.hpp | 28 +++++----- opm/core/simulator/initStateEquil_impl.hpp | 4 +- opm/core/simulator/initState_impl.hpp | 40 ++++++------- opm/core/utility/CompressedPropertyAccess.hpp | 8 +-- opm/core/utility/extractPvtTableIndex.cpp | 4 +- opm/core/utility/extractPvtTableIndex.hpp | 2 +- opm/core/wells/WellsManager.cpp | 12 ++-- opm/core/wells/WellsManager.hpp | 8 +-- opm/core/wells/WellsManager_impl.hpp | 48 ++++++++-------- tests/test_EclipseWriteRFTHandler.cpp | 4 +- tests/test_blackoilstate.cpp | 16 +++--- tests/test_column_extract.cpp | 10 ++-- tests/test_compressedpropertyaccess.cpp | 17 +++--- tests/test_equil.cpp | 54 +++++++++--------- tests/test_norne_pvt.cpp | 11 ++-- tests/test_parser.cpp | 8 +-- tests/test_pinchprocessor.cpp | 26 ++++----- tests/test_relpermdiagnostics.cpp | 9 ++- tests/test_satfunc.cpp | 34 +++++------ tests/test_stoppedwells.cpp | 9 ++- tests/test_timer.cpp | 6 +- tests/test_ug.cpp | 50 ++++++++--------- tests/test_wellcollection.cpp | 26 ++++----- tests/test_wellsgroup.cpp | 18 +++--- tests/test_wellsmanager.cpp | 44 +++++++-------- tests/test_writeReadRestartFile.cpp | 4 +- tests/test_writenumwells.cpp | 8 +-- 58 files changed, 442 insertions(+), 455 deletions(-) diff --git a/examples/compute_initial_state.cpp b/examples/compute_initial_state.cpp index d4e009f7..f1d1d720 100644 --- a/examples/compute_initial_state.cpp +++ b/examples/compute_initial_state.cpp @@ -88,11 +88,11 @@ try std::cout << "--------------- Reading parameters ---------------" << std::endl; const std::string deck_filename = param.get("deck_filename"); Opm::ParseContext parseContext; - Opm::ParserPtr parser(new Opm::Parser() ); - Opm::DeckConstPtr deck = parser->parseFile(deck_filename , parseContext); - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext)); + Opm::Parser parser; + const Opm::Deck& deck = parser.parseFile(deck_filename , parseContext); + const Opm::EclipseState eclipseState(deck, parseContext); const double grav = param.getDefault("gravity", unit::gravity); - GridManager gm(*eclipseState->getInputGrid()); + GridManager gm(eclipseState.getInputGrid()); const UnstructuredGrid& grid = *gm.c_grid(); BlackoilPropertiesFromDeck props(deck, eclipseState, grid, param); warnIfUnusedParams(param); diff --git a/examples/compute_tof.cpp b/examples/compute_tof.cpp index 761ff2e4..89a5013d 100644 --- a/examples/compute_tof.cpp +++ b/examples/compute_tof.cpp @@ -173,11 +173,11 @@ try std::string deck_filename = param.get("deck_filename"); Parser parser; ParseContext parseContext; - DeckConstPtr deck = parser.parseFile(deck_filename , parseContext); - EclipseStateConstPtr eclipseState = std::make_shared(*deck , parseContext); + const Deck& deck = parser.parseFile(deck_filename , parseContext); + EclipseState eclipseState(deck , parseContext); // Grid init - GridManager grid_manager(*eclipseState->getInputGrid()); + GridManager grid_manager(eclipseState.getInputGrid()); const UnstructuredGrid& grid = *grid_manager.c_grid(); // Rock and fluid init IncompPropertiesSinglePhase props(deck, eclipseState, grid); diff --git a/examples/diagnose_relperm.cpp b/examples/diagnose_relperm.cpp index 3f3def44..07aec746 100644 --- a/examples/diagnose_relperm.cpp +++ b/examples/diagnose_relperm.cpp @@ -65,8 +65,7 @@ try exit(1); } const char* eclipseFilename = argv[1]; - EclipseStateConstPtr eclState; - ParserPtr parser(new Opm::Parser); + Parser parser; Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }, { ParseContext::PARSE_UNKNOWN_KEYWORD, InputError::IGNORE}, { ParseContext::PARSE_RANDOM_TEXT, InputError::IGNORE}, @@ -75,10 +74,10 @@ try { ParseContext::UNSUPPORTED_INITIAL_THPRES, InputError::IGNORE}, { ParseContext::INTERNAL_ERROR_UNINITIALIZED_THPRES, InputError::IGNORE} }); - Opm::DeckConstPtr deck(parser->parseFile(eclipseFilename, parseContext)); - eclState.reset(new EclipseState(*deck, parseContext)); + Opm::Deck deck = parser.parseFile(eclipseFilename, parseContext); + Opm::EclipseState eclState( deck, parseContext ); - GridManager gm(*eclState->getInputGrid()); + GridManager gm(eclState.getInputGrid()); const UnstructuredGrid& grid = *gm.c_grid(); using boost::filesystem::path; path fpath(eclipseFilename); diff --git a/examples/mirror_grid.cpp b/examples/mirror_grid.cpp index 34d29455..a8d39cf1 100644 --- a/examples/mirror_grid.cpp +++ b/examples/mirror_grid.cpp @@ -86,13 +86,13 @@ void printKeywordValues(std::ofstream& out, std::string keyword, std::vector } // forward declaration -std::vector getMapaxesValues(Opm::DeckConstPtr deck); +std::vector getMapaxesValues(const Opm::Deck& deck); /// Mirror keyword MAPAXES in deck -void mirror_mapaxes( std::shared_ptr< const Opm::Deck > deck, std::string direction, std::ofstream& out) { +void mirror_mapaxes( const Opm::Deck& deck, std::string direction, std::ofstream& out) { // Assumes axis aligned with x/y-direction std::cout << "Warning: Keyword MAPAXES not fully understood. Result should be verified manually." << std::endl; - if (deck->hasKeyword("MAPAXES")) { + if (deck.hasKeyword("MAPAXES")) { std::vector mapaxes = getMapaxesValues(deck); std::vector mapaxes_mirrored = mapaxes; // Double the length of the coordinate axis @@ -107,9 +107,9 @@ void mirror_mapaxes( std::shared_ptr< const Opm::Deck > deck, std::string direct } /// Mirror keyword SPECGRID in deck -void mirror_specgrid(std::shared_ptr< const Opm::Deck > deck, std::string direction, std::ofstream& out) { +void mirror_specgrid( const Opm::Deck& deck, std::string direction, std::ofstream& out) { // We only need to multiply the dimension by 2 in the correct direction. - const auto& specgridRecord = deck->getKeyword("SPECGRID").getRecord(0); + const auto& specgridRecord = deck.getKeyword("SPECGRID").getRecord(0); std::vector dimensions(3); dimensions[0] = specgridRecord.getItem("NX").get< int >(0); dimensions[1] = specgridRecord.getItem("NY").get< int >(0); @@ -124,14 +124,14 @@ void mirror_specgrid(std::shared_ptr< const Opm::Deck > deck, std::string direct } /// Mirror keyword COORD in deck -void mirror_coord(std::shared_ptr< const Opm::Deck > deck, std::string direction, std::ofstream& out) { +void mirror_coord(const Opm::Deck& deck, std::string direction, std::ofstream& out) { // We assume uniform spacing in x and y directions and parallel top and bottom faces - const auto& specgridRecord = deck->getKeyword("SPECGRID").getRecord(0); + const auto& specgridRecord = deck.getKeyword("SPECGRID").getRecord(0); std::vector dimensions(3); dimensions[0] = specgridRecord.getItem("NX").get< int >(0); dimensions[1] = specgridRecord.getItem("NY").get< int >(0); dimensions[2] = specgridRecord.getItem("NZ").get< int >(0); - std::vector coord = deck->getKeyword("COORD").getRawDoubleData(); + std::vector coord = deck.getKeyword("COORD").getRawDoubleData(); const int entries_per_pillar = 6; std::vector coord_mirrored; // Handle the two directions differently due to ordering of the pillars. @@ -190,13 +190,13 @@ void mirror_coord(std::shared_ptr< const Opm::Deck > deck, std::string direction } /// Mirror keyword ZCORN in deck -void mirror_zcorn(std::shared_ptr< const Opm::Deck > deck, std::string direction, std::ofstream& out) { - const auto& specgridRecord = deck->getKeyword("SPECGRID").getRecord(0); +void mirror_zcorn(const Opm::Deck& deck, std::string direction, std::ofstream& out) { + const auto& specgridRecord = deck.getKeyword("SPECGRID").getRecord(0); std::vector dimensions(3); dimensions[0] = specgridRecord.getItem("NX").get< int >(0); dimensions[1] = specgridRecord.getItem("NY").get< int >(0); dimensions[2] = specgridRecord.getItem("NZ").get< int >(0); - std::vector zcorn = deck->getKeyword("ZCORN").getRawDoubleData(); + std::vector zcorn = deck.getKeyword("ZCORN").getRawDoubleData(); std::vector zcorn_mirrored; // Handle the two directions differently due to ordering of the pillars. if (direction == "x") { @@ -257,17 +257,17 @@ void mirror_zcorn(std::shared_ptr< const Opm::Deck > deck, std::string direction printKeywordValues(out, "ZCORN", zcorn_mirrored, 8); } -std::vector getKeywordValues(std::string keyword, std::shared_ptr< const Opm::Deck > deck, int /*dummy*/) { - return deck->getKeyword(keyword).getIntData(); +std::vector getKeywordValues(std::string keyword, const Opm::Deck& deck, int /*dummy*/) { + return deck.getKeyword(keyword).getIntData(); } -std::vector getKeywordValues(std::string keyword, std::shared_ptr< const Opm::Deck > deck, double /*dummy*/) { - return deck->getKeyword(keyword).getRawDoubleData(); +std::vector getKeywordValues(std::string keyword, const Opm::Deck& deck, double /*dummy*/) { + return deck.getKeyword(keyword).getRawDoubleData(); } -std::vector getMapaxesValues(Opm::DeckConstPtr deck) +std::vector getMapaxesValues(const Opm::Deck& deck) { - const auto& mapaxesRecord = deck->getKeyword("MAPAXES").getRecord(0); + const auto& mapaxesRecord = deck.getKeyword("MAPAXES").getRecord(0); std::vector result; for (size_t itemIdx = 0; itemIdx < mapaxesRecord.size(); ++itemIdx) { const auto& curItem = mapaxesRecord.getItem(itemIdx); @@ -281,13 +281,13 @@ std::vector getMapaxesValues(Opm::DeckConstPtr deck) /// Mirror keywords that have one value for each cell template -void mirror_celldata(std::string keyword, Opm::DeckConstPtr deck, std::string direction, std::ofstream& out) { - if ( ! deck->hasKeyword(keyword)) { +void mirror_celldata(std::string keyword, const Opm::Deck& deck, std::string direction, std::ofstream& out) { + if ( ! deck.hasKeyword(keyword)) { std::cout << "Ignoring keyword " << keyword << " as it was not found." << std::endl; return; } // Get data from eclipse deck - const auto& specgridRecord = deck->getKeyword("SPECGRID").getRecord(0); + const auto& specgridRecord = deck.getKeyword("SPECGRID").getRecord(0); std::vector dimensions(3); dimensions[0] = specgridRecord.getItem("NX").get< int >(0); dimensions[1] = specgridRecord.getItem("NY").get< int >(0); @@ -365,10 +365,10 @@ int main(int argc, char** argv) // Parse grdecl file std::cout << "Parsing grid file '" << eclipsefilename << "' ..." << std::endl; - Opm::ParserPtr parser(new Opm::Parser); + Opm::Parser parser; Opm::ParseContext parseContext; - Opm::DeckConstPtr deck(parser->parseFile(eclipsefilename , parseContext)); - if ( ! (deck->hasKeyword("SPECGRID") && deck->hasKeyword("COORD") && deck->hasKeyword("ZCORN")) ) { + const Opm::Deck deck(parser.parseFile(eclipsefilename , parseContext)); + if ( ! (deck.hasKeyword("SPECGRID") && deck.hasKeyword("COORD") && deck.hasKeyword("ZCORN")) ) { std::cerr << "Grid file " << eclipsefilename << "are missing keywords SPECGRID, COORD or ZCORN!" << std::endl; exit(1); } diff --git a/examples/wells_example.cpp b/examples/wells_example.cpp index 8f5da704..8be7c7aa 100644 --- a/examples/wells_example.cpp +++ b/examples/wells_example.cpp @@ -36,13 +36,13 @@ try // Read input file ParseContext parseContext; - Opm::ParserPtr parser(new Opm::Parser()); - Opm::DeckConstPtr deck = parser->parseFile(file_name , parseContext); - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext)); + Opm::Parser parser; + Opm::Deck deck = parser.parseFile(file_name , parseContext); + Opm::EclipseState eclipseState(deck , parseContext); std::cout << "Done!" << std::endl; // Setup grid - GridManager grid(*eclipseState->getInputGrid()); + GridManager grid(eclipseState.getInputGrid()); // Define rock and fluid properties IncompPropertiesFromDeck incomp_properties(deck, eclipseState, *grid.c_grid()); diff --git a/opm/core/doxygen_main.hpp b/opm/core/doxygen_main.hpp index bfd4deeb..d10c083d 100644 --- a/opm/core/doxygen_main.hpp +++ b/opm/core/doxygen_main.hpp @@ -48,7 +48,7 @@ creation and destruction of an UnstructuredGrid. The method Opm::GridManager::c_grid() provides access to the underlying UnstructuredGrid structure. This class also provides an easy way to initialize a grid from an ECLIPSE-format input deck, via the -constructor taking an Opm::DeckConstPtr. +constructor taking an const Opm::Deck.

Well handling

diff --git a/opm/core/grid/GridManager.cpp b/opm/core/grid/GridManager.cpp index 723f36fe..02019b0d 100644 --- a/opm/core/grid/GridManager.cpp +++ b/opm/core/grid/GridManager.cpp @@ -174,24 +174,24 @@ namespace Opm } - void GridManager::createGrdecl(Opm::DeckConstPtr deck, struct grdecl &grdecl) + void GridManager::createGrdecl(const Opm::Deck& deck, struct grdecl &grdecl) { // Extract data from deck. - const std::vector& zcorn = deck->getKeyword("ZCORN").getSIDoubleData(); - const std::vector& coord = deck->getKeyword("COORD").getSIDoubleData(); + const std::vector& zcorn = deck.getKeyword("ZCORN").getSIDoubleData(); + const std::vector& coord = deck.getKeyword("COORD").getSIDoubleData(); const int* actnum = NULL; - if (deck->hasKeyword("ACTNUM")) { - actnum = &(deck->getKeyword("ACTNUM").getIntData()[0]); + if (deck.hasKeyword("ACTNUM")) { + actnum = &(deck.getKeyword("ACTNUM").getIntData()[0]); } std::array dims; - if (deck->hasKeyword("DIMENS")) { - const auto& dimensKeyword = deck->getKeyword("DIMENS"); + if (deck.hasKeyword("DIMENS")) { + const auto& dimensKeyword = deck.getKeyword("DIMENS"); dims[0] = dimensKeyword.getRecord(0).getItem(0).get< int >(0); dims[1] = dimensKeyword.getRecord(0).getItem(1).get< int >(0); dims[2] = dimensKeyword.getRecord(0).getItem(2).get< int >(0); - } else if (deck->hasKeyword("SPECGRID")) { - const auto& specgridKeyword = deck->getKeyword("SPECGRID"); + } else if (deck.hasKeyword("SPECGRID")) { + const auto& specgridKeyword = deck.getKeyword("SPECGRID"); dims[0] = specgridKeyword.getRecord(0).getItem(0).get< int >(0); dims[1] = specgridKeyword.getRecord(0).getItem(1).get< int >(0); dims[2] = specgridKeyword.getRecord(0).getItem(2).get< int >(0); @@ -208,8 +208,8 @@ namespace Opm grdecl.dims[1] = dims[1]; grdecl.dims[2] = dims[2]; - if (deck->hasKeyword("MAPAXES")) { - const auto& mapaxesKeyword = deck->getKeyword("MAPAXES"); + if (deck.hasKeyword("MAPAXES")) { + const auto& mapaxesKeyword = deck.getKeyword("MAPAXES"); const auto& mapaxesRecord = mapaxesKeyword.getRecord(0); // memleak alert: here we need to make sure that C code diff --git a/opm/core/grid/GridManager.hpp b/opm/core/grid/GridManager.hpp index 374f6e80..41ae6455 100644 --- a/opm/core/grid/GridManager.hpp +++ b/opm/core/grid/GridManager.hpp @@ -78,7 +78,7 @@ namespace Opm /// to make it clear that we are returning a C-compatible struct. const UnstructuredGrid* c_grid() const; - static void createGrdecl(Opm::DeckConstPtr deck, struct grdecl &grdecl); + static void createGrdecl(const Opm::Deck& deck, struct grdecl &grdecl); private: // Disable copying and assignment. diff --git a/opm/core/props/BlackoilPropertiesFromDeck.cpp b/opm/core/props/BlackoilPropertiesFromDeck.cpp index b2b6b378..0d086fc5 100644 --- a/opm/core/props/BlackoilPropertiesFromDeck.cpp +++ b/opm/core/props/BlackoilPropertiesFromDeck.cpp @@ -29,8 +29,8 @@ namespace Opm { - BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclState, + BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const Opm::Deck& deck, + const Opm::EclipseState& eclState, const UnstructuredGrid& grid, bool init_rock) { @@ -44,8 +44,8 @@ namespace Opm init_rock); } - BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclState, + BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const Opm::Deck& deck, + const Opm::EclipseState& eclState, const UnstructuredGrid& grid, const parameter::ParameterGroup& param, bool init_rock) @@ -59,8 +59,8 @@ namespace Opm init(deck, eclState, materialLawManager, grid.number_of_cells, grid.global_cell, grid.cartdims, param, init_rock); } - BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclState, + BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const Opm::Deck& deck, + const Opm::EclipseState& eclState, int number_of_cells, const int* global_cell, const int* cart_dims, @@ -76,8 +76,8 @@ namespace Opm init_rock); } - BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclState, + BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const Opm::Deck& deck, + const Opm::EclipseState& eclState, int number_of_cells, const int* global_cell, const int* cart_dims, @@ -100,8 +100,8 @@ namespace Opm init_rock); } - BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclState, + BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const Opm::Deck& deck, + const Opm::EclipseState& eclState, std::shared_ptr materialLawManager, int number_of_cells, const int* global_cell, @@ -119,8 +119,8 @@ namespace Opm init_rock); } - inline void BlackoilPropertiesFromDeck::init(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclState, + inline void BlackoilPropertiesFromDeck::init(const Opm::Deck& deck, + const Opm::EclipseState& eclState, std::shared_ptr materialLawManager, int number_of_cells, const int* global_cell, @@ -145,8 +145,8 @@ namespace Opm satprops_.reset(ptr); } - inline void BlackoilPropertiesFromDeck::init(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclState, + inline void BlackoilPropertiesFromDeck::init(const Opm::Deck& deck, + const Opm::EclipseState& eclState, std::shared_ptr materialLawManager, int number_of_cells, const int* global_cell, @@ -170,7 +170,7 @@ namespace Opm // Unfortunate lack of pointer smartness here... std::string threephase_model = param.getDefault("threephase_model", "gwseg"); - if (deck->hasKeyword("ENDSCALE") && threephase_model != "gwseg") { + if (deck.hasKeyword("ENDSCALE") && threephase_model != "gwseg") { OPM_THROW(std::runtime_error, "Sorry, end point scaling currently available for the 'gwseg' model only."); } @@ -690,17 +690,17 @@ namespace Opm return &surfaceDensities_[pvtRegionIdx*pu.num_phases]; } - void BlackoilPropertiesFromDeck::initSurfaceDensities_(Opm::DeckConstPtr deck) + void BlackoilPropertiesFromDeck::initSurfaceDensities_(const Opm::Deck& deck) { const auto& pu = phaseUsage(); int np = pu.num_phases; int numPvtRegions = 1; - if (deck->hasKeyword("TABDIMS")) { - const auto& tabdimsKeyword = deck->getKeyword("TABDIMS"); + if (deck.hasKeyword("TABDIMS")) { + const auto& tabdimsKeyword = deck.getKeyword("TABDIMS"); numPvtRegions = tabdimsKeyword.getRecord(0).getItem("NTPVT").template get(0); } - const auto& densityKeyword = deck->getKeyword("DENSITY"); + const auto& densityKeyword = deck.getKeyword("DENSITY"); surfaceDensities_.resize(np*numPvtRegions); for (int pvtRegionIdx = 0; pvtRegionIdx < numPvtRegions; ++pvtRegionIdx) { diff --git a/opm/core/props/BlackoilPropertiesFromDeck.hpp b/opm/core/props/BlackoilPropertiesFromDeck.hpp index e5c18388..e5d2e449 100644 --- a/opm/core/props/BlackoilPropertiesFromDeck.hpp +++ b/opm/core/props/BlackoilPropertiesFromDeck.hpp @@ -50,8 +50,8 @@ namespace Opm /// \param[in] grid Grid to which property object applies, needed for the /// mapping from cell indices (typically from a processed grid) /// to logical cartesian indices consistent with the deck. - BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclState, + BlackoilPropertiesFromDeck(const Opm::Deck& deck, + const Opm::EclipseState& eclState, const UnstructuredGrid& grid, bool init_rock=true ); /// Initialize from deck, grid and parameters. @@ -65,29 +65,29 @@ namespace Opm /// threephase_model("simple") three-phase relperm model (accepts "simple" and "stone2"). /// For both size parameters, a 0 or negative value indicates that no spline fitting is to /// be done, and the input fluid data used directly for linear interpolation. - BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclState, + BlackoilPropertiesFromDeck(const Opm::Deck& deck, + const Opm::EclipseState& eclState, const UnstructuredGrid& grid, const parameter::ParameterGroup& param, bool init_rock=true); - BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclState, + BlackoilPropertiesFromDeck(const Opm::Deck& deck, + const Opm::EclipseState& eclState, int number_of_cells, const int* global_cell, const int* cart_dims, bool init_rock=true); - BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclState, + BlackoilPropertiesFromDeck(const Opm::Deck& deck, + const Opm::EclipseState& eclState, int number_of_cells, const int* global_cell, const int* cart_dims, const parameter::ParameterGroup& param, bool init_rock=true); - BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclState, + BlackoilPropertiesFromDeck(const Opm::Deck& deck, + const Opm::EclipseState& eclState, std::shared_ptr materialLawManager, int number_of_cells, const int* global_cell, @@ -258,7 +258,7 @@ namespace Opm return pvtTableIdx[cellIdx]; } - void initSurfaceDensities_(Opm::DeckConstPtr deck); + void initSurfaceDensities_(const Opm::Deck& deck); void compute_B_(const int n, const double* p, @@ -290,16 +290,16 @@ namespace Opm double* R, double* dRdp) const; - void init(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclState, + void init(const Opm::Deck& deck, + const Opm::EclipseState& eclState, std::shared_ptr materialLawManager, int number_of_cells, const int* global_cell, const int* cart_dims, bool init_rock); - void init(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclState, + void init(const Opm::Deck& deck, + const Opm::EclipseState& eclState, std::shared_ptr materialLawManager, int number_of_cells, const int* global_cell, diff --git a/opm/core/props/IncompPropertiesFromDeck.cpp b/opm/core/props/IncompPropertiesFromDeck.cpp index 969aeb2c..98b33ebc 100644 --- a/opm/core/props/IncompPropertiesFromDeck.cpp +++ b/opm/core/props/IncompPropertiesFromDeck.cpp @@ -27,8 +27,8 @@ namespace Opm { - IncompPropertiesFromDeck::IncompPropertiesFromDeck(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclState, + IncompPropertiesFromDeck::IncompPropertiesFromDeck(const Opm::Deck& deck, + const Opm::EclipseState& eclState, const UnstructuredGrid& grid) { rock_.init(eclState, grid.number_of_cells, grid.global_cell, grid.cartdims); diff --git a/opm/core/props/IncompPropertiesFromDeck.hpp b/opm/core/props/IncompPropertiesFromDeck.hpp index 4932ed80..b5fce2ba 100644 --- a/opm/core/props/IncompPropertiesFromDeck.hpp +++ b/opm/core/props/IncompPropertiesFromDeck.hpp @@ -52,8 +52,8 @@ namespace Opm /// \param grid Grid to which property object applies, needed for the /// mapping from cell indices (typically from a processed grid) /// to logical cartesian indices consistent with the deck. - IncompPropertiesFromDeck(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclState, + IncompPropertiesFromDeck(const Opm::Deck& deck, + const Opm::EclipseState& eclState, const UnstructuredGrid& grid); /// Destructor. diff --git a/opm/core/props/IncompPropertiesSinglePhase.cpp b/opm/core/props/IncompPropertiesSinglePhase.cpp index dff06785..abe57576 100644 --- a/opm/core/props/IncompPropertiesSinglePhase.cpp +++ b/opm/core/props/IncompPropertiesSinglePhase.cpp @@ -31,14 +31,14 @@ namespace Opm { - IncompPropertiesSinglePhase::IncompPropertiesSinglePhase(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclState, + IncompPropertiesSinglePhase::IncompPropertiesSinglePhase(const Opm::Deck& deck, + const Opm::EclipseState& eclState, const UnstructuredGrid& grid) { rock_.init(eclState, grid.number_of_cells, grid.global_cell, grid.cartdims); - if (deck->hasKeyword("DENSITY")) { - const auto& densityRecord = deck->getKeyword("DENSITY").getRecord(0); + if (deck.hasKeyword("DENSITY")) { + const auto& densityRecord = deck.getKeyword("DENSITY").getRecord(0); surface_density_ = densityRecord.getItem("OIL").getSIDouble(0); } else { surface_density_ = 1000.0; @@ -49,8 +49,8 @@ namespace Opm // This will be modified if we have a PVCDO specification. reservoir_density_ = surface_density_; - if (deck->hasKeyword("PVCDO")) { - const auto& pvcdoRecord = deck->getKeyword("PVCDO").getRecord(0); + if (deck.hasKeyword("PVCDO")) { + const auto& pvcdoRecord = deck.getKeyword("PVCDO").getRecord(0); if (pvcdoRecord.getItem("OIL_COMPRESSIBILITY").getSIDouble(0) != 0.0 || pvcdoRecord.getItem("OIL_VISCOSIBILITY").getSIDouble(0) != 0.0) { OPM_MESSAGE("Compressibility effects in PVCDO are ignored."); diff --git a/opm/core/props/IncompPropertiesSinglePhase.hpp b/opm/core/props/IncompPropertiesSinglePhase.hpp index 0be6df08..9dbb5591 100644 --- a/opm/core/props/IncompPropertiesSinglePhase.hpp +++ b/opm/core/props/IncompPropertiesSinglePhase.hpp @@ -53,8 +53,8 @@ namespace Opm /// \param grid Grid to which property object applies, needed for the /// mapping from cell indices (typically from a processed grid) /// to logical cartesian indices consistent with the deck. - IncompPropertiesSinglePhase(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclState, + IncompPropertiesSinglePhase(const Opm::Deck& deck, + const Opm::EclipseState& eclState, const UnstructuredGrid& grid); /// Destructor. diff --git a/opm/core/props/phaseUsageFromDeck.hpp b/opm/core/props/phaseUsageFromDeck.hpp index 88571e45..ea347d9d 100644 --- a/opm/core/props/phaseUsageFromDeck.hpp +++ b/opm/core/props/phaseUsageFromDeck.hpp @@ -33,12 +33,12 @@ namespace Opm /// Looks at presence of WATER, OIL and GAS keywords in state object /// to determine active phases. - inline PhaseUsage phaseUsageFromDeck(Opm::EclipseStateConstPtr eclipseState) + inline PhaseUsage phaseUsageFromDeck(const Opm::EclipseState& eclipseState) { PhaseUsage pu; std::fill(pu.phase_used, pu.phase_used + BlackoilPhases::MaxNumPhases, 0); - const auto& tm = eclipseState->getTableManager(); + const auto& tm = eclipseState.getTableManager(); // Discover phase usage. if (tm.hasPhase(Phase::PhaseEnum::WATER)) { pu.phase_used[BlackoilPhases::Aqua] = 1; @@ -71,19 +71,19 @@ namespace Opm /// Looks at presence of WATER, OIL and GAS keywords in deck /// to determine active phases. - inline PhaseUsage phaseUsageFromDeck(Opm::DeckConstPtr deck) + inline PhaseUsage phaseUsageFromDeck(const Opm::Deck& deck) { PhaseUsage pu; std::fill(pu.phase_used, pu.phase_used + BlackoilPhases::MaxNumPhases, 0); // Discover phase usage. - if (deck->hasKeyword("WATER")) { + if (deck.hasKeyword("WATER")) { pu.phase_used[BlackoilPhases::Aqua] = 1; } - if (deck->hasKeyword("OIL")) { + if (deck.hasKeyword("OIL")) { pu.phase_used[BlackoilPhases::Liquid] = 1; } - if (deck->hasKeyword("GAS")) { + if (deck.hasKeyword("GAS")) { pu.phase_used[BlackoilPhases::Vapour] = 1; } pu.num_phases = 0; diff --git a/opm/core/props/pvt/PvtPropertiesIncompFromDeck.cpp b/opm/core/props/pvt/PvtPropertiesIncompFromDeck.cpp index cea7da2d..dfb072c5 100644 --- a/opm/core/props/pvt/PvtPropertiesIncompFromDeck.cpp +++ b/opm/core/props/pvt/PvtPropertiesIncompFromDeck.cpp @@ -36,7 +36,7 @@ namespace Opm { } - void PvtPropertiesIncompFromDeck::init(Opm::DeckConstPtr deck) + void PvtPropertiesIncompFromDeck::init(const Opm::Deck& deck) { // So far, this class only supports a single PVT region. TODO? int region_number = 0; @@ -49,8 +49,8 @@ namespace Opm } // Surface densities. Accounting for different orders in eclipse and our code. - if (deck->hasKeyword("DENSITY")) { - const auto& densityRecord = deck->getKeyword("DENSITY").getRecord(region_number); + if (deck.hasKeyword("DENSITY")) { + const auto& densityRecord = deck.getKeyword("DENSITY").getRecord(region_number); surface_density_[phase_usage.phase_pos[PhaseUsage::Aqua]] = densityRecord.getItem("OIL").getSIDouble(0); surface_density_[phase_usage.phase_pos[PhaseUsage::Liquid]] = densityRecord.getItem("WATER").getSIDouble(0); } else { @@ -62,8 +62,8 @@ namespace Opm reservoir_density_ = surface_density_; // Water viscosity. - if (deck->hasKeyword("PVTW")) { - const auto& pvtwRecord = deck->getKeyword("PVTW").getRecord(region_number); + if (deck.hasKeyword("PVTW")) { + const auto& pvtwRecord = deck.getKeyword("PVTW").getRecord(region_number); if (pvtwRecord.getItem("WATER_COMPRESSIBILITY").getSIDouble(0) != 0.0 || pvtwRecord.getItem("WATER_VISCOSIBILITY").getSIDouble(0) != 0.0) { OPM_MESSAGE("Compressibility effects in PVTW are ignored."); @@ -77,8 +77,8 @@ namespace Opm } // Oil viscosity. - if (deck->hasKeyword("PVCDO")) { - const auto& pvcdoRecord = deck->getKeyword("PVCDO").getRecord(region_number); + if (deck.hasKeyword("PVCDO")) { + const auto& pvcdoRecord = deck.getKeyword("PVCDO").getRecord(region_number); if (pvcdoRecord.getItem("OIL_COMPRESSIBILITY").getSIDouble(0) != 0.0 || pvcdoRecord.getItem("OIL_VISCOSIBILITY").getSIDouble(0) != 0.0) { diff --git a/opm/core/props/pvt/PvtPropertiesIncompFromDeck.hpp b/opm/core/props/pvt/PvtPropertiesIncompFromDeck.hpp index 94ede51c..b64c42c0 100644 --- a/opm/core/props/pvt/PvtPropertiesIncompFromDeck.hpp +++ b/opm/core/props/pvt/PvtPropertiesIncompFromDeck.hpp @@ -38,7 +38,7 @@ namespace Opm PvtPropertiesIncompFromDeck(); /// Initialize from deck. - void init(Opm::DeckConstPtr deck); + void init(const Opm::Deck& deck); /// Number of active phases. int numPhases() const; diff --git a/opm/core/props/pvt/ThermalGasPvtWrapper.hpp b/opm/core/props/pvt/ThermalGasPvtWrapper.hpp index d2fe70f5..42dbffc7 100644 --- a/opm/core/props/pvt/ThermalGasPvtWrapper.hpp +++ b/opm/core/props/pvt/ThermalGasPvtWrapper.hpp @@ -41,8 +41,8 @@ namespace Opm /// extract the quantities needed specify the temperature dependence of the gas /// viscosity and density from the deck void initFromDeck(std::shared_ptr isothermalPvt, - Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclipseState) + const Opm::Deck& deck, + const Opm::EclipseState& eclipseState) { isothermalPvt_ = isothermalPvt; auto tables = eclipseState->getTableManager(); diff --git a/opm/core/props/pvt/ThermalOilPvtWrapper.hpp b/opm/core/props/pvt/ThermalOilPvtWrapper.hpp index 5ded2f4b..f0ee645d 100644 --- a/opm/core/props/pvt/ThermalOilPvtWrapper.hpp +++ b/opm/core/props/pvt/ThermalOilPvtWrapper.hpp @@ -41,8 +41,8 @@ namespace Opm /// set the tables which specify the temperature dependence of the oil viscosity void initFromDeck(std::shared_ptr isothermalPvt, - Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclipseState) + const Opm::Deck& deck, + const Opm::EclipseState& eclipseState) { isothermalPvt_ = isothermalPvt; diff --git a/opm/core/props/pvt/ThermalWaterPvtWrapper.hpp b/opm/core/props/pvt/ThermalWaterPvtWrapper.hpp index 9f666543..ae0bdada 100644 --- a/opm/core/props/pvt/ThermalWaterPvtWrapper.hpp +++ b/opm/core/props/pvt/ThermalWaterPvtWrapper.hpp @@ -41,8 +41,8 @@ namespace Opm /// set the tables which specify the temperature dependence of the water viscosity void initFromDeck(std::shared_ptr isothermalPvt, - Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclipseState) + const Opm::Deck& deck, + const Opm::EclipseState& eclipseState) { isothermalPvt_ = isothermalPvt; watvisctTables_ = 0; diff --git a/opm/core/props/rock/RockCompressibility.cpp b/opm/core/props/rock/RockCompressibility.cpp index bb067904..f84125f0 100644 --- a/opm/core/props/rock/RockCompressibility.cpp +++ b/opm/core/props/rock/RockCompressibility.cpp @@ -41,12 +41,12 @@ namespace Opm rock_comp_ = param.getDefault("rock_compressibility", 0.0)/unit::barsa; } - RockCompressibility::RockCompressibility(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclipseState) + RockCompressibility::RockCompressibility(const Opm::Deck& deck, + const Opm::EclipseState& eclipseState) : pref_(0.0), rock_comp_(0.0) { - const auto& tables = eclipseState->getTableManager(); + const auto& tables = eclipseState.getTableManager(); const auto& rocktabTables = tables.getRocktabTables(); if (rocktabTables.size() > 0) { const auto& rocktabTable = rocktabTables.getTable(0); @@ -60,8 +60,8 @@ namespace Opm } else { transmult_ = rocktabTable.getColumn("PV_MULT_TRANX").vectorCopy(); } - } else if (deck->hasKeyword("ROCK")) { - const auto& rockKeyword = deck->getKeyword("ROCK"); + } else if (deck.hasKeyword("ROCK")) { + const auto& rockKeyword = deck.getKeyword("ROCK"); if (rockKeyword.size() != 1) { // here it would be better not to use std::cout directly but to add the // warning to some "warning list"... diff --git a/opm/core/props/rock/RockCompressibility.hpp b/opm/core/props/rock/RockCompressibility.hpp index 9d38ca0b..675733aa 100644 --- a/opm/core/props/rock/RockCompressibility.hpp +++ b/opm/core/props/rock/RockCompressibility.hpp @@ -35,8 +35,8 @@ namespace Opm public: /// Construct from input deck. /// Looks for the keywords ROCK and ROCKTAB. - RockCompressibility(Opm::DeckConstPtr deck, - Opm::EclipseStateConstPtr eclipseState); + RockCompressibility(const Opm::Deck& deck, + const Opm::EclipseState& eclipseState); /// Construct from parameters. /// Accepts the following parameters (with defaults). diff --git a/opm/core/props/rock/RockFromDeck.cpp b/opm/core/props/rock/RockFromDeck.cpp index cf5eb0df..7a4de8dd 100644 --- a/opm/core/props/rock/RockFromDeck.cpp +++ b/opm/core/props/rock/RockFromDeck.cpp @@ -50,12 +50,12 @@ namespace Opm typedef GridPropertyAccess::Compressed PermComponent; PermComponent - extractPermComponent(EclipseStateConstPtr ecl, + extractPermComponent(const EclipseState& ecl, const std::string& kw, const int* global_cell); PermeabilityKind - fillTensor(EclipseStateConstPtr eclState, + fillTensor(const EclipseState& eclState, const int* global_cell, std::vector& tensor, std::array& kmap); @@ -80,7 +80,7 @@ namespace Opm { } - void RockFromDeck::init(Opm::EclipseStateConstPtr eclState, + void RockFromDeck::init(const Opm::EclipseState& eclState, int number_of_cells, const int* global_cell, const int* cart_dims) { @@ -91,7 +91,7 @@ namespace Opm perm_threshold); } - void RockFromDeck::assignPorosity(Opm::EclipseStateConstPtr eclState, + void RockFromDeck::assignPorosity(const Opm::EclipseState& eclState, int number_of_cells, const int* global_cell) { typedef GridPropertyAccess::ArrayPolicy @@ -106,7 +106,7 @@ namespace Opm } } - void RockFromDeck::assignPermeability(Opm::EclipseStateConstPtr eclState, + void RockFromDeck::assignPermeability(const Opm::EclipseState& eclState, int number_of_cells, const int* global_cell, const int* cartdims, @@ -181,9 +181,9 @@ namespace Opm /// TensorPerm at least one cross-component given. /// None no components given. /// Invalid invalid set of components given. - PermeabilityKind classifyPermeability(Opm::EclipseStateConstPtr eclState) + PermeabilityKind classifyPermeability(const Opm::EclipseState& eclState) { - auto& props = eclState->get3DProperties(); + auto& props = eclState.get3DProperties(); const bool xx = props.hasDeckDoubleGridProperty("PERMX" ); const bool xy = props.hasDeckDoubleGridProperty("PERMXY"); const bool yx = xy; @@ -290,7 +290,7 @@ namespace Opm /// @param [out] tensor /// @param [out] kmap PermeabilityKind - fillTensor(EclipseStateConstPtr eclState, + fillTensor(const EclipseState& eclState, const int* global_cell, std::vector& tensor, std::array& kmap) @@ -310,7 +310,7 @@ namespace Opm // ----------------------------------------------------------- // 1st row: [ kxx, kxy ], kxz handled in kzx - if (eclState->get3DProperties().hasDeckDoubleGridProperty("PERMX" )) { + if (eclState.get3DProperties().hasDeckDoubleGridProperty("PERMX" )) { kmap[xx] = tensor.size(); tensor.push_back(extractPermComponent(eclState, "PERMX", global_cell)); @@ -323,7 +323,7 @@ namespace Opm // ----------------------------------------------------------- // 2nd row: [ kyy, kyz ], kyx handled in kxy - if (eclState->get3DProperties().hasDeckDoubleGridProperty("PERMY" )) { + if (eclState.get3DProperties().hasDeckDoubleGridProperty("PERMY" )) { kmap[yy] = tensor.size(); tensor.push_back(extractPermComponent(eclState, "PERMY", global_cell)); @@ -340,7 +340,7 @@ namespace Opm kmap[zx] = kmap[xz] = tensor.size(); // Enforce symmetry. tensor.push_back(extractPermComponent(eclState, "PERMZX", global_cell)); } - if (eclState->get3DProperties().hasDeckDoubleGridProperty("PERMZ" )) { + if (eclState.get3DProperties().hasDeckDoubleGridProperty("PERMZ" )) { kmap[zz] = tensor.size(); tensor.push_back(extractPermComponent(eclState, "PERMZ", global_cell)); @@ -351,7 +351,7 @@ namespace Opm } PermComponent - extractPermComponent(EclipseStateConstPtr ecl, + extractPermComponent(const EclipseState& ecl, const std::string& kw, const int* global_cell) { diff --git a/opm/core/props/rock/RockFromDeck.hpp b/opm/core/props/rock/RockFromDeck.hpp index 670f0fb8..00e74958 100644 --- a/opm/core/props/rock/RockFromDeck.hpp +++ b/opm/core/props/rock/RockFromDeck.hpp @@ -47,7 +47,7 @@ namespace Opm /// \param global_cell The mapping fom local to global cell indices. /// global_cell[i] is the corresponding global index of i. /// \param cart_dims The size of the underlying cartesian grid. - void init(Opm::EclipseStateConstPtr eclState, + void init(const Opm::EclipseState& eclState, int number_of_cells, const int* global_cell, const int* cart_dims); @@ -78,10 +78,10 @@ namespace Opm } private: - void assignPorosity(Opm::EclipseStateConstPtr eclState, + void assignPorosity(const Opm::EclipseState& eclState, int number_of_cells, const int* global_cell); - void assignPermeability(Opm::EclipseStateConstPtr eclState, + void assignPermeability(const Opm::EclipseState& eclState, int number_of_cells, const int* global_cell, const int* cart_dims, diff --git a/opm/core/props/satfunc/RelpermDiagnostics.cpp b/opm/core/props/satfunc/RelpermDiagnostics.cpp index ce4839e5..979fcb4b 100644 --- a/opm/core/props/satfunc/RelpermDiagnostics.cpp +++ b/opm/core/props/satfunc/RelpermDiagnostics.cpp @@ -24,12 +24,12 @@ namespace Opm{ - void RelpermDiagnostics::phaseCheck_(DeckConstPtr deck) + void RelpermDiagnostics::phaseCheck_(const Deck& deck) { - bool hasWater = deck->hasKeyword("WATER"); - bool hasGas = deck->hasKeyword("GAS"); - bool hasOil = deck->hasKeyword("OIL"); - bool hasSolvent = deck->hasKeyword("SOLVENT"); + bool hasWater = deck.hasKeyword("WATER"); + bool hasGas = deck.hasKeyword("GAS"); + bool hasOil = deck.hasKeyword("OIL"); + bool hasSolvent = deck.hasKeyword("SOLVENT"); if (hasWater && hasGas && !hasOil && !hasSolvent) { const std::string msg = "System: Water-Gas system."; @@ -62,9 +62,9 @@ namespace Opm{ - void RelpermDiagnostics::satFamilyCheck_(Opm::EclipseStateConstPtr eclState) + void RelpermDiagnostics::satFamilyCheck_(const Opm::EclipseState& eclState) { - const auto& tableManager = eclState->getTableManager(); + const auto& tableManager = eclState.getTableManager(); const TableContainer& swofTables = tableManager.getSwofTables(); const TableContainer& slgofTables= tableManager.getSlgofTables(); const TableContainer& sgofTables = tableManager.getSgofTables(); @@ -105,15 +105,15 @@ namespace Opm{ - void RelpermDiagnostics::tableCheck_(EclipseStateConstPtr eclState, - std::shared_ptr< const Deck > deck) + void RelpermDiagnostics::tableCheck_(const EclipseState& eclState, + const Deck& deck) { - const int numSatRegions = deck->getKeyword("TABDIMS").getRecord(0).getItem("NTSFUN").get< int >(0); + const int numSatRegions = deck.getKeyword("TABDIMS").getRecord(0).getItem("NTSFUN").get< int >(0); { const std::string msg = "Number of saturation regions: " + std::to_string(numSatRegions) + "\n"; OpmLog::info(msg); } - const auto& tableManager = eclState->getTableManager(); + const auto& tableManager = eclState.getTableManager(); const TableContainer& swofTables = tableManager.getSwofTables(); const TableContainer& slgofTables = tableManager.getSlgofTables(); const TableContainer& sgofTables = tableManager.getSgofTables(); @@ -129,46 +129,46 @@ namespace Opm{ const TableContainer& msfnTables = tableManager.getMsfnTables(); for (int satnumIdx = 0; satnumIdx < numSatRegions; ++satnumIdx) { - if (deck->hasKeyword("SWOF")) { + if (deck.hasKeyword("SWOF")) { swofTableCheck_(swofTables.getTable(satnumIdx), satnumIdx+1); } - if (deck->hasKeyword("SGOF")) { + if (deck.hasKeyword("SGOF")) { sgofTableCheck_(sgofTables.getTable(satnumIdx), satnumIdx+1); } - if (deck->hasKeyword("SLGOF")) { + if (deck.hasKeyword("SLGOF")) { slgofTableCheck_(slgofTables.getTable(satnumIdx), satnumIdx+1); } - if (deck->hasKeyword("SWFN")) { + if (deck.hasKeyword("SWFN")) { swfnTableCheck_(swfnTables.getTable(satnumIdx), satnumIdx+1); } - if (deck->hasKeyword("SGFN")) { + if (deck.hasKeyword("SGFN")) { sgfnTableCheck_(sgfnTables.getTable(satnumIdx), satnumIdx+1); } - if (deck->hasKeyword("SOF3")) { + if (deck.hasKeyword("SOF3")) { sof3TableCheck_(sof3Tables.getTable(satnumIdx), satnumIdx+1); } - if (deck->hasKeyword("SOF2")) { + if (deck.hasKeyword("SOF2")) { sof2TableCheck_(sof2Tables.getTable(satnumIdx), satnumIdx+1); } - if (deck->hasKeyword("SGWFN")) { + if (deck.hasKeyword("SGWFN")) { sgwfnTableCheck_(sgwfnTables.getTable(satnumIdx), satnumIdx+1); } - if (deck->hasKeyword("SGCWMIS")) { + if (deck.hasKeyword("SGCWMIS")) { sgcwmisTableCheck_(sgcwmisTables.getTable(satnumIdx), satnumIdx+1); } - if (deck->hasKeyword("SORWMIS")) { + if (deck.hasKeyword("SORWMIS")) { sorwmisTableCheck_(sorwmisTables.getTable(satnumIdx), satnumIdx+1); } - if (deck->hasKeyword("SSFN")) { + if (deck.hasKeyword("SSFN")) { ssfnTableCheck_(ssfnTables.getTable(satnumIdx), satnumIdx+1); } - if (deck->hasKeyword("MSFN")) { + if (deck.hasKeyword("MSFN")) { msfnTableCheck_(msfnTables.getTable(satnumIdx), satnumIdx+1); } } - if (deck->hasKeyword("MISCIBLE")) { + if (deck.hasKeyword("MISCIBLE")) { const int numMiscNumIdx = miscTables.size(); const std::string msg = "Number of misc regions: " + std::to_string(numMiscNumIdx) + "\n"; OpmLog::info(msg); @@ -586,14 +586,14 @@ namespace Opm{ - void RelpermDiagnostics::unscaledEndPointsCheck_(DeckConstPtr deck, - EclipseStateConstPtr eclState) + void RelpermDiagnostics::unscaledEndPointsCheck_(const Deck& deck, + const EclipseState& eclState) { // get the number of saturation regions and the number of cells in the deck - const int numSatRegions = deck->getKeyword("TABDIMS").getRecord(0).getItem("NTSFUN").get< int >(0); + const int numSatRegions = deck.getKeyword("TABDIMS").getRecord(0).getItem("NTSFUN").get< int >(0); unscaledEpsInfo_.resize(numSatRegions); - const auto& tables = eclState->getTableManager(); + const auto& tables = eclState.getTableManager(); const TableContainer& swofTables = tables.getSwofTables(); const TableContainer& sgofTables = tables.getSgofTables(); const TableContainer& slgofTables = tables.getSlgofTables(); diff --git a/opm/core/props/satfunc/RelpermDiagnostics.hpp b/opm/core/props/satfunc/RelpermDiagnostics.hpp index e8db76ad..75002c21 100644 --- a/opm/core/props/satfunc/RelpermDiagnostics.hpp +++ b/opm/core/props/satfunc/RelpermDiagnostics.hpp @@ -58,8 +58,8 @@ namespace Opm { ///\param[in] deck ecliplise data file. ///\param[in] grid unstructured grid. template - void diagnosis(EclipseStateConstPtr eclState, - DeckConstPtr deck, + void diagnosis(const EclipseState& eclState, + const Deck& deck, const GridT& grid); private: @@ -86,22 +86,22 @@ namespace Opm { ///Check the phase that used. - void phaseCheck_(DeckConstPtr deck); + void phaseCheck_(const Deck& deck); ///Check saturation family I and II. - void satFamilyCheck_(EclipseStateConstPtr eclState); + void satFamilyCheck_(const EclipseState& eclState); ///Check saturation tables. - void tableCheck_(EclipseStateConstPtr eclState, - DeckConstPtr deck); + void tableCheck_(const EclipseState& eclState, + const Deck& deck); ///Check endpoints in the saturation tables. - void unscaledEndPointsCheck_(DeckConstPtr deck, - EclipseStateConstPtr eclState); + void unscaledEndPointsCheck_(const Deck& deck, + const EclipseState& eclState); template - void scaledEndPointsCheck_(DeckConstPtr deck, - EclipseStateConstPtr eclState, + void scaledEndPointsCheck_(const Deck& deck, + const EclipseState& eclState, const GridT& grid); ///For every table, need to deal with case by case. diff --git a/opm/core/props/satfunc/RelpermDiagnostics_impl.hpp b/opm/core/props/satfunc/RelpermDiagnostics_impl.hpp index 2f72a2fc..c036f03b 100644 --- a/opm/core/props/satfunc/RelpermDiagnostics_impl.hpp +++ b/opm/core/props/satfunc/RelpermDiagnostics_impl.hpp @@ -29,8 +29,8 @@ namespace Opm { template - void RelpermDiagnostics::diagnosis(Opm::EclipseStateConstPtr eclState, - Opm::DeckConstPtr deck, + void RelpermDiagnostics::diagnosis(const Opm::EclipseState& eclState, + const Opm::Deck& deck, const GridT& grid) { OpmLog::info("\n***************Saturation Functions Diagnostics***************"); @@ -42,8 +42,8 @@ namespace Opm { } template - void RelpermDiagnostics::scaledEndPointsCheck_(DeckConstPtr deck, - EclipseStateConstPtr eclState, + void RelpermDiagnostics::scaledEndPointsCheck_(const Deck& deck, + const EclipseState& eclState, const GridT& grid) { const int nc = Opm::UgGridHelpers::numCells(grid); @@ -53,7 +53,7 @@ namespace Opm { scaledEpsInfo_.resize(nc); EclEpsGridProperties epsGridProperties; epsGridProperties.initFromDeck(deck, eclState, /*imbibition=*/false); - const auto& satnum = eclState->get3DProperties().getIntGridProperty("SATNUM"); + const auto& satnum = eclState.get3DProperties().getIntGridProperty("SATNUM"); const std::string tag = "Scaled endpoints"; for (int c = 0; c < nc; ++c) { @@ -80,7 +80,7 @@ namespace Opm { OpmLog::warning(tag, msg); } - if (deck->hasKeyword("SCALECRS") && fluidSystem_ == FluidSystem::BlackOil) { + if (deck.hasKeyword("SCALECRS") && fluidSystem_ == FluidSystem::BlackOil) { // Mobilility check. if ((scaledEpsInfo_[c].Sowcr + scaledEpsInfo_[c].Swcr) >= 1.0) { const std::string msg = "For scaled endpoints input, cell" + cellIdx + " SATNUM = " + satnumIdx + ", SOWCR + SWCR exceed 1.0"; diff --git a/opm/core/props/satfunc/SaturationPropsFromDeck.hpp b/opm/core/props/satfunc/SaturationPropsFromDeck.hpp index b2c211e6..0fb07edc 100644 --- a/opm/core/props/satfunc/SaturationPropsFromDeck.hpp +++ b/opm/core/props/satfunc/SaturationPropsFromDeck.hpp @@ -66,7 +66,7 @@ namespace Opm /// Initialize from deck and MaterialLawManager. /// \param[in] deck Input deck /// \param[in] materialLawManager An initialized MaterialLawManager object - void init(Opm::DeckConstPtr deck, + void init(const Opm::Deck& deck, std::shared_ptr materialLawManager) { init(Opm::phaseUsageFromDeck(deck), materialLawManager); diff --git a/opm/core/simulator/SimulatorTimer.cpp b/opm/core/simulator/SimulatorTimer.cpp index f94baf87..cedcaeef 100644 --- a/opm/core/simulator/SimulatorTimer.cpp +++ b/opm/core/simulator/SimulatorTimer.cpp @@ -49,17 +49,17 @@ namespace Opm } /// Use the SimulatorTimer as a shim around opm-parser's Opm::TimeMap - void SimulatorTimer::init(Opm::TimeMapConstPtr timeMap, size_t report_step) + void SimulatorTimer::init(const TimeMap& timeMap, size_t report_step) { - total_time_ = timeMap->getTotalTime(); - timesteps_.resize(timeMap->numTimesteps()); - for ( size_t i = 0; i < timeMap->numTimesteps(); ++i ) { - timesteps_[i] = timeMap->getTimeStepLength(i); + total_time_ = timeMap.getTotalTime(); + timesteps_.resize(timeMap.numTimesteps()); + for ( size_t i = 0; i < timeMap.numTimesteps(); ++i ) { + timesteps_[i] = timeMap.getTimeStepLength(i); } setCurrentStepNum(report_step); - boost::posix_time::ptime start_time = timeMap->getStartTime(0); + boost::posix_time::ptime start_time = timeMap.getStartTime(0); start_date_ = start_time.date(); } diff --git a/opm/core/simulator/SimulatorTimer.hpp b/opm/core/simulator/SimulatorTimer.hpp index 52494a39..ada0cc04 100644 --- a/opm/core/simulator/SimulatorTimer.hpp +++ b/opm/core/simulator/SimulatorTimer.hpp @@ -47,7 +47,7 @@ namespace Opm void init(const parameter::ParameterGroup& param); /// Use the SimulatorTimer as a shim around opm-parser's Opm::TimeMap - void init(TimeMapConstPtr timeMap, size_t report_step = 0); + void init(const TimeMap& timeMap, size_t report_step = 0); /// Whether the current step is the first step. bool initialStep() const; diff --git a/opm/core/simulator/initState.hpp b/opm/core/simulator/initState.hpp index 7e995536..bfb876f4 100644 --- a/opm/core/simulator/initState.hpp +++ b/opm/core/simulator/initState.hpp @@ -181,7 +181,7 @@ namespace Opm template void initStateFromDeck(const UnstructuredGrid& grid, const Props& props, - Opm::DeckConstPtr deck, + const Opm::Deck& deck, const double gravity, State& state); @@ -196,7 +196,7 @@ namespace Opm template void initBlackoilStateFromDeck(const UnstructuredGrid& grid, const Props& props, - Opm::DeckConstPtr deck, + const Opm::Deck& deck, const double gravity, State& state); /// Initialize a blackoil state from input deck. @@ -209,7 +209,7 @@ namespace Opm CCI begin_cell_centroids, int dimensions, const Props& props, - Opm::DeckConstPtr deck, + const Opm::Deck& deck, const double gravity, State& state); } // namespace Opm diff --git a/opm/core/simulator/initStateEquil.hpp b/opm/core/simulator/initStateEquil.hpp index 0894a2af..6eb58c54 100644 --- a/opm/core/simulator/initStateEquil.hpp +++ b/opm/core/simulator/initStateEquil.hpp @@ -72,8 +72,8 @@ namespace Opm template void initStateEquil(const Grid& grid, const BlackoilPropertiesInterface& props, - const Opm::DeckConstPtr deck, - const Opm::EclipseStateConstPtr eclipseState, + const Opm::Deck& deck, + const Opm::EclipseState& eclipseState, const double gravity, BlackoilState& state); @@ -213,16 +213,16 @@ namespace Opm template inline std::vector - equilnum(const Opm::DeckConstPtr deck, - const Opm::EclipseStateConstPtr eclipseState, + equilnum(const Opm::Deck& deck, + const Opm::EclipseState& eclipseState, const Grid& G ) { std::vector eqlnum; - if (deck->hasKeyword("EQLNUM")) { + if (deck.hasKeyword("EQLNUM")) { const int nc = UgGridHelpers::numCells(G); eqlnum.resize(nc); const std::vector& e = - eclipseState->get3DProperties().getIntGridProperty("EQLNUM").getData(); + eclipseState.get3DProperties().getIntGridProperty("EQLNUM").getData(); const int* gc = UgGridHelpers::globalCell(G); for (int cell = 0; cell < nc; ++cell) { const int deck_pos = (gc == NULL) ? cell : gc[cell]; @@ -243,8 +243,8 @@ namespace Opm public: template InitialStateComputer(BlackoilPropertiesInterface& props, - const Opm::DeckConstPtr deck, - const Opm::EclipseStateConstPtr eclipseState, + const Opm::Deck& deck, + const Opm::EclipseState& eclipseState, const Grid& G , const double grav = unit::gravity) : pp_(props.numPhases(), @@ -255,14 +255,14 @@ namespace Opm rv_(UgGridHelpers::numCells(G)) { // Get the equilibration records. - const std::vector rec = getEquil(*eclipseState); - const auto& tables = eclipseState->getTableManager(); + const std::vector rec = getEquil(eclipseState); + const auto& tables = eclipseState.getTableManager(); // Create (inverse) region mapping. const RegionMapping<> eqlmap(equilnum(deck, eclipseState, G)); // Create Rs functions. rs_func_.reserve(rec.size()); - if (deck->hasKeyword("DISGAS")) { + if (deck.hasKeyword("DISGAS")) { const TableContainer& rsvdTables = tables.getRsvdTables(); for (size_t i = 0; i < rec.size(); ++i) { if (eqlmap.cells(i).empty()) @@ -300,7 +300,7 @@ namespace Opm } rv_func_.reserve(rec.size()); - if (deck->hasKeyword("VAPOIL")) { + if (deck.hasKeyword("VAPOIL")) { const TableContainer& rvvdTables = tables.getRvvdTables(); for (size_t i = 0; i < rec.size(); ++i) { if (eqlmap.cells(i).empty()) @@ -342,8 +342,8 @@ namespace Opm // Check for presence of kw SWATINIT - if (deck->hasKeyword("SWATINIT")) { - const std::vector& swat_init = eclipseState-> + if (deck.hasKeyword("SWATINIT")) { + const std::vector& swat_init = eclipseState. get3DProperties().getDoubleGridProperty("SWATINIT").getData(); const int nc = UgGridHelpers::numCells(G); swat_init_.resize(nc); diff --git a/opm/core/simulator/initStateEquil_impl.hpp b/opm/core/simulator/initStateEquil_impl.hpp index 1c0286df..f0d948e5 100644 --- a/opm/core/simulator/initStateEquil_impl.hpp +++ b/opm/core/simulator/initStateEquil_impl.hpp @@ -886,8 +886,8 @@ namespace Opm template void initStateEquil(const Grid& grid, BlackoilPropertiesFromDeck& props, - const Opm::DeckConstPtr deck, - const Opm::EclipseStateConstPtr eclipseState, + const Opm::Deck& deck, + const Opm::EclipseState& eclipseState, const double gravity, BlackoilState& state) { diff --git a/opm/core/simulator/initState_impl.hpp b/opm/core/simulator/initState_impl.hpp index a7b3c710..fd4cbb01 100644 --- a/opm/core/simulator/initState_impl.hpp +++ b/opm/core/simulator/initState_impl.hpp @@ -621,7 +621,7 @@ namespace Opm template void initStateFromDeck(const UnstructuredGrid& grid, const Props& props, - Opm::DeckConstPtr deck, + const Opm::Deck& deck, const double gravity, State& state) { @@ -640,7 +640,7 @@ namespace Opm CCI begin_cell_centroids, int dimensions, const Props& props, - Opm::DeckConstPtr deck, + const Opm::Deck& deck, const double gravity, State& state) { @@ -650,12 +650,12 @@ namespace Opm OPM_THROW(std::runtime_error, "initStateFromDeck(): user specified property object with " << num_phases << " phases, " "found " << pu.num_phases << " phases in deck."); } - if (deck->hasKeyword("EQUIL") && deck->hasKeyword("PRESSURE")) { + if (deck.hasKeyword("EQUIL") && deck.hasKeyword("PRESSURE")) { OPM_THROW(std::runtime_error, "initStateFromDeck(): The deck must either specify the initial " "condition using the PRESSURE _or_ the EQUIL keyword (currently it has both)"); } - if (deck->hasKeyword("EQUIL")) { + if (deck.hasKeyword("EQUIL")) { if (num_phases != 2) { OPM_THROW(std::runtime_error, "initStateFromDeck(): EQUIL-based init currently handling only two-phase scenarios."); } @@ -663,7 +663,7 @@ namespace Opm OPM_THROW(std::runtime_error, "initStateFromDeck(): EQUIL-based init currently handling only oil-water scenario (no gas)."); } // Set saturations depending on oil-water contact. - Equil equil( deck->getKeyword( "EQUIL" ) ); + Equil equil( deck.getKeyword( "EQUIL" ) ); if (equil.size() != 1) { OPM_THROW(std::runtime_error, "initStateFromDeck(): No region support yet."); } @@ -675,19 +675,19 @@ namespace Opm const double datum_p = equil.getRecord( 0 ).datumDepthPressure(); initHydrostaticPressure(number_of_cells, begin_cell_centroids, dimensions, props, woc, gravity, datum_z, datum_p, state); - } else if (deck->hasKeyword("PRESSURE")) { + } else if (deck.hasKeyword("PRESSURE")) { // Set saturations from SWAT/SGAS, pressure from PRESSURE. std::vector& s = state.saturation(); std::vector& p = state.pressure(); - const std::vector& p_deck = deck->getKeyword("PRESSURE").getSIDoubleData(); + const std::vector& p_deck = deck.getKeyword("PRESSURE").getSIDoubleData(); const int num_cells = number_of_cells; if (num_phases == 2) { if (!pu.phase_used[BlackoilPhases::Aqua]) { // oil-gas: we require SGAS - if (!deck->hasKeyword("SGAS")) { + if (!deck.hasKeyword("SGAS")) { OPM_THROW(std::runtime_error, "initStateFromDeck(): missing SGAS keyword in 2-phase init"); } - const std::vector& sg_deck = deck->getKeyword("SGAS").getSIDoubleData(); + const std::vector& sg_deck = deck.getKeyword("SGAS").getSIDoubleData(); const int gpos = pu.phase_pos[BlackoilPhases::Vapour]; const int opos = pu.phase_pos[BlackoilPhases::Liquid]; for (int c = 0; c < num_cells; ++c) { @@ -698,10 +698,10 @@ namespace Opm } } else { // water-oil or water-gas: we require SWAT - if (!deck->hasKeyword("SWAT")) { + if (!deck.hasKeyword("SWAT")) { OPM_THROW(std::runtime_error, "initStateFromDeck(): missing SWAT keyword in 2-phase init"); } - const std::vector& sw_deck = deck->getKeyword("SWAT").getSIDoubleData(); + const std::vector& sw_deck = deck.getKeyword("SWAT").getSIDoubleData(); const int wpos = pu.phase_pos[BlackoilPhases::Aqua]; const int nwpos = (wpos + 1) % 2; for (int c = 0; c < num_cells; ++c) { @@ -712,15 +712,15 @@ namespace Opm } } } else if (num_phases == 3) { - const bool has_swat_sgas = deck->hasKeyword("SWAT") && deck->hasKeyword("SGAS"); + const bool has_swat_sgas = deck.hasKeyword("SWAT") && deck.hasKeyword("SGAS"); if (!has_swat_sgas) { OPM_THROW(std::runtime_error, "initStateFromDeck(): missing SGAS or SWAT keyword in 3-phase init."); } const int wpos = pu.phase_pos[BlackoilPhases::Aqua]; const int gpos = pu.phase_pos[BlackoilPhases::Vapour]; const int opos = pu.phase_pos[BlackoilPhases::Liquid]; - const std::vector& sw_deck = deck->getKeyword("SWAT").getSIDoubleData(); - const std::vector& sg_deck = deck->getKeyword("SGAS").getSIDoubleData(); + const std::vector& sw_deck = deck.getKeyword("SWAT").getSIDoubleData(); + const std::vector& sg_deck = deck.getKeyword("SGAS").getSIDoubleData(); for (int c = 0; c < num_cells; ++c) { int c_deck = (global_cell == NULL) ? c : global_cell[c]; s[3*c + wpos] = sw_deck[c_deck]; @@ -910,7 +910,7 @@ namespace Opm template void initBlackoilStateFromDeck(const UnstructuredGrid& grid, const Props& props, - Opm::DeckConstPtr deck, + const Opm::Deck& deck, const double gravity, State& state) { @@ -930,15 +930,15 @@ namespace Opm CCI begin_cell_centroids, int dimensions, const Props& props, - Opm::DeckConstPtr deck, + const Opm::Deck& deck, const double gravity, State& state) { initStateFromDeck(number_of_cells, global_cell, number_of_faces, face_cells, begin_face_centroids, begin_cell_centroids, dimensions, props, deck, gravity, state); - if (deck->hasKeyword("RS")) { - const std::vector& rs_deck = deck->getKeyword("RS").getSIDoubleData(); + if (deck.hasKeyword("RS")) { + const std::vector& rs_deck = deck.getKeyword("RS").getSIDoubleData(); const int num_cells = number_of_cells; for (int c = 0; c < num_cells; ++c) { int c_deck = (global_cell == NULL) ? c : global_cell[c]; @@ -946,8 +946,8 @@ namespace Opm } initBlackoilSurfvolUsingRSorRV(number_of_cells, props, state); computeSaturation(props,state); - } else if (deck->hasKeyword("RV")){ - const std::vector& rv_deck = deck->getKeyword("RV").getSIDoubleData(); + } else if (deck.hasKeyword("RV")){ + const std::vector& rv_deck = deck.getKeyword("RV").getSIDoubleData(); const int num_cells = number_of_cells; for (int c = 0; c < num_cells; ++c) { int c_deck = (global_cell == NULL) ? c : global_cell[c]; diff --git a/opm/core/utility/CompressedPropertyAccess.hpp b/opm/core/utility/CompressedPropertyAccess.hpp index 7fb038d5..562557b8 100644 --- a/opm/core/utility/CompressedPropertyAccess.hpp +++ b/opm/core/utility/CompressedPropertyAccess.hpp @@ -110,7 +110,7 @@ namespace Opm { HasProperty::p(PropertyContainer& ecl, const std::string& kw) { - return ecl->get3DProperties().hasDeckIntGridProperty(kw); + return ecl.get3DProperties().hasDeckIntGridProperty(kw); } /** @@ -145,7 +145,7 @@ namespace Opm { HasProperty::p(PropertyContainer& ecl, const std::string& kw) { - return ecl->get3DProperties().hasDeckDoubleGridProperty(kw); + return ecl.get3DProperties().hasDeckDoubleGridProperty(kw); } /** @@ -181,7 +181,7 @@ namespace Opm { { assert (HasProperty::p(ecl, kw)); - return &ecl->get3DProperties().getIntGridProperty(kw); + return &ecl.get3DProperties().getIntGridProperty(kw); } /** @@ -217,7 +217,7 @@ namespace Opm { { assert (HasProperty::p(ecl, kw)); - return &ecl->get3DProperties().getDoubleGridProperty(kw); + return &ecl.get3DProperties().getDoubleGridProperty(kw); } } // namespace EclPropImpl diff --git a/opm/core/utility/extractPvtTableIndex.cpp b/opm/core/utility/extractPvtTableIndex.cpp index d7b75f63..738039dd 100644 --- a/opm/core/utility/extractPvtTableIndex.cpp +++ b/opm/core/utility/extractPvtTableIndex.cpp @@ -27,12 +27,12 @@ namespace Opm { void extractPvtTableIndex(std::vector &pvtTableIdx, - Opm::EclipseStateConstPtr eclState, + const Opm::EclipseState& eclState, size_t numCompressed, const int *compressedToCartesianCellIdx) { //Get the PVTNUM data - const std::vector& pvtnumData = eclState->get3DProperties().getIntGridProperty("PVTNUM").getData(); + const std::vector& pvtnumData = eclState.get3DProperties().getIntGridProperty("PVTNUM").getData(); // Convert this into an array of compressed cells // Eclipse uses Fortran-style indices which start at 1 // instead of 0, we subtract 1. diff --git a/opm/core/utility/extractPvtTableIndex.hpp b/opm/core/utility/extractPvtTableIndex.hpp index 550e258f..72447046 100644 --- a/opm/core/utility/extractPvtTableIndex.hpp +++ b/opm/core/utility/extractPvtTableIndex.hpp @@ -24,7 +24,7 @@ namespace Opm { void extractPvtTableIndex(std::vector &pvtTableIdx, - Opm::EclipseStateConstPtr eclState, + const Opm::EclipseState& eclState, size_t numCompressed, const int *compressedToCartesianCellIdx); diff --git a/opm/core/wells/WellsManager.cpp b/opm/core/wells/WellsManager.cpp index 897d5301..746a6ec2 100644 --- a/opm/core/wells/WellsManager.cpp +++ b/opm/core/wells/WellsManager.cpp @@ -326,7 +326,7 @@ namespace Opm } /// Construct wells from deck. - WellsManager::WellsManager(const Opm::EclipseStateConstPtr eclipseState, + WellsManager::WellsManager(const Opm::EclipseState& eclipseState, const size_t timeStep, const UnstructuredGrid& grid, const double* permeability) @@ -729,11 +729,11 @@ namespace Opm } - void WellsManager::addChildGroups(GroupTreeNodeConstPtr parentNode, ScheduleConstPtr schedule, size_t timeStep, const PhaseUsage& phaseUsage) { - for (auto childIter = parentNode->begin(); childIter != parentNode->end(); ++childIter) { - GroupTreeNodeConstPtr childNode = (*childIter).second; - well_collection_.addGroup(schedule->getGroup(childNode->name()), parentNode->name(), timeStep, phaseUsage); - addChildGroups(childNode, schedule, timeStep, phaseUsage); + void WellsManager::addChildGroups(const GroupTreeNode& parentNode, const Schedule& schedule, size_t timeStep, const PhaseUsage& phaseUsage) { + for (auto childIter = parentNode.begin(); childIter != parentNode.end(); ++childIter) { + const auto& childNode = (*childIter).second; + well_collection_.addGroup(schedule.getGroup(childNode->name()), parentNode.name(), timeStep, phaseUsage); + addChildGroups(*childNode, schedule, timeStep, phaseUsage); } } diff --git a/opm/core/wells/WellsManager.hpp b/opm/core/wells/WellsManager.hpp index 56e2526a..f32323b1 100644 --- a/opm/core/wells/WellsManager.hpp +++ b/opm/core/wells/WellsManager.hpp @@ -83,7 +83,7 @@ namespace Opm /// like shut wells. E.g. in a a parallel run these would be /// the wells handeled by another process. Defaults to empty set. template - WellsManager(const Opm::EclipseStateConstPtr eclipseState, + WellsManager(const Opm::EclipseState& eclipseState, const size_t timeStep, int num_cells, const int* global_cell, @@ -97,7 +97,7 @@ namespace Opm const std::vector& well_potentials={}, const std::unordered_set& deactivated_wells = {}); - WellsManager(const Opm::EclipseStateConstPtr eclipseState, + WellsManager(const Opm::EclipseState& eclipseState, const size_t timeStep, const UnstructuredGrid& grid, const double* permeability); @@ -154,7 +154,7 @@ namespace Opm private: template - void init(const Opm::EclipseStateConstPtr eclipseState, + void init(const Opm::EclipseState& eclipseState, const size_t timeStep, int num_cells, const int* global_cell, @@ -193,7 +193,7 @@ namespace Opm const std::unordered_set& deactivated_wells, const DynamicListEconLimited& list_econ_limited); - void addChildGroups(GroupTreeNodeConstPtr parentNode, std::shared_ptr< const Schedule > schedule, size_t timeStep, const PhaseUsage& phaseUsage); + void addChildGroups(const GroupTreeNode& parentNode, const Schedule& schedule, size_t timeStep, const PhaseUsage& phaseUsage); void setupGuideRates(std::vector& wells, const size_t timeStep, std::vector& well_data, std::map& well_names_to_index, const PhaseUsage& phaseUsage, const std::vector& well_potentials); // Data diff --git a/opm/core/wells/WellsManager_impl.hpp b/opm/core/wells/WellsManager_impl.hpp index 99cf17e8..b6fd9e2c 100644 --- a/opm/core/wells/WellsManager_impl.hpp +++ b/opm/core/wells/WellsManager_impl.hpp @@ -161,15 +161,13 @@ void WellsManager::createWellsFromSpecs(std::vector& wells, size_t } { // COMPDAT handling - auto completionSet = well->getCompletions(timeStep); // shut completions and open ones stored in this process will have 1 others 0. - for (size_t c=0; csize(); c++) { - CompletionConstPtr completion = completionSet->get(c); - if (completion->getState() == WellCompletion::OPEN) { - int i = completion->getI(); - int j = completion->getJ(); - int k = completion->getK(); + for(const auto& completion : well->getCompletions(timeStep)) { + if (completion.getState() == WellCompletion::OPEN) { + int i = completion.getI(); + int j = completion.getJ(); + int k = completion.getK(); const int* cpgdim = cart_dims; int cart_grid_indx = i + cpgdim[0]*(j + cpgdim[1]*k); @@ -195,12 +193,12 @@ void WellsManager::createWellsFromSpecs(std::vector& wells, size_t PerfData pd; pd.cell = cell; { - const Value& transmissibilityFactor = completion->getConnectionTransmissibilityFactorAsValueObject(); - const double wellPi = completion ->getWellPi(); + const Value& transmissibilityFactor = completion.getConnectionTransmissibilityFactorAsValueObject(); + const double wellPi = completion.getWellPi(); if (transmissibilityFactor.hasValue()) { pd.well_index = transmissibilityFactor.getValue(); } else { - double radius = 0.5*completion->getDiameter(); + double radius = 0.5*completion.getDiameter(); if (radius <= 0.0) { radius = 0.5*unit::feet; OPM_MESSAGE("**** Warning: Well bore internal radius set to " << radius); @@ -217,8 +215,8 @@ void WellsManager::createWellsFromSpecs(std::vector& wells, size_t const double* cell_perm = &permeability[dimensions*dimensions*cell]; pd.well_index = WellsManagerDetail::computeWellIndex(radius, cubical, cell_perm, - completion->getSkinFactor(), - completion->getDirection(), + completion.getSkinFactor(), + completion.getDirection(), ntg[cell]); } pd.well_index *= wellPi; @@ -226,8 +224,8 @@ void WellsManager::createWellsFromSpecs(std::vector& wells, size_t wellperf_data[active_well_index].push_back(pd); } } else { - if (completion->getState() != WellCompletion::SHUT) { - OPM_THROW(std::runtime_error, "Completion state: " << WellCompletion::StateEnum2String( completion->getState() ) << " not handled"); + if (completion.getState() != WellCompletion::SHUT) { + OPM_THROW(std::runtime_error, "Completion state: " << WellCompletion::StateEnum2String( completion.getState() ) << " not handled"); } } } @@ -305,7 +303,7 @@ void WellsManager::createWellsFromSpecs(std::vector& wells, size_t template WellsManager:: -WellsManager(const Opm::EclipseStateConstPtr eclipseState, +WellsManager(const Opm::EclipseState& eclipseState, const size_t timeStep, int number_of_cells, const int* global_cell, @@ -328,7 +326,7 @@ WellsManager(const Opm::EclipseStateConstPtr eclipseState, /// Construct wells from deck. template void -WellsManager::init(const Opm::EclipseStateConstPtr eclipseState, +WellsManager::init(const Opm::EclipseState& eclipseState, const size_t timeStep, int number_of_cells, const int* global_cell, @@ -347,7 +345,7 @@ WellsManager::init(const Opm::EclipseStateConstPtr eclipseState, "the corresponding grid is 3-dimensional."); } - if (eclipseState->getSchedule()->numWells() == 0) { + if (eclipseState.getSchedule().numWells() == 0) { OPM_MESSAGE("No wells specified in Schedule section, " "initializing no wells"); return; @@ -369,8 +367,8 @@ WellsManager::init(const Opm::EclipseStateConstPtr eclipseState, // For easy lookup: std::map well_names_to_index; - auto schedule = eclipseState->getSchedule(); - auto wells = schedule->getWells(timeStep); + const auto& schedule = eclipseState.getSchedule(); + auto wells = schedule.getWells(timeStep); std::vector wells_on_proc; well_names.reserve(wells.size()); @@ -382,7 +380,7 @@ WellsManager::init(const Opm::EclipseStateConstPtr eclipseState, DoubleArray ntg_glob(eclipseState, "NTG", 1.0); NTGArray ntg(ntg_glob, global_cell); - EclipseGridConstPtr eclGrid = eclipseState->getInputGrid(); + const auto& eclGrid = eclipseState.getInputGrid(); // use cell thickness (dz) from eclGrid // dz overwrites values calculated by WellDetails::getCubeDim @@ -390,7 +388,7 @@ WellsManager::init(const Opm::EclipseStateConstPtr eclipseState, { std::vector gc = compressedToCartesian(number_of_cells, global_cell); for (int cell = 0; cell < number_of_cells; ++cell) { - dz[cell] = eclGrid->getCellThicknes(gc[cell]); + dz[cell] = eclGrid.getCellThicknes(gc[cell]); } } @@ -406,13 +404,13 @@ WellsManager::init(const Opm::EclipseStateConstPtr eclipseState, setupWellControls(wells, timeStep, well_names, pu, wells_on_proc, list_econ_limited); { - GroupTreeNodeConstPtr fieldNode = - schedule->getGroupTree(timeStep).getNode("FIELD"); + const auto& fieldNode = + schedule.getGroupTree(timeStep).getNode("FIELD"); - const auto& fieldGroup = schedule->getGroup(fieldNode->name()); + const auto& fieldGroup = schedule.getGroup(fieldNode->name()); well_collection_.addField(fieldGroup, timeStep, pu); - addChildGroups(fieldNode, schedule, timeStep, pu); + addChildGroups(*fieldNode, schedule, timeStep, pu); } for (auto w = wells.begin(), e = wells.end(); w != e; ++w) { diff --git a/tests/test_EclipseWriteRFTHandler.cpp b/tests/test_EclipseWriteRFTHandler.cpp index bd4c7299..7b9142e7 100755 --- a/tests/test_EclipseWriteRFTHandler.cpp +++ b/tests/test_EclipseWriteRFTHandler.cpp @@ -90,9 +90,9 @@ void verifyRFTFile(const std::string& rft_filename) { -Opm::DeckConstPtr createDeck(const std::string& input_str) { +const Opm::Deck createDeck(const std::string& input_str) { Opm::ParserPtr parser = std::make_shared(); - Opm::DeckConstPtr deck = parser->parseString(input_str , Opm::ParseContext()); + const Opm::Deck& deck = parser->parseString(input_str , Opm::ParseContext()); return deck; } diff --git a/tests/test_blackoilstate.cpp b/tests/test_blackoilstate.cpp index bb94eb55..19d41875 100644 --- a/tests/test_blackoilstate.cpp +++ b/tests/test_blackoilstate.cpp @@ -41,17 +41,17 @@ BOOST_AUTO_TEST_CASE(EqualsDifferentDeckReturnFalse) { const string filename2 = "testBlackoilState2.DATA"; const auto es1 = Opm::Parser::parse(filename1); - auto eg1 = es1.getInputGridCopy(); + auto eg1 = es1.getInputGrid(); std::vector actnum = get_testBlackoilStateActnum(); - eg1->resetACTNUM(actnum.data()); + eg1.resetACTNUM(actnum.data()); const auto es2 = Opm::Parser::parse(filename2); - auto eg2 = es2.getInputGrid(); + const auto& eg2 = es2.getInputGrid(); - GridManager gridManager1(*eg1); + GridManager gridManager1(eg1); const UnstructuredGrid& grid1 = *gridManager1.c_grid(); - GridManager gridManager2(*eg2); + GridManager gridManager2(eg2); const UnstructuredGrid& grid2 = *gridManager2.c_grid(); BlackoilState state1( UgGridHelpers::numCells( grid1 ) , UgGridHelpers::numFaces( grid1 ) , 3); @@ -68,12 +68,12 @@ BOOST_AUTO_TEST_CASE(EqualsNumericalDifferenceReturnFalse) { const string filename = "testBlackoilState1.DATA"; const auto es = Opm::Parser::parse(filename); - auto eg = es.getInputGridCopy(); + auto eg = es.getInputGrid(); std::vector actnum = get_testBlackoilStateActnum(); - eg->resetACTNUM(actnum.data()); + eg.resetACTNUM(actnum.data()); - GridManager gridManager(*eg); + GridManager gridManager(eg); const UnstructuredGrid& grid = *gridManager.c_grid(); BlackoilState state1( UgGridHelpers::numCells( grid ) , UgGridHelpers::numFaces( grid ) , 3); diff --git a/tests/test_column_extract.cpp b/tests/test_column_extract.cpp index 08fcf791..00af7ebc 100644 --- a/tests/test_column_extract.cpp +++ b/tests/test_column_extract.cpp @@ -132,14 +132,14 @@ BOOST_AUTO_TEST_CASE(DisjointColumn) correct_answer[9].resize(1); Opm::ParseContext parseContext; - Opm::ParserPtr parser(new Opm::Parser()); - Opm::DeckConstPtr deck(parser->parseString(grdecl , parseContext)); - Opm::EclipseGridPtr ep = std::make_shared(deck); + Opm::Parser parser; + Opm::Deck deck = parser.parseString(grdecl , parseContext); + Opm::EclipseGrid ep = Opm::EclipseGrid(deck); std::vector actnum; for (size_t i = 1; i <= (3 * 3 * 3); i++) actnum.push_back(i != 14); // ACTNUM 13*1 0 13* 1 - ep->resetACTNUM(actnum.data()); - Opm::GridManager manager(*ep); + ep.resetACTNUM(actnum.data()); + Opm::GridManager manager(ep); VVI columns; Opm::extractColumn(*manager.c_grid(), columns); diff --git a/tests/test_compressedpropertyaccess.cpp b/tests/test_compressedpropertyaccess.cpp index af3024d9..b45715f2 100644 --- a/tests/test_compressedpropertyaccess.cpp +++ b/tests/test_compressedpropertyaccess.cpp @@ -42,16 +42,13 @@ #include struct SetupSimple { - SetupSimple() - { - Opm::ParseContext parseContext; - Opm::ParserPtr parser(new Opm::Parser()); - deck = parser->parseFile("compressed_gridproperty.data" , parseContext); - ecl.reset(new Opm::EclipseState(*deck , parseContext)); - } + SetupSimple() : + deck( Opm::Parser{}.parseFile( "compressed_gridproperty.data", Opm::ParseContext{} ) ), + ecl( deck ) + {} - Opm::DeckConstPtr deck; - Opm::EclipseStateConstPtr ecl; + Opm::Deck deck; + Opm::EclipseState ecl; }; @@ -60,7 +57,7 @@ struct TestFixture : public Setup { TestFixture() : Setup () - , grid (*ecl->getInputGrid()) + , grid (ecl.getInputGrid()) , reltol(1.0e-10) { } diff --git a/tests/test_equil.cpp b/tests/test_equil.cpp index bd50d3d3..75d80281 100644 --- a/tests/test_equil.cpp +++ b/tests/test_equil.cpp @@ -66,32 +66,32 @@ static Opm::EquilRecord mkEquilRecord( double datd, double datp, auto dd = DeckItem::make< double >( "datdep" ); dd.push_back( datd ); - auto dd_dim = std::make_shared< Opm::Dimension >( "dddim", 1 ); + Opm::Dimension dd_dim( "dddim", 1 ); dd.push_backDimension( dd_dim, dd_dim ); auto dp = DeckItem::make< double >( "datps" ); dp.push_back( datp ); - auto dp_dim = std::make_shared< Opm::Dimension >( "dpdim", 1 ); + Opm::Dimension dp_dim( "dpdim", 1 ); dp.push_backDimension( dp_dim, dp_dim ); auto zw = DeckItem::make< double >( "zwoc" ); zw.push_back( zwoc ); - auto zw_dim = std::make_shared< Opm::Dimension >( "zwdim", 1 ); + Opm::Dimension zw_dim( "zwdim", 1 ); zw.push_backDimension( zw_dim, zw_dim ); auto pcow = DeckItem::make< double >( "pcow" ); pcow.push_back( pcow_woc ); - auto pcow_dim = std::make_shared< Opm::Dimension >( "pcowdim", 1 ); + Opm::Dimension pcow_dim( "pcowdim", 1 ); pcow.push_backDimension( pcow_dim, pcow_dim ); auto zg = DeckItem::make< double >( "zgoc" ); zg.push_back( zgoc ); - auto zg_dim = std::make_shared< Opm::Dimension >( "zgdim", 1 ); + Opm::Dimension zg_dim( "zgdim", 1 ); zg.push_backDimension( zg_dim, zg_dim ); auto pcgo = DeckItem::make< double >( "pcgo" ); pcgo.push_back( pcgo_goc ); - auto pcgo_dim = std::make_shared< Opm::Dimension >( "pcgodim", 1 ); + Opm::Dimension pcgo_dim( "pcgodim", 1 ); pcgo.push_backDimension( pcgo_dim, pcgo_dim ); auto i1 = DeckItem::make< int >( "i1" ); @@ -364,9 +364,9 @@ BOOST_AUTO_TEST_CASE (DeckAllDead) std::shared_ptr grid(create_grid_cart3d(1, 1, 10), destroy_grid); Opm::ParseContext parseContext; - Opm::ParserPtr parser(new Opm::Parser() ); - Opm::DeckConstPtr deck = parser->parseFile("deadfluids.DATA" , parseContext); - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext)); + Opm::Parser parser; + Opm::Deck deck = parser.parseFile("deadfluids.DATA" , parseContext); + Opm::EclipseState eclipseState(deck, parseContext); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, *grid, false); Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, *grid, 10.0); const auto& pressures = comp.press(); @@ -391,10 +391,10 @@ BOOST_AUTO_TEST_CASE (CapillaryInversion) // Test setup. Opm::GridManager gm(1, 1, 40, 1.0, 1.0, 2.5); const UnstructuredGrid& grid = *(gm.c_grid()); - Opm::ParserPtr parser(new Opm::Parser() ); + Opm::Parser parser; Opm::ParseContext parseContext; - Opm::DeckConstPtr deck = parser->parseFile("capillary.DATA" , parseContext); - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext)); + Opm::Deck deck = parser.parseFile("capillary.DATA" , parseContext); + Opm::EclipseState eclipseState(deck , parseContext); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false); // Test the capillary inversion for oil-water. @@ -445,10 +445,10 @@ BOOST_AUTO_TEST_CASE (DeckWithCapillary) { Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0); const UnstructuredGrid& grid = *(gm.c_grid()); - Opm::ParserPtr parser(new Opm::Parser() ); + Opm::Parser parser; Opm::ParseContext parseContext; - Opm::DeckConstPtr deck = parser->parseFile("capillary.DATA" , parseContext); - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext)); + Opm::Deck deck = parser.parseFile("capillary.DATA" , parseContext); + Opm::EclipseState eclipseState(deck , parseContext); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false); Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 10.0); @@ -486,10 +486,10 @@ BOOST_AUTO_TEST_CASE (DeckWithCapillaryOverlap) { Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0); const UnstructuredGrid& grid = *(gm.c_grid()); - Opm::ParserPtr parser(new Opm::Parser() ); + Opm::Parser parser; Opm::ParseContext parseContext; - Opm::DeckConstPtr deck = parser->parseFile("capillary_overlap.DATA" , parseContext); - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext)); + Opm::Deck deck = parser.parseFile("capillary_overlap.DATA" , parseContext); + Opm::EclipseState eclipseState(deck , parseContext); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false); Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665); @@ -549,10 +549,10 @@ BOOST_AUTO_TEST_CASE (DeckWithLiveOil) { Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0); const UnstructuredGrid& grid = *(gm.c_grid()); - Opm::ParserPtr parser(new Opm::Parser() ); + Opm::Parser parser; Opm::ParseContext parseContext; - Opm::DeckConstPtr deck = parser->parseFile("equil_liveoil.DATA" , parseContext); - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext)); + Opm::Deck deck = parser.parseFile("equil_liveoil.DATA" , parseContext); + Opm::EclipseState eclipseState(deck , parseContext); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false); Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665); @@ -629,10 +629,10 @@ BOOST_AUTO_TEST_CASE (DeckWithLiveGas) { Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0); const UnstructuredGrid& grid = *(gm.c_grid()); - Opm::ParserPtr parser(new Opm::Parser() ); + Opm::Parser parser; Opm::ParseContext parseContext; - Opm::DeckConstPtr deck = parser->parseFile("equil_livegas.DATA" , parseContext); - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext)); + Opm::Deck deck = parser.parseFile("equil_livegas.DATA" , parseContext); + Opm::EclipseState eclipseState(deck , parseContext); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false); Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665); @@ -712,10 +712,10 @@ BOOST_AUTO_TEST_CASE (DeckWithRSVDAndRVVD) { Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0); const UnstructuredGrid& grid = *(gm.c_grid()); - Opm::ParserPtr parser(new Opm::Parser() ); Opm::ParseContext parseContext; - Opm::DeckConstPtr deck = parser->parseFile("equil_rsvd_and_rvvd.DATA", parseContext); - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext)); + Opm::Parser parser; + Opm::Deck deck = parser.parseFile("equil_rsvd_and_rvvd.DATA", parseContext); + Opm::EclipseState eclipseState(deck , parseContext); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false); Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665); diff --git a/tests/test_norne_pvt.cpp b/tests/test_norne_pvt.cpp index 1a186434..6fd3361f 100644 --- a/tests/test_norne_pvt.cpp +++ b/tests/test_norne_pvt.cpp @@ -57,7 +57,7 @@ using namespace Opm; further semantic meaning. */ -void verify_norne_oil_pvt_region1(Opm::DeckConstPtr deck, Opm::EclipseStateConstPtr eclState) { +void verify_norne_oil_pvt_region1(const Opm::Deck& deck, const Opm::EclipseState& eclState) { Opm::LiveOilPvt oilPvt; oilPvt.initFromDeck(deck, eclState); @@ -131,7 +131,7 @@ void verify_norne_oil_pvt_region1(Opm::DeckConstPtr deck, Opm::EclipseStateConst } -void verify_norne_oil_pvt_region2(Opm::DeckConstPtr deck, Opm::EclipseStateConstPtr eclState) { +void verify_norne_oil_pvt_region2(const Opm::Deck& deck, const Opm::EclipseState& eclState) { Opm::LiveOilPvt oilPvt; oilPvt.initFromDeck(deck, eclState); @@ -276,12 +276,11 @@ void verify_norne_oil_pvt_region2(Opm::DeckConstPtr deck, Opm::EclipseStateConst BOOST_AUTO_TEST_CASE( Test_Norne_PVT) { Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }}); - Opm::ParserPtr parser(new Parser()); + Opm::Parser parser; - std::shared_ptr deck; - deck = parser->parseFile("norne_pvt.data", parseContext); + auto deck = parser.parseFile("norne_pvt.data", parseContext); - Opm::EclipseStateConstPtr eclState(new EclipseState(*deck, parseContext)); + Opm::EclipseState eclState(deck, parseContext); verify_norne_oil_pvt_region1( deck, eclState ); verify_norne_oil_pvt_region2( deck, eclState ); diff --git a/tests/test_parser.cpp b/tests/test_parser.cpp index fa078882..2b481888 100644 --- a/tests/test_parser.cpp +++ b/tests/test_parser.cpp @@ -43,11 +43,11 @@ BOOST_AUTO_TEST_CASE(CreateParser) { const std::string filename1 = "testBlackoilState1.DATA"; Opm::ParseContext parseContext; - Opm::ParserPtr parser(new Opm::Parser() ); - Opm::DeckConstPtr deck = parser->parseFile( filename1 , parseContext); + Opm::Parser parser; + Opm::Deck deck = parser.parseFile( filename1 , parseContext); - BOOST_CHECK_EQUAL( 6U , deck->size() ); - const auto& actnum = deck->getKeyword("ACTNUM").getRecord(0).getItem(0); + BOOST_CHECK_EQUAL( 6U , deck.size() ); + const auto& actnum = deck.getKeyword("ACTNUM").getRecord(0).getItem(0); const std::vector& actnum_data = actnum.getData< int >(); BOOST_CHECK_EQUAL( 1000U , actnum.size() ); diff --git a/tests/test_pinchprocessor.cpp b/tests/test_pinchprocessor.cpp index 2cb0bed3..d9d6bef1 100644 --- a/tests/test_pinchprocessor.cpp +++ b/tests/test_pinchprocessor.cpp @@ -51,18 +51,18 @@ using namespace Opm; BOOST_AUTO_TEST_CASE(Processing) { const std::string filename="../tests/testPinch1.DATA"; - Opm::ParserPtr parser(new Opm::Parser()); + Opm::Parser parser; Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }}); - Opm::DeckConstPtr deck = parser->parseFile(filename, parseContext); - std::shared_ptr eclstate (new Opm::EclipseState(*deck, parseContext)); - const auto& porv = eclstate->get3DProperties().getDoubleGridProperty("PORV").getData(); - EclipseGridConstPtr eclgrid = eclstate->getInputGrid(); + Opm::Deck deck = parser.parseFile(filename, parseContext); + EclipseState eclstate(deck, parseContext); + const auto& porv = eclstate.get3DProperties().getDoubleGridProperty("PORV").getData(); + const auto& eclgrid = eclstate.getInputGrid(); - BOOST_CHECK_EQUAL(eclgrid->getMinpvMode(), MinpvMode::EclSTD); + BOOST_CHECK_EQUAL(eclgrid.getMinpvMode(), MinpvMode::EclSTD); - const int nc_initial = eclgrid->getNumActive(); + const int nc_initial = eclgrid.getNumActive(); - Opm::GridManager gridM(*eclgrid, porv); + Opm::GridManager gridM(eclgrid, porv); typedef UnstructuredGrid Grid; const Grid& grid = *(gridM.c_grid()); const int* global_cell = Opm::UgGridHelpers::globalCell(grid); @@ -74,16 +74,16 @@ BOOST_AUTO_TEST_CASE(Processing) Opm::RockFromDeck rock; rock.init(eclstate, nc, global_cell, cart_dims); - const double minpv = eclgrid->getMinpvValue(); + const double minpv = eclgrid.getMinpvValue(); BOOST_CHECK_EQUAL(minpv, 0.001); - const double thickness = eclgrid->getPinchThresholdThickness(); + const double thickness = eclgrid.getPinchThresholdThickness(); BOOST_CHECK_EQUAL(thickness, 0.001); - auto transMode = eclgrid->getPinchOption(); + auto transMode = eclgrid.getPinchOption(); BOOST_CHECK_EQUAL(transMode, PinchMode::ModeEnum::TOPBOT); - auto multzMode = eclgrid->getMultzOption(); + auto multzMode = eclgrid.getMultzOption(); BOOST_CHECK_EQUAL(multzMode, PinchMode::ModeEnum::TOP); PinchProcessor pinch(minpv, thickness, transMode, multzMode); @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(Processing) std::vector htrans(Opm::UgGridHelpers::numCellFaces(grid)); Grid* ug = const_cast(& grid); tpfa_htrans_compute(ug, rock.permeability(), htrans.data()); - const auto& transMult = eclstate->getTransMult(); + const auto& transMult = eclstate.getTransMult(); std::vector multz(nc, 0.0); for (int i = 0; i < nc; ++i) { multz[i] = transMult.getMultiplier(global_cell[i], Opm::FaceDir::ZPlus); diff --git a/tests/test_relpermdiagnostics.cpp b/tests/test_relpermdiagnostics.cpp index 8814ed01..a6a06965 100644 --- a/tests/test_relpermdiagnostics.cpp +++ b/tests/test_relpermdiagnostics.cpp @@ -50,15 +50,14 @@ BOOST_AUTO_TEST_SUITE () BOOST_AUTO_TEST_CASE(diagnosis) { using namespace Opm; - EclipseStateConstPtr eclState; - ParserPtr parser(new Opm::Parser); + Parser parser; Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }, { ParseContext::PARSE_UNKNOWN_KEYWORD, InputError::IGNORE}, { ParseContext::PARSE_RANDOM_TEXT, InputError::IGNORE} }); - Opm::DeckConstPtr deck(parser->parseFile("../tests/relpermDiagnostics.DATA", parseContext)); - eclState.reset(new EclipseState(*deck, parseContext)); - GridManager gm(*eclState->getInputGrid()); + Opm::Deck deck = parser.parseFile("../tests/relpermDiagnostics.DATA", parseContext); + EclipseState eclState(deck, parseContext); + GridManager gm(eclState.getInputGrid()); const UnstructuredGrid& grid = *gm.c_grid(); std::shared_ptr counterLog = std::make_shared(Log::DefaultMessageTypes); OpmLog::addBackend( "COUNTERLOG" , counterLog ); diff --git a/tests/test_satfunc.cpp b/tests/test_satfunc.cpp index 9fb641a7..a6e883fe 100644 --- a/tests/test_satfunc.cpp +++ b/tests/test_satfunc.cpp @@ -66,10 +66,10 @@ BOOST_AUTO_TEST_CASE (GwsegStandard) Opm::GridManager gm(1, 1, 10, 1.0, 1.0, 5.0); const UnstructuredGrid& grid = *(gm.c_grid()); - Opm::ParserPtr parser(new Opm::Parser() ); Opm::ParseContext parseContext; - Opm::DeckConstPtr deck = parser->parseFile("satfuncStandard.DATA", parseContext); - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext)); + Opm::Parser parser; + Opm::Deck deck = parser.parseFile("satfuncStandard.DATA", parseContext); + Opm::EclipseState eclipseState(deck , parseContext); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, param, false); const int np = 3; @@ -152,10 +152,10 @@ BOOST_AUTO_TEST_CASE (GwsegEPSBase) Opm::GridManager gm(1, 1, 10, 1.0, 1.0, 5.0); const UnstructuredGrid& grid = *(gm.c_grid()); - Opm::ParserPtr parser(new Opm::Parser() ); Opm::ParseContext parseContext; - Opm::DeckConstPtr deck = parser->parseFile("satfuncEPSBase.DATA" , parseContext); - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext)); + Opm::Parser parser; + Opm::Deck deck = parser.parseFile("satfuncEPSBase.DATA" , parseContext); + Opm::EclipseState eclipseState(deck , parseContext); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, param, false); const int np = 3; @@ -239,9 +239,9 @@ BOOST_AUTO_TEST_CASE (GwsegEPS_A) Opm::GridManager gm(1, 1, 10, 1.0, 1.0, 5.0); const UnstructuredGrid& grid = *(gm.c_grid()); Opm::ParseContext parseContext; - Opm::ParserPtr parser(new Opm::Parser() ); - Opm::DeckConstPtr deck = parser->parseFile("satfuncEPS_A.DATA" , parseContext); - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext)); + Opm::Parser parser; + Opm::Deck deck = parser.parseFile("satfuncEPS_A.DATA" , parseContext); + Opm::EclipseState eclipseState(deck , parseContext); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, param, false); const int np = 3; @@ -392,8 +392,8 @@ BOOST_AUTO_TEST_CASE (GwsegEPS_B) Opm::GridManager gm(1, 1, 10, 1.0, 1.0, 5.0); const UnstructuredGrid& grid = *(gm.c_grid()); Opm::ParserPtr parser(new Opm::Parser() ); - Opm::DeckConstPtr deck = parser->parseFile("satfuncEPS_B.DATA"); - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(deck)); + const Opm::Deck& deck = parser->parseFile("satfuncEPS_B.DATA"); + const Opm::EclipseState& eclipseState(new Opm::EclipseState(deck)); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, param, false); const int np = props.numPhases(); @@ -490,10 +490,10 @@ BOOST_AUTO_TEST_CASE (GwsegEPS_C) Opm::GridManager gm(1, 1, 10, 1.0, 1.0, 5.0); const UnstructuredGrid& grid = *(gm.c_grid()); - Opm::ParserPtr parser(new Opm::Parser() ); Opm::ParseContext parseContext; - Opm::DeckConstPtr deck = parser->parseFile("satfuncEPS_C.DATA", parseContext); - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext)); + Opm::Parser parser; + Opm::Deck deck = parser.parseFile("satfuncEPS_C.DATA", parseContext); + Opm::EclipseState eclipseState(deck , parseContext); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, param, false); const int np = 3; @@ -593,10 +593,10 @@ BOOST_AUTO_TEST_CASE (GwsegEPS_D) Opm::GridManager gm(1, 1, 10, 1.0, 1.0, 5.0); const UnstructuredGrid& grid = *(gm.c_grid()); - Opm::ParserPtr parser(new Opm::Parser() ); Opm::ParseContext parseContext; - Opm::DeckConstPtr deck = parser->parseFile("satfuncEPS_D.DATA" , parseContext); - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext)); + Opm::Parser parser; + Opm::Deck deck = parser.parseFile("satfuncEPS_D.DATA" , parseContext); + Opm::EclipseState eclipseState(deck , parseContext); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, param, false); const int np = 3; diff --git a/tests/test_stoppedwells.cpp b/tests/test_stoppedwells.cpp index 3c2a09a9..c1ea918d 100644 --- a/tests/test_stoppedwells.cpp +++ b/tests/test_stoppedwells.cpp @@ -43,12 +43,11 @@ using namespace Opm; BOOST_AUTO_TEST_CASE(TestStoppedWells) { const std::string filename = "wells_stopped.data"; - Opm::ParserPtr parser(new Opm::Parser()); Opm::ParseContext parseContext; - Opm::DeckConstPtr deck(parser->parseFile(filename , parseContext)); - - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext)); - Opm::GridManager gridManager(*eclipseState->getInputGrid()); + Opm::Parser parser; + Opm::Deck deck(parser.parseFile(filename , parseContext)); + Opm::EclipseState eclipseState(deck , parseContext); + Opm::GridManager gridManager(eclipseState.getInputGrid()); double target_surfacerate_inj; double target_surfacerate_prod; diff --git a/tests/test_timer.cpp b/tests/test_timer.cpp index 05b10f59..59d1bcf7 100644 --- a/tests/test_timer.cpp +++ b/tests/test_timer.cpp @@ -43,11 +43,11 @@ BOOST_AUTO_TEST_CASE(CreateTimer) { const std::string filename1 = "TESTTIMER.DATA"; - Opm::ParserPtr parser(new Opm::Parser() ); Opm::ParseContext parseContext; - Opm::DeckConstPtr parserDeck = parser->parseFile( filename1 , parseContext); + Opm::Parser parser; + Opm::Deck parserDeck = parser.parseFile( filename1 , parseContext); - Opm::TimeMapPtr timeMap(new Opm::TimeMap(parserDeck)); + Opm::TimeMap timeMap( parserDeck ); Opm::SimulatorTimer simtimer; boost::gregorian::date defaultStartDate( 2012, 1, 1); diff --git a/tests/test_ug.cpp b/tests/test_ug.cpp index 3c650b8c..23aff953 100644 --- a/tests/test_ug.cpp +++ b/tests/test_ug.cpp @@ -55,19 +55,19 @@ BOOST_AUTO_TEST_CASE(Equal) { "EDIT\n" "\n"; - Opm::ParserPtr parser(new Opm::Parser() ); + Opm::Parser parser; - Opm::DeckConstPtr deck1 = parser->parseFile( filename1 , parseContext); - Opm::EclipseState es1(*deck1, parseContext); + Opm::Deck deck1 = parser.parseFile( filename1 , parseContext); + Opm::EclipseState es1(deck1, parseContext); - Opm::DeckConstPtr deck2 = parser->parseString( deck2Data , parseContext); - Opm::EclipseState es2(*deck2, parseContext); + Opm::Deck deck2 = parser.parseString( deck2Data , parseContext); + Opm::EclipseState es2(deck2, parseContext); - BOOST_CHECK( deck1->hasKeyword("ZCORN") ); - BOOST_CHECK( deck1->hasKeyword("COORD") ); + BOOST_CHECK( deck1.hasKeyword("ZCORN") ); + BOOST_CHECK( deck1.hasKeyword("COORD") ); - Opm::GridManager grid1(*es1.getInputGrid()); - Opm::GridManager grid2(*es2.getInputGrid()); + Opm::GridManager grid1(es1.getInputGrid()); + Opm::GridManager grid2(es2.getInputGrid()); const UnstructuredGrid* cgrid1 = grid1.c_grid(); const UnstructuredGrid* cgrid2 = grid2.c_grid(); @@ -84,21 +84,21 @@ BOOST_AUTO_TEST_CASE(Equal) { // TODO This method might be obsolete after using EclipseState to generate grid BOOST_AUTO_TEST_CASE(EqualEclipseGrid) { const std::string filename = "CORNERPOINT_ACTNUM.DATA"; - Opm::ParserPtr parser(new Opm::Parser() ); + Opm::Parser parser; Opm::ParseContext parseContext; - Opm::DeckConstPtr deck = parser->parseFile( filename , parseContext); - Opm::EclipseState es(*deck, parseContext); + Opm::Deck deck = parser.parseFile( filename , parseContext); + Opm::EclipseState es(deck, parseContext); auto grid = es.getInputGrid(); - Opm::GridManager gridM(*es.getInputGrid()); + Opm::GridManager gridM(es.getInputGrid()); const UnstructuredGrid* cgrid1 = gridM.c_grid(); struct UnstructuredGrid * cgrid2; { struct grdecl g; - const auto& dimens = deck->getKeyword("DIMENS"); - const auto& coord = deck->getKeyword("COORD"); - const auto& zcorn = deck->getKeyword("ZCORN"); - const auto& actnum = deck->getKeyword("ACTNUM"); + const auto& dimens = deck.getKeyword("DIMENS"); + const auto& coord = deck.getKeyword("COORD"); + const auto& zcorn = deck.getKeyword("ZCORN"); + const auto& actnum = deck.getKeyword("ACTNUM"); g.dims[0] = dimens.getRecord(0).getItem("NX").get< int >(0); g.dims[1] = dimens.getRecord(0).getItem("NY").get< int >(0); @@ -157,21 +157,21 @@ BOOST_AUTO_TEST_CASE(TOPS_Fully_Specified) { "EDIT\n" "\n"; - Opm::ParserPtr parser(new Opm::Parser()); + Opm::Parser parser; Opm::ParseContext parseContext; - Opm::DeckConstPtr deck1 = parser->parseString(deck1Data, parseContext); - Opm::DeckConstPtr deck2 = parser->parseString(deck2Data, parseContext); + const Opm::Deck& deck1 = parser.parseString(deck1Data, parseContext); + const Opm::Deck& deck2 = parser.parseString(deck2Data, parseContext); - Opm::EclipseState es1(*deck1, parseContext); - Opm::EclipseState es2(*deck2, parseContext); + Opm::EclipseState es1(deck1, parseContext); + Opm::EclipseState es2(deck2, parseContext); - Opm::GridManager gridM1(*es1.getInputGrid()); - Opm::GridManager gridM2(*es2.getInputGrid()); + Opm::GridManager gridM1(es1.getInputGrid()); + Opm::GridManager gridM2(es2.getInputGrid()); const UnstructuredGrid* cgrid1 = gridM1.c_grid(); const UnstructuredGrid* cgrid2 = gridM2.c_grid(); BOOST_CHECK(grid_equal(cgrid1, cgrid2)); - Opm::EclipseGrid grid = Opm::UgGridHelpers::createEclipseGrid( *cgrid1 , *es1.getInputGrid( ) ); + Opm::EclipseGrid grid = Opm::UgGridHelpers::createEclipseGrid( *cgrid1 , es1.getInputGrid( ) ); } diff --git a/tests/test_wellcollection.cpp b/tests/test_wellcollection.cpp index 4c318531..77f30db8 100644 --- a/tests/test_wellcollection.cpp +++ b/tests/test_wellcollection.cpp @@ -40,38 +40,38 @@ using namespace Opm; BOOST_AUTO_TEST_CASE(AddWellsAndGroupToCollection) { - ParserPtr parser(new Parser()); + Parser parser; std::string scheduleFile("wells_group.data"); ParseContext parseContext; - DeckConstPtr deck = parser->parseFile(scheduleFile, parseContext); - EclipseStateConstPtr eclipseState(new EclipseState(*deck, parseContext)); + Deck deck = parser.parseFile(scheduleFile, parseContext); + EclipseState eclipseState(deck, parseContext); PhaseUsage pu = phaseUsageFromDeck(eclipseState); - GroupTreeNodePtr field=eclipseState->getSchedule()->getGroupTree(2).getNode("FIELD"); - GroupTreeNodePtr g1=eclipseState->getSchedule()->getGroupTree(2).getNode("G1"); - GroupTreeNodePtr g2=eclipseState->getSchedule()->getGroupTree(2).getNode("G2"); + const auto& field=eclipseState.getSchedule().getGroupTree(2).getNode("FIELD"); + const auto& g1=eclipseState.getSchedule().getGroupTree(2).getNode("G1"); + const auto& g2=eclipseState.getSchedule().getGroupTree(2).getNode("G2"); WellCollection collection; // Add groups to WellCollection - const auto& fieldGroup = eclipseState->getSchedule()->getGroup(field->name()); + const auto& fieldGroup = eclipseState.getSchedule().getGroup(field->name()); collection.addField(fieldGroup, 2, pu); for (auto iter = field->begin(); iter != field->end(); ++iter) { - const auto& childGroupNode = eclipseState->getSchedule()->getGroup((*iter).second->name()); + const auto& childGroupNode = eclipseState.getSchedule().getGroup((*iter).second->name()); collection.addGroup(childGroupNode, fieldGroup.name(), 2, pu); } - const auto& g1Group = eclipseState->getSchedule()->getGroup(g1->name()); + const auto& g1Group = eclipseState.getSchedule().getGroup(g1->name()); for (auto iter = g1->begin(); iter != g1->end(); ++iter) { - const auto& childGroupNode = eclipseState->getSchedule()->getGroup((*iter).second->name()); + const auto& childGroupNode = eclipseState.getSchedule().getGroup((*iter).second->name()); collection.addGroup(childGroupNode, g1Group.name(), 2, pu); } - const auto& g2Group = eclipseState->getSchedule()->getGroup(g2->name()); + const auto& g2Group = eclipseState.getSchedule().getGroup(g2->name()); for (auto iter = g2->begin(); iter != g2->end(); ++iter) { - auto childGroupNode = eclipseState->getSchedule()->getGroup((*iter).second->name()); + const auto& childGroupNode = eclipseState.getSchedule().getGroup((*iter).second->name()); collection.addGroup(childGroupNode, g2Group.name(), 2, pu); } @@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE(AddWellsAndGroupToCollection) { // Add wells to WellCollection WellCollection wellCollection; - auto wells = eclipseState->getSchedule()->getWells(); + auto wells = eclipseState.getSchedule().getWells(); for (size_t i=0; iparseFile(scheduleFile, parseContext); - EclipseStateConstPtr eclipseState(new EclipseState(*deck , parseContext)); + Parser parser; + Deck deck = parser.parseFile(scheduleFile, parseContext); + EclipseState eclipseState(deck , parseContext); PhaseUsage pu = phaseUsageFromDeck(eclipseState); - auto wells = eclipseState->getSchedule()->getWells(); + auto wells = eclipseState.getSchedule().getWells(); for (size_t i=0; iparseFile(scheduleFile, parseContext); - EclipseStateConstPtr eclipseState(new EclipseState(*deck , parseContext)); + Deck deck = parser.parseFile(scheduleFile, parseContext); + EclipseState eclipseState(deck , parseContext); PhaseUsage pu = phaseUsageFromDeck(eclipseState); - auto nodes = eclipseState->getSchedule()->getGroupTree(2).getNodes(); + auto nodes = eclipseState.getSchedule().getGroupTree(2).getNodes(); for (size_t i=0; igetSchedule()->getGroup(nodes[i]->name()); + const auto& group = eclipseState.getSchedule().getGroup(nodes[i]->name()); std::shared_ptr wellsGroup = createGroupWellsGroup(group, 2, pu); BOOST_CHECK_EQUAL(group.name(), wellsGroup->name()); if (group.isInjectionGroup(2)) { diff --git a/tests/test_wellsmanager.cpp b/tests/test_wellsmanager.cpp index 649fd6cb..774a9146 100644 --- a/tests/test_wellsmanager.cpp +++ b/tests/test_wellsmanager.cpp @@ -177,12 +177,12 @@ void check_controls_epoch3(struct WellControls ** ctrls) { BOOST_AUTO_TEST_CASE(New_Constructor_Works) { const std::string filename = "wells_manager_data.data"; - Opm::ParserPtr parser(new Opm::Parser()); + Opm::Parser parser; Opm::ParseContext parseContext; - Opm::DeckConstPtr deck(parser->parseFile(filename, parseContext)); + Opm::Deck deck = parser.parseFile(filename, parseContext); - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext)); - Opm::GridManager gridManager(*eclipseState->getInputGrid()); + Opm::EclipseState eclipseState(deck, parseContext); + Opm::GridManager gridManager(eclipseState.getInputGrid()); { Opm::WellsManager wellsManager(eclipseState, 0, *gridManager.c_grid(), NULL); @@ -214,12 +214,11 @@ BOOST_AUTO_TEST_CASE(New_Constructor_Works) { BOOST_AUTO_TEST_CASE(WellsEqual) { const std::string filename = "wells_manager_data.data"; - Opm::ParserPtr parser(new Opm::Parser()); Opm::ParseContext parseContext; - Opm::DeckConstPtr deck(parser->parseFile(filename, parseContext)); - - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext)); - Opm::GridManager gridManager(*eclipseState->getInputGrid()); + Opm::Parser parser; + Opm::Deck deck(parser.parseFile(filename, parseContext)); + Opm::EclipseState eclipseState(deck, parseContext); + Opm::GridManager gridManager(eclipseState.getInputGrid()); Opm::WellsManager wellsManager0(eclipseState, 0, *gridManager.c_grid(), NULL); Opm::WellsManager wellsManager1(eclipseState, 1, *gridManager.c_grid(), NULL); @@ -231,11 +230,10 @@ BOOST_AUTO_TEST_CASE(WellsEqual) { BOOST_AUTO_TEST_CASE(ControlsEqual) { const std::string filename = "wells_manager_data.data"; Opm::ParseContext parseContext; - Opm::ParserPtr parser(new Opm::Parser()); - Opm::DeckConstPtr deck(parser->parseFile(filename, parseContext)); - - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext)); - Opm::GridManager gridManager(*eclipseState->getInputGrid()); + Opm::Parser parser; + Opm::Deck deck(parser.parseFile(filename, parseContext)); + Opm::EclipseState eclipseState(deck, parseContext); + Opm::GridManager gridManager(eclipseState.getInputGrid()); Opm::WellsManager wellsManager0(eclipseState, 0, *gridManager.c_grid(), NULL); Opm::WellsManager wellsManager1(eclipseState, 1, *gridManager.c_grid(), NULL); @@ -253,12 +251,11 @@ BOOST_AUTO_TEST_CASE(ControlsEqual) { BOOST_AUTO_TEST_CASE(WellShutOK) { const std::string filename = "wells_manager_data.data"; - Opm::ParserPtr parser(new Opm::Parser()); Opm::ParseContext parseContext; - Opm::DeckConstPtr deck(parser->parseFile(filename, parseContext)); - - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext)); - Opm::GridManager gridManager(*eclipseState->getInputGrid()); + Opm::Parser parser; + Opm::Deck deck(parser.parseFile(filename, parseContext)); + Opm::EclipseState eclipseState(deck, parseContext); + Opm::GridManager gridManager(eclipseState.getInputGrid()); Opm::WellsManager wellsManager2(eclipseState, 2, *gridManager.c_grid(), NULL); @@ -270,12 +267,11 @@ BOOST_AUTO_TEST_CASE(WellShutOK) { BOOST_AUTO_TEST_CASE(WellSTOPOK) { const std::string filename = "wells_manager_data_wellSTOP.data"; - Opm::ParserPtr parser(new Opm::Parser()); Opm::ParseContext parseContext; - Opm::DeckConstPtr deck(parser->parseFile(filename, parseContext)); - - Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext)); - Opm::GridManager gridManager(*eclipseState->getInputGrid()); + Opm::Parser parser; + Opm::Deck deck(parser.parseFile(filename, parseContext)); + Opm::EclipseState eclipseState(deck, parseContext); + Opm::GridManager gridManager(eclipseState.getInputGrid()); Opm::WellsManager wellsManager(eclipseState, 0, *gridManager.c_grid(), NULL); diff --git a/tests/test_writeReadRestartFile.cpp b/tests/test_writeReadRestartFile.cpp index b8a41974..7158d531 100644 --- a/tests/test_writeReadRestartFile.cpp +++ b/tests/test_writeReadRestartFile.cpp @@ -196,7 +196,7 @@ std::shared_ptr createBlackOilState(Opm::EclipseGridConstPtr return blackoilState; } -Opm::EclipseWriterPtr createEclipseWriter(Opm::DeckConstPtr deck, +Opm::EclipseWriterPtr createEclipseWriter(const Opm::Deck& deck, Opm::EclipseStatePtr eclipseState, std::string& eclipse_data_filename) { @@ -255,7 +255,7 @@ BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData) Opm::Parser parser; Opm::ParseContext parseContext; - Opm::DeckConstPtr deck = parser.parseString(input, parseContext); + const Opm::Deck& deck = parser.parseString(input, parseContext); Opm::EclipseStatePtr eclipseState(new Opm::EclipseState(deck , parseContext)); Opm::EclipseWriterPtr eclipseWriter = createEclipseWriter(deck, eclipseState, eclipse_data_filename); diff --git a/tests/test_writenumwells.cpp b/tests/test_writenumwells.cpp index d668777e..19f31f88 100644 --- a/tests/test_writenumwells.cpp +++ b/tests/test_writenumwells.cpp @@ -136,15 +136,15 @@ std::shared_ptr createBlackOilState(Opm::EclipseGridConstPtr } -Opm::DeckConstPtr createDeck(const std::string& eclipse_data_filename) { +const Opm::Deck createDeck(const std::string& eclipse_data_filename) { Opm::ParserPtr parser(new Opm::Parser()); - Opm::DeckConstPtr deck = parser->parseFile(eclipse_data_filename , Opm::ParseContext()); + const Opm::Deck& deck = parser->parseFile(eclipse_data_filename , Opm::ParseContext()); return deck; } -Opm::EclipseWriterPtr createEclipseWriter(Opm::DeckConstPtr deck, +Opm::EclipseWriterPtr createEclipseWriter(const Opm::Deck& deck, Opm::EclipseStatePtr eclipseState, std::string& eclipse_data_filename) { @@ -172,7 +172,7 @@ BOOST_AUTO_TEST_CASE(EclipseWriteRestartWellInfo) test_work_area_copy_file(test_area, eclipse_data_filename.c_str()); Opm::ParseContext parseContext; - Opm::DeckConstPtr deck = createDeck(eclipse_data_filename); + const Opm::Deck deck = createDeck(eclipse_data_filename); Opm::EclipseStatePtr eclipseState(new Opm::EclipseState(deck , parseContext)); Opm::EclipseWriterPtr eclipseWriter = createEclipseWriter(deck, eclipseState, eclipse_data_filename);