Merge pull request #565 from joakim-hove/schedule-eval-actions
Add method Schedule::evalActions() to evaluate ACTIONX
This commit is contained in:
@@ -33,6 +33,7 @@ class Actions {
|
||||
public:
|
||||
Actions() = default;
|
||||
size_t size() const;
|
||||
bool empty() const;
|
||||
void add(const ActionX& action);
|
||||
bool ready(std::time_t sim_time) const;
|
||||
ActionX& at(const std::string& name);
|
||||
|
||||
@@ -45,17 +45,18 @@
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
class Actions;
|
||||
class Deck;
|
||||
class DeckKeyword;
|
||||
class DeckRecord;
|
||||
class EclipseGrid;
|
||||
class Eclipse3DProperties;
|
||||
class SCHEDULESection;
|
||||
class TimeMap;
|
||||
class UnitSystem;
|
||||
class EclipseState;
|
||||
class Runspec;
|
||||
class Actions;
|
||||
class SCHEDULESection;
|
||||
class SummaryState;
|
||||
class TimeMap;
|
||||
class UnitSystem;
|
||||
|
||||
class Schedule {
|
||||
public:
|
||||
@@ -108,6 +109,7 @@ namespace Opm
|
||||
|
||||
const WellTestConfig& wtestConfig(size_t timestep) const;
|
||||
const Actions& actionConfig() const;
|
||||
void evalAction(const SummaryState& summary_state, size_t timeStep);
|
||||
|
||||
const GroupTree& getGroupTree(size_t t) const;
|
||||
size_t numGroups() const;
|
||||
|
||||
@@ -27,6 +27,11 @@ size_t Actions::size() const {
|
||||
}
|
||||
|
||||
|
||||
bool Actions::empty() const {
|
||||
return this->actions.empty();
|
||||
}
|
||||
|
||||
|
||||
void Actions::add(const ActionX& action) {
|
||||
auto iter = this->actions.find(action.name());
|
||||
if (iter != this->actions.end())
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/WellInjectionProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/WellProductionProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
|
||||
#include <opm/parser/eclipse/Units/Dimension.hpp>
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
|
||||
@@ -1948,7 +1949,7 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
double Schedule::seconds(size_t timeStep) const {
|
||||
double Schedule::seconds(size_t timeStep) const {
|
||||
return this->m_timeMap.seconds(timeStep);
|
||||
}
|
||||
|
||||
@@ -1956,5 +1957,12 @@ namespace Opm {
|
||||
double Schedule::stepLength(size_t timeStep) const {
|
||||
return this->m_timeMap.getTimeStepLength(timeStep);
|
||||
}
|
||||
|
||||
|
||||
void Schedule::evalAction(const SummaryState& st, size_t timeStep) {
|
||||
if (this->actions.empty())
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -144,11 +144,12 @@ BOOST_AUTO_TEST_CASE(TestActions) {
|
||||
Opm::ActionContext context(st);
|
||||
Opm::Actions config;
|
||||
BOOST_CHECK_EQUAL(config.size(), 0);
|
||||
BOOST_CHECK(config.empty());
|
||||
|
||||
Opm::ActionX action1("NAME", 10, 100, 0);
|
||||
config.add(action1);
|
||||
BOOST_CHECK_EQUAL(config.size(), 1);
|
||||
|
||||
BOOST_CHECK(!config.empty());
|
||||
|
||||
double min_wait = 86400;
|
||||
size_t max_eval = 3;
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/WellConnections.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
@@ -2661,7 +2663,7 @@ VFPINJ \n \
|
||||
Runspec runspec (deck);
|
||||
Schedule schedule(deck, grid1 , eclipseProperties, runspec , ParseContext() );
|
||||
|
||||
|
||||
schedule.evalAction(SummaryState(), 5);
|
||||
BOOST_CHECK( schedule.getEvents().hasEvent(ScheduleEvents::VFPINJ_UPDATE, 0));
|
||||
BOOST_CHECK( !schedule.getEvents().hasEvent(ScheduleEvents::VFPINJ_UPDATE, 1));
|
||||
BOOST_CHECK( schedule.getEvents().hasEvent(ScheduleEvents::VFPINJ_UPDATE, 2));
|
||||
|
||||
Reference in New Issue
Block a user