opm-simulators
Toggle main menu visibility
Loading...
Searching...
No Matches
ConnectionIndexMap.hpp
1
/*
2
Copyright 2016 SINTEF ICT, Applied Mathematics.
3
Copyright 2016 - 2017 Statoil ASA.
4
Copyright 2017 Dr. Blatt - HPC-Simulation-Software & Services
5
Copyright 2016 - 2018 IRIS AS
6
7
This file is part of the Open Porous Media project (OPM).
8
9
OPM is free software: you can redistribute it and/or modify
10
it under the terms of the GNU General Public License as published by
11
the Free Software Foundation, either version 3 of the License, or
12
(at your option) any later version.
13
14
OPM is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
GNU General Public License for more details.
18
19
You should have received a copy of the GNU General Public License
20
along with OPM. If not, see <http://www.gnu.org/licenses/>.
21
*/
22
23
#ifndef OPM_CONNECTION_INDEX_MAP_HEADER_INCLUDED
24
#define OPM_CONNECTION_INDEX_MAP_HEADER_INCLUDED
25
26
#include <cstddef>
27
#include <vector>
28
29
namespace
Opm
{
30
32
class
ConnectionIndexMap
33
{
34
public
:
39
explicit
ConnectionIndexMap
(
const
std::size_t numConns)
40
: local_(numConns, -1)
41
{
42
this->global_.reserve(numConns);
43
this->open_.reserve(numConns);
44
}
45
53
void
addActiveConnection
(
const
int
connIdx,
54
const
bool
connIsOpen)
55
{
56
this->local_[connIdx] =
57
static_cast<
int
>
(this->global_.size());
58
59
this->global_.push_back(connIdx);
60
61
const
auto
open_conn_idx = connIsOpen
62
? this->num_open_conns_++
63
: -1;
64
65
this->open_.push_back(open_conn_idx);
66
}
67
73
const
std::vector<int>&
local
()
const
74
{
75
return
this->local_;
76
}
77
83
int
global
(
const
int
connIdx)
const
84
{
85
return
this->global_[connIdx];
86
}
87
95
int
open
(
const
int
connIdx)
const
96
{
97
return
this->open_[connIdx];
98
}
99
100
private
:
104
std::vector<int> local_{};
105
108
std::vector<int> global_{};
109
111
std::vector<int> open_{};
112
114
int
num_open_conns_{0};
115
};
116
117
}
// namespace Opm
118
119
#endif
Opm::ConnectionIndexMap::addActiveConnection
void addActiveConnection(const int connIdx, const bool connIsOpen)
Enumerate/map new active connection.
Definition
ConnectionIndexMap.hpp:53
Opm::ConnectionIndexMap::ConnectionIndexMap
ConnectionIndexMap(const std::size_t numConns)
Constructor.
Definition
ConnectionIndexMap.hpp:39
Opm::ConnectionIndexMap::local
const std::vector< int > & local() const
Get local connection IDs/indices of every existing well connection.
Definition
ConnectionIndexMap.hpp:73
Opm::ConnectionIndexMap::global
int global(const int connIdx) const
Get global connection ID of local (on-rank) connection.
Definition
ConnectionIndexMap.hpp:83
Opm::ConnectionIndexMap::open
int open(const int connIdx) const
Get open connection ID of local (on-rank) connection.
Definition
ConnectionIndexMap.hpp:95
Opm
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition
blackoilbioeffectsmodules.hh:43
opm
simulators
wells
ConnectionIndexMap.hpp
Generated by
1.17.0