3#ifndef DUNE_PDELAB_COMMON_POLYMORPHICBUFFERWRAPPER_HH
4#define DUNE_PDELAB_COMMON_POLYMORPHICBUFFERWRAPPER_HH
30 template<
typename Buffer>
43 void write(
const T& data)
45 assert(_mode == Mode::send);
46 const char* raw_data =
reinterpret_cast<const char*
>(&data);
47 for (std::size_t i = 0; i <
sizeof(T); ++i)
48 _buffer.write(*(raw_data++));
54 assert(_mode == Mode::receive);
55 char* raw_data =
reinterpret_cast<char*
>(&data);
56 for (std::size_t i = 0; i <
sizeof(T); ++i)
57 _buffer.read(*(raw_data++));
64 , _transmit_rank(transmit_rank)
70 if (_mode == Mode::receive)
82 bool transmitRank()
const
84 return _transmit_rank;
87 int senderRank()
const
89 assert(_sender_rank >= 0);
98 const bool _transmit_rank;
Wrapper for message buffers of grid DataHandles that allows for sending different types of data.
Definition: polymorphicbufferwrapper.hh:32
Dune namespace.
Definition: alignedallocator.hh:11