3#ifndef DUNE_GLOBALAGGREGATES_HH
4#define DUNE_GLOBALAGGREGATES_HH
25 template<
typename T,
typename TI>
26 struct GlobalAggregatesMap
29 typedef TI ParallelIndexSet;
39 GlobalAggregatesMap(AggregatesMap<Vertex>& aggregates,
40 const GlobalLookupIndexSet<ParallelIndexSet>& indexset)
41 : aggregates_(aggregates), indexset_(indexset)
44 inline const GlobalIndex& operator[](std::size_t index)
const
46 const Vertex& aggregate = aggregates_[index];
49 return isolatedMarker;
58 inline GlobalIndex& get(std::size_t index)
60 const Vertex& aggregate = aggregates_[index];
64 return const_cast<GlobalIndex&
>(pair->
global());
70 Proxy(
const GlobalLookupIndexSet<ParallelIndexSet>& indexset, Vertex& aggregate)
71 : indexset_(&indexset), aggregate_(&aggregate)
74 Proxy& operator=(
const GlobalIndex& global)
76 if(global==isolatedMarker)
80 *aggregate_ = indexset_->operator[](global).local();
85 const GlobalLookupIndexSet<ParallelIndexSet>* indexset_;
89 inline Proxy operator[](std::size_t index)
91 return Proxy(indexset_, aggregates_[index]);
94 inline void put(
const GlobalIndex& global,
size_t i)
96 aggregates_[i]=indexset_[global].local();
101 AggregatesMap<Vertex>& aggregates_;
102 const GlobalLookupIndexSet<ParallelIndexSet>& indexset_;
103 static const GlobalIndex isolatedMarker;
106 template<
typename T,
typename TI>
107 const typename TI::GlobalIndex GlobalAggregatesMap<T,TI>::isolatedMarker =
110 template<
typename T,
typename TI>
111 struct AggregatesGatherScatter
113 typedef TI ParallelIndexSet;
116 static const GlobalIndex& gather(
const GlobalAggregatesMap<T,TI>& ga,
size_t i)
121 static void scatter(GlobalAggregatesMap<T,TI>& ga, GlobalIndex global,
size_t i)
127 template<
typename T,
typename O,
typename I>
128 struct AggregatesPublisher
139 template<
class T1,
class T2>
140 class OwnerOverlapCopyCommunication;
156 template<
typename T,
typename O,
typename T1,
typename T2>
160 typedef O OverlapFlags;
169 typedef Dune::Amg::GlobalAggregatesMap<Vertex,IndexSet> GlobalMap;
170 GlobalMap gmap(aggregates, globalLookup);
177 typedef typename ParallelInformation::RemoteIndices::const_iterator Lists;
184 Vertex maxAggregate =0;
186 for(Iter i=aggregates.begin(), end=aggregates.end(); i!=end; ++i)
187 maxAggregate =
std::max(maxAggregate, *i);
190 std::map<Vertex,Vertex> newMapping;
193 typedef typename ParallelInformation::RemoteIndices::RemoteIndexList
194 ::const_iterator RIter;
195 for(RIter ri=lists->second.first->begin(), rend = lists->second.first->end();
197 if(O::contains(ri->localIndexPair().local().attribute()))
198 newMapping.insert(std::make_pair(aggregates[ri->localIndexPair().local()],
201 typedef typename std::map<Vertex,Vertex>::iterator MIter;
202 for(MIter mi=newMapping.begin(), mend=newMapping.end();
204 mi->second=++maxAggregate;
207 for(RIter ri=lists->second.first->begin(), rend = lists->second.first->end();
209 if(O::contains(ri->localIndexPair().local().attribute()))
210 aggregates[ri->localIndexPair().local()] =
211 newMapping[aggregates[ri->localIndexPair().local()]];
217 template<
typename T,
typename O>
218 struct AggregatesPublisher<T,O,SequentialInformation>
221 typedef SequentialInformation ParallelInformation;
225 [[maybe_unused]] ParallelInformation& pinfo,
234 template<
typename T,
typename TI>
235 struct CommPolicy<Amg::GlobalAggregatesMap<T,TI> >
237 typedef Amg::AggregatesMap<T>
Type;
238 typedef typename Amg::GlobalAggregatesMap<T,TI>::IndexedType
IndexedType;
Provides classes for the Coloring process of AMG.
A pair consisting of a global and local index.
Definition: indexset.hh:83
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition: owneroverlapcopy.hh:172
void copyCopyToAll(const T &source, T &dest) const
Communicate values from copy data points to all other data points.
Definition: owneroverlapcopy.hh:326
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition: owneroverlapcopy.hh:309
const RemoteIndices & remoteIndices() const
Get the underlying remote indices.
Definition: owneroverlapcopy.hh:469
const_iterator end() const
Get an iterator over all remote index lists.
Definition: remoteindices.hh:1529
const_iterator find(int proc) const
Find an iterator over the remote index lists of a specific process.
Definition: remoteindices.hh:1515
TL LocalIndex
The type of the local index, e.g. ParallelLocalIndex.
Definition: indexset.hh:237
const GlobalIndex & global() const
Get the global index.
TG GlobalIndex
the type of the global index. This type has to provide at least a operator< for sorting.
Definition: indexset.hh:224
static const Vertex ISOLATED
Identifier of isolated vertices.
Definition: aggregates.hh:569
static const Vertex UNAGGREGATED
Identifier of not yet aggregated vertices.
Definition: aggregates.hh:564
auto max(ADLTag< 0 >, const V &v1, const V &v2)
implements binary Simd::max()
Definition: defaults.hh:79
Provides a map between global and local indices.
Dune namespace.
Definition: alignedallocator.hh:11
V::value_type IndexedType
The type we get at each index with operator[].
Definition: communicator.hh:145
static int getSize(const V &, int index)
Get the number of primitve elements at that index.
SizeOne IndexedTypeFlag
Whether the indexed type has variable size or there is always one value at each index.
Definition: communicator.hh:151
V Type
The type the policy is for.
Definition: communicator.hh:138
@ nonoverlapping
Category for non-overlapping solvers.
Definition: solvercategory.hh:25
static Category category(const OP &op, decltype(op.category()) *=nullptr)
Helperfunction to extract the solver category either from an enum, or from the newly introduced virtu...
Definition: solvercategory.hh:32