1#ifndef __DUNE_ACFEM_INTERSECTIONDATAHANDLE_HH__
2#define __DUNE_ACFEM_INTERSECTIONDATAHANDLE_HH__
5#include <dune/grid/common/datahandleif.hh>
11 template<
class Storage>
12 struct IntersectionDataHandleTraits
14 typedef Storage StorageType;
15 typedef typename StorageType::value_type IntersectionStorageType;
16 typedef typename IntersectionStorageType::value_type DataItemType;
19 template<
class Key,
class IntersectionStorage,
class... Further>
20 struct IntersectionDataHandleTraits<std::map<Key, IntersectionStorage, Further...> >
22 typedef std::map<Key, IntersectionStorage, Further...> StorageType;
23 typedef IntersectionStorage IntersectionStorageType;
24 typedef typename IntersectionStorageType::value_type DataItemType;
44 template<
class IndexSet,
class Storage,
class Operation>
46 :
public CommDataHandleIF<IntersectionDataHandle<IndexSet, Storage, Operation>,
47 typename IntersectionDataHandleTraits<Storage>::DataItemType>
50 typedef IndexSet IndexSetType;
51 typedef Storage CommunicationStorageType;
53 typedef IntersectionDataHandleTraits<Storage> TraitsType;
54 typedef typename TraitsType::IntersectionStorageType IntersectionStorageType;
55 typedef typename TraitsType::DataItemType DataItemType;
56 typedef Operation OperationType;
57 typedef typename IndexSetType::IndexType IndexType;
61 : indexSet_(idxSet), storage_(storage)
65 : indexSet_(other.indexSet_), storage_(other.storage_)
87 template<
class EntityType>
88 size_t size(EntityType& e)
const
90 IndexType idx = indexSet_.index(e);
91 return storage_[idx].size();
95 template<
class MessageBuffer,
class EntityType>
96 void gather(MessageBuffer& buff,
const EntityType& e)
const
98 IndexType idx = indexSet_.index(e);
100 const auto& intersectionStorage(storage_[idx]);
101 const auto end = intersectionStorage.end();
102 for (
auto it = intersectionStorage.begin(); it != end; ++it) {
108 template<
class MessageBuffer,
class EntityType>
109 void scatter(MessageBuffer& buff,
const EntityType& e,
size_t n)
111 assert(n ==
size(e));
113 int idx = indexSet_.index(e);
114 auto& intersectionStorage(storage_[idx]);
115 const auto end = intersectionStorage.end();
116 for (
auto it = intersectionStorage.begin(); it != end; ++it) {
119#if DUNE_VERSION_NEWER(DUNE_FEM, 2, 5)
120 OperationType()(tmp, *it);
122 OperationType::apply(tmp, *it);
128 const IndexSetType& indexSet_;
129 CommunicationStorageType& storage_;
General intersection - intersection communication which communicates for each intersection a potentia...
Definition: intersectiondatahandle.hh:48
void scatter(MessageBuffer &buff, const EntityType &e, size_t n)
unpack data from message to user buffer
Definition: intersectiondatahandle.hh:109
bool contains(int dim, int codim) const
returns true if data for this codim should be communicated
Definition: intersectiondatahandle.hh:69
void gather(MessageBuffer &buff, const EntityType &e) const
pack data from user to message buffer
Definition: intersectiondatahandle.hh:96
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:79
size_t size(EntityType &e) const
how many objects of type DataItemType have to be sent for a given entity.
Definition: intersectiondatahandle.hh:88