3#ifndef DUNE_GRID_COMMON_DATAHANDLEIF_HH
4#define DUNE_GRID_COMMON_DATAHANDLEIF_HH
12#include <dune/common/bartonnackmanifcheck.hh>
29 template <
class MessageBufferImp>
32 MessageBufferImp & buff_;
74 template <
class DataHandleImp,
class DataTypeImp>
78 class CheckFixedSizeMethod
82 static std::true_type testSignature(
bool (T::*)(
int,
int)
const);
85 static decltype(testSignature(&T::fixedsize)) test(std::nullptr_t);
88 static std::false_type test(...);
90 using type =
decltype(test<M>(
nullptr));
92 static const bool value = type::value;
96 template <
class DH,
bool>
99 static bool fixedSize(
const DH& dh,
int dim,
int codim )
101 return dh.fixedSize( dim, codim );
107 struct CallFixedSize< DH, true >
109 static bool fixedSize(
const DH& dh,
int dim,
int codim )
111 return dh.overloaded_deprecated_fixedsize( dim, codim );
131 CHECK_INTERFACE_IMPLEMENTATION((asImp().
contains(dim,codim)));
132 return asImp().contains(dim,codim);
145 [[deprecated(
"fixedsize (lower case s) will be removed after release 2.8. Implement and call fixedSize (camelCase) instead!")]]
154 [[deprecated(
"fixedsize (lower case s) will be removed after release 2.8. Implement and call fixedSize (camelCase) instead!")]]
157 return asImp().fixedsize( dim, codim );
171 return CallFixedSize< DataHandleImp,
172 CheckFixedSizeMethod< DataHandleImp >::value >
::fixedSize( asImp(), dim, codim );
179 template<
class EntityType>
180 size_t size (
const EntityType& e)
const
182 CHECK_INTERFACE_IMPLEMENTATION((asImp().
size(e)));
183 return asImp().size(e);
190 template<
class MessageBufferImp,
class EntityType>
191 void gather (MessageBufferImp& buff,
const EntityType& e)
const
194 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().
gather(buffIF,e)));
204 template<
class MessageBufferImp,
class EntityType>
205 void scatter (MessageBufferImp& buff,
const EntityType& e,
size_t n)
208 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().
scatter(buffIF,e,n)));
213 DataHandleImp& asImp () {
return static_cast<DataHandleImp &
> (*this);}
215 const DataHandleImp& asImp ()
const
217 return static_cast<const DataHandleImp &
>(*this);
221#undef CHECK_INTERFACE_IMPLEMENTATION
222#undef CHECK_AND_CALL_INTERFACE_IMPLEMENTATION
Include standard header files.
Definition: agrid.hh:58
Communication message buffer interface. This class describes the interface for reading and writing da...
Definition: datahandleif.hh:31
MessageBufferIF(MessageBufferImp &buff)
stores reference to original buffer buff
Definition: datahandleif.hh:35
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:43
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:57
CommDataHandleIF describes the features of a data handle for communication in parallel runs using the...
Definition: datahandleif.hh:76
CommDataHandleIF()
Definition: datahandleif.hh:121
void scatter(MessageBufferImp &buff, const EntityType &e, size_t n)
unpack data from message buffer to user.
Definition: datahandleif.hh:205
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:146
bool contains(int dim, int codim) const
returns true if data for given valid codim should be communicated
Definition: datahandleif.hh:129
size_t size(const EntityType &e) const
how many objects of type DataType have to be sent for a given entity
Definition: datahandleif.hh:180
void gather(MessageBufferImp &buff, const EntityType &e) const
pack data from user to message buffer
Definition: datahandleif.hh:191
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:167
DataTypeImp DataType
data type of data to communicate
Definition: datahandleif.hh:117
bool overloaded_deprecated_fixedsize(int dim, int codim) const
Definition: datahandleif.hh:155