overlaptypes.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
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 2 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 Consult the COPYING file in the top-level source directory of this
20 module for the precise wording of the license and the list of
21 copyright holders.
22*/
29#ifndef EWOMS_OVERLAP_TYPES_HH
30#define EWOMS_OVERLAP_TYPES_HH
31
32#include <cstddef>
33#include <list>
34#include <map>
35#include <set>
36#include <vector>
37
38namespace Opm {
39namespace Linear {
40
44using Index = int;
45
49using ProcessRank = unsigned;
50
54using BorderDistance = unsigned;
55
60{
63};
64
70{
73};
74
80{
84};
85
92{
95 unsigned numPeers;
96};
97
102{
105
108
111
114};
115
120using BorderList = std::list<BorderIndex>;
121
125class SeedList : public std::list<IndexRankDist>
126{
127public:
128 void update(const BorderList& borderList)
129 {
130 this->clear();
131
132 auto it = borderList.begin();
133 const auto& endIt = borderList.end();
134 for (; it != endIt; ++it) {
135 IndexRankDist ird;
136 ird.index = it->localIdx;
137 ird.peerRank = it->peerRank;
138 ird.borderDistance = it->borderDistance;
139
140 this->push_back(ird);
141 }
142 }
143};
144
148class PeerSet : public std::set<ProcessRank>
149{
150public:
151 void update(const BorderList& borderList)
152 {
153 this->clear();
154
155 auto it = borderList.begin();
156 const auto& endIt = borderList.end();
157 for (; it != endIt; ++it)
158 this->insert(it->peerRank);
159 }
160};
161
165using OverlapWithPeer = std::vector<IndexDistanceNpeers>;
166
171using OverlapByRank = std::map<ProcessRank, OverlapWithPeer>;
172
176using OverlapByIndex = std::vector<std::map<ProcessRank, BorderDistance> >;
177
181using DomesticOverlapWithPeer = std::vector<Index>;
182
187using DomesticOverlapByRank = std::map<ProcessRank, DomesticOverlapWithPeer>;
188
189} // namespace Linear
190} // namespace Opm
191
192#endif
A set of process ranks.
Definition: overlaptypes.hh:149
void update(const BorderList &borderList)
Definition: overlaptypes.hh:151
The list of indices which are on the process boundary.
Definition: overlaptypes.hh:126
void update(const BorderList &borderList)
Definition: overlaptypes.hh:128
unsigned BorderDistance
The type representing the distance of an index to the border.
Definition: overlaptypes.hh:54
std::map< ProcessRank, DomesticOverlapWithPeer > DomesticOverlapByRank
A type mapping the process rank to the list of domestic indices which are owned by the peer.
Definition: overlaptypes.hh:187
std::vector< Index > DomesticOverlapWithPeer
The list of domestic indices are owned by peer rank.
Definition: overlaptypes.hh:181
unsigned ProcessRank
The type of the rank of a process.
Definition: overlaptypes.hh:49
std::vector< std::map< ProcessRank, BorderDistance > > OverlapByIndex
Maps each index to a list of processes .
Definition: overlaptypes.hh:176
std::vector< IndexDistanceNpeers > OverlapWithPeer
The list of indices which overlap with a peer rank.
Definition: overlaptypes.hh:165
int Index
The type of an index of a degree of freedom.
Definition: overlaptypes.hh:44
std::list< BorderIndex > BorderList
This class managages a list of indices which are on the border of a process' partition of the grid.
Definition: overlaptypes.hh:120
std::map< ProcessRank, OverlapWithPeer > OverlapByRank
A type mapping the process rank to the list of indices shared with this peer.
Definition: overlaptypes.hh:171
Definition: blackoilboundaryratevector.hh:37
A single index intersecting with the process boundary.
Definition: overlaptypes.hh:102
Index localIdx
Index of the entity for the local process.
Definition: overlaptypes.hh:104
BorderDistance borderDistance
Distance to the process border for the peer (in hops)
Definition: overlaptypes.hh:113
ProcessRank peerRank
Rank of the peer process.
Definition: overlaptypes.hh:110
Index peerIdx
Index of the entity for the peer process.
Definition: overlaptypes.hh:107
This structure stores an index, a process rank, and the number of processes which "see" the degree of...
Definition: overlaptypes.hh:92
BorderDistance borderDistance
Definition: overlaptypes.hh:94
unsigned numPeers
Definition: overlaptypes.hh:95
Index index
Definition: overlaptypes.hh:93
This structure stores an index, a process rank, and the distance of the degree of freedom to the proc...
Definition: overlaptypes.hh:80
BorderDistance borderDistance
Definition: overlaptypes.hh:83
ProcessRank peerRank
Definition: overlaptypes.hh:82
Index index
Definition: overlaptypes.hh:81
This structure stores an index and a process rank.
Definition: overlaptypes.hh:60
ProcessRank rank
Definition: overlaptypes.hh:62
Index index
Definition: overlaptypes.hh:61
This structure stores a local index on a peer process and a global index.
Definition: overlaptypes.hh:70
Index globalIdx
Definition: overlaptypes.hh:72
Index peerIdx
Definition: overlaptypes.hh:71