1#ifndef DUNE_FEM_DEFAULTDATAHANDLE_HH
2#define DUNE_FEM_DEFAULTDATAHANDLE_HH
7#include <dune/grid/common/datahandleif.hh>
24 template<
class DiscreteFunction,
class Operation = DFCommunicationOperation::Add >
26 :
public CommDataHandleIF
27 < DefaultCommunicationHandler< DiscreteFunction, Operation >,
28 typename DiscreteFunction::DofType >
31 typedef CommDataHandleIF< ThisType, typename DiscreteFunction::DofType > BaseType;
61 template <
class Buffer >
68 : buffer_( buffer ), function_( function )
71 template <
class GlobalKey>
72 void operator () (
const size_t local,
const GlobalKey& globalKey )
const
74 const auto &block = function_->dofVector()[ globalKey ];
79 template <
class Buffer >
84 const Operation& operation_;
87 : buffer_( buffer ), function_( function ), operation_( operation )
90 template <
class GlobalKey>
91 void operator () (
const size_t local,
const GlobalKey& globalKey )
const
93 auto &&block = function_->dofVector()[ globalKey ];
96 buffer_.read( value );
97 operation_( value, block[ j ] );
114 template<
class MessageBuffer,
class Entity >
115 void gather ( MessageBuffer &buffer,
const Entity &entity )
const
117 GatherFunctor< MessageBuffer > gatherDofs ( buffer,
function_ );
122 template<
class MessageBuffer,
class Entity >
123 void scatter ( MessageBuffer &buffer,
const Entity &entity,
size_t n )
125 assert( n ==
size( entity ) );
132 template<
class Entity >
133 size_t size (
const Entity &entity )
const
Definition: bindguard.hh:11
static void forEach(IndexRange< T, sz > range, F &&f)
Definition: hybrid.hh:129
Default communication handler for discrete functions.
Definition: defaultcommhandler.hh:29
const Operation operation_
Definition: defaultcommhandler.hh:141
DiscreteFunctionType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
Definition: defaultcommhandler.hh:38
DiscreteFunctionSpaceType::BlockMapperType BlockMapperType
Definition: defaultcommhandler.hh:41
DiscreteFunctionSpaceType::LocalBlockIndices LocalBlockIndices
Definition: defaultcommhandler.hh:42
void scatter(MessageBuffer &buffer, const Entity &entity, size_t n)
read buffer and apply operation
Definition: defaultcommhandler.hh:123
DiscreteFunctionType *const function_
Definition: defaultcommhandler.hh:139
DefaultCommunicationHandler(DiscreteFunctionType &function, const Operation &operation=Operation())
Definition: defaultcommhandler.hh:45
bool fixedSize(int dim, int codim) const
Definition: defaultcommhandler.hh:108
void gather(MessageBuffer &buffer, const Entity &entity) const
read buffer and apply operation
Definition: defaultcommhandler.hh:115
DefaultCommunicationHandler(const DefaultCommunicationHandler &other)
Definition: defaultcommhandler.hh:51
const BlockMapperType & blockMapper_
Definition: defaultcommhandler.hh:140
bool contains(int dim, int codim) const
Definition: defaultcommhandler.hh:103
size_t size(const Entity &entity) const
return local dof size to be communicated
Definition: defaultcommhandler.hh:133
DefaultCommunicationHandler & operator=(const DefaultCommunicationHandler &)=delete
cannot be implemented because of the reference
DiscreteFunction DiscreteFunctionType
Definition: defaultcommhandler.hh:36
BaseType::DataType DataType
Definition: defaultcommhandler.hh:34