opm-common
Toggle main menu visibility
Loading...
Searching...
No Matches
PyAction.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 PYACTION_HPP_
21
#define PYACTION_HPP_
22
23
#include <functional>
24
#include <memory>
25
#include <string>
26
#include <vector>
27
28
namespace
Opm
{
29
30
class
Python
;
31
class
EclipseState
;
32
class
Schedule
;
33
class
SummaryState
;
34
class
PyRunModule;
35
36
namespace
Action {
37
class
State
;
38
39
class
PyAction
40
{
41
public
:
42
enum class
RunCount {
43
single,
44
unlimited,
45
first_true
46
};
47
48
49
static
RunCount from_string(std::string run_count);
50
static
PyAction serializationTestObject();
51
PyAction() =
default
;
52
PyAction(std::shared_ptr<const Python> python,
const
std::string& name, RunCount run_count,
const
std::string& module_file);
53
bool
run(
EclipseState
& ecl_state,
54
Schedule
& schedule,
55
std::size_t report_step,
56
SummaryState
& st,
57
const
std::function<
void
(
const
std::string&,
const
std::vector<std::string>&)>& actionx_callback,
58
const
std::unordered_map<std::string, double>& target_wellpi = {})
const
;
59
const
std::string& name()
const
;
60
bool
ready(
const
State
& state)
const
;
61
bool
operator==(
const
PyAction& other)
const
;
62
63
template
<
class
Serializer>
64
void
serializeOp(
Serializer
& serializer)
65
{
66
serializer(m_name);
67
serializer(m_run_count);
68
serializer(module_file);
69
serializer(m_active);
70
}
71
static
bool
valid_keyword(
const
std::string& keyword);
72
73
private
:
74
void
update(
bool
result)
const
;
75
76
mutable
std::shared_ptr< PyRunModule > run_module;
77
std::string m_name;
78
RunCount m_run_count{RunCount::single};
79
std::string module_file;
80
mutable
bool
m_active =
true
;
81
};
82
83
}
84
85
}
86
87
#endif
Opm::Action::State
Management information about the current run's ACTION system, especially concerning the number of tim...
Definition
State.hpp:51
Opm::EclipseState
Definition
EclipseState.hpp:62
Opm::Python
Definition
Python.hpp:116
Opm::Schedule
Definition
Schedule.hpp:101
Opm::Serializer
Class for (de-)serializing.
Definition
Serializer.hpp:94
Opm::SummaryState
Definition
SummaryState.hpp:72
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
PyAction.hpp
Generated by
1.17.0