RateVector: Forward 'eval' Calls to GuideRateModel::Target Overload
Avoids having to repeat the implementation for wells and groups.
This commit is contained in:
parent
a4d07b5c57
commit
3080b9c7f6
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2019 Equinor ASA.
|
Copyright 2019, 2020 Equinor ASA.
|
||||||
|
|
||||||
This file is part of the Open Porous Media project (OPM).
|
This file is part of the Open Porous Media project (OPM).
|
||||||
|
|
||||||
@ -20,14 +20,16 @@
|
|||||||
#ifndef GUIDE_RATE_HPP
|
#ifndef GUIDE_RATE_HPP
|
||||||
#define GUIDE_RATE_HPP
|
#define GUIDE_RATE_HPP
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.hpp>
|
||||||
|
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2019 Equinor ASA.
|
Copyright 2019, 2020 Equinor ASA.
|
||||||
|
|
||||||
This file is part of the Open Porous Media project (OPM).
|
This file is part of the Open Porous Media project (OPM).
|
||||||
|
|
||||||
@ -22,39 +22,21 @@
|
|||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
double GuideRate::RateVector::eval(Well::GuideRateTarget target) const {
|
|
||||||
if (target == Well::GuideRateTarget::OIL)
|
|
||||||
return this->oil_rat;
|
|
||||||
|
|
||||||
if (target == Well::GuideRateTarget::GAS)
|
|
||||||
return this->gas_rat;
|
|
||||||
|
|
||||||
if (target == Well::GuideRateTarget::LIQ)
|
|
||||||
return this->oil_rat + this->wat_rat;
|
|
||||||
|
|
||||||
if (target == Well::GuideRateTarget::WAT)
|
double GuideRate::RateVector::eval(Well::GuideRateTarget target) const
|
||||||
return this->wat_rat;
|
{
|
||||||
|
return this->eval(GuideRateModel::convert_target(target));
|
||||||
throw std::logic_error("Don't know how to convert .... ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double GuideRate::RateVector::eval(Group::GuideRateTarget target) const {
|
double GuideRate::RateVector::eval(Group::GuideRateTarget target) const
|
||||||
if (target == Group::GuideRateTarget::OIL)
|
{
|
||||||
return this->oil_rat;
|
return this->eval(GuideRateModel::convert_target(target));
|
||||||
|
|
||||||
if (target == Group::GuideRateTarget::GAS)
|
|
||||||
return this->gas_rat;
|
|
||||||
|
|
||||||
if (target == Group::GuideRateTarget::LIQ)
|
|
||||||
return this->oil_rat + this->wat_rat;
|
|
||||||
|
|
||||||
if (target == Group::GuideRateTarget::WAT)
|
|
||||||
return this->wat_rat;
|
|
||||||
|
|
||||||
throw std::logic_error("Don't know how to convert .... ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double GuideRate::RateVector::eval(GuideRateModel::Target target) const {
|
double GuideRate::RateVector::eval(GuideRateModel::Target target) const
|
||||||
|
{
|
||||||
if (target == GuideRateModel::Target::OIL)
|
if (target == GuideRateModel::Target::OIL)
|
||||||
return this->oil_rat;
|
return this->oil_rat;
|
||||||
|
|
||||||
@ -67,7 +49,9 @@ double GuideRate::RateVector::eval(GuideRateModel::Target target) const {
|
|||||||
if (target == GuideRateModel::Target::WAT)
|
if (target == GuideRateModel::Target::WAT)
|
||||||
return this->wat_rat;
|
return this->wat_rat;
|
||||||
|
|
||||||
throw std::logic_error("Don't know how to convert .... ");
|
throw std::logic_error {
|
||||||
|
"Don't know how to convert target type " + std::to_string(static_cast<int>(target))
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user