5#ifndef DUNE_GRID_COMMON_DATAHANDLEIF_HH
6#define DUNE_GRID_COMMON_DATAHANDLEIF_HH
14#include <dune/common/bartonnackmanifcheck.hh>
31 template <
class MessageBufferImp>
34 MessageBufferImp & buff_;
76 template <
class DataHandleImp,
class DataTypeImp>
80 class CheckFixedSizeMethod
84 static std::true_type testSignature(
bool (T::*)(
int,
int)
const);
87 static decltype(testSignature(&T::fixedsize)) test(std::nullptr_t);
90 static std::false_type test(...);
92 using type =
decltype(test<M>(
nullptr));
94 static const bool value = type::value;
98 template <
class DH,
bool>
101 static bool fixedSize(
const DH& dh,
int dim,
int codim )
103 return dh.fixedSize( dim, codim );
109 struct CallFixedSize< DH, true >
111 static bool fixedSize(
const DH& dh,
int dim,
int codim )
113 return dh.overloaded_deprecated_fixedsize( dim, codim );
133 CHECK_INTERFACE_IMPLEMENTATION((asImp().
contains(dim,codim)));
134 return asImp().contains(dim,codim);
147 [[deprecated(
"fixedsize (lower case s) will be removed after release 2.8. Implement and call fixedSize (camelCase) instead!")]]
156 [[deprecated(
"fixedsize (lower case s) will be removed after release 2.8. Implement and call fixedSize (camelCase) instead!")]]
159 return asImp().fixedsize( dim, codim );
173 return CallFixedSize< DataHandleImp,
174 CheckFixedSizeMethod< DataHandleImp >::value >
::fixedSize( asImp(), dim, codim );
181 template<
class EntityType>
182 size_t size (
const EntityType& e)
const
184 CHECK_INTERFACE_IMPLEMENTATION((asImp().
size(e)));
185 return asImp().size(e);
192 template<
class MessageBufferImp,
class EntityType>
193 void gather (MessageBufferImp& buff,
const EntityType& e)
const
196 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().
gather(buffIF,e)));
206 template<
class MessageBufferImp,
class EntityType>
207 void scatter (MessageBufferImp& buff,
const EntityType& e,
size_t n)
210 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().
scatter(buffIF,e,n)));
215 DataHandleImp& asImp () {
return static_cast<DataHandleImp &
> (*this);}
217 const DataHandleImp& asImp ()
const
219 return static_cast<const DataHandleImp &
>(*this);
223#undef CHECK_INTERFACE_IMPLEMENTATION
224#undef CHECK_AND_CALL_INTERFACE_IMPLEMENTATION
Include standard header files.
Definition: agrid.hh:60
Communication message buffer interface. This class describes the interface for reading and writing da...
Definition: datahandleif.hh:33
MessageBufferIF(MessageBufferImp &buff)
stores reference to original buffer buff
Definition: datahandleif.hh:37
void write(const T &val)
just wraps the call of the internal buffer method write which writes the data of type T from the buff...
Definition: datahandleif.hh:45
void read(T &val)
just wraps the call of the internal buffer method read which reads the data of type T from the buffer...
Definition: datahandleif.hh:59
CommDataHandleIF describes the features of a data handle for communication in parallel runs using the...
Definition: datahandleif.hh:78
CommDataHandleIF()
Definition: datahandleif.hh:123
void scatter(MessageBufferImp &buff, const EntityType &e, size_t n)
unpack data from message buffer to user.
Definition: datahandleif.hh:207
int fixedsize(int dim, int codim) const
returns true if size of data per entity of given dim and codim is a constant
Definition: datahandleif.hh:148
bool contains(int dim, int codim) const
returns true if data for given valid codim should be communicated
Definition: datahandleif.hh:131
size_t size(const EntityType &e) const
how many objects of type DataType have to be sent for a given entity
Definition: datahandleif.hh:182
void gather(MessageBufferImp &buff, const EntityType &e) const
pack data from user to message buffer
Definition: datahandleif.hh:193
bool fixedSize(int dim, int codim) const
returns true if size of data per entity of given dim and codim is a constant
Definition: datahandleif.hh:169
DataTypeImp DataType
data type of data to communicate
Definition: datahandleif.hh:119
bool overloaded_deprecated_fixedsize(int dim, int codim) const
Definition: datahandleif.hh:157