29 #ifndef EWOMS_GRID_COMM_HANDLES_HH 30 #define EWOMS_GRID_COMM_HANDLES_HH 32 #include <dune/common/version.hh> 34 #include <dune/grid/common/datahandleif.hh> 45 template <
class FieldType,
class Container,
class EntityMapper,
int commCodim>
47 :
public Dune::CommDataHandleIF<GridCommHandleSum<FieldType, Container,
48 EntityMapper, commCodim>,
53 : mapper_(mapper), container_(container)
56 bool contains(
int,
int codim)
const 60 return codim == commCodim;
63 bool fixedSize(
int,
int)
const 70 template <
class EntityType>
71 std::size_t size(
const EntityType&)
const 77 template <
class MessageBufferImp,
class EntityType>
78 void gather(MessageBufferImp& buff,
const EntityType& e)
const 80 const 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, std::size_t)
87 const unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
91 container_[dofIdx] += tmp;
95 const EntityMapper& mapper_;
96 Container& container_;
104 template <
class FieldType,
class Container,
class EntityMapper,
unsigned commCodim>
106 :
public Dune::CommDataHandleIF<GridCommHandleGhostSync<FieldType, Container,
107 EntityMapper, commCodim>,
112 : mapper_(mapper), container_(container)
116 bool contains(
int,
int codim)
const 120 return codim == commCodim;
123 bool fixedSize(
int,
int)
const 130 template <
class EntityType>
131 std::size_t size(
const EntityType&)
const 137 template <
class MessageBufferImp,
class EntityType>
138 void gather(MessageBufferImp& buff,
const EntityType& e)
const 140 const unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
141 buff.write(container_[dofIdx]);
144 template <
class MessageBufferImp,
class EntityType>
145 void scatter(MessageBufferImp& buff,
const EntityType& e, std::size_t)
147 const unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
148 buff.read(container_[dofIdx]);
152 const EntityMapper& mapper_;
153 Container& container_;
160 template <
class FieldType,
class Container,
class EntityMapper,
unsigned commCodim>
162 :
public Dune::CommDataHandleIF<GridCommHandleMax<FieldType, Container,
163 EntityMapper, commCodim>,
168 : mapper_(mapper), container_(container)
171 bool contains(
int,
int codim)
const 175 return codim == commCodim;
178 bool fixedSize(
int,
int)
const 185 template <
class EntityType>
186 std::size_t size(
const EntityType&)
const 192 template <
class MessageBufferImp,
class EntityType>
193 void gather(MessageBufferImp& buff,
const EntityType& e)
const 195 const unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
196 buff.write(container_[dofIdx]);
199 template <
class MessageBufferImp,
class EntityType>
200 void scatter(MessageBufferImp& buff,
const EntityType& e, std::size_t)
202 const unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
205 container_[dofIdx] = std::max(container_[dofIdx], tmp);
209 const EntityMapper& mapper_;
210 Container& container_;
217 template <
class FieldType,
class Container,
class EntityMapper,
unsigned commCodim>
219 :
public Dune::CommDataHandleIF<GridCommHandleMin<FieldType, Container,
220 EntityMapper, commCodim>,
225 : mapper_(mapper), container_(container)
228 bool contains(
int,
int codim)
const 232 return codim == commCodim;
235 bool fixedSize(
int,
int)
const 242 template <
class EntityType>
243 std::size_t size(
const EntityType&)
const 249 template <
class MessageBufferImp,
class EntityType>
250 void gather(MessageBufferImp& buff,
const EntityType& e)
const 252 const unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
253 buff.write(container_[dofIdx]);
256 template <
class MessageBufferImp,
class EntityType>
257 void scatter(MessageBufferImp& buff,
const EntityType& e, std::size_t)
259 const unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
262 container_[dofIdx] = std::min(container_[dofIdx], tmp);
266 const EntityMapper& mapper_;
267 Container& container_;
Data handle for parallel communication which can be used to set the values values of ghost and overla...
Definition: gridcommhandles.hh:105
Data handle for parallel communication which takes the maximum of all values that are attached to DOF...
Definition: gridcommhandles.hh:161
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
Provides data handle for parallel communication which takes the minimum of all values that are attach...
Definition: gridcommhandles.hh:218
Data handle for parallel communication which sums up all values are attached to DOFs.
Definition: gridcommhandles.hh:46