opm-simulators
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 
38 namespace Opm {
39 namespace Linear {
40 
44 using Index = int;
45 
49 using ProcessRank = unsigned;
50 
54 using BorderDistance = unsigned;
55 
59 struct IndexRank
60 {
61  Index index;
62  ProcessRank rank;
63 };
64 
70 {
71  Index peerIdx;
72  Index globalIdx;
73 };
74 
80 {
81  Index index;
82  ProcessRank peerRank;
83  BorderDistance borderDistance;
84 };
85 
92 {
93  Index index;
94  BorderDistance borderDistance;
95  unsigned numPeers;
96 };
97 
102 {
105 
108 
111 
114 };
115 
120 using BorderList = std::list<BorderIndex>;
121 
125 class SeedList : public std::list<IndexRankDist>
126 {
127 public:
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 
148 class PeerSet : public std::set<ProcessRank>
149 {
150 public:
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 
165 using OverlapWithPeer = std::vector<IndexDistanceNpeers>;
166 
171 using OverlapByRank = std::map<ProcessRank, OverlapWithPeer>;
172 
176 using OverlapByIndex = std::vector<std::map<ProcessRank, BorderDistance> >;
177 
181 using DomesticOverlapWithPeer = std::vector<Index>;
182 
187 using DomesticOverlapByRank = std::map<ProcessRank, DomesticOverlapWithPeer>;
188 
189 } // namespace Linear
190 } // namespace Opm
191 
192 #endif
This structure stores an index and a process rank.
Definition: overlaptypes.hh:59
unsigned BorderDistance
The type representing the distance of an index to the border.
Definition: overlaptypes.hh:54
The list of indices which are on the process boundary.
Definition: overlaptypes.hh:125
This structure stores a local index on a peer process and a global index.
Definition: overlaptypes.hh:69
A set of process ranks.
Definition: overlaptypes.hh:148
A single index intersecting with the process boundary.
Definition: overlaptypes.hh:101
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
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
std::vector< IndexDistanceNpeers > OverlapWithPeer
The list of indices which overlap with a peer rank.
Definition: overlaptypes.hh:165
Index peerIdx
Index of the entity for the peer process.
Definition: overlaptypes.hh:107
This structure stores an index, a process rank, and the distance of the degree of freedom to the proc...
Definition: overlaptypes.hh:79
std::vector< std::map< ProcessRank, BorderDistance > > OverlapByIndex
Maps each index to a list of processes .
Definition: overlaptypes.hh:176
unsigned ProcessRank
The type of the rank of a process.
Definition: overlaptypes.hh:49
This structure stores an index, a process rank, and the number of processes which "see" the degree of...
Definition: overlaptypes.hh:91
Index localIdx
Index of the entity for the local process.
Definition: overlaptypes.hh:104
std::map< ProcessRank, OverlapWithPeer > OverlapByRank
A type mapping the process rank to the list of indices shared with this peer.
Definition: overlaptypes.hh:171
std::vector< Index > DomesticOverlapWithPeer
The list of domestic indices are owned by peer rank.
Definition: overlaptypes.hh:181
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
std::list< BorderIndex > BorderList
This class managages a list of indices which are on the border of a process&#39; partition of the grid...
Definition: overlaptypes.hh:120
int Index
The type of an index of a degree of freedom.
Definition: overlaptypes.hh:44