24#ifndef DUMUX_VECTOR_EXCHANGE_HH
25#define DUMUX_VECTOR_EXCHANGE_HH
27#include <dune/grid/common/datahandleif.hh>
36template<
class Mapper,
class Vector>
38 :
public Dune::CommDataHandleIF<VectorExchange<Mapper,Vector>,
39 typename Vector::value_type>
61 template<
class Entity>
62 size_t size (Entity& entity)
const
68 template<
class MessageBuffer,
class Entity>
69 void gather (MessageBuffer& buff,
const Entity& entity)
const
71 buff.write(dataVector_[mapper_.index(entity)]);
78 template<
class MessageBuffer,
class Entity>
79 void scatter (MessageBuffer& buff,
const Entity& entity,
size_t n)
83 dataVector_[mapper_.index(entity)] = x;
88 : mapper_(mapper), dataVector_(dataVector)
92 const Mapper& mapper_;
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
A data handle class to exchange entries of a vector.
Definition: vectorexchange.hh:40
bool contains(int dim, int codim) const
returns true if data for this codim should be communicated
Definition: vectorexchange.hh:46
typename Vector::value_type DataType
export type of data for message buffer
Definition: vectorexchange.hh:43
VectorExchange(const Mapper &mapper, Vector &dataVector)
constructor
Definition: vectorexchange.hh:87
bool fixedsize(int dim, int codim) const
returns true if size per entity of given dim and codim is a constant
Definition: vectorexchange.hh:52
size_t size(Entity &entity) const
how many objects of type DataType have to be sent for a given entity
Definition: vectorexchange.hh:62
void scatter(MessageBuffer &buff, const Entity &entity, size_t n)
unpack data from message buffer to user
Definition: vectorexchange.hh:79
void gather(MessageBuffer &buff, const Entity &entity) const
pack data from user to message buffer
Definition: vectorexchange.hh:69