5#ifndef DUNE_GEOGRID_DATAHANDLE_HH
6#define DUNE_GEOGRID_DATAHANDLE_HH
12#include <dune/grid/geometrygrid/capabilities.hh>
13#include <dune/grid/geometrygrid/entity.hh>
24 template<
class Gr
id,
class WrappedHandle >
26 :
public CommDataHandleIF< CommDataHandle< Grid, WrappedHandle >, typename WrappedHandle::DataType >
28 typedef typename std::remove_const< Grid >::type::Traits Traits;
31 CommDataHandle (
const Grid &grid, WrappedHandle &handle )
33 wrappedHandle_( handle )
36 bool contains (
int dim,
int codim )
const
38 const bool contains = wrappedHandle_.contains( dim, codim );
40 assertHostEntity( dim, codim );
44 bool fixedSize (
int dim,
int codim )
const
46 return wrappedHandle_.fixedSize( dim, codim );
49 template<
class HostEntity >
50 size_t size (
const HostEntity &hostEntity )
const
52 typedef typename Grid::Traits::template Codim< HostEntity::codimension >::Entity Entity;
53 typedef typename Grid::Traits::template Codim< HostEntity::codimension >::EntityImpl EntityImpl;
54 Entity entity( EntityImpl( grid_, hostEntity ) );
55 return wrappedHandle_.size( entity );
58 template<
class MessageBuffer,
class HostEntity >
59 void gather ( MessageBuffer &buffer,
const HostEntity &hostEntity )
const
61 typedef typename Grid::Traits::template Codim< HostEntity::codimension >::Entity Entity;
62 typedef typename Grid::Traits::template Codim< HostEntity::codimension >::EntityImpl EntityImpl;
63 Entity entity( EntityImpl( grid_, hostEntity ) );
64 wrappedHandle_.gather( buffer, entity );
67 template<
class MessageBuffer,
class HostEntity >
68 void scatter ( MessageBuffer &buffer,
const HostEntity &hostEntity,
size_t size_ )
70 typedef typename Grid::Traits::template Codim< HostEntity::codimension >::Entity Entity;
71 typedef typename Grid::Traits::template Codim< HostEntity::codimension >::EntityImpl EntityImpl;
72 Entity entity( EntityImpl( grid_, hostEntity ) );
73 wrappedHandle_.scatter( buffer, entity, size_ );
77 static void assertHostEntity (
int ,
int codim )
79 if( !Capabilities::CodimCache< Grid >::hasHostEntity( codim ) )
80 DUNE_THROW( NotImplemented,
"Host grid has no entities for codimension " << codim <<
"." );
84 WrappedHandle &wrappedHandle_;
void scatter(MessageBufferImp &buff, const EntityType &e, size_t n)
unpack data from message buffer to user.
Definition: datahandleif.hh:143
void gather(MessageBufferImp &buff, const EntityType &e) const
pack data from user to message buffer
Definition: datahandleif.hh:129
Different resources needed by all grid implementations.
Describes the parallel communication interface class for MessageBuffers and DataHandles.
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
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
Traits for type conversions and type information.
std::size_t fixedSize
The number of data items per index if it is fixed, 0 otherwise.
Definition: variablesizecommunicator.hh:264