diff --git a/opm/parser/eclipse/EclipseState/Grid/FieldPropsManager.hpp b/opm/parser/eclipse/EclipseState/Grid/FieldPropsManager.hpp index ef916174f..c0f212b7d 100644 --- a/opm/parser/eclipse/EclipseState/Grid/FieldPropsManager.hpp +++ b/opm/parser/eclipse/EclipseState/Grid/FieldPropsManager.hpp @@ -112,26 +112,6 @@ public: */ - /* - Return the keyword values as a std::vector<>. All elements in the return - value are guaranteed to be assigned a valid value. If the keyword is not - in the container, or not all elements have a valid value - an exception - will be raised: - - - keyword which is not supported at all -> std::logic_error - - keyword which is not in the deck at all -> std::out_of_range - - keyword which has not been fully initialized -> std::runtime_error - - Many of the keywords in the container can be automatically created, in - that case the get() method will silently create a new keyword and default - initialize if it is not already in the container. The different exceptions - raised for the different error conditions are the same for get(), - get_copy() and get_global(). - */ - template - const std::vector& get(const std::string& keyword) const; - - /* The get_copy() has exactly the same behaviour as get(), but the important difference is that said keyword is not already in the container it is not @@ -154,14 +134,6 @@ public: template std::vector get_copy(const std::string& keyword, bool global=false) const; - /* - This is exactly like the get() method, but the returned vector will have - global cartesian size, where all inactive cells have been filled with - zeros. - */ - template - std::vector get_global(const std::string& keyword) const; - /* Will return a pointer to the keyword data, or nullptr if the container does not have suce a keyword. Observe that container will hold on to an @@ -174,14 +146,6 @@ public: template const std::vector* try_get(const std::string& keyword) const; - /* - Will check if the container has the keyword loaded; in a fully initialized - state. If you ask for a keyword which is not supported at all you will - just get false back. - */ - template - bool has(const std::string& keyword) const; - /* You can ask whether the elements in the keyword have a default value - which typically is calculated in some way, or if it has been explicitly @@ -213,9 +177,6 @@ public: template std::vector keys() const; - /* - Don't understand why - but these are needed to work with opm-simulators heavily templated code?! - */ const std::vector& get_int(const std::string& keyword) const { return this->get(keyword); } std::vector get_global_int(const std::string& keyword) const { return this->get_global(keyword); } @@ -226,6 +187,42 @@ public: bool has_double(const std::string& keyword) const { return this->has(keyword); } private: + /* + Return the keyword values as a std::vector<>. All elements in the return + value are guaranteed to be assigned a valid value. If the keyword is not + in the container, or not all elements have a valid value - an exception + will be raised: + + - keyword which is not supported at all -> std::logic_error + - keyword which is not in the deck at all -> std::out_of_range + - keyword which has not been fully initialized -> std::runtime_error + + Many of the keywords in the container can be automatically created, in + that case the get() method will silently create a new keyword and default + initialize if it is not already in the container. The different exceptions + raised for the different error conditions are the same for get(), + get_copy() and get_global(). + */ + template + const std::vector& get(const std::string& keyword) const; + + /* + Will check if the container has the keyword loaded; in a fully initialized + state. If you ask for a keyword which is not supported at all you will + just get false back. + */ + template + bool has(const std::string& keyword) const; + + /* + This is exactly like the get() method, but the returned vector will have + global cartesian size, where all inactive cells have been filled with + zeros. + */ + template + std::vector get_global(const std::string& keyword) const; + + std::shared_ptr fp; }; diff --git a/python/cxx/field_props.cpp b/python/cxx/field_props.cpp index 20670000d..8fd011669 100644 --- a/python/cxx/field_props.cpp +++ b/python/cxx/field_props.cpp @@ -10,35 +10,35 @@ namespace { bool contains( const FieldPropsManager& manager, const std::string& kw) { - if (manager.has(kw)) + if (manager.has_int(kw)) return true; - if (manager.has(kw)) + if (manager.has_double(kw)) return true; return false; } py::array_t get_double_array(const FieldPropsManager& m, const std::string& kw) { - if (m.has(kw)) - return convert::numpy_array( m.get(kw) ); + if (m.has_double(kw)) + return convert::numpy_array( m.get_double(kw) ); else throw std::invalid_argument("Keyword '" + kw + "'is not of type double."); } py::array_t get_int_array(const FieldPropsManager& m, const std::string& kw) { - if (m.has(kw)) - return convert::numpy_array( m.get(kw) ); + if (m.has_int(kw)) + return convert::numpy_array( m.get_int(kw) ); else throw std::invalid_argument("Keyword '" + kw + "'is not of type int."); } py::array get_array(const FieldPropsManager& m, const std::string& kw) { - if (m.has(kw)) - return convert::numpy_array(m.get(kw)); + if (m.has_double(kw)) + return convert::numpy_array(m.get_double(kw)); - if (m.has(kw)) - return convert::numpy_array(m.get(kw)); + if (m.has_int(kw)) + return convert::numpy_array(m.get_int(kw)); throw std::invalid_argument("No such keyword: " + kw); } diff --git a/src/opm/output/eclipse/Summary.cpp b/src/opm/output/eclipse/Summary.cpp index c520890fd..0189e62f3 100644 --- a/src/opm/output/eclipse/Summary.cpp +++ b/src/opm/output/eclipse/Summary.cpp @@ -2088,7 +2088,7 @@ SummaryImplementation(const EclipseState& es, const Schedule& sched, const std::string& basename) : grid_ (std::cref(grid)) - , regCache_ (es.fieldProps().get("FIPNUM"), grid, sched) + , regCache_ (es.fieldProps().get_int("FIPNUM"), grid, sched) , deferredSMSpec_(makeDeferredSMSpecCreation(es, grid, sched)) , rset_ (makeResultSet(es.cfg().io(), basename)) , fmt_ { es.cfg().io().getFMTOUT() } diff --git a/src/opm/output/eclipse/WriteInit.cpp b/src/opm/output/eclipse/WriteInit.cpp index a07ac508f..66aed3ba0 100644 --- a/src/opm/output/eclipse/WriteInit.cpp +++ b/src/opm/output/eclipse/WriteInit.cpp @@ -330,13 +330,13 @@ namespace { // invoke the autocreation property, and ensure that the keywords // exist in the properties container. const auto& fp = es.fieldProps(); - fp.get("PVTNUM"); - fp.get("SATNUM"); - fp.get("EQLNUM"); - fp.get("FIPNUM"); + fp.get_int("PVTNUM"); + fp.get_int("SATNUM"); + fp.get_int("EQLNUM"); + fp.get_int("FIPNUM"); for (const auto& keyword : fp.keys()) - initFile.write(keyword, fp.get(keyword)); + initFile.write(keyword, fp.get_int(keyword)); } @@ -370,17 +370,17 @@ namespace { initFile.write("DZ" , dz); } - template - void writeCellPropertiesWithDefaultFlag(const Properties& propList, - const ::Opm::FieldPropsManager& fp, - WriteVector&& write) + template + void writeCellDoublePropertiesWithDefaultFlag(const Properties& propList, + const ::Opm::FieldPropsManager& fp, + WriteVector&& write) { for (const auto& prop : propList) { - if (! fp.has(prop.name)) + if (! fp.has_double(prop.name)) continue; - auto data = fp.get(prop.name); - auto defaulted = fp.defaulted(prop.name); + auto data = fp.get_double(prop.name); + auto defaulted = fp.defaulted(prop.name); write(prop, std::move(defaulted), std::move(data)); } } @@ -392,9 +392,9 @@ namespace { { for (const auto& prop : propList) { - if (!fp.has(prop.name)) + if (!fp.has_double(prop.name)) continue; - auto data = fp.get(prop.name); + auto data = fp.get_double(prop.name); write(prop, std::move(data)); } } @@ -406,7 +406,7 @@ namespace { ::Opm::EclIO::OutputStream::Init& initFile) { if (needDflt) { - writeCellPropertiesWithDefaultFlag(propList, fp, + writeCellDoublePropertiesWithDefaultFlag(propList, fp, [&units, &initFile](const CellProperty& prop, std::vector&& dflt, std::vector&& value) @@ -454,7 +454,7 @@ namespace { // therefore invoke the auto create functionality to ensure // that "NTG" is included in the properties container. const auto& fp = es.fieldProps(); - es.fieldProps().get("NTG"); + es.fieldProps().get_double("NTG"); writeDoubleCellProperties(doubleKeywords, fp, units, false, initFile); } @@ -506,7 +506,7 @@ namespace { ::Opm::EclIO::OutputStream::Init& initFile) { for (const auto& prop : propList) - fp.get(prop.name); + fp.get_double(prop.name); // Don't write sentinel value if input defaulted. writeDoubleCellProperties(propList, fp, diff --git a/src/opm/parser/eclipse/EclipseState/EclipseState.cpp b/src/opm/parser/eclipse/EclipseState/EclipseState.cpp index d1aa3ca9d..ffa268484 100644 --- a/src/opm/parser/eclipse/EclipseState/EclipseState.cpp +++ b/src/opm/parser/eclipse/EclipseState/EclipseState.cpp @@ -199,14 +199,14 @@ bool enable3DPropsTesting() { void EclipseState::initTransMult() { const auto& fp = this->field_props; - if (fp.has("MULTX")) this->m_transMult.applyMULT(fp.get_global("MULTX") , FaceDir::XPlus); - if (fp.has("MULTX-")) this->m_transMult.applyMULT(fp.get_global("MULTX-"), FaceDir::XMinus); + if (fp.has_double("MULTX")) this->m_transMult.applyMULT(fp.get_global_double("MULTX") , FaceDir::XPlus); + if (fp.has_double("MULTX-")) this->m_transMult.applyMULT(fp.get_global_double("MULTX-"), FaceDir::XMinus); - if (fp.has("MULTY")) this->m_transMult.applyMULT(fp.get_global("MULTY") , FaceDir::YPlus); - if (fp.has("MULTY-")) this->m_transMult.applyMULT(fp.get_global("MULTY-"), FaceDir::YMinus); + if (fp.has_double("MULTY")) this->m_transMult.applyMULT(fp.get_global_double("MULTY") , FaceDir::YPlus); + if (fp.has_double("MULTY-")) this->m_transMult.applyMULT(fp.get_global_double("MULTY-"), FaceDir::YMinus); - if (fp.has("MULTZ")) this->m_transMult.applyMULT(fp.get_global("MULTZ") , FaceDir::ZPlus); - if (fp.has("MULTZ-")) this->m_transMult.applyMULT(fp.get_global("MULTZ-"), FaceDir::ZMinus); + if (fp.has_double("MULTZ")) this->m_transMult.applyMULT(fp.get_global_double("MULTZ") , FaceDir::ZPlus); + if (fp.has_double("MULTZ-")) this->m_transMult.applyMULT(fp.get_global_double("MULTZ-"), FaceDir::ZMinus); } void EclipseState::initFaults(const Deck& deck) { diff --git a/src/opm/parser/eclipse/EclipseState/Grid/MULTREGTScanner.cpp b/src/opm/parser/eclipse/EclipseState/Grid/MULTREGTScanner.cpp index 02201e597..0a4fca41a 100644 --- a/src/opm/parser/eclipse/EclipseState/Grid/MULTREGTScanner.cpp +++ b/src/opm/parser/eclipse/EclipseState/Grid/MULTREGTScanner.cpp @@ -120,7 +120,7 @@ std::vector unique(const std::vector data) { MULTREGTSearchMap searchPairs; for (std::vector::const_iterator record = m_records.begin(); record != m_records.end(); ++record) { const std::string& region_name = record->region_name; - if (this->fp->has( region_name)) { + if (this->fp->has_int( region_name)) { int srcRegion = record->src_value; int targetRegion = record->target_value; @@ -140,7 +140,7 @@ std::vector unique(const std::vector data) { + " which is not in the deck"); if (this->regions.count(region_name) == 0) - this->regions[region_name] = this->fp->get_global(region_name); + this->regions[region_name] = this->fp->get_global_int(region_name); } for (auto iter = searchPairs.begin(); iter != searchPairs.end(); ++iter) { @@ -216,12 +216,12 @@ std::vector unique(const std::vector data) { region_name = MULTREGT::RegionNameFromDeckValue( regionItem.get(0) ); if (srcItem.defaultApplied(0) || srcItem.get(0) < 0) - src_regions = unique(this->fp->get(region_name)); + src_regions = unique(this->fp->get_int(region_name)); else src_regions.push_back(srcItem.get(0)); if (targetItem.defaultApplied(0) || targetItem.get(0) < 0) - target_regions = unique(fp->get(region_name)); + target_regions = unique(fp->get_int(region_name)); else target_regions.push_back(targetItem.get(0)); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp index 602965ebe..2fc2a0193 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp @@ -216,8 +216,8 @@ inline std::array< size_t, 3> directionIndices(const Opm::Connection::Direction const auto permx = field_properties.try_get("PERMX"); const auto permy = field_properties.try_get("PERMY"); const auto permz = field_properties.try_get("PERMZ"); - const auto& ntg = field_properties.get("NTG"); - const auto& satnum_data = field_properties.get("SATNUM"); + const auto& ntg = field_properties.get_double("NTG"); + const auto& satnum_data = field_properties.get_int("SATNUM"); this->loadCOMPDAT(record, grid, satnum_data, permx, permy, permz, ntg); } diff --git a/src/opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.cpp b/src/opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.cpp index 1338ebf22..4ded494d5 100644 --- a/src/opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.cpp +++ b/src/opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.cpp @@ -88,10 +88,10 @@ namespace Opm { //Option is set and keyword is found if( m_active && thpresKeyword ) { - if (!fp.has("EQLNUM")) + if (!fp.has_int("EQLNUM")) throw std::runtime_error("Error when internalizing THPRES: EQLNUM keyword not found in deck"); - const auto& eqlnum = fp.get("EQLNUM"); + const auto& eqlnum = fp.get_int("EQLNUM"); //Find max of eqlnum int maxEqlnum = *std::max_element(eqlnum.begin(), eqlnum.end()); diff --git a/tests/parser/EclipseGridTests.cpp b/tests/parser/EclipseGridTests.cpp index 1280a3d25..73e8a6f8a 100644 --- a/tests/parser/EclipseGridTests.cpp +++ b/tests/parser/EclipseGridTests.cpp @@ -969,7 +969,7 @@ BOOST_AUTO_TEST_CASE(GridBoxActnum) { const auto& fp = es.fieldProps(); const auto& grid = es.getInputGrid(); - BOOST_CHECK_NO_THROW(fp.get("ACTNUM")); + BOOST_CHECK_NO_THROW(fp.get_int("ACTNUM")); size_t active = 10 * 10 * 10 // 1000 - (10 * 10 * 1) // - top layer @@ -1024,7 +1024,7 @@ BOOST_AUTO_TEST_CASE(GridActnumVia3D) { std::vector actnum = {1, 1, 0, 1, 1, 0, 1, 1}; Opm::EclipseGrid grid3( grid , actnum); - BOOST_CHECK_NO_THROW(fp.get("ACTNUM")); + BOOST_CHECK_NO_THROW(fp.get_int("ACTNUM")); BOOST_CHECK_NO_THROW(grid.getNumActive()); BOOST_CHECK_EQUAL(grid.getNumActive(), 2 * 2 * 2 - 1); diff --git a/tests/parser/EclipseStateTests.cpp b/tests/parser/EclipseStateTests.cpp index 03df80093..04ca18d08 100644 --- a/tests/parser/EclipseStateTests.cpp +++ b/tests/parser/EclipseStateTests.cpp @@ -99,8 +99,8 @@ BOOST_AUTO_TEST_CASE(GetPOROTOPBased) { EclipseState state(deck ); const auto& fp = state.fieldProps(); - const auto& poro = fp.get( "PORO" ); - const auto& permx = fp.get( "PERMX" ); + const auto& poro = fp.get_double( "PORO" ); + const auto& permx = fp.get_double( "PERMX" ); for (size_t i=0; i < poro.size(); i++) { BOOST_CHECK_EQUAL( 0.10 , poro[i]); @@ -273,7 +273,7 @@ BOOST_AUTO_TEST_CASE(IntProperties) { BOOST_CHECK_EQUAL( false, state.fieldProps().supported( "NONO" ) ); BOOST_CHECK_EQUAL( true, state.fieldProps().supported( "SATNUM" ) ); - BOOST_CHECK_EQUAL( true, state.fieldProps().has( "SATNUM" ) ); + BOOST_CHECK_EQUAL( true, state.fieldProps().has_int( "SATNUM" ) ); } @@ -281,7 +281,7 @@ BOOST_AUTO_TEST_CASE(GetProperty) { auto deck = createDeck(); EclipseState state(deck); - const auto& satnum = state.fieldProps().get_global("SATNUM"); + const auto& satnum = state.fieldProps().get_global_int("SATNUM"); BOOST_CHECK_EQUAL(1000U , satnum.size() ); for (size_t i=0; i < satnum.size(); i++) BOOST_CHECK_EQUAL( 2 , satnum[i]); @@ -420,10 +420,10 @@ BOOST_AUTO_TEST_CASE(NoGridOptsDefaultRegion) { auto deck = createDeckNoGridOpts(); EclipseState state(deck); const auto& fp = state.fieldProps(); - const auto& multnum = fp.get("MULTNUM"); - const auto& fluxnum = fp.get("FLUXNUM"); + const auto& multnum = fp.get_int("MULTNUM"); + const auto& fluxnum = fp.get_int("FLUXNUM"); const auto default_kw = fp.default_region(); - const auto& def_pro = fp.get(default_kw); + const auto& def_pro = fp.get_int(default_kw); BOOST_CHECK_EQUAL( &fluxnum , &def_pro ); BOOST_CHECK_NE( &fluxnum , &multnum ); @@ -434,10 +434,10 @@ BOOST_AUTO_TEST_CASE(WithGridOptsDefaultRegion) { auto deck = createDeckWithGridOpts(); EclipseState state(deck); const auto& fp = state.fieldProps(); - const auto& multnum = fp.get("MULTNUM"); - const auto& fluxnum = fp.get("FLUXNUM"); + const auto& multnum = fp.get_int("MULTNUM"); + const auto& fluxnum = fp.get_int("FLUXNUM"); const auto default_kw = fp.default_region(); - const auto& def_pro = fp.get(default_kw); + const auto& def_pro = fp.get_int(default_kw); BOOST_CHECK_EQUAL( &multnum , &def_pro ); BOOST_CHECK_NE( &fluxnum , &multnum ); diff --git a/tests/parser/FieldPropsTests.cpp b/tests/parser/FieldPropsTests.cpp index 6304a2d01..5150cbd26 100644 --- a/tests/parser/FieldPropsTests.cpp +++ b/tests/parser/FieldPropsTests.cpp @@ -52,14 +52,14 @@ BOOST_AUTO_TEST_CASE(CreateFieldProps) { BOOST_CHECK(!fpm.try_get("NO_SUCH_KEYWOWRD")); BOOST_CHECK(!fpm.try_get("NO_SUCH_KEYWOWRD")); - BOOST_CHECK_THROW(fpm.get("PORO"), std::out_of_range); - BOOST_CHECK_THROW(fpm.get_global("PERMX"), std::out_of_range); + BOOST_CHECK_THROW(fpm.get_double("PORO"), std::out_of_range); + BOOST_CHECK_THROW(fpm.get_global_double("PERMX"), std::out_of_range); BOOST_CHECK_THROW(fpm.get_copy("PERMX"), std::out_of_range); - BOOST_CHECK_THROW(fpm.get("NOT_SUPPORTED"), std::logic_error); - BOOST_CHECK_THROW(fpm.get("NOT_SUPPORTED"), std::logic_error); + BOOST_CHECK_THROW(fpm.get_int("NOT_SUPPORTED"), std::logic_error); + BOOST_CHECK_THROW(fpm.get_double("NOT_SUPPORTED"), std::logic_error); - BOOST_CHECK_THROW(fpm.get_global("NO1"), std::logic_error); - BOOST_CHECK_THROW(fpm.get_global("NO2"), std::logic_error); + BOOST_CHECK_THROW(fpm.get_global_double("NO1"), std::logic_error); + BOOST_CHECK_THROW(fpm.get_global_int("NO2"), std::logic_error); } @@ -92,20 +92,20 @@ PERMX Deck deck = Parser{}.parseString(deck_string); FieldPropsManager fpm(deck, grid, TableManager()); - BOOST_CHECK(!fpm.has("NO-PORO")); - BOOST_CHECK(fpm.has("PORO")); - const auto& poro1 = fpm.get("PORO"); + BOOST_CHECK(!fpm.has_double("NO-PORO")); + BOOST_CHECK(fpm.has_double("PORO")); + const auto& poro1 = fpm.get_double("PORO"); BOOST_CHECK_EQUAL(poro1.size(), grid.getNumActive()); const auto& poro2 = fpm.try_get("PORO"); BOOST_CHECK(poro1 == *poro2); - BOOST_CHECK(!fpm.has("NO-PORO")); + BOOST_CHECK(!fpm.has_double("NO-PORO")); // PERMX keyword is not fully initialized BOOST_CHECK(!fpm.try_get("PERMX")); - BOOST_CHECK(!fpm.has("PERMX")); - BOOST_CHECK_THROW(fpm.get("PERMX"), std::runtime_error); + BOOST_CHECK(!fpm.has_double("PERMX")); + BOOST_CHECK_THROW(fpm.get_double("PERMX"), std::runtime_error); { const auto& keys = fpm.keys(); BOOST_CHECK_EQUAL(keys.size(), 1); @@ -151,7 +151,7 @@ SATNUM EclipseGrid grid(3,1,3); grid.resetACTNUM(actnum1); Deck deck = Parser{}.parseString(deck_string); FieldPropsManager fpm(deck, grid, TableManager()); - const auto& s1 = fpm.get("SATNUM"); + const auto& s1 = fpm.get_int("SATNUM"); BOOST_CHECK_EQUAL(s1.size(), 6); BOOST_CHECK_EQUAL(s1[0], 0); BOOST_CHECK_EQUAL(s1[1], 1); @@ -193,7 +193,7 @@ ADDREG EclipseGrid grid(3,2,1); grid.resetACTNUM(actnum1); Deck deck = Parser{}.parseString(deck_string); FieldPropsManager fpm(deck, grid, TableManager()); - const auto& poro = fpm.get("PORO"); + const auto& poro = fpm.get_double("PORO"); BOOST_CHECK_EQUAL(poro.size(), 4); BOOST_CHECK_EQUAL(poro[0], 0.10); BOOST_CHECK_EQUAL(poro[3], 1.10); @@ -231,7 +231,7 @@ NTG EclipseGrid grid(EclipseGrid(10,10, 2)); Deck deck = Parser{}.parseString(deck_string); FieldPropsManager fpm(deck, grid, TableManager()); - const auto& ntg = fpm.get("NTG"); + const auto& ntg = fpm.get_double("NTG"); const auto& defaulted = fpm.defaulted("NTG"); for (std::size_t g=0; g < 100; g++) { @@ -301,9 +301,9 @@ ENDBOX EclipseGrid grid(10,10, 5); Deck deck = Parser{}.parseString(deck_string); FieldPropsManager fpm(deck, grid, TableManager()); - const auto& poro = fpm.get("PORO"); - const auto& ntg = fpm.get("NTG"); - const auto& multpv = fpm.get("MULTPV"); + const auto& poro = fpm.get_double("PORO"); + const auto& ntg = fpm.get_double("NTG"); + const auto& multpv = fpm.get_double("MULTPV"); const auto& defaulted = fpm.defaulted("PORV"); const auto& porv = fpm.porv(); @@ -479,12 +479,12 @@ BOOST_AUTO_TEST_CASE(LATE_GET_SATFUNC) { Opm::EclipseGrid eg(deck); Opm::FieldPropsManager fp(deck, eg, tm); - const auto& fp_swu = fp.get_global("SWU"); + const auto& fp_swu = fp.get_global_double("SWU"); BOOST_CHECK_EQUAL(fp_swu[1 + 0 * 3*3], 0.93); BOOST_CHECK_EQUAL(fp_swu[1 + 1 * 3*3], 0.852); BOOST_CHECK_EQUAL(fp_swu[1 + 2 * 3*3], 0.801); - const auto& fp_sgu = fp.get_global("ISGU"); + const auto& fp_sgu = fp.get_global_double("ISGU"); BOOST_CHECK_EQUAL(fp_sgu[1 + 0 * 3*3], 0.9); BOOST_CHECK_EQUAL(fp_sgu[1 + 1 * 3*3], 0.85); BOOST_CHECK_EQUAL(fp_sgu[1 + 2 * 3*3], 0.80); @@ -506,24 +506,24 @@ PORO grid.resetACTNUM(actnum); FieldPropsManager fpm(deck, grid, TableManager()); - BOOST_CHECK(!fpm.has("NTG")); + BOOST_CHECK(!fpm.has_double("NTG")); const auto& ntg = fpm.get_copy("NTG"); - BOOST_CHECK(!fpm.has("NTG")); + BOOST_CHECK(!fpm.has_double("NTG")); BOOST_CHECK(ntg.size() == grid.getNumActive()); - BOOST_CHECK(fpm.has("PORO")); + BOOST_CHECK(fpm.has_double("PORO")); const auto& poro1 = fpm.get_copy("PORO"); - BOOST_CHECK(fpm.has("PORO")); + BOOST_CHECK(fpm.has_double("PORO")); const auto& poro2 = fpm.get_copy("PORO"); - BOOST_CHECK(fpm.has("PORO")); + BOOST_CHECK(fpm.has_double("PORO")); BOOST_CHECK( poro1 == poro2 ); BOOST_CHECK( &poro1 != &poro2 ); BOOST_CHECK( poro1.size() == grid.getNumActive()); - BOOST_CHECK(!fpm.has("SATNUM")); + BOOST_CHECK(!fpm.has_int("SATNUM")); const auto& satnum = fpm.get_copy("SATNUM", true); - BOOST_CHECK(!fpm.has("SATNUM")); + BOOST_CHECK(!fpm.has_int("SATNUM")); BOOST_CHECK(satnum.size() == grid.getCartesianSize()); //The PERMY keyword can not be default initialized @@ -550,7 +550,7 @@ RTEMPVD Opm::TableManager tm(deck); FieldPropsManager fpm(deck, grid, tm); - const auto& tempi = fpm.get("TEMPI"); + const auto& tempi = fpm.get_double("TEMPI"); double celcius_offset = 273.15; BOOST_CHECK_CLOSE( tempi[0], 0 + celcius_offset , 1e-6); BOOST_CHECK_CLOSE( tempi[1], 100 + celcius_offset , 1e-6); @@ -580,8 +580,8 @@ MULTZ Opm::TableManager tm(deck); FieldPropsManager fpm(deck, grid, tm); - const auto& multz = fpm.get("MULTZ"); - const auto& multx = fpm.get("MULTX"); + const auto& multz = fpm.get_double("MULTZ"); + const auto& multx = fpm.get_double("MULTX"); BOOST_CHECK_EQUAL( multz[0], 4 ); BOOST_CHECK_EQUAL( multx[0], 2 ); } diff --git a/tests/parser/MULTREGTScannerTests.cpp b/tests/parser/MULTREGTScannerTests.cpp index 15e061ef8..9193f93f5 100644 --- a/tests/parser/MULTREGTScannerTests.cpp +++ b/tests/parser/MULTREGTScannerTests.cpp @@ -296,10 +296,10 @@ BOOST_AUTO_TEST_CASE(MULTREGT_COPY_MULTNUM) { Opm::EclipseGrid eg(deck); Opm::FieldPropsManager fp(deck, eg, tm); - BOOST_CHECK_NO_THROW(fp.has("FLUXNUM")); - BOOST_CHECK_NO_THROW(fp.has("MULTNUM")); - const auto& fdata = fp.get_global("FLUXNUM"); - const auto& mdata = fp.get_global("MULTNUM"); + BOOST_CHECK_NO_THROW(fp.has_int("FLUXNUM")); + BOOST_CHECK_NO_THROW(fp.has_int("MULTNUM")); + const auto& fdata = fp.get_global_int("FLUXNUM"); + const auto& mdata = fp.get_global_int("MULTNUM"); std::vector data = { 1, 2, 1, 2, 3, 4, 3, 4 }; for (auto i = 0; i < 2 * 2 * 2; i++) { diff --git a/tests/parser/MultiRegTests.cpp b/tests/parser/MultiRegTests.cpp index 311e3841d..e812ffcb8 100644 --- a/tests/parser/MultiRegTests.cpp +++ b/tests/parser/MultiRegTests.cpp @@ -234,8 +234,8 @@ BOOST_AUTO_TEST_CASE(Test_OPERATER) { Opm::FieldPropsManager fp(deck, eg, tm); const auto& porv = fp.porv(true); - const auto& permx = fp.get_global("PERMX"); - const auto& permy = fp.get_global("PERMY"); + const auto& permx = fp.get_global_double("PERMX"); + const auto& permy = fp.get_global_double("PERMY"); BOOST_CHECK_EQUAL( porv[0], 0.50 ); BOOST_CHECK_EQUAL( porv[1], 1.00 ); diff --git a/tests/parser/ThresholdPressureTest.cpp b/tests/parser/ThresholdPressureTest.cpp index 17ba2bc3f..6f713e015 100644 --- a/tests/parser/ThresholdPressureTest.cpp +++ b/tests/parser/ThresholdPressureTest.cpp @@ -235,7 +235,7 @@ struct Setup BOOST_AUTO_TEST_CASE(ThresholdPressureDeckHasEqlnum) { Setup s(inputStrWithEqlNum); - BOOST_CHECK(s.fp.has("EQLNUM")); + BOOST_CHECK(s.fp.has_int("EQLNUM")); } BOOST_AUTO_TEST_CASE(ThresholdPressureTest) { diff --git a/tests/parser/TransMultTests.cpp b/tests/parser/TransMultTests.cpp index ed860880f..eeadab994 100644 --- a/tests/parser/TransMultTests.cpp +++ b/tests/parser/TransMultTests.cpp @@ -72,6 +72,6 @@ MULTZ Opm::FieldPropsManager fp(deck, grid, tables); Opm::TransMult transMult(grid, deck, fp); - transMult.applyMULT(fp.get_global("MULTZ"), Opm::FaceDir::ZPlus); + transMult.applyMULT(fp.get_global_double("MULTZ"), Opm::FaceDir::ZPlus); BOOST_CHECK_EQUAL( transMult.getMultiplier(0,0,0 , Opm::FaceDir::ZPlus) , 4.0 ); } diff --git a/tests/parser/integration/BoxTest.cpp b/tests/parser/integration/BoxTest.cpp index 62259ac4e..78e1ab678 100644 --- a/tests/parser/integration/BoxTest.cpp +++ b/tests/parser/integration/BoxTest.cpp @@ -49,9 +49,9 @@ inline EclipseState makeState(const std::string& fileName) { BOOST_AUTO_TEST_CASE( PERMX ) { EclipseState state = makeState( prefix() + "BOX/BOXTEST1" ); - const auto& permx = state.fieldProps().get_global( "PERMX" ); - const auto& permy = state.fieldProps().get_global( "PERMY" ); - const auto& permz = state.fieldProps().get_global( "PERMZ" ); + const auto& permx = state.fieldProps().get_global_double( "PERMX" ); + const auto& permy = state.fieldProps().get_global_double( "PERMY" ); + const auto& permz = state.fieldProps().get_global_double( "PERMZ" ); size_t i, j, k; const EclipseGrid& grid = state.getInputGrid(); @@ -72,7 +72,7 @@ BOOST_AUTO_TEST_CASE( PERMX ) { BOOST_AUTO_TEST_CASE( PARSE_BOX_OK ) { EclipseState state = makeState( prefix() + "BOX/BOXTEST1" ); - const auto& satnum = state.fieldProps().get_global( "SATNUM" ); + const auto& satnum = state.fieldProps().get_global_int( "SATNUM" ); { size_t i, j, k; const EclipseGrid& grid = state.getInputGrid(); @@ -94,8 +94,8 @@ BOOST_AUTO_TEST_CASE( PARSE_BOX_OK ) { BOOST_AUTO_TEST_CASE( PARSE_MULTIPLY_COPY ) { EclipseState state = makeState( prefix() + "BOX/BOXTEST1" ); - const auto& satnum = state.fieldProps().get_global( "SATNUM" ); - const auto& fipnum = state.fieldProps().get_global( "FIPNUM" ); + const auto& satnum = state.fieldProps().get_global_int( "SATNUM" ); + const auto& fipnum = state.fieldProps().get_global_int( "FIPNUM" ); size_t i, j, k; const EclipseGrid& grid = state.getInputGrid(); @@ -119,9 +119,9 @@ BOOST_AUTO_TEST_CASE( PARSE_MULTIPLY_COPY ) { BOOST_AUTO_TEST_CASE( EQUALS ) { EclipseState state = makeState( prefix() + "BOX/BOXTEST1" ); - const auto& pvtnum = state.fieldProps().get_global( "PVTNUM" ); - const auto& eqlnum = state.fieldProps().get_global( "EQLNUM" ); - const auto& poro = state.fieldProps().get_global( "PORO" ); + const auto& pvtnum = state.fieldProps().get_global_int( "PVTNUM" ); + const auto& eqlnum = state.fieldProps().get_global_int( "EQLNUM" ); + const auto& poro = state.fieldProps().get_global_double( "PORO" ); size_t i, j, k; const EclipseGrid& grid = state.getInputGrid(); @@ -142,7 +142,7 @@ BOOST_AUTO_TEST_CASE( EQUALS ) { BOOST_AUTO_TEST_CASE( OPERATE ) { EclipseState state = makeState( prefix() + "BOX/BOXTEST1" ); const EclipseGrid& grid = state.getInputGrid(); - const auto& ntg = state.fieldProps().get_global("NTG"); + const auto& ntg = state.fieldProps().get_global_double("NTG"); BOOST_CHECK_EQUAL( ntg[grid.getGlobalIndex(0,0,0)], 8.50 ); // MULTA BOOST_CHECK_EQUAL( ntg[grid.getGlobalIndex(0,5,0)], 5.00 ); // POLY BOOST_CHECK_EQUAL( ntg[grid.getGlobalIndex(0,0,1)], 4.0 ); // COPY diff --git a/tests/test_regionCache.cpp b/tests/test_regionCache.cpp index 87ae13bb4..f50c86917 100644 --- a/tests/test_regionCache.cpp +++ b/tests/test_regionCache.cpp @@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(create) { EclipseState es(deck); const EclipseGrid& grid = es.getInputGrid(); Schedule schedule( deck, es); - out::RegionCache rc(es.fieldProps().get("FIPNUM"), grid, schedule); + out::RegionCache rc(es.fieldProps().get_int("FIPNUM"), grid, schedule); { const auto& empty = rc.connections( 4 ); BOOST_CHECK_EQUAL( empty.size() , 0 );