From 9e288a9d780b89ea88c7b74c48dfe27bbeed66c0 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Sun, 12 May 2019 10:01:26 +0200 Subject: [PATCH] Refactor SummaryState - Change SummaryState::add() -> SummaryState::update(), the SummaryState::update() method is semantically aware of totals. - Add an internal variable to the SummaryState class to keep track of the elapsed simulation time. --- .../EclipseState/Schedule/SummaryState.hpp | 20 +- src/opm/output/eclipse/LoadRestart.cpp | 44 ++-- src/opm/output/eclipse/Summary.cpp | 17 +- .../EclipseState/Schedule/SummaryState.cpp | 77 +++++-- tests/parser/ACTIONX.cpp | 46 ++-- tests/parser/UDQTests.cpp | 74 +++--- tests/test_AggregateGroupData.cpp | 24 +- tests/test_AggregateMSWData.cpp | 50 ++-- tests/test_AggregateWellData.cpp | 132 +++++------ tests/test_Restart.cpp | 216 +++++++++--------- tests/test_Summary.cpp | 113 ++++++--- 11 files changed, 461 insertions(+), 352 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp b/opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp index d26b8fde1..1fd17ce4a 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp @@ -66,20 +66,30 @@ class SummaryState { public: typedef std::unordered_map::const_iterator const_iterator; - double get(const std::string&) const; - bool has(const std::string& key) const; - void add(const std::string& key, double value); - void add(const ecl::smspec_node& node, double value); + /* + The set() function has to be retained temporarily to support updating of + cumulatives from restart files. + */ + void set(const std::string& key, double value); - void add_well_var(const std::string& well, const std::string& var, double value); + bool has(const std::string& key) const; bool has_well_var(const std::string& well, const std::string& var) const; + + void update(const std::string& key, double value); + void update(const ecl::smspec_node& node, double value); + void update_well_var(const std::string& well, const std::string& var, double value); + void update_elapsed(double delta); + + double get(const std::string&) const; double get_well_var(const std::string& well, const std::string& var) const; + double get_elapsed() const; std::vector wells() const; std::vector wells(const std::string& var) const; const_iterator begin() const; const_iterator end() const; private: + double elapsed; std::unordered_map values; // The first key is the variable and the second key is the well. diff --git a/src/opm/output/eclipse/LoadRestart.cpp b/src/opm/output/eclipse/LoadRestart.cpp index 41d6975b8..bef815842 100644 --- a/src/opm/output/eclipse/LoadRestart.cpp +++ b/src/opm/output/eclipse/LoadRestart.cpp @@ -1086,20 +1086,20 @@ namespace { const auto xwel = wellData.xwel(wellID); // No unit conversion here. Smry expects output units. - smry.add(key("WOPT"), xwel[VI::XWell::index::OilPrTotal]); - smry.add(key("WWPT"), xwel[VI::XWell::index::WatPrTotal]); - smry.add(key("WGPT"), xwel[VI::XWell::index::GasPrTotal]); - smry.add(key("WVPT"), xwel[VI::XWell::index::VoidPrTotal]); + smry.update(key("WOPT"), xwel[VI::XWell::index::OilPrTotal]); + smry.update(key("WWPT"), xwel[VI::XWell::index::WatPrTotal]); + smry.update(key("WGPT"), xwel[VI::XWell::index::GasPrTotal]); + smry.update(key("WVPT"), xwel[VI::XWell::index::VoidPrTotal]); - smry.add(key("WWIT"), xwel[VI::XWell::index::WatInjTotal]); - smry.add(key("WGIT"), xwel[VI::XWell::index::GasInjTotal]); + smry.update(key("WWIT"), xwel[VI::XWell::index::WatInjTotal]); + smry.update(key("WGIT"), xwel[VI::XWell::index::GasInjTotal]); - smry.add(key("WOPTH"), xwel[VI::XWell::index::HistOilPrTotal]); - smry.add(key("WWPTH"), xwel[VI::XWell::index::HistWatPrTotal]); - smry.add(key("WGPTH"), xwel[VI::XWell::index::HistGasPrTotal]); + smry.update(key("WOPTH"), xwel[VI::XWell::index::HistOilPrTotal]); + smry.update(key("WWPTH"), xwel[VI::XWell::index::HistWatPrTotal]); + smry.update(key("WGPTH"), xwel[VI::XWell::index::HistGasPrTotal]); - smry.add(key("WWITH"), xwel[VI::XWell::index::HistWatInjTotal]); - smry.add(key("WGITH"), xwel[VI::XWell::index::HistGasInjTotal]); + smry.update(key("WWITH"), xwel[VI::XWell::index::HistWatInjTotal]); + smry.update(key("WGITH"), xwel[VI::XWell::index::HistGasInjTotal]); } void assign_group_cumulatives(const std::string& group, @@ -1123,19 +1123,19 @@ namespace { const auto xgrp = groupData.xgrp(groupID); // No unit conversion here. Smry expects output units. - smry.add(key("OPT"), xgrp[VI::XGroup::index::OilPrTotal]); - smry.add(key("WPT"), xgrp[VI::XGroup::index::WatPrTotal]); - smry.add(key("GPT"), xgrp[VI::XGroup::index::GasPrTotal]); - smry.add(key("VPT"), xgrp[VI::XGroup::index::VoidPrTotal]); + smry.update(key("OPT"), xgrp[VI::XGroup::index::OilPrTotal]); + smry.update(key("WPT"), xgrp[VI::XGroup::index::WatPrTotal]); + smry.update(key("GPT"), xgrp[VI::XGroup::index::GasPrTotal]); + smry.update(key("VPT"), xgrp[VI::XGroup::index::VoidPrTotal]); - smry.add(key("WIT"), xgrp[VI::XGroup::index::WatInjTotal]); - smry.add(key("GIT"), xgrp[VI::XGroup::index::GasInjTotal]); + smry.update(key("WIT"), xgrp[VI::XGroup::index::WatInjTotal]); + smry.update(key("GIT"), xgrp[VI::XGroup::index::GasInjTotal]); - smry.add(key("OPTH"), xgrp[VI::XGroup::index::HistOilPrTotal]); - smry.add(key("WPTH"), xgrp[VI::XGroup::index::HistWatPrTotal]); - smry.add(key("GPTH"), xgrp[VI::XGroup::index::HistGasPrTotal]); - smry.add(key("WITH"), xgrp[VI::XGroup::index::HistWatInjTotal]); - smry.add(key("GITH"), xgrp[VI::XGroup::index::HistGasInjTotal]); + smry.update(key("OPTH"), xgrp[VI::XGroup::index::HistOilPrTotal]); + smry.update(key("WPTH"), xgrp[VI::XGroup::index::HistWatPrTotal]); + smry.update(key("GPTH"), xgrp[VI::XGroup::index::HistGasPrTotal]); + smry.update(key("WITH"), xgrp[VI::XGroup::index::HistWatInjTotal]); + smry.update(key("GITH"), xgrp[VI::XGroup::index::HistGasInjTotal]); } Opm::SummaryState diff --git a/src/opm/output/eclipse/Summary.cpp b/src/opm/output/eclipse/Summary.cpp index fffc90f1b..3ea0318b9 100644 --- a/src/opm/output/eclipse/Summary.cpp +++ b/src/opm/output/eclipse/Summary.cpp @@ -1164,7 +1164,7 @@ void eval_udq(const Schedule& schedule, std::size_t sim_step, SummaryState& st) for (const auto& well : wells) { const auto& udq_value = ws[well]; if (udq_value) - st.add_well_var(well, ws.name(), udq_value.value()); + st.update_well_var(well, ws.name(), udq_value.value()); } } @@ -1173,7 +1173,7 @@ void eval_udq(const Schedule& schedule, std::size_t sim_step, SummaryState& st) for (const auto& well : wells) { const auto& udq_value = ws[well]; if (udq_value) - st.add_well_var(well, def.keyword(), udq_value.value()); + st.update_well_var(well, def.keyword(), udq_value.value()); } } } @@ -1381,7 +1381,7 @@ Summary::Summary( const EclipseState& st, for (const auto& pair : this->handlers->handlers) { const auto * nodeptr = pair.first; if (nodeptr->is_total()) - this->prev_state.add(*nodeptr, 0); + this->prev_state.update(*nodeptr, 0); } } @@ -1522,7 +1522,7 @@ void Summary::add_timestep( int report_step, unit_applied_val += this->prev_state.get(genkey); } - st.add(*f.first, unit_applied_val); + st.update(*f.first, unit_applied_val); } for( const auto& value_pair : single_values ) { @@ -1532,7 +1532,7 @@ void Summary::add_timestep( int report_step, const auto unit = single_values_units.at( key ); double si_value = value_pair.second; double output_value = es.getUnits().from_si(unit , si_value ); - st.add(*node_pair->second, output_value); + st.update(*node_pair->second, output_value); } } @@ -1547,7 +1547,7 @@ void Summary::add_timestep( int report_step, assert (smspec_node_get_num( nodeptr ) - 1 == static_cast(reg)); double si_value = value_pair.second[reg]; double output_value = es.getUnits().from_si(unit , si_value ); - st.add(*nodeptr, output_value); + st.update(*nodeptr, output_value); } } } @@ -1560,7 +1560,7 @@ void Summary::add_timestep( int report_step, const auto unit = block_units.at( key.first ); double si_value = value_pair.second; double output_value = es.getUnits().from_si(unit , si_value ); - st.add(*nodeptr, output_value); + st.update(*nodeptr, output_value); } } @@ -1616,9 +1616,10 @@ void Summary::reset_cumulative_quantities(const SummaryState& rstrt) // is constructed from information in a restart file--i.e., from // the double precision restart vectors 'XGRP' and 'XWEL' during // RestartIO::load(). - this->prev_state.add(genkey, rstrt.get(genkey)); + this->prev_state.set(genkey, rstrt.get(genkey)); } } } + }} // namespace Opm::out diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/SummaryState.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/SummaryState.cpp index 0b12c0ad9..35b7382cb 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/SummaryState.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/SummaryState.cpp @@ -21,16 +21,71 @@ #include namespace Opm{ - void SummaryState::add(const ecl::smspec_node& node, double value) { - if (node.get_var_type() == ECL_SMSPEC_WELL_VAR) - this->add_well_var(node.get_wgname(), - node.get_keyword(), - value); - else - this->add(node.get_gen_key1(), value); +namespace { + + bool is_total(const std::string& key) { + auto sep_pos = key.find(':'); + + if (sep_pos == 0) + return false; + + if (sep_pos == std::string::npos) { + if (key.back() == 'T') + return true; + + return (key.compare(key.size() - 2, 2, "TH") == 0); + } else + return is_total(key.substr(0,sep_pos)); } - void SummaryState::add(const std::string& key, double value) { +} + void SummaryState::update_elapsed(double delta) { + this->elapsed += delta; + } + + + double SummaryState::get_elapsed() const { + return this->elapsed; + } + + + void SummaryState::update(const std::string& key, double value) { + if (is_total(key)) + this->values[key] += value; + else + this->values[key] = value; + } + + void SummaryState::update(const ecl::smspec_node& node, double value) { + if (node.get_var_type() == ECL_SMSPEC_WELL_VAR) + this->update_well_var(node.get_wgname(), + node.get_keyword(), + value); + else { + const std::string& key = node.get_gen_key1(); + if (node.is_total()) + this->values[key] += value; + else + this->values[key] = value; + + } + } + + + void SummaryState::update_well_var(const std::string& well, const std::string& var, double value) { + std::string key = var + ":" + well; + if (is_total(var)) { + this->values[key] += value; + this->well_values[var][well] += value; + } else { + this->values[key] = value; + this->well_values[var][well] = value; + } + this->m_wells.insert(well); + } + + + void SummaryState::set(const std::string& key, double value) { this->values[key] = value; } @@ -48,12 +103,6 @@ namespace Opm{ return iter->second; } - void SummaryState::add_well_var(const std::string& well, const std::string& var, double value) { - this->add(var + ":" + well, value); - this->well_values[var][well] = value; - this->m_wells.insert(well); - } - bool SummaryState::has_well_var(const std::string& well, const std::string& var) const { const auto& var_iter = this->well_values.find(var); if (var_iter == this->well_values.end()) diff --git a/tests/parser/ACTIONX.cpp b/tests/parser/ACTIONX.cpp index f4a2bf5df..fbf05ebb6 100644 --- a/tests/parser/ACTIONX.cpp +++ b/tests/parser/ACTIONX.cpp @@ -185,7 +185,7 @@ BOOST_AUTO_TEST_CASE(TestActions) { BOOST_AUTO_TEST_CASE(TestContext) { Opm::SummaryState st; - st.add_well_var("OP1", "WOPR", 100); + st.update_well_var("OP1", "WOPR", 100); Opm::ActionContext context(st); BOOST_REQUIRE_THROW(context.get("func", "arg"), std::out_of_range); @@ -471,7 +471,7 @@ BOOST_AUTO_TEST_CASE(LGR) { BOOST_AUTO_TEST_CASE(ActionContextTest) { SummaryState st; - st.add("WWCT:OP1", 100); + st.update("WWCT:OP1", 100); ActionContext context(st); @@ -490,9 +490,9 @@ BOOST_AUTO_TEST_CASE(TestMatchingWells) { SummaryState st; std::vector matching_wells; - st.add_well_var("OPX", "WOPR", 0); - st.add_well_var("OPY", "WOPR", 0.50); - st.add_well_var("OPZ", "WOPR", 2.0); + st.update_well_var("OPX", "WOPR", 0); + st.update_well_var("OPY", "WOPR", 0.50); + st.update_well_var("OPZ", "WOPR", 2.0); ActionContext context(st); BOOST_CHECK( ast.eval(context, matching_wells) ); @@ -508,13 +508,13 @@ BOOST_AUTO_TEST_CASE(TestMatchingWells2) { std::vector matching_wells1; std::vector matching_wells2; - st.add_well_var("PX", "WOPR", 0); - st.add_well_var("PY", "WOPR", 0.50); - st.add_well_var("PZ", "WOPR", 2.0); + st.update_well_var("PX", "WOPR", 0); + st.update_well_var("PY", "WOPR", 0.50); + st.update_well_var("PZ", "WOPR", 2.0); - st.add_well_var("IX", "WOPR", 0); - st.add_well_var("IY", "WOPR", 0.50); - st.add_well_var("IZ", "WOPR", 2.0); + st.update_well_var("IX", "WOPR", 0); + st.update_well_var("IY", "WOPR", 0.50); + st.update_well_var("IZ", "WOPR", 2.0); ActionContext context(st); BOOST_CHECK( ast1.eval(context, matching_wells1) ); @@ -534,13 +534,13 @@ BOOST_AUTO_TEST_CASE(TestMatchingWells_AND) { SummaryState st; std::vector matching_wells; - st.add_well_var("OPX", "WOPR", 0); - st.add_well_var("OPY", "WOPR", 0.50); - st.add_well_var("OPZ", "WOPR", 2.0); // The WOPR check matches this well. + st.update_well_var("OPX", "WOPR", 0); + st.update_well_var("OPY", "WOPR", 0.50); + st.update_well_var("OPZ", "WOPR", 2.0); // The WOPR check matches this well. - st.add_well_var("OPX", "WWCT", 1.0); - st.add_well_var("OPY", "WWCT", 0.0); // The WWCT check matches this well. - st.add_well_var("OPZ", "WWCT", 1.0); + st.update_well_var("OPX", "WWCT", 1.0); + st.update_well_var("OPY", "WWCT", 0.0); // The WWCT check matches this well. + st.update_well_var("OPZ", "WWCT", 1.0); ActionContext context(st); BOOST_CHECK( ast.eval(context, matching_wells) ); @@ -556,13 +556,13 @@ BOOST_AUTO_TEST_CASE(TestMatchingWells_OR) { SummaryState st; std::vector matching_wells; - st.add_well_var("OPX", "WOPR", 0); - st.add_well_var("OPY", "WOPR", 0.50); - st.add_well_var("OPZ", "WOPR", 2.0); // The WOPR check matches this well. + st.update_well_var("OPX", "WOPR", 0); + st.update_well_var("OPY", "WOPR", 0.50); + st.update_well_var("OPZ", "WOPR", 2.0); // The WOPR check matches this well. - st.add_well_var("OPX", "WWCT", 1.0); - st.add_well_var("OPY", "WWCT", 0.0); // The WWCT check matches this well. - st.add_well_var("OPZ", "WWCT", 1.0); + st.update_well_var("OPX", "WWCT", 1.0); + st.update_well_var("OPY", "WWCT", 0.0); // The WWCT check matches this well. + st.update_well_var("OPZ", "WWCT", 1.0); ActionContext context(st); BOOST_CHECK( ast.eval(context, matching_wells) ); diff --git a/tests/parser/UDQTests.cpp b/tests/parser/UDQTests.cpp index 148b86526..6397a56d0 100644 --- a/tests/parser/UDQTests.cpp +++ b/tests/parser/UDQTests.cpp @@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE(MIX_SCALAR) { SummaryState st; UDQContext context(udqft, st); - st.add_well_var("P1", "WOPR", 1); + st.update_well_var("P1", "WOPR", 1); auto res_add = def_add.eval_wells(context); BOOST_CHECK_EQUAL( res_add["P1"].value() , 2); @@ -122,9 +122,9 @@ BOOST_AUTO_TEST_CASE(UDQ_DEFINETEST) { SummaryState st; UDQContext context(udqft, st); - st.add_well_var("W1", "WBHP", 11); - st.add_well_var("W2", "WBHP", 2); - st.add_well_var("W3", "WBHP", 3); + st.update_well_var("W1", "WBHP", 11); + st.update_well_var("W2", "WBHP", 2); + st.update_well_var("W3", "WBHP", 3); auto res = def.eval_wells(context); BOOST_CHECK_EQUAL(res.size(), 3); BOOST_CHECK_EQUAL( res["W1"].value(), 11 ); @@ -137,10 +137,10 @@ BOOST_AUTO_TEST_CASE(UDQ_DEFINETEST) { UDQContext context(udqft, st); - st.add_well_var("P1", "WBHP", 1); - st.add_well_var("P2", "WBHP", 2); - st.add_well_var("I1", "WBHP", 1); - st.add_well_var("I2", "WBHP", 2); + st.update_well_var("P1", "WBHP", 1); + st.update_well_var("P2", "WBHP", 2); + st.update_well_var("I1", "WBHP", 1); + st.update_well_var("I2", "WBHP", 2); auto res = def.eval_wells(context); BOOST_CHECK_EQUAL(res.size(), 4); BOOST_CHECK_EQUAL( res["P1"].value(), 1 ); @@ -154,7 +154,7 @@ BOOST_AUTO_TEST_CASE(UDQ_DEFINETEST) { UDQContext context(udqft, st); - st.add_well_var("P1", "WBHP", 1); + st.update_well_var("P1", "WBHP", 1); BOOST_CHECK_THROW( def.eval_wells( context ), std::invalid_argument); } @@ -162,10 +162,10 @@ BOOST_AUTO_TEST_CASE(UDQ_DEFINETEST) { UDQDefine def(udqp, "WUBHP", {"NINT" , "(", "WBHP", ")"}); SummaryState st; UDQContext context(udqft, st); - st.add_well_var("P1", "WBHP", 4); - st.add_well_var("P2", "WBHP", 3); - st.add_well_var("I1", "WBHP", 2); - st.add_well_var("I2", "WBHP", 1); + st.update_well_var("P1", "WBHP", 4); + st.update_well_var("P2", "WBHP", 3); + st.update_well_var("I1", "WBHP", 2); + st.update_well_var("I2", "WBHP", 1); auto res = def.eval_wells(context); BOOST_CHECK_EQUAL( res["P1"].value(), 4 ); @@ -183,7 +183,7 @@ BOOST_AUTO_TEST_CASE(UDQ_DEFINETEST) { UDQContext context(udqft, st); - st.add_well_var("P1", "WBHP", 1); + st.update_well_var("P1", "WBHP", 1); BOOST_CHECK_THROW( def.eval_wells( context ), std::invalid_argument); } } @@ -412,7 +412,7 @@ BOOST_AUTO_TEST_CASE(UDQ_CONTEXT) { for (std::string& key : std::vector({"ELAPSED", "MSUMLINS", "MSUMNEWT", "NEWTON", "TCPU", "TIME", "TIMESTEP"})) BOOST_CHECK_NO_THROW( ctx.get(key) ); - st.add("SUMMARY:KEY", 1.0); + st.update("SUMMARY:KEY", 1.0); BOOST_CHECK_EQUAL(ctx.get("SUMMARY:KEY") , 1.0 ); } @@ -813,11 +813,11 @@ BOOST_AUTO_TEST_CASE(UDQ_POW_TEST) { SummaryState st; UDQContext context(udqft, st); - st.add_well_var("P1", "WOPR", 1); - st.add_well_var("P1", "WWPR", 2); - st.add_well_var("P1", "WGOR", 3); - st.add_well_var("P1", "WWIR", 4); - st.add_well_var("P1", "WOPT", 7); + st.update_well_var("P1", "WOPR", 1); + st.update_well_var("P1", "WWPR", 2); + st.update_well_var("P1", "WGOR", 3); + st.update_well_var("P1", "WWIR", 4); + st.update_well_var("P1", "WOPT", 7); auto res_pow1 = def_pow1.eval_wells(context); auto res_pow2 = def_pow2.eval_wells(context); @@ -832,15 +832,15 @@ BOOST_AUTO_TEST_CASE(UDQ_CMP_TEST) { SummaryState st; UDQContext context(udqft, st); - st.add_well_var("P1", "WOPR", 0); - st.add_well_var("P1", "WWPR", 10); - st.add_well_var("P1", "WGOR", -3); - st.add_well_var("P1", "WWIR", 4); + st.update_well_var("P1", "WOPR", 0); + st.update_well_var("P1", "WWPR", 10); + st.update_well_var("P1", "WGOR", -3); + st.update_well_var("P1", "WWIR", 4); - st.add_well_var("P2", "WOPR", 0); - st.add_well_var("P2", "WWPR", -2); - st.add_well_var("P2", "WGOR", 4); - st.add_well_var("P2", "WWIR", 1); + st.update_well_var("P2", "WOPR", 0); + st.update_well_var("P2", "WWPR", -2); + st.update_well_var("P2", "WGOR", 4); + st.update_well_var("P2", "WWIR", 1); auto res_cmp = def_cmp.eval_wells(context); BOOST_CHECK_EQUAL( res_cmp["P1"].value() , 1.0); @@ -866,15 +866,15 @@ BOOST_AUTO_TEST_CASE(UDQ_BASIC_MATH_TEST) { SummaryState st; UDQContext context(udqft, st); - st.add_well_var("P1", "WOPR", 1); - st.add_well_var("P2", "WOPR", 2); - st.add_well_var("P3", "WOPR", 3); - st.add_well_var("P4", "WOPR", 4); + st.update_well_var("P1", "WOPR", 1); + st.update_well_var("P2", "WOPR", 2); + st.update_well_var("P3", "WOPR", 3); + st.update_well_var("P4", "WOPR", 4); - st.add_well_var("P1", "WWPR", 1); - st.add_well_var("P2", "WWPR", 2); - st.add_well_var("P3", "WWPR", 3); - st.add_well_var("P4", "WWPR", 4); + st.update_well_var("P1", "WWPR", 1); + st.update_well_var("P2", "WWPR", 2); + st.update_well_var("P3", "WWPR", 3); + st.update_well_var("P4", "WWPR", 4); auto res_add = def_add.eval_wells(context); BOOST_CHECK_EQUAL( res_add.size(), 4); @@ -945,7 +945,7 @@ BOOST_AUTO_TEST_CASE(UDQPARSE_PARSECONTEXT) { UDQDefine def1(udqp, "WUBHP", tokens, parseContext, errors); SummaryState st; UDQContext context(UDQFunctionTable(udqp), st); - st.add_well_var("P1", "WOPR", 1); + st.update_well_var("P1", "WOPR", 1); printf("Have returned with def1 \n"); auto res = def1.eval_wells(context); diff --git a/tests/test_AggregateGroupData.cpp b/tests/test_AggregateGroupData.cpp index 6cbc54f09..dd241d67e 100644 --- a/tests/test_AggregateGroupData.cpp +++ b/tests/test_AggregateGroupData.cpp @@ -432,22 +432,22 @@ END { auto state = Opm::SummaryState{}; - state.add("GOPR:GRP1", 235.); - state.add("GGPR:GRP1", 100237.); - state.add("GWPR:GRP1", 239.); + state.update("GOPR:GRP1", 235.); + state.update("GGPR:GRP1", 100237.); + state.update("GWPR:GRP1", 239.); - state.add("GOPR:WGRP1", 23.); - state.add("GGPR:WGRP1", 50237.); - state.add("GWPR:WGRP1", 29.); + state.update("GOPR:WGRP1", 23.); + state.update("GGPR:WGRP1", 50237.); + state.update("GWPR:WGRP1", 29.); - state.add("GOPR:WGRP2", 43.); - state.add("GGPR:WGRP2", 70237.); - state.add("GWPR:WGRP2", 59.); + state.update("GOPR:WGRP2", 43.); + state.update("GGPR:WGRP2", 70237.); + state.update("GWPR:WGRP2", 59.); - state.add("FOPR", 3456.); - state.add("FGPR", 2003456.); - state.add("FWPR", 5678.); + state.update("FOPR", 3456.); + state.update("FGPR", 2003456.); + state.update("FWPR", 5678.); return state; } diff --git a/tests/test_AggregateMSWData.cpp b/tests/test_AggregateMSWData.cpp index bbe7191f4..4360a1d3e 100644 --- a/tests/test_AggregateMSWData.cpp +++ b/tests/test_AggregateMSWData.cpp @@ -498,37 +498,37 @@ END { auto state = Opm::SummaryState{}; - state.add("SPR:PROD:1", 235.); - state.add("SPR:PROD:2", 237.); - state.add("SPR:PROD:3", 239.); - state.add("SPR:PROD:4", 243.); + state.update("SPR:PROD:1", 235.); + state.update("SPR:PROD:2", 237.); + state.update("SPR:PROD:3", 239.); + state.update("SPR:PROD:4", 243.); - state.add("SOFR:PROD:1", 35.); - state.add("SOFR:PROD:2", 30.); - state.add("SOFR:PROD:3", 25.); - state.add("SOFR:PROD:4", 20.); + state.update("SOFR:PROD:1", 35.); + state.update("SOFR:PROD:2", 30.); + state.update("SOFR:PROD:3", 25.); + state.update("SOFR:PROD:4", 20.); - state.add("SGFR:PROD:1", 25.E3); - state.add("SGFR:PROD:2", 20.E3); - state.add("SGFR:PROD:3", 15.E3); - state.add("SGFR:PROD:4", 10.E3); + state.update("SGFR:PROD:1", 25.E3); + state.update("SGFR:PROD:2", 20.E3); + state.update("SGFR:PROD:3", 15.E3); + state.update("SGFR:PROD:4", 10.E3); - state.add("SWFR:PROD:1", 11.); - state.add("SWFR:PROD:2", 12.); - state.add("SWFR:PROD:3", 13.); - state.add("SWFR:PROD:4", 14.); + state.update("SWFR:PROD:1", 11.); + state.update("SWFR:PROD:2", 12.); + state.update("SWFR:PROD:3", 13.); + state.update("SWFR:PROD:4", 14.); - state.add("SPR:WINJ:1", 310.); - state.add("SPR:WINJ:2", 320.); - state.add("SPR:WINJ:3", 330.); - state.add("SPR:WINJ:4", 340.); + state.update("SPR:WINJ:1", 310.); + state.update("SPR:WINJ:2", 320.); + state.update("SPR:WINJ:3", 330.); + state.update("SPR:WINJ:4", 340.); - state.add("SWFR:WINJ:1", 21.); - state.add("SWFR:WINJ:2", 22.); - state.add("SWFR:WINJ:3", 23.); - state.add("SWFR:WINJ:4", 24.); + state.update("SWFR:WINJ:1", 21.); + state.update("SWFR:WINJ:2", 22.); + state.update("SWFR:WINJ:3", 23.); + state.update("SWFR:WINJ:4", 24.); - state.add("WBHP:WINJ", 234.); + state.update("WBHP:WINJ", 234.); return state; } diff --git a/tests/test_AggregateWellData.cpp b/tests/test_AggregateWellData.cpp index b92b4f455..3c011599f 100644 --- a/tests/test_AggregateWellData.cpp +++ b/tests/test_AggregateWellData.cpp @@ -218,74 +218,74 @@ TSTEP -- 8 { auto state = Opm::SummaryState{}; - state.add("WOPR:OP_1" , 1.0); - state.add("WWPR:OP_1" , 2.0); - state.add("WGPR:OP_1" , 3.0); - state.add("WVPR:OP_1" , 4.0); - state.add("WOPT:OP_1" , 10.0); - state.add("WWPT:OP_1" , 20.0); - state.add("WGPT:OP_1" , 30.0); - state.add("WVPT:OP_1" , 40.0); - state.add("WWIR:OP_1" , 0.0); - state.add("WGIR:OP_1" , 0.0); - state.add("WWIT:OP_1" , 0.0); - state.add("WGIT:OP_1" , 0.0); - state.add("WWCT:OP_1" , 0.625); - state.add("WGOR:OP_1" , 234.5); - state.add("WBHP:OP_1" , 314.15); - state.add("WOPTH:OP_1", 345.6); - state.add("WWPTH:OP_1", 456.7); - state.add("WGPTH:OP_1", 567.8); - state.add("WWITH:OP_1", 0.0); - state.add("WGITH:OP_1", 0.0); - state.add("WGVIR:OP_1", 0.0); - state.add("WWVIR:OP_1", 0.0); + state.update("WOPR:OP_1" , 1.0); + state.update("WWPR:OP_1" , 2.0); + state.update("WGPR:OP_1" , 3.0); + state.update("WVPR:OP_1" , 4.0); + state.update("WOPT:OP_1" , 10.0); + state.update("WWPT:OP_1" , 20.0); + state.update("WGPT:OP_1" , 30.0); + state.update("WVPT:OP_1" , 40.0); + state.update("WWIR:OP_1" , 0.0); + state.update("WGIR:OP_1" , 0.0); + state.update("WWIT:OP_1" , 0.0); + state.update("WGIT:OP_1" , 0.0); + state.update("WWCT:OP_1" , 0.625); + state.update("WGOR:OP_1" , 234.5); + state.update("WBHP:OP_1" , 314.15); + state.update("WOPTH:OP_1", 345.6); + state.update("WWPTH:OP_1", 456.7); + state.update("WGPTH:OP_1", 567.8); + state.update("WWITH:OP_1", 0.0); + state.update("WGITH:OP_1", 0.0); + state.update("WGVIR:OP_1", 0.0); + state.update("WWVIR:OP_1", 0.0); - state.add("WOPR:OP_2" , 0.0); - state.add("WWPR:OP_2" , 0.0); - state.add("WGPR:OP_2" , 0.0); - state.add("WVPR:OP_2" , 0.0); - state.add("WOPT:OP_2" , 0.0); - state.add("WWPT:OP_2" , 0.0); - state.add("WGPT:OP_2" , 0.0); - state.add("WVPT:OP_2" , 0.0); - state.add("WWIR:OP_2" , 100.0); - state.add("WGIR:OP_2" , 200.0); - state.add("WWIT:OP_2" , 1000.0); - state.add("WGIT:OP_2" , 2000.0); - state.add("WWCT:OP_2" , 0.0); - state.add("WGOR:OP_2" , 0.0); - state.add("WBHP:OP_2" , 400.6); - state.add("WOPTH:OP_2", 0.0); - state.add("WWPTH:OP_2", 0.0); - state.add("WGPTH:OP_2", 0.0); - state.add("WWITH:OP_2", 1515.0); - state.add("WGITH:OP_2", 3030.0); - state.add("WGVIR:OP_2", 1234.0); - state.add("WWVIR:OP_2", 4321.0); + state.update("WOPR:OP_2" , 0.0); + state.update("WWPR:OP_2" , 0.0); + state.update("WGPR:OP_2" , 0.0); + state.update("WVPR:OP_2" , 0.0); + state.update("WOPT:OP_2" , 0.0); + state.update("WWPT:OP_2" , 0.0); + state.update("WGPT:OP_2" , 0.0); + state.update("WVPT:OP_2" , 0.0); + state.update("WWIR:OP_2" , 100.0); + state.update("WGIR:OP_2" , 200.0); + state.update("WWIT:OP_2" , 1000.0); + state.update("WGIT:OP_2" , 2000.0); + state.update("WWCT:OP_2" , 0.0); + state.update("WGOR:OP_2" , 0.0); + state.update("WBHP:OP_2" , 400.6); + state.update("WOPTH:OP_2", 0.0); + state.update("WWPTH:OP_2", 0.0); + state.update("WGPTH:OP_2", 0.0); + state.update("WWITH:OP_2", 1515.0); + state.update("WGITH:OP_2", 3030.0); + state.update("WGVIR:OP_2", 1234.0); + state.update("WWVIR:OP_2", 4321.0); - state.add("WOPR:OP_3" , 11.0); - state.add("WWPR:OP_3" , 12.0); - state.add("WGPR:OP_3" , 13.0); - state.add("WVPR:OP_3" , 14.0); - state.add("WOPT:OP_3" , 110.0); - state.add("WWPT:OP_3" , 120.0); - state.add("WGPT:OP_3" , 130.0); - state.add("WVPT:OP_3" , 140.0); - state.add("WWIR:OP_3" , 0.0); - state.add("WGIR:OP_3" , 0.0); - state.add("WWIT:OP_3" , 0.0); - state.add("WGIT:OP_3" , 0.0); - state.add("WWCT:OP_3" , 0.0625); - state.add("WGOR:OP_3" , 1234.5); - state.add("WBHP:OP_3" , 314.15); - state.add("WOPTH:OP_3", 2345.6); - state.add("WWPTH:OP_3", 3456.7); - state.add("WGPTH:OP_3", 4567.8); - state.add("WWITH:OP_3", 0.0); - state.add("WGITH:OP_3", 0.0); - state.add("WGVIR:OP_3", 0.0); - state.add("WWVIR:OP_3", 43.21); + state.update("WOPR:OP_3" , 11.0); + state.update("WWPR:OP_3" , 12.0); + state.update("WGPR:OP_3" , 13.0); + state.update("WVPR:OP_3" , 14.0); + state.update("WOPT:OP_3" , 110.0); + state.update("WWPT:OP_3" , 120.0); + state.update("WGPT:OP_3" , 130.0); + state.update("WVPT:OP_3" , 140.0); + state.update("WWIR:OP_3" , 0.0); + state.update("WGIR:OP_3" , 0.0); + state.update("WWIT:OP_3" , 0.0); + state.update("WGIT:OP_3" , 0.0); + state.update("WWCT:OP_3" , 0.0625); + state.update("WGOR:OP_3" , 1234.5); + state.update("WBHP:OP_3" , 314.15); + state.update("WOPTH:OP_3", 2345.6); + state.update("WWPTH:OP_3", 3456.7); + state.update("WGPTH:OP_3", 4567.8); + state.update("WWITH:OP_3", 0.0); + state.update("WGITH:OP_3", 0.0); + state.update("WGVIR:OP_3", 0.0); + state.update("WWVIR:OP_3", 43.21); return state; } diff --git a/tests/test_Restart.cpp b/tests/test_Restart.cpp index c80fe06b2..89e20cb6d 100644 --- a/tests/test_Restart.cpp +++ b/tests/test_Restart.cpp @@ -351,118 +351,118 @@ Opm::SummaryState sim_state() { auto state = Opm::SummaryState{}; - state.add("WOPR:OP_1" , 1.0); - state.add("WWPR:OP_1" , 2.0); - state.add("WGPR:OP_1" , 3.0); - state.add("WVPR:OP_1" , 4.0); - state.add("WOPT:OP_1" , 10.0); - state.add("WWPT:OP_1" , 20.0); - state.add("WGPT:OP_1" , 30.0); - state.add("WVPT:OP_1" , 40.0); - state.add("WWIR:OP_1" , 0.0); - state.add("WGIR:OP_1" , 0.0); - state.add("WWIT:OP_1" , 0.0); - state.add("WGIT:OP_1" , 0.0); - state.add("WWCT:OP_1" , 0.625); - state.add("WGOR:OP_1" , 234.5); - state.add("WBHP:OP_1" , 314.15); - state.add("WOPTH:OP_1", 345.6); - state.add("WWPTH:OP_1", 456.7); - state.add("WGPTH:OP_1", 567.8); - state.add("WWITH:OP_1", 0.0); - state.add("WGITH:OP_1", 0.0); - state.add("WGVIR:OP_1", 0.0); - state.add("WWVIR:OP_1", 0.0); + state.update("WOPR:OP_1" , 1.0); + state.update("WWPR:OP_1" , 2.0); + state.update("WGPR:OP_1" , 3.0); + state.update("WVPR:OP_1" , 4.0); + state.update("WOPT:OP_1" , 10.0); + state.update("WWPT:OP_1" , 20.0); + state.update("WGPT:OP_1" , 30.0); + state.update("WVPT:OP_1" , 40.0); + state.update("WWIR:OP_1" , 0.0); + state.update("WGIR:OP_1" , 0.0); + state.update("WWIT:OP_1" , 0.0); + state.update("WGIT:OP_1" , 0.0); + state.update("WWCT:OP_1" , 0.625); + state.update("WGOR:OP_1" , 234.5); + state.update("WBHP:OP_1" , 314.15); + state.update("WOPTH:OP_1", 345.6); + state.update("WWPTH:OP_1", 456.7); + state.update("WGPTH:OP_1", 567.8); + state.update("WWITH:OP_1", 0.0); + state.update("WGITH:OP_1", 0.0); + state.update("WGVIR:OP_1", 0.0); + state.update("WWVIR:OP_1", 0.0); - state.add("WOPR:OP_2" , 0.0); - state.add("WWPR:OP_2" , 0.0); - state.add("WGPR:OP_2" , 0.0); - state.add("WVPR:OP_2" , 0.0); - state.add("WOPT:OP_2" , 0.0); - state.add("WWPT:OP_2" , 0.0); - state.add("WGPT:OP_2" , 0.0); - state.add("WVPT:OP_2" , 0.0); - state.add("WWIR:OP_2" , 100.0); - state.add("WGIR:OP_2" , 200.0); - state.add("WWIT:OP_2" , 1000.0); - state.add("WGIT:OP_2" , 2000.0); - state.add("WWCT:OP_2" , 0.0); - state.add("WGOR:OP_2" , 0.0); - state.add("WBHP:OP_2" , 400.6); - state.add("WOPTH:OP_2", 0.0); - state.add("WWPTH:OP_2", 0.0); - state.add("WGPTH:OP_2", 0.0); - state.add("WWITH:OP_2", 1515.0); - state.add("WGITH:OP_2", 3030.0); - state.add("WGVIR:OP_2", 1234.0); - state.add("WWVIR:OP_2", 4321.0); + state.update("WOPR:OP_2" , 0.0); + state.update("WWPR:OP_2" , 0.0); + state.update("WGPR:OP_2" , 0.0); + state.update("WVPR:OP_2" , 0.0); + state.update("WOPT:OP_2" , 0.0); + state.update("WWPT:OP_2" , 0.0); + state.update("WGPT:OP_2" , 0.0); + state.update("WVPT:OP_2" , 0.0); + state.update("WWIR:OP_2" , 100.0); + state.update("WGIR:OP_2" , 200.0); + state.update("WWIT:OP_2" , 1000.0); + state.update("WGIT:OP_2" , 2000.0); + state.update("WWCT:OP_2" , 0.0); + state.update("WGOR:OP_2" , 0.0); + state.update("WBHP:OP_2" , 400.6); + state.update("WOPTH:OP_2", 0.0); + state.update("WWPTH:OP_2", 0.0); + state.update("WGPTH:OP_2", 0.0); + state.update("WWITH:OP_2", 1515.0); + state.update("WGITH:OP_2", 3030.0); + state.update("WGVIR:OP_2", 1234.0); + state.update("WWVIR:OP_2", 4321.0); - state.add("WOPR:OP_3" , 11.0); - state.add("WWPR:OP_3" , 12.0); - state.add("WGPR:OP_3" , 13.0); - state.add("WVPR:OP_3" , 14.0); - state.add("WOPT:OP_3" , 110.0); - state.add("WWPT:OP_3" , 120.0); - state.add("WGPT:OP_3" , 130.0); - state.add("WVPT:OP_3" , 140.0); - state.add("WWIR:OP_3" , 0.0); - state.add("WGIR:OP_3" , 0.0); - state.add("WWIT:OP_3" , 0.0); - state.add("WGIT:OP_3" , 0.0); - state.add("WWCT:OP_3" , 0.0625); - state.add("WGOR:OP_3" , 1234.5); - state.add("WBHP:OP_3" , 314.15); - state.add("WOPTH:OP_3", 2345.6); - state.add("WWPTH:OP_3", 3456.7); - state.add("WGPTH:OP_3", 4567.8); - state.add("WWITH:OP_3", 0.0); - state.add("WGITH:OP_3", 0.0); - state.add("WGVIR:OP_3", 0.0); - state.add("WWVIR:OP_3", 43.21); + state.update("WOPR:OP_3" , 11.0); + state.update("WWPR:OP_3" , 12.0); + state.update("WGPR:OP_3" , 13.0); + state.update("WVPR:OP_3" , 14.0); + state.update("WOPT:OP_3" , 110.0); + state.update("WWPT:OP_3" , 120.0); + state.update("WGPT:OP_3" , 130.0); + state.update("WVPT:OP_3" , 140.0); + state.update("WWIR:OP_3" , 0.0); + state.update("WGIR:OP_3" , 0.0); + state.update("WWIT:OP_3" , 0.0); + state.update("WGIT:OP_3" , 0.0); + state.update("WWCT:OP_3" , 0.0625); + state.update("WGOR:OP_3" , 1234.5); + state.update("WBHP:OP_3" , 314.15); + state.update("WOPTH:OP_3", 2345.6); + state.update("WWPTH:OP_3", 3456.7); + state.update("WGPTH:OP_3", 4567.8); + state.update("WWITH:OP_3", 0.0); + state.update("WGITH:OP_3", 0.0); + state.update("WGVIR:OP_3", 0.0); + state.update("WWVIR:OP_3", 43.21); - state.add("GOPR:OP" , 110.0); - state.add("GWPR:OP" , 120.0); - state.add("GGPR:OP" , 130.0); - state.add("GVPR:OP" , 140.0); - state.add("GOPT:OP" , 1100.0); - state.add("GWPT:OP" , 1200.0); - state.add("GGPT:OP" , 1300.0); - state.add("GVPT:OP" , 1400.0); - state.add("GWIR:OP" , - 256.0); - state.add("GGIR:OP" , - 65536.0); - state.add("GWIT:OP" , 31415.9); - state.add("GGIT:OP" , 27182.8); - state.add("GWCT:OP" , 0.625); - state.add("GGOR:OP" , 1234.5); - state.add("GGVIR:OP", 123.45); - state.add("GWVIR:OP", 1234.56); - state.add("GOPTH:OP", 5678.90); - state.add("GWPTH:OP", 6789.01); - state.add("GGPTH:OP", 7890.12); - state.add("GWITH:OP", 8901.23); - state.add("GGITH:OP", 9012.34); + state.update("GOPR:OP" , 110.0); + state.update("GWPR:OP" , 120.0); + state.update("GGPR:OP" , 130.0); + state.update("GVPR:OP" , 140.0); + state.update("GOPT:OP" , 1100.0); + state.update("GWPT:OP" , 1200.0); + state.update("GGPT:OP" , 1300.0); + state.update("GVPT:OP" , 1400.0); + state.update("GWIR:OP" , - 256.0); + state.update("GGIR:OP" , - 65536.0); + state.update("GWIT:OP" , 31415.9); + state.update("GGIT:OP" , 27182.8); + state.update("GWCT:OP" , 0.625); + state.update("GGOR:OP" , 1234.5); + state.update("GGVIR:OP", 123.45); + state.update("GWVIR:OP", 1234.56); + state.update("GOPTH:OP", 5678.90); + state.update("GWPTH:OP", 6789.01); + state.update("GGPTH:OP", 7890.12); + state.update("GWITH:OP", 8901.23); + state.update("GGITH:OP", 9012.34); - state.add("FOPR" , 1100.0); - state.add("FWPR" , 1200.0); - state.add("FGPR" , 1300.0); - state.add("FVPR" , 1400.0); - state.add("FOPT" , 11000.0); - state.add("FWPT" , 12000.0); - state.add("FGPT" , 13000.0); - state.add("FVPT" , 14000.0); - state.add("FWIR" , - 2560.0); - state.add("FGIR" , - 655360.0); - state.add("FWIT" , 314159.2); - state.add("FGIT" , 271828.1); - state.add("FWCT" , 0.625); - state.add("FGOR" , 1234.5); - state.add("FOPTH", 56789.01); - state.add("FWPTH", 67890.12); - state.add("FGPTH", 78901.23); - state.add("FWITH", 89012.34); - state.add("FGITH", 90123.45); - state.add("FGVIR", 1234.56); - state.add("FWVIR", 12345.67); + state.update("FOPR" , 1100.0); + state.update("FWPR" , 1200.0); + state.update("FGPR" , 1300.0); + state.update("FVPR" , 1400.0); + state.update("FOPT" , 11000.0); + state.update("FWPT" , 12000.0); + state.update("FGPT" , 13000.0); + state.update("FVPT" , 14000.0); + state.update("FWIR" , - 2560.0); + state.update("FGIR" , - 655360.0); + state.update("FWIT" , 314159.2); + state.update("FGIT" , 271828.1); + state.update("FWCT" , 0.625); + state.update("FGOR" , 1234.5); + state.update("FOPTH", 56789.01); + state.update("FWPTH", 67890.12); + state.update("FGPTH", 78901.23); + state.update("FWITH", 89012.34); + state.update("FGITH", 90123.45); + state.update("FGVIR", 1234.56); + state.update("FWVIR", 12345.67); return state; } diff --git a/tests/test_Summary.cpp b/tests/test_Summary.cpp index 34e925ff4..c1d312aaa 100644 --- a/tests/test_Summary.cpp +++ b/tests/test_Summary.cpp @@ -1388,16 +1388,16 @@ BOOST_AUTO_TEST_CASE(efficiency_factor) { BOOST_AUTO_TEST_CASE(Test_SummaryState) { Opm::SummaryState st; - st.add("WWCT:OP_2", 100); + st.update("WWCT:OP_2", 100); BOOST_CHECK_CLOSE(st.get("WWCT:OP_2"), 100, 1e-5); BOOST_CHECK_THROW(st.get("NO_SUCH_KEY"), std::out_of_range); BOOST_CHECK(st.has("WWCT:OP_2")); BOOST_CHECK(!st.has("NO_SUCH_KEY")); - st.add_well_var("OP1", "WWCT", 0.75); - st.add_well_var("OP2", "WWCT", 0.75); - st.add_well_var("OP3", "WOPT", 0.75); + st.update_well_var("OP1", "WWCT", 0.75); + st.update_well_var("OP2", "WWCT", 0.75); + st.update_well_var("OP3", "WOPT", 0.75); BOOST_CHECK( st.has_well_var("OP1", "WWCT")); BOOST_CHECK_EQUAL( st.get_well_var("OP1", "WWCT"), 0.75); BOOST_CHECK_EQUAL( st.get_well_var("OP1", "WWCT"), st.get("WWCT:OP1")); @@ -2921,43 +2921,43 @@ BOOST_AUTO_TEST_CASE(Reset) }; auto rstrt = ::Opm::SummaryState{}; - rstrt.add("WOPT:W_1", 1.0); - rstrt.add("WWPT:W_1", 2.0); - rstrt.add("WGPT:W_1", 3.0); - rstrt.add("WVPT:W_1", 4.0); + rstrt.update("WOPT:W_1", 1.0); + rstrt.update("WWPT:W_1", 2.0); + rstrt.update("WGPT:W_1", 3.0); + rstrt.update("WVPT:W_1", 4.0); - rstrt.add("WWIT:W_1", 5.0); - rstrt.add("WGIT:W_1", 6.0); + rstrt.update("WWIT:W_1", 5.0); + rstrt.update("WGIT:W_1", 6.0); - rstrt.add("WOPTH:W_1", 0.1); - rstrt.add("WWPTH:W_1", 0.2); - rstrt.add("WGPTH:W_1", 0.3); + rstrt.update("WOPTH:W_1", 0.1); + rstrt.update("WWPTH:W_1", 0.2); + rstrt.update("WGPTH:W_1", 0.3); - rstrt.add("WWITH:W_1", 0.5); - rstrt.add("WGITH:W_1", 0.6); + rstrt.update("WWITH:W_1", 0.5); + rstrt.update("WGITH:W_1", 0.6); - rstrt.add("GOPT:NoSuchGroup", 1.0); - rstrt.add("GWPT:NoSuchGroup", 2.0); - rstrt.add("GGPT:NoSuchGroup", 3.0); - rstrt.add("GVPT:NoSuchGroup", 4.0); + rstrt.update("GOPT:NoSuchGroup", 1.0); + rstrt.update("GWPT:NoSuchGroup", 2.0); + rstrt.update("GGPT:NoSuchGroup", 3.0); + rstrt.update("GVPT:NoSuchGroup", 4.0); - rstrt.add("GWIT:NoSuchGroup", 5.0); - rstrt.add("GGIT:NoSuchGroup", 6.0); + rstrt.update("GWIT:NoSuchGroup", 5.0); + rstrt.update("GGIT:NoSuchGroup", 6.0); - rstrt.add("FOPT", 10.0); - rstrt.add("FWPT", 20.0); - rstrt.add("FGPT", 30.0); - rstrt.add("FVPT", 40.0); + rstrt.update("FOPT", 10.0); + rstrt.update("FWPT", 20.0); + rstrt.update("FGPT", 30.0); + rstrt.update("FVPT", 40.0); - rstrt.add("FWIT", 50.0); - rstrt.add("FGIT", 60.0); + rstrt.update("FWIT", 50.0); + rstrt.update("FGIT", 60.0); - rstrt.add("FOPTH", 0.01); - rstrt.add("FWPTH", 0.02); - rstrt.add("FGPTH", 0.03); + rstrt.update("FOPTH", 0.01); + rstrt.update("FWPTH", 0.02); + rstrt.update("FGPTH", 0.03); - rstrt.add("FWITH", 0.05); - rstrt.add("FGITH", 0.06); + rstrt.update("FWITH", 0.05); + rstrt.update("FGITH", 0.06); smry.reset_cumulative_quantities(rstrt); @@ -3079,4 +3079,53 @@ BOOST_AUTO_TEST_CASE(Reset) BOOST_CHECK_CLOSE(sumstate.get("FGITH"), 0.06, 1.0e-10); } + + +BOOST_AUTO_TEST_CASE(SummaryState_TOTAL) { + SummaryState st; + st.update("FOPR", 100); + BOOST_CHECK_EQUAL(st.get("FOPR"), 100); + st.update("FOPR", 100); + BOOST_CHECK_EQUAL(st.get("FOPR"), 100); + st.update("WOPR:OP1", 100); + BOOST_CHECK_EQUAL(st.get("WOPR:OP1"), 100); + st.update("WOPR:OP1", 100); + BOOST_CHECK_EQUAL(st.get("WOPR:OP1"), 100); + + st.update("FOPT", 100); + BOOST_CHECK_EQUAL(st.get("FOPT"), 100); + st.update("FOPT", 100); + BOOST_CHECK_EQUAL(st.get("FOPT"), 200); + st.update("WOPT:OP1", 100); + BOOST_CHECK_EQUAL(st.get("WOPT:OP1"), 100); + st.update("WOPT:OP1", 100); + BOOST_CHECK_EQUAL(st.get("WOPT:OP1"), 200); + + st.update_well_var("OP1", "WOPR", 100); + BOOST_CHECK_EQUAL(st.get_well_var("OP1", "WOPR"), 100); + st.update_well_var("OP1", "WOPR", 100); + BOOST_CHECK_EQUAL(st.get_well_var("OP1", "WOPR"), 100); + + st.update_well_var("OP1", "WOPT", 100); + BOOST_CHECK_EQUAL(st.get_well_var("OP1", "WOPT"), 100); + st.update_well_var("OP1", "WOPT", 100); + BOOST_CHECK_EQUAL(st.get_well_var("OP1", "WOPT"), 200); + + st.update_well_var("OP1", "WOPTH", 100); + BOOST_CHECK_EQUAL(st.get_well_var("OP1", "WOPTH"), 100); + st.update_well_var("OP1", "WOPTH", 100); + BOOST_CHECK_EQUAL(st.get_well_var("OP1", "WOPTH"), 200); + + st.update("FOPTH", 100); + BOOST_CHECK_EQUAL(st.get("FOPTH"), 100); + st.update("FOPTH", 100); + BOOST_CHECK_EQUAL(st.get("FOPTH"), 200); + + + st.update_elapsed(100); + BOOST_CHECK_EQUAL(st.get_elapsed(), 100); + st.update_elapsed(100); + BOOST_CHECK_EQUAL(st.get_elapsed(), 200); +} + BOOST_AUTO_TEST_SUITE_END()