1#ifndef __DUNE_ACFEM_INTERSECTIONDATAHANDLE_HH__
2#define __DUNE_ACFEM_INTERSECTIONDATAHANDLE_HH__
5#include <dune/common/version.hh>
6#include <dune/grid/common/datahandleif.hh>
7#include <dune/common/version.hh>
13 template<
class Storage>
14 struct IntersectionDataHandleTraits
16 typedef Storage StorageType;
17 typedef typename StorageType::value_type IntersectionStorageType;
18 typedef typename IntersectionStorageType::value_type DataItemType;
21 template<
class Key,
class IntersectionStorage,
class... Further>
22 struct IntersectionDataHandleTraits<
std::map<Key, IntersectionStorage, Further...> >
24 typedef std::map<Key, IntersectionStorage, Further...> StorageType;
25 typedef IntersectionStorage IntersectionStorageType;
26 typedef typename IntersectionStorageType::value_type DataItemType;
46 template<
class IndexSet,
class Storage,
class Operation>
48 :
public CommDataHandleIF<IntersectionDataHandle<IndexSet, Storage, Operation>,
49 typename IntersectionDataHandleTraits<Storage>::DataItemType>
52 typedef IndexSet IndexSetType;
53 typedef Storage CommunicationStorageType;
55 typedef IntersectionDataHandleTraits<Storage> TraitsType;
56 typedef typename TraitsType::IntersectionStorageType IntersectionStorageType;
57 typedef typename TraitsType::DataItemType DataItemType;
58 typedef Operation OperationType;
62 : indexSet_(idxSet), storage_(
storage)
66 : indexSet_(other.indexSet_), storage_(other.storage_)
88 template<
class Entity>
89 size_t size(
const Entity& e)
const
91 return storage_[indexSet_.index(e)].size();
95 template<
class MessageBuffer,
class Entity>
96 void gather(MessageBuffer& buff,
const Entity& e)
const
98 for (
const auto data : storage_[indexSet_.index(e)]) {
104 template<
class MessageBuffer,
class Entity>
105 void scatter(MessageBuffer& buff,
const Entity& e,
size_t n)
107 assert(n ==
size(e));
108 for (
auto& data : storage_[indexSet_.index(e)]) {
109 typename std::decay<
decltype(data)>::type tmp;
111#if DUNE_VERSION_NEWER(DUNE_FEM, 2, 5)
112 OperationType()(tmp, data);
114 OperationType::apply(tmp, data);
120 const IndexSetType& indexSet_;
121 CommunicationStorageType& storage_;
General intersection - intersection communication which communicates for each intersection a potentia...
Definition: intersectiondatahandle.hh:50
void scatter(MessageBuffer &buff, const Entity &e, size_t n)
unpack data from message to user buffer
Definition: intersectiondatahandle.hh:105
size_t size(const Entity &e) const
how many objects of type DataItemType have to be sent for a given entity.
Definition: intersectiondatahandle.hh:89
bool contains(int dim, int codim) const
returns true if data for this codim should be communicated
Definition: intersectiondatahandle.hh:70
bool fixedSize(int dim, int codim) const
This entire beast is meant for communication like arrays of values at each quadrature point,...
Definition: intersectiondatahandle.hh:80
void gather(MessageBuffer &buff, const Entity &e) const
pack data from user to message buffer
Definition: intersectiondatahandle.hh:96
constexpr auto storage(const F &f, T &&... t)
Generate an expression storage container.
Definition: storage.hh:704