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 <set>
33 #include <list>
34 #include <vector>
35 #include <map>
36 #include <cstddef>
37 
38 namespace Ewoms {
39 namespace Linear {
40 
44 typedef int Index;
45 
49 typedef unsigned ProcessRank;
50 
54 typedef unsigned BorderDistance;
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 typedef std::list<BorderIndex> BorderList;
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 typedef std::vector<IndexDistanceNpeers> OverlapWithPeer;
166 
171 typedef std::map<ProcessRank, OverlapWithPeer> OverlapByRank;
172 
176 typedef std::vector<std::map<ProcessRank, BorderDistance> > OverlapByIndex;
177 
181 typedef std::vector<Index> DomesticOverlapWithPeer;
182 
187 typedef std::map<ProcessRank, DomesticOverlapWithPeer> DomesticOverlapByRank;
188 
189 } // namespace Linear
190 } // namespace Ewoms
191 
192 #endif
std::vector< std::map< ProcessRank, BorderDistance > > OverlapByIndex
Maps each index to a list of processes .
Definition: overlaptypes.hh:176
std::vector< Index > DomesticOverlapWithPeer
The list of domestic indices are owned by peer rank.
Definition: overlaptypes.hh:181
The list of indices which are on the process boundary.
Definition: overlaptypes.hh:125
Definition: baseauxiliarymodule.hh:37
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
unsigned BorderDistance
The type representing the distance of an index to the border.
Definition: overlaptypes.hh:54
int Index
The type of an index of a degree of freedom.
Definition: overlaptypes.hh:44
This structure stores an index and a process rank.
Definition: overlaptypes.hh:59
Index localIdx
Index of the entity for the local process.
Definition: overlaptypes.hh:104
ProcessRank peerRank
Rank of the peer process.
Definition: overlaptypes.hh:110
BorderDistance borderDistance
Distance to the process border for the peer (in hops)
Definition: overlaptypes.hh:113
std::map< ProcessRank, OverlapWithPeer > OverlapByRank
A type mapping the process rank to the list of indices shared with this peer.
Definition: overlaptypes.hh:171
This structure stores an index, a process rank, and the number of processes which "see" the degree of...
Definition: overlaptypes.hh:91
unsigned ProcessRank
The type of the rank of a process.
Definition: overlaptypes.hh:49
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 structure stores a local index on a peer process and a global index.
Definition: overlaptypes.hh:69
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
This structure stores an index, a process rank, and the distance of the degree of freedom to the proc...
Definition: overlaptypes.hh:79
A set of process ranks.
Definition: overlaptypes.hh:148
A single index intersecting with the process boundary.
Definition: overlaptypes.hh:101