5#ifndef DUNE_GEOGRID_DATAHANDLE_HH
6#define DUNE_GEOGRID_DATAHANDLE_HH
8#include <dune/common/typetraits.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;
33 wrappedHandle_( handle )
38 const bool contains = wrappedHandle_.contains( dim, codim );
40 assertHostEntity( dim, codim );
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 )
80 DUNE_THROW( NotImplemented,
"Host grid has no entities for codimension " << codim <<
"." );
84 WrappedHandle &wrappedHandle_;
Describes the parallel communication interface class for MessageBuffers and DataHandles.
Include standard header files.
Definition: agrid.hh:60
CommDataHandleIF describes the features of a data handle for communication in parallel runs using the...
Definition: datahandleif.hh:78
Grid abstract base class.
Definition: common/grid.hh:375
Definition: geometrygrid/capabilities.hh:116
Definition: geometrygrid/datahandle.hh:27
bool fixedSize(int dim, int codim) const
Definition: geometrygrid/datahandle.hh:44
bool contains(int dim, int codim) const
Definition: geometrygrid/datahandle.hh:36
size_t size(const HostEntity &hostEntity) const
Definition: geometrygrid/datahandle.hh:50
CommDataHandle(const Grid &grid, WrappedHandle &handle)
Definition: geometrygrid/datahandle.hh:31
void gather(MessageBuffer &buffer, const HostEntity &hostEntity) const
Definition: geometrygrid/datahandle.hh:59
void scatter(MessageBuffer &buffer, const HostEntity &hostEntity, size_t size_)
Definition: geometrygrid/datahandle.hh:68
DUNE-conform implementation of the entity.
Definition: geometrygrid/entity.hh:694
Different resources needed by all grid implementations.