29 #ifndef EWOMS_GRID_COMM_HANDLES_HH
30 #define EWOMS_GRID_COMM_HANDLES_HH
32 #include <opm/common/Unused.hpp>
34 #include <dune/grid/common/datahandleif.hh>
35 #include <dune/common/version.hh>
43 template <
class FieldType,
class Container,
class EntityMapper,
int commCodim>
45 :
public Dune::CommDataHandleIF<GridCommHandleSum<FieldType, Container,
46 EntityMapper, commCodim>,
51 : mapper_(mapper), container_(container)
54 bool contains(
int dim OPM_UNUSED,
int codim)
const
58 return codim == commCodim;
61 bool fixedsize(
int dim OPM_UNUSED,
int codim OPM_UNUSED)
const
68 template <
class EntityType>
69 size_t size(
const EntityType& e OPM_UNUSED)
const
75 template <
class MessageBufferImp,
class EntityType>
76 void gather(MessageBufferImp& buff,
const EntityType& e)
const
78 unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
79 buff.write(container_[dofIdx]);
82 template <
class MessageBufferImp,
class EntityType>
83 void scatter(MessageBufferImp& buff,
const EntityType& e,
size_t n OPM_UNUSED)
85 unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
89 container_[dofIdx] += tmp;
93 const EntityMapper& mapper_;
94 Container& container_;
102 template <
class FieldType,
class Container,
class EntityMapper,
unsigned commCodim>
104 :
public Dune::CommDataHandleIF<GridCommHandleGhostSync<FieldType, Container,
105 EntityMapper, commCodim>,
110 : mapper_(mapper), container_(container)
114 bool contains(
unsigned dim OPM_UNUSED,
unsigned codim)
const
118 return codim == commCodim;
121 bool fixedsize(
unsigned dim OPM_UNUSED,
unsigned codim OPM_UNUSED)
const
128 template <
class EntityType>
129 size_t size(
const EntityType& e OPM_UNUSED)
const
135 template <
class MessageBufferImp,
class EntityType>
136 void gather(MessageBufferImp& buff,
const EntityType& e)
const
138 unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
139 buff.write(container_[dofIdx]);
142 template <
class MessageBufferImp,
class EntityType>
143 void scatter(MessageBufferImp& buff,
const EntityType& e,
size_t n OPM_UNUSED)
145 unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
146 buff.read(container_[dofIdx]);
150 const EntityMapper& mapper_;
151 Container& container_;
158 template <
class FieldType,
class Container,
class EntityMapper,
unsigned commCodim>
160 :
public Dune::CommDataHandleIF<GridCommHandleMax<FieldType, Container,
161 EntityMapper, commCodim>,
166 : mapper_(mapper), container_(container)
169 bool contains(
unsigned dim OPM_UNUSED,
unsigned codim)
const
173 return codim == commCodim;
176 bool fixedsize(
unsigned dim OPM_UNUSED,
unsigned codim OPM_UNUSED)
const
183 template <
class EntityType>
184 size_t size(
const EntityType& e OPM_UNUSED)
const
190 template <
class MessageBufferImp,
class EntityType>
191 void gather(MessageBufferImp& buff,
const EntityType& e)
const
193 unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
194 buff.write(container_[dofIdx]);
197 template <
class MessageBufferImp,
class EntityType>
198 void scatter(MessageBufferImp& buff,
const EntityType& e,
size_t n OPM_UNUSED)
200 unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
203 container_[dofIdx] = std::max(container_[dofIdx], tmp);
207 const EntityMapper& mapper_;
208 Container& container_;
215 template <
class FieldType,
class Container,
class EntityMapper,
unsigned commCodim>
217 :
public Dune::CommDataHandleIF<GridCommHandleMin<FieldType, Container,
218 EntityMapper, commCodim>,
223 : mapper_(mapper), container_(container)
226 bool contains(
unsigned dim OPM_UNUSED,
unsigned codim)
const
230 return codim == commCodim;
233 bool fixedsize(
unsigned dim OPM_UNUSED,
unsigned codim OPM_UNUSED)
const
240 template <
class EntityType>
241 size_t size(
const EntityType& e OPM_UNUSED)
const
247 template <
class MessageBufferImp,
class EntityType>
248 void gather(MessageBufferImp& buff,
const EntityType& e)
const
250 unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
251 buff.write(container_[dofIdx]);
254 template <
class MessageBufferImp,
class EntityType>
255 void scatter(MessageBufferImp& buff,
const EntityType& e,
size_t n OPM_UNUSED)
257 unsigned dofIdx =
static_cast<unsigned>(mapper_.index(e));
260 container_[dofIdx] = std::min(container_[dofIdx], tmp);
264 const EntityMapper& mapper_;
265 Container& container_;
Data handle for parallel communication which takes the maximum of all values that are attached to DOF...
Definition: gridcommhandles.hh:159
Data handle for parallel communication which sums up all values are attached to DOFs.
Definition: gridcommhandles.hh:44
Provides data handle for parallel communication which takes the minimum of all values that are attach...
Definition: gridcommhandles.hh:216
Data handle for parallel communication which can be used to set the values values of ghost and overla...
Definition: gridcommhandles.hh:103