29#ifndef EWOMS_GRID_COMM_HANDLES_HH
30#define EWOMS_GRID_COMM_HANDLES_HH
32#include <dune/grid/common/datahandleif.hh>
33#include <dune/common/version.hh>
41template <
class FieldType,
class Container,
class EntityMapper,
int commCodim>
43 :
public Dune::CommDataHandleIF<GridCommHandleSum<FieldType, Container,
44 EntityMapper, commCodim>,
49 : mapper_(mapper), container_(container)
56 return codim == commCodim;
59#if DUNE_VERSION_LT(DUNE_GRID, 2, 8)
60 bool fixedsize(
int,
int)
const
70 template <
class EntityType>
71 size_t size(
const EntityType&)
const
77 template <
class MessageBufferImp,
class EntityType>
78 void gather(MessageBufferImp& buff,
const EntityType& e)
const
80 unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
81 buff.write(container_[dofIdx]);
84 template <
class MessageBufferImp,
class EntityType>
85 void scatter(MessageBufferImp& buff,
const EntityType& e,
size_t)
87 unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
91 container_[dofIdx] += tmp;
95 const EntityMapper& mapper_;
96 Container& container_;
104template <
class FieldType,
class Container,
class EntityMapper,
unsigned commCodim>
106 :
public Dune::CommDataHandleIF<GridCommHandleGhostSync<FieldType, Container,
107 EntityMapper, commCodim>,
112 : mapper_(mapper), container_(container)
120 return codim == commCodim;
123#if DUNE_VERSION_LT(DUNE_GRID, 2, 8)
124 bool fixedsize(
int,
int)
const
134 template <
class EntityType>
135 size_t size(
const EntityType&)
const
141 template <
class MessageBufferImp,
class EntityType>
142 void gather(MessageBufferImp& buff,
const EntityType& e)
const
144 unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
145 buff.write(container_[dofIdx]);
148 template <
class MessageBufferImp,
class EntityType>
149 void scatter(MessageBufferImp& buff,
const EntityType& e,
size_t)
151 unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
152 buff.read(container_[dofIdx]);
156 const EntityMapper& mapper_;
157 Container& container_;
164template <
class FieldType,
class Container,
class EntityMapper,
unsigned commCodim>
166 :
public Dune::CommDataHandleIF<GridCommHandleMax<FieldType, Container,
167 EntityMapper, commCodim>,
172 : mapper_(mapper), container_(container)
179 return codim == commCodim;
182#if DUNE_VERSION_LT(DUNE_GRID, 2, 8)
183 bool fixedsize(
int,
int)
const
193 template <
class EntityType>
194 size_t size(
const EntityType&)
const
200 template <
class MessageBufferImp,
class EntityType>
201 void gather(MessageBufferImp& buff,
const EntityType& e)
const
203 unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
204 buff.write(container_[dofIdx]);
207 template <
class MessageBufferImp,
class EntityType>
208 void scatter(MessageBufferImp& buff,
const EntityType& e,
size_t)
210 unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
213 container_[dofIdx] = std::max(container_[dofIdx], tmp);
217 const EntityMapper& mapper_;
218 Container& container_;
225template <
class FieldType,
class Container,
class EntityMapper,
unsigned commCodim>
227 :
public Dune::CommDataHandleIF<GridCommHandleMin<FieldType, Container,
228 EntityMapper, commCodim>,
233 : mapper_(mapper), container_(container)
240 return codim == commCodim;
243#if DUNE_VERSION_LT(DUNE_GRID, 2, 8)
244 bool fixedsize(
int,
int)
const
254 template <
class EntityType>
255 size_t size(
const EntityType&)
const
261 template <
class MessageBufferImp,
class EntityType>
262 void gather(MessageBufferImp& buff,
const EntityType& e)
const
264 unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
265 buff.write(container_[dofIdx]);
268 template <
class MessageBufferImp,
class EntityType>
269 void scatter(MessageBufferImp& buff,
const EntityType& e,
size_t)
271 unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
274 container_[dofIdx] = std::min(container_[dofIdx], tmp);
278 const EntityMapper& mapper_;
279 Container& container_;
Data handle for parallel communication which can be used to set the values values of ghost and overla...
Definition: gridcommhandles.hh:109
size_t size(const EntityType &) const
Definition: gridcommhandles.hh:135
bool contains(int, int codim) const
Definition: gridcommhandles.hh:116
void gather(MessageBufferImp &buff, const EntityType &e) const
Definition: gridcommhandles.hh:142
GridCommHandleGhostSync(Container &container, const EntityMapper &mapper)
Definition: gridcommhandles.hh:111
void scatter(MessageBufferImp &buff, const EntityType &e, size_t)
Definition: gridcommhandles.hh:149
bool fixedSize(int, int) const
Definition: gridcommhandles.hh:126
Data handle for parallel communication which takes the maximum of all values that are attached to DOF...
Definition: gridcommhandles.hh:169
bool contains(int, int codim) const
Definition: gridcommhandles.hh:175
void scatter(MessageBufferImp &buff, const EntityType &e, size_t)
Definition: gridcommhandles.hh:208
bool fixedSize(int, int) const
Definition: gridcommhandles.hh:185
size_t size(const EntityType &) const
Definition: gridcommhandles.hh:194
void gather(MessageBufferImp &buff, const EntityType &e) const
Definition: gridcommhandles.hh:201
GridCommHandleMax(Container &container, const EntityMapper &mapper)
Definition: gridcommhandles.hh:171
Provides data handle for parallel communication which takes the minimum of all values that are attach...
Definition: gridcommhandles.hh:230
void scatter(MessageBufferImp &buff, const EntityType &e, size_t)
Definition: gridcommhandles.hh:269
void gather(MessageBufferImp &buff, const EntityType &e) const
Definition: gridcommhandles.hh:262
size_t size(const EntityType &) const
Definition: gridcommhandles.hh:255
GridCommHandleMin(Container &container, const EntityMapper &mapper)
Definition: gridcommhandles.hh:232
bool fixedSize(int, int) const
Definition: gridcommhandles.hh:246
bool contains(int, int codim) const
Definition: gridcommhandles.hh:236
Data handle for parallel communication which sums up all values are attached to DOFs.
Definition: gridcommhandles.hh:46
void scatter(MessageBufferImp &buff, const EntityType &e, size_t)
Definition: gridcommhandles.hh:85
void gather(MessageBufferImp &buff, const EntityType &e) const
Definition: gridcommhandles.hh:78
GridCommHandleSum(Container &container, const EntityMapper &mapper)
Definition: gridcommhandles.hh:48
bool contains(int, int codim) const
Definition: gridcommhandles.hh:52
size_t size(const EntityType &) const
Definition: gridcommhandles.hh:71
bool fixedSize(int, int) const
Definition: gridcommhandles.hh:62
Definition: blackoilboundaryratevector.hh:37