opm-common
Toggle main menu visibility
Loading...
Searching...
No Matches
UDQState.hpp
1
/*
2
Copyright 2020 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 UDQSTATE_HPP_
21
#define UDQSTATE_HPP_
22
23
#include <opm/input/eclipse/Schedule/UDQ/UDQSet.hpp>
24
25
#include <
opm/output/eclipse/WindowedArray.hpp
>
26
27
#include <cstddef>
28
#include <string>
29
#include <unordered_map>
30
#include <utility>
31
32
namespace
Opm::RestartIO {
33
struct
RstState
;
34
class
RstUDQ;
35
}
// namespace Opm::RestartIO
36
37
namespace
Opm
{
38
39
class
UDQState
40
{
41
public
:
42
using
ExportRange =
RestartIO::Helpers::WindowedArray<double>::WriteWindow
;
43
44
UDQState() =
default
;
45
explicit
UDQState(
double
undefined);
46
47
bool
has(
const
std::string& key)
const
;
48
void
load_rst(
const
RestartIO::RstState
& rst_state);
49
50
bool
has_well_var(
const
std::string& well,
const
std::string& key)
const
;
51
bool
has_group_var(
const
std::string& group,
const
std::string& key)
const
;
52
bool
has_segment_var(
const
std::string& well,
const
std::string& key,
const
std::size_t segment)
const
;
53
54
double
get(
const
std::string& key)
const
;
55
double
get_group_var(
const
std::string& well,
const
std::string& var)
const
;
56
double
get_well_var(
const
std::string& well,
const
std::string& var)
const
;
57
double
get_segment_var(
const
std::string& well,
const
std::string& var,
const
std::size_t segment)
const
;
58
59
void
exportSegmentUDQ(
const
std::string& var,
60
const
std::string& well,
61
ExportRange& output)
const
;
62
63
void
add_define(std::size_t report_step,
const
std::string& udq_key,
const
UDQSet
& result);
64
void
add_assign(
const
std::string& udq_key,
const
UDQSet
& result);
65
bool
define(
const
std::pair<UDQUpdate, std::size_t>& update_status)
const
;
66
double
undefined_value()
const
;
67
68
bool
operator==(
const
UDQState& other)
const
;
69
70
static
UDQState serializationTestObject();
71
72
template
<
class
Serializer>
73
void
serializeOp(
Serializer
& serializer)
74
{
75
serializer(this->undef_value);
76
serializer(this->scalar_values);
77
serializer(this->well_values);
78
serializer(this->group_values);
79
serializer(this->segment_values);
80
serializer(this->defines);
81
}
82
83
private
:
84
double
undef_value{};
85
std::unordered_map<std::string, double> scalar_values{};
86
87
// [var][well] -> double
88
std::unordered_map<std::string, std::unordered_map<std::string, double>> well_values{};
89
90
// [var][group] -> double
91
std::unordered_map<std::string, std::unordered_map<std::string, double>> group_values{};
92
93
// [var][well][segment] -> double
94
std::unordered_map<std::string, std::unordered_map<std::string, std::unordered_map<std::size_t, double>>> segment_values{};
95
96
std::unordered_map<std::string, std::size_t> defines{};
97
98
void
add(
const
std::string& udq_key,
const
UDQSet
& result);
99
double
get_wg_var(
const
std::string& well,
const
std::string& key, UDQVarType var_type)
const
;
100
};
101
102
}
// namespace Opm
103
104
#endif
// UDQSTATE_HPP_
WindowedArray.hpp
Provide facilities to simplify constructing restart vectors such as IWEL or RSEG.
Opm::RestartIO::Helpers::WindowedArray::WriteWindow
boost::iterator_range< typename std::vector< T >::iterator > WriteWindow
Read/write access.
Definition
WindowedArray.hpp:53
Opm::Serializer
Class for (de-)serializing.
Definition
Serializer.hpp:94
Opm::UDQSet
Definition
UDQSet.hpp:187
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition
Exceptions.hpp:30
Opm::RestartIO::RstState
Definition
state.hpp:57
opm
input
eclipse
Schedule
UDQ
UDQState.hpp
Generated by
1.17.0