1#ifndef DUNE_FEM_HPDG_SPACE_DISCONTINUOUSGALERKIN_DATAHANDLE_HH
2#define DUNE_FEM_HPDG_SPACE_DISCONTINUOUSGALERKIN_DATAHANDLE_HH
9#include <dune/grid/common/datahandleif.hh>
23 template<
class Gr
idPart,
class LocalKeys >
24 struct DiscontinuousGalerkinBlockMapper;
31 template<
class BlockMapper >
39 template<
class Gr
idPart,
class LocalKeys >
41 :
public Dune::CommDataHandleIF< DataHandle< DiscontinuousGalerkinBlockMapper< GridPart, LocalKeys > >, typename LocalKeys::DataType >
44 using BaseType = Dune::CommDataHandleIF< DataHandle< DiscontinuousGalerkinBlockMapper< GridPart, LocalKeys > >,
typename LocalKeys::DataType >;
50 using KeyType =
typename LocalKeys::KeyType;
59 : blockMapper_( blockMapper )
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
89 return (Entity::codimension == 0 ? 1u : 0u);
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_;
Definition: bindguard.hh:11
An -adaptive Dune::Fem::DofMapper.
Definition: blockmapper.hh:102
Definition: space/hpdg/datahandle.hh:32
Definition: space/hpdg/datahandle.hh:42
bool fixedSize(int dim, int codim) const
Definition: space/hpdg/datahandle.hh:84
DataHandle(BlockMapperType &blockMapper)
Definition: space/hpdg/datahandle.hh:58
void scatter(Buffer &buffer, const Entity &entity, std::size_t n)
Definition: space/hpdg/datahandle.hh:100
std::size_t size(const Entity &entity) const
Definition: space/hpdg/datahandle.hh:87
DataHandle(ThisType &&)=default
typename BaseType::DataType DataType
data type
Definition: space/hpdg/datahandle.hh:52
typename LocalKeys::KeyType KeyType
key type
Definition: space/hpdg/datahandle.hh:50
bool contains(int dim, int codim) const
Definition: space/hpdg/datahandle.hh:82
void gather(Buffer &buffer, const Entity &entity) const
Definition: space/hpdg/datahandle.hh:93
DataHandle(const ThisType &)=default