Split udq eval in eval_assign() and eval_define()
This commit is contained in:
parent
4b3231c9ef
commit
598afb9dc9
@ -67,6 +67,7 @@ namespace Opm {
|
||||
void add_assign(const std::string& quantity, const std::unordered_set<std::string>& selector, double value, std::size_t report_step);
|
||||
void add_define(const std::string& quantity, const KeywordLocation& location, const std::vector<std::string>& expression, std::size_t report_step);
|
||||
|
||||
void eval_assign(std::size_t report_step, const WellMatcher& wm, SummaryState& st, UDQState& udq_state) const;
|
||||
void eval(std::size_t report_step, const WellMatcher& wm, SummaryState& st, UDQState& udq_state) const;
|
||||
const UDQDefine& define(const std::string& key) const;
|
||||
const UDQAssign& assign(const std::string& key) const;
|
||||
@ -109,6 +110,8 @@ namespace Opm {
|
||||
private:
|
||||
void add_node(const std::string& quantity, UDQAction action);
|
||||
UDQAction action_type(const std::string& udq_key) const;
|
||||
void eval_assign(std::size_t report_step, SummaryState& st, UDQState& udq_state, UDQContext& context) const;
|
||||
void eval_define(std::size_t report_step, UDQState& udq_state, UDQContext& context) const;
|
||||
|
||||
|
||||
UDQParams udq_params;
|
||||
|
@ -350,10 +350,7 @@ namespace Opm {
|
||||
this->type_count == data.type_count;
|
||||
}
|
||||
|
||||
void UDQConfig::eval(std::size_t report_step, const WellMatcher& wm, SummaryState& st, UDQState& udq_state) const {
|
||||
const auto& func_table = this->function_table();
|
||||
UDQContext context(func_table, wm, st, udq_state);
|
||||
|
||||
void UDQConfig::eval_assign(std::size_t report_step, SummaryState& st, UDQState& udq_state, UDQContext& context) const {
|
||||
for (const auto& assign : this->assignments(UDQVarType::WELL_VAR)) {
|
||||
if (udq_state.assign(report_step, assign.keyword())) {
|
||||
auto ws = assign.eval(st.wells());
|
||||
@ -361,13 +358,6 @@ namespace Opm {
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& def : this->definitions(UDQVarType::WELL_VAR)) {
|
||||
if (udq_state.define(def.keyword(), def.status())) {
|
||||
auto ws = def.eval(context);
|
||||
context.update_define(report_step, def.keyword(), ws);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& assign : this->assignments(UDQVarType::GROUP_VAR)) {
|
||||
if (udq_state.assign(report_step, assign.keyword())) {
|
||||
auto ws = assign.eval(st.groups());
|
||||
@ -375,17 +365,27 @@ namespace Opm {
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& def : this->definitions(UDQVarType::GROUP_VAR)) {
|
||||
for (const auto& assign : this->assignments(UDQVarType::FIELD_VAR)) {
|
||||
if (udq_state.assign(assign.report_step(), assign.keyword())) {
|
||||
auto ws = assign.eval();
|
||||
context.update_assign(report_step, assign.keyword(), ws);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UDQConfig::eval_define(std::size_t report_step, UDQState& udq_state, UDQContext& context) const {
|
||||
for (const auto& def : this->definitions(UDQVarType::WELL_VAR)) {
|
||||
if (udq_state.define(def.keyword(), def.status())) {
|
||||
auto ws = def.eval(context);
|
||||
context.update_define(report_step, def.keyword(), ws);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& assign : this->assignments(UDQVarType::FIELD_VAR)) {
|
||||
if (udq_state.assign(assign.report_step(), assign.keyword())) {
|
||||
auto ws = assign.eval();
|
||||
context.update_assign(report_step, assign.keyword(), ws);
|
||||
for (const auto& def : this->definitions(UDQVarType::GROUP_VAR)) {
|
||||
if (udq_state.define(def.keyword(), def.status())) {
|
||||
auto ws = def.eval(context);
|
||||
context.update_define(report_step, def.keyword(), ws);
|
||||
}
|
||||
}
|
||||
|
||||
@ -397,6 +397,17 @@ namespace Opm {
|
||||
}
|
||||
}
|
||||
|
||||
void UDQConfig::eval(std::size_t report_step, const WellMatcher& wm, SummaryState& st, UDQState& udq_state) const {
|
||||
UDQContext context(this->function_table(), wm, st, udq_state);
|
||||
this->eval_assign(report_step, st, udq_state, context);
|
||||
this->eval_define(report_step, udq_state, context);
|
||||
}
|
||||
|
||||
void UDQConfig::eval_assign(std::size_t report_step, const WellMatcher& wm, SummaryState& st, UDQState& udq_state) const {
|
||||
UDQContext context(this->function_table(), wm, st, udq_state);
|
||||
this->eval_assign(report_step, st, udq_state, context);
|
||||
}
|
||||
|
||||
|
||||
void UDQConfig::required_summary(std::unordered_set<std::string>& summary_keys) const {
|
||||
for (const auto& def_pair : this->m_definitions) {
|
||||
|
Loading…
Reference in New Issue
Block a user