From b62b5be44fd85328e1c9ac8a326a955f2fc3afd4 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Thu, 20 Jan 2022 08:12:10 +0100 Subject: [PATCH] Remove unused argument sim_time from Schedule::applyAction() --- msim/src/msim.cpp | 2 +- opm/input/eclipse/Schedule/Schedule.hpp | 2 +- src/opm/input/eclipse/Schedule/Schedule.cpp | 2 +- tests/parser/ACTIONX.cpp | 19 ++++++++----------- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/msim/src/msim.cpp b/msim/src/msim.cpp index 01731e282..bfced735c 100644 --- a/msim/src/msim.cpp +++ b/msim/src/msim.cpp @@ -86,7 +86,7 @@ void msim::post_step(Schedule& schedule, SummaryState& st, data::Solution& /* so for (const auto& action : actions.pending(this->action_state, std::chrono::system_clock::to_time_t(sim_time))) { auto result = action->eval(context); if (result) - schedule.applyAction(report_step, sim_time, *action, result, {}); + schedule.applyAction(report_step, *action, result, {}); } for (const auto& pyaction : actions.pending_python()) diff --git a/opm/input/eclipse/Schedule/Schedule.hpp b/opm/input/eclipse/Schedule/Schedule.hpp index 7de1c8249..3bca336e8 100644 --- a/opm/input/eclipse/Schedule/Schedule.hpp +++ b/opm/input/eclipse/Schedule/Schedule.hpp @@ -279,7 +279,7 @@ namespace Opm bool write_rst_file(std::size_t report_step) const; const std::map< std::string, int >& rst_keywords( size_t timestep ) const; - SimulatorUpdate applyAction(std::size_t reportStep, const time_point& sim_time, const Action::ActionX& action, const Action::Result& result, const std::unordered_map& wellpi); + SimulatorUpdate applyAction(std::size_t reportStep, const Action::ActionX& action, const Action::Result& result, const std::unordered_map& wellpi); void applyWellProdIndexScaling(const std::string& well_name, const std::size_t reportStep, const double scalingFactor); diff --git a/src/opm/input/eclipse/Schedule/Schedule.cpp b/src/opm/input/eclipse/Schedule/Schedule.cpp index 8edb09711..100ea3344 100644 --- a/src/opm/input/eclipse/Schedule/Schedule.cpp +++ b/src/opm/input/eclipse/Schedule/Schedule.cpp @@ -1290,7 +1290,7 @@ File {} line {}.)", pattern, location.keyword, location.filename, location.linen } - SimulatorUpdate Schedule::applyAction(std::size_t reportStep, const time_point&, const Action::ActionX& action, const Action::Result& result, const std::unordered_map& target_wellpi) { + SimulatorUpdate Schedule::applyAction(std::size_t reportStep, const Action::ActionX& action, const Action::Result& result, const std::unordered_map& target_wellpi) { const std::string prefix = "| "; ParseContext parseContext; ErrorGuard errors; diff --git a/tests/parser/ACTIONX.cpp b/tests/parser/ACTIONX.cpp index a1744876a..343c92335 100644 --- a/tests/parser/ACTIONX.cpp +++ b/tests/parser/ACTIONX.cpp @@ -157,9 +157,8 @@ TSTEP BOOST_CHECK( sched.hasWell("W2")); Action::Result action_result(true); - auto sim_time = TimeService::now(); const auto& action1 = sched[0].actions.get()["ACTION"]; - auto sim_update = sched.applyAction(0, sim_time, action1, action_result, {}); + auto sim_update = sched.applyAction(0, action1, action_result, {}); const auto& affected_wells = sim_update.affected_wells; std::vector expected_wells{"W0", "W1", "W3"}; BOOST_CHECK( std::is_permutation(affected_wells.begin(), affected_wells.end(), @@ -224,9 +223,8 @@ COMPDAT Schedule sched = make_schedule(TRAILING_COMPDAT); Action::Result action_result(true); - auto sim_time = TimeService::now(); const auto& action1 = sched[0].actions.get()["ACTION"]; - BOOST_CHECK_NO_THROW( sched.applyAction(0, sim_time, action1, Action::Result{true}, {})); + BOOST_CHECK_NO_THROW( sched.applyAction(0, action1, Action::Result{true}, {})); } @@ -1139,8 +1137,7 @@ TSTEP Action::Result action_result(true); - auto sim_time = TimeService::now(); - sched.applyAction(0, sim_time, action1, action_result, {}); + sched.applyAction(0, action1, action_result, {}); { const auto& group = sched.getGroup("G1", 1); @@ -1255,7 +1252,7 @@ TSTEP Action::Result action_result(true); - const auto& sim_update = sched.applyAction(0, TimeService::now(), action1, action_result, {}); + const auto& sim_update = sched.applyAction(0, action1, action_result, {}); BOOST_CHECK( sim_update.affected_wells.empty() ); { const auto& glo = sched.glo(0); @@ -1329,7 +1326,7 @@ TSTEP BOOST_CHECK(!sched.hasWell("PROD1")); Action::Result action_result(true); - sched.applyAction(0, TimeService::now(), action1, action_result, {}); + sched.applyAction(0, action1, action_result, {}); const auto& well = sched.getWell("PROD1", 1); const auto& connections = well.getConnections(); @@ -1391,10 +1388,10 @@ TSTEP Action::Result action_result(true); - BOOST_CHECK_THROW( sched.applyAction(0, TimeService::now(), action1, action_result, {}), std::exception); + BOOST_CHECK_THROW( sched.applyAction(0, action1, action_result, {}), std::exception); { const auto& well = sched.getWell("PROD1", 0); - const auto& sim_update = sched.applyAction(0, TimeService::now(), action1, action_result, {{"PROD1", well.convertDeckPI(500)}}); + const auto& sim_update = sched.applyAction(0, action1, action_result, {{"PROD1", well.convertDeckPI(500)}}); BOOST_CHECK_EQUAL( sim_update.affected_wells.count("PROD1"), 1); BOOST_CHECK_EQUAL( sim_update.affected_wells.size(), 1); } @@ -1464,7 +1461,7 @@ TSTEP BOOST_CHECK(sched[0].geo_keywords().empty()); Action::Result action_result(true); - auto sim_update = sched.applyAction(0, TimeService::now(), action1, action_result, {}); + auto sim_update = sched.applyAction(0, action1, action_result, {}); BOOST_CHECK( sim_update.tran_update ); BOOST_CHECK_EQUAL(sched[0].geo_keywords().size(), 3); }