Use Same Evaluation Factory for All Vectors
In particular, switch to using the Evaluator::Factory object for the "required" restart vectors too. This is in preparation of including aquifer-related summary vectors into the set of required restart vectors.
This commit is contained in:
@@ -3025,13 +3025,12 @@ private:
|
|||||||
|
|
||||||
void configureTimeVectors(const EclipseState& es, const SummaryConfig& sumcfg);
|
void configureTimeVectors(const EclipseState& es, const SummaryConfig& sumcfg);
|
||||||
|
|
||||||
void configureSummaryInput(const EclipseState& es,
|
void configureSummaryInput(const SummaryConfig& sumcfg,
|
||||||
const SummaryConfig& sumcfg,
|
Evaluator::Factory& evaluatorFactory);
|
||||||
const EclipseGrid& grid,
|
|
||||||
const Schedule& sched);
|
|
||||||
|
|
||||||
void configureRequiredRestartParameters(const SummaryConfig& sumcfg,
|
void configureRequiredRestartParameters(const SummaryConfig& sumcfg,
|
||||||
const Schedule& sched);
|
const Schedule& sched,
|
||||||
|
Evaluator::Factory& evaluatorFactory);
|
||||||
|
|
||||||
void configureUDQ(const SummaryConfig& summary_config, const Schedule& sched);
|
void configureUDQ(const SummaryConfig& summary_config, const Schedule& sched);
|
||||||
|
|
||||||
@@ -3059,9 +3058,18 @@ SummaryImplementation(const EclipseState& es,
|
|||||||
, fmt_ { es.cfg().io().getFMTOUT() }
|
, fmt_ { es.cfg().io().getFMTOUT() }
|
||||||
, unif_ { es.cfg().io().getUNIFOUT() }
|
, unif_ { es.cfg().io().getUNIFOUT() }
|
||||||
{
|
{
|
||||||
|
const auto st = SummaryState {
|
||||||
|
TimeService::from_time_t(sched.getStartTime())
|
||||||
|
};
|
||||||
|
|
||||||
|
Evaluator::Factory evaluatorFactory {
|
||||||
|
es, grid, st, sched.getUDQConfig(sched.size() - 1)
|
||||||
|
};
|
||||||
|
|
||||||
this->configureTimeVectors(es, sumcfg);
|
this->configureTimeVectors(es, sumcfg);
|
||||||
this->configureSummaryInput(es, sumcfg, grid, sched);
|
this->configureSummaryInput(sumcfg, evaluatorFactory);
|
||||||
this->configureRequiredRestartParameters(sumcfg, sched);
|
this->configureRequiredRestartParameters(sumcfg,
|
||||||
|
sched, evaluatorFactory);
|
||||||
this->configureUDQ(sumcfg, sched);
|
this->configureUDQ(sumcfg, sched);
|
||||||
|
|
||||||
for (const auto& config_node : sumcfg.keywords("WBP*"))
|
for (const auto& config_node : sumcfg.keywords("WBP*"))
|
||||||
@@ -3251,22 +3259,12 @@ configureTimeVectors(const EclipseState& es, const SummaryConfig& sumcfg)
|
|||||||
|
|
||||||
void
|
void
|
||||||
Opm::out::Summary::SummaryImplementation::
|
Opm::out::Summary::SummaryImplementation::
|
||||||
configureSummaryInput(const EclipseState& es,
|
configureSummaryInput(const SummaryConfig& sumcfg,
|
||||||
const SummaryConfig& sumcfg,
|
Evaluator::Factory& evaluatorFactory)
|
||||||
const EclipseGrid& grid,
|
|
||||||
const Schedule& sched)
|
|
||||||
{
|
{
|
||||||
const auto st = SummaryState {
|
|
||||||
TimeService::from_time_t(sched.getStartTime())
|
|
||||||
};
|
|
||||||
|
|
||||||
Evaluator::Factory fact {
|
|
||||||
es, grid, st, sched.getUDQConfig(sched.size() - 1)
|
|
||||||
};
|
|
||||||
|
|
||||||
auto unsuppkw = std::vector<SummaryConfigNode>{};
|
auto unsuppkw = std::vector<SummaryConfigNode>{};
|
||||||
for (const auto& node : sumcfg) {
|
for (const auto& node : sumcfg) {
|
||||||
auto prmDescr = fact.create(node);
|
auto prmDescr = evaluatorFactory.create(node);
|
||||||
|
|
||||||
if (! prmDescr.evaluator) {
|
if (! prmDescr.evaluator) {
|
||||||
// No known evaluation function/type for this keyword
|
// No known evaluation function/type for this keyword
|
||||||
@@ -3430,24 +3428,24 @@ void Opm::out::Summary::SummaryImplementation::configureUDQ(const SummaryConfig&
|
|||||||
void
|
void
|
||||||
Opm::out::Summary::SummaryImplementation::
|
Opm::out::Summary::SummaryImplementation::
|
||||||
configureRequiredRestartParameters(const SummaryConfig& sumcfg,
|
configureRequiredRestartParameters(const SummaryConfig& sumcfg,
|
||||||
const Schedule& sched)
|
const Schedule& sched,
|
||||||
|
Evaluator::Factory& evaluatorFactory)
|
||||||
{
|
{
|
||||||
auto makeEvaluator = [&sumcfg, this](const Opm::EclIO::SummaryNode& node) -> void
|
auto makeEvaluator = [&sumcfg, &evaluatorFactory, this]
|
||||||
|
(const Opm::EclIO::SummaryNode& node) -> void
|
||||||
{
|
{
|
||||||
if (sumcfg.hasSummaryKey(node.unique_key()))
|
if (sumcfg.hasSummaryKey(node.unique_key()))
|
||||||
// Handler already exists. Don't add second evaluation.
|
// Handler already exists. Don't add second evaluation.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto fcnPos = funs.find(node.keyword);
|
auto descriptor = evaluatorFactory.create(node);
|
||||||
if (fcnPos == funs.end())
|
if (descriptor.evaluator == nullptr)
|
||||||
throw std::logic_error {
|
throw std::logic_error {
|
||||||
fmt::format("Evaluation function for:{} not found", node.keyword)
|
fmt::format("Evaluation function for:{} not found", node.keyword)
|
||||||
};
|
};
|
||||||
|
|
||||||
auto eval = std::make_unique<
|
this->extra_parameters
|
||||||
Evaluator::FunctionRelation>(node, fcnPos->second);
|
.emplace(node.unique_key(), std::move(descriptor.evaluator));
|
||||||
|
|
||||||
this->extra_parameters.emplace(node.unique_key(), std::move(eval));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const auto& node : requiredRestartVectors(sched))
|
for (const auto& node : requiredRestartVectors(sched))
|
||||||
|
|||||||
Reference in New Issue
Block a user