|
dune-pdelab 2.9
|
Loading...
Searching...
No Matches
genericdatahandle.hh
Go to the documentation of this file.
32 // Wrap the grid's communication buffer to enable sending leaf ordering sizes along with the data
41 // export original data type to fix up size information forwarded to standard gather / scatter functors
61 + (gfs.sendLeafSizes() ? TypeTree::TreeInfo<typename GFS::Ordering>::leafCount * sizeof(size_type) : 0)
75 // Data is per entity, so we don' need to send leaf ordering size and thus can avoid wrapping the
85 // export original data type to fix up size information forwarded to standard gather / scatter functors
129 template<typename GFS, typename V, typename GatherScatter, typename CommunicationDescriptor = DOFDataCommunicationDescriptor<typename V::ElementType> >
131 : public Dune::CommDataHandleIF<GFSDataHandle<GFS,V,GatherScatter,CommunicationDescriptor>,typename CommunicationDescriptor::DataType>
141 GFSDataHandle(const GFS& gfs, V& v, GatherScatter gather_scatter = GatherScatter(), CommunicationDescriptor communication_descriptor = CommunicationDescriptor())
175 CommunicationDescriptor::wrap_buffer && AlwaysTrue<Entity>::value // we can only support this if the buffer is wrapped
226 CommunicationDescriptor::wrap_buffer && AlwaysTrue<Entity>::value // we require the buffer to be wrapped
253 needs_commit = _gather_scatter.scatter(buf_wrapper,remote_offsets,_index_cache.offsets(),e,_local_view);
327 // default scatter - requires function space structure to be identical on sender and receiver side
331 if (local_view.cache().gridFunctionSpace().entitySet().partitions().contains(e.partitionType()))
334 DUNE_THROW(Exception,"size mismatch in GridFunctionSpace data handle, have " << local_view.size() << "DOFs, but received " << n);
343 DUNE_THROW(Exception,"expected no DOFs in partition '" << e.partitionType() << "', but have " << local_view.size());
354 // enhanced scatter with support for function spaces with different structure on sender and receiver side
356 bool scatter(MessageBuffer& buff, const Offsets& remote_offsets, const Offsets& local_offsets, const Entity& e, LocalView& local_view) const
358 if (local_view.cache().gridFunctionSpace().entitySet().partitions().contains(e.partitionType()))
361 // the compile time structure of the overall function space (and its ordering) will be identical on both sides
362 // of the communication, but one side may be missing information on some leaf orderings, e.g. because the DOF
363 // belongs to a MultiDomain subdomain that only has an active grid cell on one side of the communication.
364 // So we step through the leaves and simply ignore any block where one of the two sides is of size 0.
365 // Otherwise, it's business as usual: we make sure that the sizes from both sides match and then process all
391 DUNE_THROW(Exception,"size mismatch in GridFunctionSpace data handle block " << block << ", have " << local_offsets[block] - local_i << "DOFs, but received " << remote_offsets[block] - remote_i);
404 DUNE_THROW(Exception,"expected no DOFs in partition '" << e.partitionType() << "', but have " << local_view.size());
446 if (local_view.cache().gridFunctionSpace().entitySet().partitions().contains(e.partitionType()))
449 DUNE_THROW(Exception,"size mismatch in GridFunctionSpace data handle, have " << local_view.size() << "DOFs, but received " << n);
458 DUNE_THROW(Exception,"expected no DOFs in partition '" << e.partitionType() << "', but have " << local_view.size());
471 bool scatter(MessageBuffer& buff, const Offsets& remote_offsets, const Offsets& local_offsets, const Entity& e, LocalView& local_view) const
473 if (local_view.cache().gridFunctionSpace().entitySet().partitions().contains(e.partitionType()))
500 DUNE_THROW(Exception,"size mismatch in GridFunctionSpace data handle block " << block << ", have " << local_offsets[block] - local_i << "DOFs, but received " << remote_offsets[block] - remote_i);
513 DUNE_THROW(Exception,"expected no DOFs in partition '" << e.partitionType() << "', but have " << local_view.size());
555 if (local_view.cache().gridFunctionSpace().entitySet().partitions().contains(e.partitionType()))
558 DUNE_THROW(Exception,"size mismatch in GridFunctionSpace data handle, have " << local_view.size() << "DOFs, but received " << n);
568 DUNE_THROW(Exception,"expected no DOFs in partition '" << e.partitionType() << "', but have " << local_view.size());
581 bool scatter(MessageBuffer& buff, const Offsets& remote_offsets, const Offsets& local_offsets, const Entity& e, LocalView& local_view) const
583 if (local_view.cache().gridFunctionSpace().entitySet().partitions().contains(e.partitionType()))
610 DUNE_THROW(Exception,"size mismatch in GridFunctionSpace data handle block " << block << ", have " << local_offsets[block] - local_i << "DOFs, but received " << remote_offsets[block] - remote_i);
623 DUNE_THROW(Exception,"expected no DOFs in partition '" << e.partitionType() << "', but have " << local_view.size());
819 const bool ghost = e.partitionType()!=Dune::InteriorEntity && e.partitionType()!=Dune::BorderEntity;
830 // Figure out where we are - we have to do this again on the receiving side due to the asymmetric
832 const bool ghost = e.partitionType()!=Dune::InteriorEntity && e.partitionType()!=Dune::BorderEntity;
924 const bool is_interior_or_border = (e.partitionType()==Dune::InteriorEntity || e.partitionType()==Dune::BorderEntity);
1008 : BaseT(gfs_,v_,DisjointPartitioningGatherScatter<typename V::ElementType>(gfs_.gridView().comm().rank()))
int count() const
int size() const
#define DUNE_THROW(E, m)
For backward compatibility – Do not use this!
InteriorEntity
BorderEntity
Wrapper for message buffers of grid DataHandles that allows for sending different types of data.
Definition polymorphicbufferwrapper.hh:32
void read(T &data)
Definition polymorphicbufferwrapper.hh:52
void write(const T &data)
Definition polymorphicbufferwrapper.hh:43
Definition entityindexcache.hh:18
const Offsets & offsets() const
Definition entityindexcache.hh:80
Communication descriptor for sending one item of type E per DOF.
Definition genericdatahandle.hh:25
static constexpr bool transmitRank()
Definition genericdatahandle.hh:36
static const bool wrap_buffer
Definition genericdatahandle.hh:33
bool contains(const GFS &gfs, int dim, int codim) const
Definition genericdatahandle.hh:45
char DataType
Definition genericdatahandle.hh:27
E OriginalDataType
Definition genericdatahandle.hh:42
std::size_t size(const GFS &gfs, const Entity &e) const
Definition genericdatahandle.hh:57
std::size_t size_type
size type to use if communicating leaf ordering sizes
Definition genericdatahandle.hh:30
bool fixedSize(const GFS &gfs, int dim, int codim) const
Definition genericdatahandle.hh:51
Communication descriptor for sending count items of type E per entity with attached DOFs.
Definition genericdatahandle.hh:70
std::size_t size(const GFS &gfs, const Entity &e) const
Definition genericdatahandle.hh:103
static const bool wrap_buffer
Definition genericdatahandle.hh:77
bool contains(const GFS &gfs, int dim, int codim) const
Definition genericdatahandle.hh:91
E OriginalDataType
Definition genericdatahandle.hh:86
EntityDataCommunicationDescriptor(std::size_t count=1)
Definition genericdatahandle.hh:112
static constexpr bool transmitRank()
Definition genericdatahandle.hh:80
std::size_t size_type
size type to use if communicating leaf ordering sizes
Definition genericdatahandle.hh:73
bool fixedSize(const GFS &gfs, int dim, int codim) const
Definition genericdatahandle.hh:97
Implement a data handle with a grid function space.
Definition genericdatahandle.hh:132
CommunicationDescriptor::DataType DataType
Definition genericdatahandle.hh:136
bool contains(int dim, int codim) const
returns true if data for this codim should be communicated
Definition genericdatahandle.hh:151
GFS::Traits::SizeType size_type
Definition genericdatahandle.hh:137
std::enable_if< CommunicationDescriptor::wrap_buffer &&AlwaysTrue< Entity >::value >::type gather(MessageBuffer &buff, const Entity &e) const
pack data from user to message buffer - version with support for sending leaf ordering sizes
Definition genericdatahandle.hh:177
std::enable_if<!CommunicationDescriptor::wrap_buffer &&AlwaysTrue< Entity >::value >::type gather(MessageBuffer &buff, const Entity &e) const
pack data from user to message buffer - version without support for sending leaf ordering sizes
Definition genericdatahandle.hh:209
size_type size(const Entity &e) const
how many objects of type DataType have to be sent for a given entity
Definition genericdatahandle.hh:167
bool fixedSize(int dim, int codim) const
returns true if size per entity of given dim and codim is a constant
Definition genericdatahandle.hh:157
static const size_type leaf_count
Definition genericdatahandle.hh:139
std::enable_if<!CommunicationDescriptor::wrap_buffer &&AlwaysTrue< Entity >::value >::type scatter(MessageBuffer &buff, const Entity &e, size_type n)
unpack data from message buffer to user
Definition genericdatahandle.hh:284
std::enable_if< CommunicationDescriptor::wrap_buffer &&AlwaysTrue< Entity >::value >::type scatter(MessageBuffer &buff, const Entity &e, size_type n)
unpack data from message buffer to user
Definition genericdatahandle.hh:228
GFSDataHandle(const GFS &gfs, V &v, GatherScatter gather_scatter=GatherScatter(), CommunicationDescriptor communication_descriptor=CommunicationDescriptor())
Definition genericdatahandle.hh:141
Definition genericdatahandle.hh:313
bool scatter(MessageBuffer &buff, const Offsets &remote_offsets, const Offsets &local_offsets, const Entity &e, LocalView &local_view) const
Definition genericdatahandle.hh:356
bool scatter(MessageBuffer &buff, size_type n, const Entity &e, LocalView &local_view) const
Definition genericdatahandle.hh:329
bool gather(MessageBuffer &buff, const Entity &e, const LocalView &local_view) const
Definition genericdatahandle.hh:320
DataGatherScatter(GatherScatter gather_scatter=GatherScatter())
Definition genericdatahandle.hh:415
Definition genericdatahandle.hh:428
bool gather(MessageBuffer &buff, const Entity &e, const LocalView &local_view) const
Definition genericdatahandle.hh:435
bool scatter(MessageBuffer &buff, const Offsets &remote_offsets, const Offsets &local_offsets, const Entity &e, LocalView &local_view) const
Definition genericdatahandle.hh:471
bool scatter(MessageBuffer &buff, size_type n, const Entity &e, LocalView &local_view) const
Definition genericdatahandle.hh:444
DataEntityGatherScatter(GatherScatter gather_scatter=GatherScatter())
Definition genericdatahandle.hh:524
std::size_t size_type
Definition genericdatahandle.hh:432
Definition genericdatahandle.hh:537
bool scatter(MessageBuffer &buff, size_type n, const Entity &e, LocalView &local_view) const
Definition genericdatahandle.hh:553
DataContainerIndexGatherScatter(GatherScatter gather_scatter=GatherScatter())
Definition genericdatahandle.hh:635
bool scatter(MessageBuffer &buff, const Offsets &remote_offsets, const Offsets &local_offsets, const Entity &e, LocalView &local_view) const
Definition genericdatahandle.hh:581
bool gather(MessageBuffer &buff, const Entity &e, const LocalView &local_view) const
Definition genericdatahandle.hh:544
std::size_t size_type
Definition genericdatahandle.hh:541
Definition genericdatahandle.hh:647
void gather(MessageBuffer &buff, DataType &data) const
Definition genericdatahandle.hh:650
void scatter(MessageBuffer &buff, DataType &data) const
Definition genericdatahandle.hh:656
Definition genericdatahandle.hh:667
AddDataHandle(const GFS &gfs_, V &v_)
Definition genericdatahandle.hh:672
Definition genericdatahandle.hh:678
void scatter(MessageBuffer &buff, DataType &data) const
Definition genericdatahandle.hh:688
void gather(MessageBuffer &buff, DataType &data) const
Definition genericdatahandle.hh:681
Definition genericdatahandle.hh:699
AddClearDataHandle(const GFS &gfs_, V &v_)
Definition genericdatahandle.hh:704
Definition genericdatahandle.hh:710
void gather(MessageBuffer &buff, DataType &data) const
Definition genericdatahandle.hh:713
void scatter(MessageBuffer &buff, DataType &data) const
Definition genericdatahandle.hh:719
Definition genericdatahandle.hh:730
CopyDataHandle(const GFS &gfs_, V &v_)
Definition genericdatahandle.hh:735
Definition genericdatahandle.hh:741
void gather(MessageBuffer &buff, DataType &data) const
Definition genericdatahandle.hh:744
void scatter(MessageBuffer &buff, DataType &data) const
Definition genericdatahandle.hh:750
Definition genericdatahandle.hh:761
MinDataHandle(const GFS &gfs_, V &v_)
Definition genericdatahandle.hh:766
Definition genericdatahandle.hh:772
void scatter(MessageBuffer &buff, DataType &data) const
Definition genericdatahandle.hh:781
void gather(MessageBuffer &buff, DataType &data) const
Definition genericdatahandle.hh:775
Definition genericdatahandle.hh:792
MaxDataHandle(const GFS &gfs_, V &v_)
Definition genericdatahandle.hh:797
GatherScatter functor for marking ghost DOFs.
Definition genericdatahandle.hh:812
bool scatter(MessageBuffer &buff, std::size_t n, const Entity &e, LocalView &local_view) const
Definition genericdatahandle.hh:828
bool gather(MessageBuffer &buff, const Entity &e, LocalView &local_view) const
Definition genericdatahandle.hh:816
GhostDataHandle(const GFS &gfs_, V &v_, bool init_vector=true)
Creates a new GhostDataHandle.
Definition genericdatahandle.hh:883
GatherScatter functor for creating a disjoint DOF partitioning.
Definition genericdatahandle.hh:903
bool gather(MessageBuffer &buff, const Entity &e, LocalView &local_view) const
Definition genericdatahandle.hh:908
DisjointPartitioningGatherScatter(RankIndex rank)
Create a DisjointPartitioningGatherScatter object.
Definition genericdatahandle.hh:953
bool scatter(MessageBuffer &buff, std::size_t n, const Entity &e, LocalView &local_view) const
Definition genericdatahandle.hh:918
GatherScatter data handle for creating a disjoint DOF partitioning.
Definition genericdatahandle.hh:983
DisjointPartitioningDataHandle(const GFS &gfs_, V &v_, bool init_vector=true)
Creates a new DisjointPartitioningDataHandle.
Definition genericdatahandle.hh:1007
GatherScatter functor for marking shared DOFs.
Definition genericdatahandle.hh:1024
bool scatter(MessageBuffer &buff, std::size_t n, const Entity &e, LocalView &local_view) const
Definition genericdatahandle.hh:1034
bool gather(MessageBuffer &buff, const Entity &e, LocalView &local_view) const
Definition genericdatahandle.hh:1027
Data handle for marking shared DOFs.
Definition genericdatahandle.hh:1062
SharedDOFDataHandle(const GFS &gfs_, V &v_, bool init_vector=true)
Creates a new SharedDOFDataHandle.
Definition genericdatahandle.hh:1085
Data handle for collecting set of neighboring MPI ranks.
Definition genericdatahandle.hh:1105
GFS::Traits::SizeType size_type
Definition genericdatahandle.hh:1113
void scatter(MessageBuffer &buff, const Entity &e, size_type n)
Definition genericdatahandle.hh:1146
size_type size(Entity &e) const
Definition genericdatahandle.hh:1134
void gather(MessageBuffer &buff, const Entity &e) const
Definition genericdatahandle.hh:1140
bool fixedSize(int dim, int codim) const
Definition genericdatahandle.hh:1127
GFSNeighborDataHandle(const GFS &gfs, RankIndex rank, std::set< RankIndex > &neighbors)
Definition genericdatahandle.hh:1115
bool contains(int dim, int codim) const
Definition genericdatahandle.hh:1121
T begin(T... args)
T end(T... args)
T insert(T... args)
T max(T... args)
T min(T... args)
Legal Statements / Impressum | Hosted by TU Dresden & Uni Heidelberg | Generated by
1.9.8