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  Copyright (C) 2011 by Bernd Flemisch
5  Copyright (C) 2012-2013 by Andreas Lauser
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 2 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 */
28 #ifndef EWOMS_OVERLAP_TYPES_HH
29 #define EWOMS_OVERLAP_TYPES_HH
30 
31 #include <set>
32 #include <list>
33 #include <vector>
34 #include <map>
35 #include <cstddef>
36 
37 namespace Ewoms {
38 namespace Linear {
39 
43 typedef int Index;
44 
48 typedef unsigned ProcessRank;
49 
53 typedef unsigned BorderDistance;
54 
58 struct IndexRank
59 {
60  Index index;
61  ProcessRank rank;
62 };
63 
69 {
70  Index peerIdx;
71  Index globalIdx;
72 };
73 
79 {
80  Index index;
81  ProcessRank peerRank;
82  BorderDistance borderDistance;
83 };
84 
91 {
92  Index index;
93  BorderDistance borderDistance;
94  int numPeers;
95 };
96 
101 {
103  Index localIdx;
104 
106  Index peerIdx;
107 
109  ProcessRank peerRank;
110 
112  BorderDistance borderDistance;
113 };
114 
119 typedef std::list<BorderIndex> BorderList;
120 
124 class SeedList : public std::list<IndexRankDist>
125 {
126 public:
127  void update(const BorderList &borderList)
128  {
129  this->clear();
130 
131  auto it = borderList.begin();
132  const auto &endIt = borderList.end();
133  for (; it != endIt; ++it) {
134  IndexRankDist ird;
135  ird.index = it->localIdx;
136  ird.peerRank = it->peerRank;
137  ird.borderDistance = it->borderDistance;
138 
139  this->push_back(ird);
140  }
141  }
142 };
143 
147 class PeerSet : public std::set<ProcessRank>
148 {
149 public:
150  void update(const BorderList &borderList)
151  {
152  this->clear();
153 
154  auto it = borderList.begin();
155  const auto &endIt = borderList.end();
156  for (; it != endIt; ++it)
157  this->insert(it->peerRank);
158  }
159 };
160 
164 typedef std::vector<IndexDistanceNpeers> OverlapWithPeer;
165 
170 typedef std::map<ProcessRank, OverlapWithPeer> OverlapByRank;
171 
175 typedef std::vector<std::map<ProcessRank, BorderDistance> > OverlapByIndex;
176 
180 typedef std::vector<Index> DomesticOverlapWithPeer;
181 
186 typedef std::map<ProcessRank, DomesticOverlapWithPeer> DomesticOverlapByRank;
187 
188 } // namespace Linear
189 } // namespace Ewoms
190 
191 #endif
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:186
This structure stores an index, a process rank, and the number of processes which "see" the degree of...
Definition: overlaptypes.hh:90
A set of process ranks.
Definition: overlaptypes.hh:147
This structure stores an index, a process rank, and the distance of the degree of freedom to the proc...
Definition: overlaptypes.hh:78
unsigned BorderDistance
The type representing the distance of an index to the border.
Definition: overlaptypes.hh:53
int numPeers
Definition: overlaptypes.hh:94
ProcessRank peerRank
Definition: overlaptypes.hh:81
This structure stores a local index on a peer process and a global index.
Definition: overlaptypes.hh:68
This structure stores an index and a process rank.
Definition: overlaptypes.hh:58
Index peerIdx
Definition: overlaptypes.hh:70
Index globalIdx
Definition: overlaptypes.hh:71
void update(const BorderList &borderList)
Definition: overlaptypes.hh:127
Index index
Definition: overlaptypes.hh:60
std::vector< Index > DomesticOverlapWithPeer
The list of domestic indices are owned by peer rank.
Definition: overlaptypes.hh:180
BorderDistance borderDistance
Definition: overlaptypes.hh:82
BorderDistance borderDistance
Distance to the process border for the peer (in hops)
Definition: overlaptypes.hh:112
BorderDistance borderDistance
Definition: overlaptypes.hh:93
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:119
Index index
Definition: overlaptypes.hh:92
std::vector< IndexDistanceNpeers > OverlapWithPeer
The list of indices which overlap with a peer rank.
Definition: overlaptypes.hh:164
Index localIdx
Index of the entity for the local process.
Definition: overlaptypes.hh:103
Index peerIdx
Index of the entity for the peer process.
Definition: overlaptypes.hh:106
A single index intersecting with the process boundary.
Definition: overlaptypes.hh:100
Definition: baseauxiliarymodule.hh:35
The list of indices which are on the process boundary.
Definition: overlaptypes.hh:124
ProcessRank rank
Definition: overlaptypes.hh:61
std::map< ProcessRank, OverlapWithPeer > OverlapByRank
A type mapping the process rank to the list of indices shared with this peer.
Definition: overlaptypes.hh:170
std::vector< std::map< ProcessRank, BorderDistance > > OverlapByIndex
Maps each index to a list of processes .
Definition: overlaptypes.hh:175
int Index
The type of an index of a degree of freedom.
Definition: overlaptypes.hh:43
void update(const BorderList &borderList)
Definition: overlaptypes.hh:150
ProcessRank peerRank
Rank of the peer process.
Definition: overlaptypes.hh:109
Index index
Definition: overlaptypes.hh:80
unsigned ProcessRank
The type of the rank of a process.
Definition: overlaptypes.hh:48