6#include <dune/common/unused.hh>
7#include <dune/common/version.hh>
8#include <dune/grid/common/datahandleif.hh>
13 template <
int dim>
class UGGrid;
29 :
public Dune::CommDataHandleIF<UniqueBorderPartition<Grid>, int>
31 using IdSet =
typename Grid::GlobalIdSet;
32 using IdType =
typename IdSet::IdType;
35 using EntitySet = std::set<IdType>;
50 , idSet_(grid.globalIdSet())
54 bool contains(
int ,
int )
const {
return true; }
57 bool fixedSize(
int ,
int )
const {
return true; }
60 template <
class Entity>
61 std::size_t size(Entity
const& )
const {
return 1; }
63 template <
class MessageBuffer,
class Entity>
64 void gather(MessageBuffer& buff, Entity
const& )
const
69 template <
class MessageBuffer,
class Entity>
70 void scatter(MessageBuffer& buff, Entity
const& e, std::size_t n)
72 scatterImpl(buff, e, n, int_t<Entity::codimension>{});
78 return notOwner_.count(
id) == 0;
89 template <
class MessageBuffer,
class Entity,
int cd>
90 void scatterImpl(MessageBuffer& buff, Entity
const& e, [[maybe_unused]] std::size_t n, int_t<cd>)
100 notOwner_.insert(idSet_.id(e));
103 template <
class MessageBuffer,
class Entity>
104 void scatterImpl(MessageBuffer& buff, Entity
const& e, [[maybe_unused]] std::size_t n, int_t<0>)
113 if (rank > myrank_) {
114 for (
int codim = 1; codim <= Grid::dimension; ++codim) {
115 for (
int i = 0; i <
int(e.subEntities(codim)); ++i) {
116 notOwner_.insert(idSet_.subId(e, i, codim));
Determine for each border entity which processor owns it.
Definition: UniqueBorderPartition.hpp:30
int numIterations() const
Number of iterations to perform the communication in order to collect all neighboring entities.
Definition: UniqueBorderPartition.hpp:82
UniqueBorderPartition(int rank, Grid const &grid)
Construct a UniqueBorderPartition DataHandle to be used in a GridView communicator.
Definition: UniqueBorderPartition.hpp:48
bool contains(IdType const &id) const
Returns whether id is owned by this rank.
Definition: UniqueBorderPartition.hpp:76