Loading...
Searching...
No Matches
ActionValue.hpp
/*
Copyright 2019 Equinor ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ACTION_VALUE_HPP
#define ACTION_VALUE_HPP
#include <opm/input/eclipse/Schedule/Action/ActionResult.hpp>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
namespace Opm::Action {
enum class TokenType
{
number, // 0
ecl_expr, // 1
open_paren, // 2
close_paren, // 3
op_gt, // 4
op_ge, // 5
op_lt, // 6
op_le, // 7
op_eq, // 8
op_ne, // 9
op_and, // 10
op_or, // 11
end, // 12
error, // 13
};
enum class FuncType
{
none, // 0
time, // 1
time_month, // 2
region, // 3
field, // 4
group, // 5
well, // 6
well_segment, // 7
well_connection, // 8
Well_lgr, // 9
aquifer, // 10
block, // 11
};
class Value
{
public:
Value() = default;
explicit Value(double value);
Value(std::string_view wname, double value);
Result eval_cmp(TokenType op, const Value& rhs) const;
void add_well(std::string_view well, double value);
double scalar() const;
private:
double scalar_value_{};
double is_scalar_{false};
std::vector<std::pair<std::string, double>> well_values_{};
Result evalWellComparisons(TokenType op, double rhs) const;
};
} // namespace Opm::Action
#endif // ACTION_VALUE_HPP
Opm::Action::Result
Class Action::Result holds the boolean result of a ACTIONX condition like.
Definition ActionResult.hpp:69
Opm::Action::Value::add_well
void add_well(std::string_view well, double value)
Incorporate well level function value into Value object.
Definition ActionValue.cpp:128
Opm::Action::Value::scalar
double scalar() const
Retrieve scalar function value.
Definition ActionValue.cpp:140
Opm::Action::Value::Value
Value()=default
Default constructor.
Opm::Action::Value::eval_cmp
Result eval_cmp(TokenType op, const Value &rhs) const
Compare current Value to another Value.
Definition ActionValue.cpp:104