Internalize nupcol in ScheduleState
This commit is contained in:
@@ -283,7 +283,6 @@ namespace Opm
|
||||
|
||||
void applyAction(std::size_t reportStep, const Action::ActionX& action, const Action::Result& result);
|
||||
void applyWellProdIndexScaling(const std::string& well_name, const std::size_t reportStep, const double scalingFactor);
|
||||
int getNupcol(std::size_t reportStep) const;
|
||||
|
||||
|
||||
const Network::ExtNetwork& network(std::size_t report_step) const;
|
||||
@@ -342,7 +341,6 @@ namespace Opm
|
||||
m_network.serializeOp(serializer);
|
||||
m_glo.serializeOp(serializer);
|
||||
rft_config.serializeOp(serializer);
|
||||
m_nupcol.template serializeOp<Serializer, false>(serializer);
|
||||
restart_config.serializeOp(serializer);
|
||||
serializer.map(wellgroup_events);
|
||||
if (!serializer.isSerializing()) {
|
||||
@@ -381,7 +379,6 @@ namespace Opm
|
||||
DynamicState<std::shared_ptr<Network::ExtNetwork>> m_network;
|
||||
DynamicState<std::shared_ptr<GasLiftOpt>> m_glo;
|
||||
RFTConfig rft_config;
|
||||
DynamicState<int> m_nupcol;
|
||||
RestartConfig restart_config;
|
||||
UnitSystem unit_system;
|
||||
std::optional<int> exit_status;
|
||||
|
||||
@@ -59,6 +59,9 @@ namespace Opm {
|
||||
void tuning(Tuning tuning);
|
||||
const Tuning& tuning() const;
|
||||
|
||||
void nupcol(int nupcol);
|
||||
int nupcol() const;
|
||||
|
||||
|
||||
template<class Serializer>
|
||||
void serializeOp(Serializer& serializer) {
|
||||
@@ -66,6 +69,7 @@ namespace Opm {
|
||||
serializer(m_end_time);
|
||||
serializer(m_pavg);
|
||||
m_tuning.serializeOp(serializer);
|
||||
serializer(m_nupcol);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -74,6 +78,7 @@ namespace Opm {
|
||||
|
||||
std::shared_ptr<PAvg> m_pavg;
|
||||
Tuning m_tuning;
|
||||
int m_nupcol;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -736,7 +736,7 @@ namespace {
|
||||
OpmLog::note(msg);
|
||||
}
|
||||
|
||||
this->m_nupcol.update(handlerContext.currentStep, nupcol);
|
||||
this->snapshots.back().nupcol(nupcol);
|
||||
}
|
||||
|
||||
void Schedule::handleRPTSCHED(const HandlerContext& handlerContext, const ParseContext&, ErrorGuard&) {
|
||||
|
||||
@@ -128,7 +128,6 @@ namespace {
|
||||
m_network(this->m_timeMap, std::make_shared<Network::ExtNetwork>()),
|
||||
m_glo(this->m_timeMap, std::make_shared<GasLiftOpt>()),
|
||||
rft_config(this->m_timeMap),
|
||||
m_nupcol(this->m_timeMap, runspec.nupcol()),
|
||||
restart_config(m_timeMap, deck, parseContext, errors),
|
||||
unit_system(deck.getActiveUnitSystem()),
|
||||
rpt_config(this->m_timeMap, std::make_shared<RPTConfig>())
|
||||
@@ -284,7 +283,6 @@ namespace {
|
||||
result.global_whistctl_mode = {{Well::ProducerCMode::CRAT}, 1};
|
||||
result.m_actions = {{std::make_shared<Action::Actions>(Action::Actions::serializeObject())}, 1};
|
||||
result.rft_config = RFTConfig::serializeObject();
|
||||
result.m_nupcol = {{1}, 1};
|
||||
result.restart_config = RestartConfig::serializeObject();
|
||||
result.wellgroup_events = {{"test", Events::serializeObject()}};
|
||||
result.unit_system = UnitSystem::newFIELD();
|
||||
@@ -1612,10 +1610,6 @@ private:
|
||||
return this->restart_config;
|
||||
}
|
||||
|
||||
int Schedule::getNupcol(std::size_t reportStep) const {
|
||||
return this->m_nupcol.get(reportStep);
|
||||
}
|
||||
|
||||
bool Schedule::operator==(const Schedule& data) const {
|
||||
auto&& comparePtr = [](const auto& t1, const auto& t2) {
|
||||
if ((t1 && !t2) || (!t1 && t2))
|
||||
@@ -1671,7 +1665,6 @@ private:
|
||||
compareDynState(this->m_actions, data.m_actions) &&
|
||||
compareDynState(this->rpt_config, data.rpt_config) &&
|
||||
rft_config == data.rft_config &&
|
||||
this->m_nupcol == data.m_nupcol &&
|
||||
this->restart_config == data.restart_config &&
|
||||
this->unit_system == data.unit_system &&
|
||||
this->wellgroup_events == data.wellgroup_events;
|
||||
|
||||
@@ -65,17 +65,26 @@ const PAvg& ScheduleState::pavg() const {
|
||||
return *this->m_pavg;
|
||||
}
|
||||
|
||||
void ScheduleState::nupcol(int nupcol) {
|
||||
this->m_nupcol = nupcol;
|
||||
}
|
||||
|
||||
int ScheduleState::nupcol() const {
|
||||
return this->m_nupcol;
|
||||
}
|
||||
|
||||
bool ScheduleState::operator==(const ScheduleState& other) const {
|
||||
return this->m_start_time == other.m_start_time &&
|
||||
this->m_tuning == other.m_tuning &&
|
||||
this->m_end_time == other.m_end_time;
|
||||
this->m_end_time == other.m_end_time &&
|
||||
this->m_nupcol == other.m_nupcol;
|
||||
}
|
||||
|
||||
ScheduleState ScheduleState::serializeObject() {
|
||||
auto t1 = std::chrono::system_clock::now();
|
||||
auto t2 = t1 + std::chrono::hours(48);
|
||||
ScheduleState ts(t1, t2);
|
||||
ts.nupcol(77);
|
||||
return ts;
|
||||
}
|
||||
|
||||
|
||||
@@ -3447,9 +3447,9 @@ DATES -- 1
|
||||
const auto& schedule = make_schedule(input);
|
||||
{
|
||||
// Flow uses 12 as default
|
||||
BOOST_CHECK_EQUAL(schedule.getNupcol(0),20);
|
||||
BOOST_CHECK_EQUAL(schedule.getNupcol(1),12);
|
||||
BOOST_CHECK_EQUAL(schedule.getNupcol(2),10);
|
||||
BOOST_CHECK_EQUAL(schedule[0].nupcol(),20);
|
||||
BOOST_CHECK_EQUAL(schedule[1].nupcol(),12);
|
||||
BOOST_CHECK_EQUAL(schedule[2].nupcol(),10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user