My Project
Loading...
Searching...
No Matches
ASTNode.hpp
1
/*
2
Copyright 2019 Equinor ASA.
3
4
This file is part of the Open Porous Media project (OPM).
5
6
OPM is free software: you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
OPM is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with OPM. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#ifndef ASTNODE_HPP
21
#define ASTNODE_HPP
22
23
#include <opm/input/eclipse/Schedule/Action/ActionContext.hpp>
24
25
#include "ActionValue.hpp"
26
27
#include <cstddef>
28
#include <string>
29
#include <unordered_set>
30
#include <vector>
31
32
namespace
Opm
{
namespace
Action {
33
34
class
ActionContext;
35
class
WellSet;
36
37
class
ASTNode
38
{
39
public
:
40
ASTNode
();
41
explicit
ASTNode
(TokenType type_arg);
42
explicit
ASTNode
(
double
value);
43
explicit
ASTNode
(TokenType type_arg,
44
FuncType func_type_arg,
45
const
std::string& func_arg,
46
const
std::vector<std::string>& arg_list_arg);
47
48
static
ASTNode
serializationTestObject();
49
50
Action::Result
eval(
const
Action::Context
& context)
const
;
51
Action::Value
value(
const
Action::Context
& context)
const
;
52
53
void
required_summary(std::unordered_set<std::string>& required_summary)
const
;
54
55
bool
operator==(
const
ASTNode
& data)
const
;
56
57
TokenType type;
58
FuncType func_type;
59
std::string func;
60
61
void
add_child(
const
ASTNode
& child);
62
std::size_t size()
const
;
63
bool
empty()
const
;
64
65
template
<
class
Serializer>
66
void
serializeOp(
Serializer
& serializer)
67
{
68
serializer(type);
69
serializer(func_type);
70
serializer(func);
71
serializer(arg_list);
72
serializer(number);
73
serializer(children);
74
}
75
76
private
:
77
std::vector<std::string> arg_list{};
78
double
number {0.0};
79
80
// To have a member std::vector<ASTNode> inside the ASTNode class is
81
// supposedly borderline undefined behaviour; it compiles without
82
// warnings and works. Good for enough for me.
83
std::vector<ASTNode> children{};
84
};
85
86
}}
// namespace Opm::Action
87
88
#endif
// ASTNODE_HPP
Opm::Action::ASTNode
Definition
ASTNode.hpp:38
Opm::Action::Context
Definition
ActionContext.hpp:41
Opm::Action::Result
Definition
ActionResult.hpp:99
Opm::Action::Value
Definition
ActionValue.hpp:66
Opm::Serializer
Class for (de-)serializing.
Definition
Serializer.hpp:91
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition
Exceptions.hpp:30
opm
input
eclipse
Schedule
Action
ASTNode.hpp
Generated by
1.9.8