1#ifndef DUNE_FEM_HPDG_SPACE_DISCONTINUOUSGALERKIN_DATAHANDLE_HH
2#define DUNE_FEM_HPDG_SPACE_DISCONTINUOUSGALERKIN_DATAHANDLE_HH
23 template<
class Gr
idPart,
class LocalKeys >
24 struct DiscontinuousGalerkinBlockMapper;
31 template<
class BlockMapper >
39 template<
class Gr
idPart,
class LocalKeys >
40 class DataHandle< DiscontinuousGalerkinBlockMapper< GridPart, LocalKeys > >
41 :
public Dune::CommDataHandleIF< DataHandle< DiscontinuousGalerkinBlockMapper< GridPart, LocalKeys > >, typename LocalKeys::DataType >
43 using ThisType = DataHandle< DiscontinuousGalerkinBlockMapper< GridPart, LocalKeys > >;
46 using BlockMapperType = DiscontinuousGalerkinBlockMapper< GridPart, LocalKeys >;
50 using KeyType =
typename LocalKeys::KeyType;
52 using DataType =
typename BaseType::DataType;
58 explicit DataHandle ( BlockMapperType &blockMapper )
59 : blockMapper_( blockMapper )
68 DataHandle (
const ThisType & ) =
default;
70 ThisType &operator= (
const ThisType & ) =
default;
72 DataHandle ( ThisType && ) =
default;
74 ThisType &operator= ( ThisType && ) =
default;
82 bool contains (
int dim,
int codim )
const {
return (codim == 0); }
84 bool fixedSize (
int dim,
int codim )
const {
return true; }
86 template<
class Entity >
87 std::size_t
size (
const Entity &entity )
const
92 template<
class Buffer,
class Entity >
93 void gather ( Buffer &buffer,
const Entity &entity )
const
95 const auto &keys = blockMapper().keys_[ entity ];
96 buffer.write( encode( keys.second ) );
99 template<
class Buffer,
class Entity >
100 void scatter ( Buffer &buffer,
const Entity &entity, std::size_t n )
103 auto &keys = blockMapper().keys_[ entity ];
106 keys.second = decode( data );
112 DataType encode (
const KeyType &key )
const {
return localKeys().encode( key ); }
114 KeyType decode (
const DataType &data )
const {
return localKeys().decode( data ); }
116 KeyType reduce (
const KeyType &a,
const KeyType &b )
const {
return localKeys().reduce( a, b ); }
118 const LocalKeys &localKeys ()
const {
return blockMapper().localKeys(); }
120 BlockMapperType &blockMapper () {
return blockMapper_.get(); }
122 const BlockMapperType &blockMapper ()
const {
return blockMapper_.get(); }
124 std::reference_wrapper< BlockMapperType > blockMapper_;
CommDataHandleIF describes the features of a data handle for communication in parallel runs using the...
Definition: datahandleif.hh:78
static constexpr int codimension
Know your own codimension.
Definition: entity.hh:106
Describes the parallel communication interface class for MessageBuffers and DataHandles.
Dune namespace.
Definition: alignedallocator.hh:13
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75
constexpr std::bool_constant<((II==value)||...)> contains(std::integer_sequence< T, II... >, std::integral_constant< T, value >)
Checks whether or not a given sequence contains a value.
Definition: integersequence.hh:137
std::size_t fixedSize
The number of data items per index if it is fixed, 0 otherwise.
Definition: variablesizecommunicator.hh:264