27#ifndef EWOMS_ELEMENT_BORDER_LIST_FROM_GRID_HH
28#define EWOMS_ELEMENT_BORDER_LIST_FROM_GRID_HH
33#include <dune/grid/common/datahandleif.hh>
34#include <dune/grid/common/gridenums.hh>
35#include <dune/grid/common/partitionset.hh>
36#include <dune/common/version.hh>
47template <
class Gr
idView,
class ElementMapper>
51 using PeerBlackList = BlackList::PeerBlackList;
52 using PeerBlackLists = BlackList::PeerBlackLists;
54 using Element =
typename GridView::template Codim<0>::Entity;
56 class BorderListHandle_
57 :
public Dune::CommDataHandleIF<BorderListHandle_, ProcessRank>
60 BorderListHandle_(
const GridView& gridView,
61 const ElementMapper&
map,
66 , blackList_(blackList)
67 , borderList_(borderList)
70 if (
elem.partitionType() != Dune::InteriorEntity) {
78 bool contains(
int,
int codim)
const
79 {
return codim == 0; }
81#if DUNE_VERSION_LT(DUNE_GRID, 2, 8)
82 bool fixedsize(
int,
int)
const
84 bool fixedSize(
int,
int)
const
88 template <
class EntityType>
92 template <
class MessageBufferImp,
class EntityType>
95 unsigned myIdx =
static_cast<unsigned>(map_.index(
e));
96 buff.write(
static_cast<unsigned>(gridView_.comm().rank()));
100 template <
class MessageBufferImp>
107 auto isIt = gridView_.ibegin(
e);
108 const auto&
isEndIt = gridView_.iend(
e);
110 if (!
isIt->neighbor())
112 else if (
isIt->outside().partitionType() == Dune::InteriorEntity) {
127 peerSet_.insert(tmp);
134 bIdx.borderDistance = 1;
136 borderList_.push_back(
bIdx);
142 template <
class MessageBufferImp,
class EntityType>
148 const std::set<ProcessRank>& peerSet()
const
153 const ElementMapper& map_;
154 std::set<ProcessRank> peerSet_;
159 class PeerBlackListHandle_
160 :
public Dune::CommDataHandleIF<PeerBlackListHandle_, int>
163 PeerBlackListHandle_(
const GridView& gridView,
164 const ElementMapper&
map,
166 : gridView_(gridView)
172 bool contains(
int,
int codim)
const
173 {
return codim == 0; }
175#if DUNE_VERSION_LT(DUNE_GRID, 2, 8)
176 bool fixedsize(
int,
int)
const
178 bool fixedSize(
int,
int)
const
182 template <
class EntityType>
186 template <
class MessageBufferImp,
class EntityType>
189 buff.write(
static_cast<int>(gridView_.comm().rank()));
190 buff.write(
static_cast<int>(map_.index(
e)));
193 template <
class MessageBufferImp,
class EntityType>
202 localIdx =
static_cast<Index>(map_.index(
e));
205 pIdx.nativeIndexOfPeer =
static_cast<Index>(peerIdx);
206 pIdx.myOwnNativeIndex =
static_cast<Index>(localIdx);
211 const PeerBlackList& peerBlackList(
ProcessRank peerRank)
const
212 {
return peerBlackLists_.at(peerRank); }
216 const ElementMapper& map_;
217 PeerBlackLists peerBlackLists_;
222 : gridView_(gridView)
225 BorderListHandle_
blh(gridView,
map, blackList_, borderList_);
226 gridView.communicate(
blh,
227 Dune::InteriorBorder_All_Interface,
228 Dune::BackwardCommunication);
230 PeerBlackListHandle_
pblh(gridView,
map, peerBlackLists_);
231 gridView.communicate(
pblh,
232 Dune::InteriorBorder_All_Interface,
233 Dune::BackwardCommunication);
244 {
return borderList_; }
248 {
return blackList_; }
251 const GridView gridView_;
252 const ElementMapper& map_;
257 PeerBlackLists peerBlackLists_;
Expresses which degrees of freedom are blacklisted for the parallel linear solvers and which domestic...
Expresses which degrees of freedom are blacklisted for the parallel linear solvers and which domestic...
Definition blacklist.hh:49
Uses communication on the grid to find the initial seed list of indices for methods which use element...
Definition elementborderlistfromgrid.hh:49
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilboundaryratevector.hh:37
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:242
This files provides several data structures for storing tuples of indices of remote and/or local proc...
unsigned ProcessRank
The type of the rank of a process.
Definition overlaptypes.hh:49
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
Definition blacklist.hh:51
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