3#ifndef DUNE_GLOBALAGGREGATES_HH
4#define DUNE_GLOBALAGGREGATES_HH
26 template<
typename T,
typename TI>
27 struct GlobalAggregatesMap
30 typedef TI ParallelIndexSet;
40 GlobalAggregatesMap(AggregatesMap<Vertex>& aggregates,
41 const GlobalLookupIndexSet<ParallelIndexSet>& indexset)
42 : aggregates_(aggregates), indexset_(indexset)
45 inline const GlobalIndex& operator[](std::size_t index)
const
47 const Vertex& aggregate = aggregates_[index];
50 return isolatedMarker;
59 inline GlobalIndex& get(std::size_t index)
61 const Vertex& aggregate = aggregates_[index];
65 return const_cast<GlobalIndex&
>(pair->
global());
71 Proxy(
const GlobalLookupIndexSet<ParallelIndexSet>& indexset, Vertex& aggregate)
72 : indexset_(&indexset), aggregate_(&aggregate)
75 Proxy& operator=(
const GlobalIndex& global)
77 if(global==isolatedMarker)
81 *aggregate_ = indexset_->operator[](global).local();
86 const GlobalLookupIndexSet<ParallelIndexSet>* indexset_;
90 inline Proxy operator[](std::size_t index)
92 return Proxy(indexset_, aggregates_[index]);
95 inline void put(
const GlobalIndex& global,
size_t i)
97 aggregates_[i]=indexset_[global].local();
102 AggregatesMap<Vertex>& aggregates_;
103 const GlobalLookupIndexSet<ParallelIndexSet>& indexset_;
104 static const GlobalIndex isolatedMarker;
107 template<
typename T,
typename TI>
108 const typename TI::GlobalIndex GlobalAggregatesMap<T,TI>::isolatedMarker =
109 std::numeric_limits<typename TI::GlobalIndex>::max();
111 template<
typename T,
typename TI>
112 struct AggregatesGatherScatter
114 typedef TI ParallelIndexSet;
117 static const GlobalIndex& gather(
const GlobalAggregatesMap<T,TI>& ga,
size_t i)
122 static void scatter(GlobalAggregatesMap<T,TI>& ga, GlobalIndex global,
size_t i)
128 template<
typename T,
typename O,
typename I>
129 struct AggregatesPublisher
140 template<
class T1,
class T2>
141 class OwnerOverlapCopyCommunication;
157 template<
typename T,
typename O,
typename T1,
typename T2>
161 typedef O OverlapFlags;
170 typedef Dune::Amg::GlobalAggregatesMap<Vertex,IndexSet> GlobalMap;
171 GlobalMap gmap(aggregates, globalLookup);
179 typedef typename ParallelInformation::RemoteIndices::const_iterator Lists;
186 Vertex maxAggregate =0;
188 for(Iter i=aggregates.begin(), end=aggregates.end(); i!=end; ++i)
189 maxAggregate = std::max(maxAggregate, *i);
192 std::map<Vertex,Vertex> newMapping;
195 typedef typename ParallelInformation::RemoteIndices::RemoteIndexList
196 ::const_iterator RIter;
197 for(RIter ri=lists->second.first->begin(), rend = lists->second.first->end();
199 if(O::contains(ri->localIndexPair().local().attribute()))
200 newMapping.insert(std::make_pair(aggregates[ri->localIndexPair().local()],
203 typedef typename std::map<Vertex,Vertex>::iterator MIter;
204 for(MIter mi=newMapping.begin(), mend=newMapping.end();
206 mi->second=++maxAggregate;
209 for(RIter ri=lists->second.first->begin(), rend = lists->second.first->end();
211 if(O::contains(ri->localIndexPair().local().attribute()))
212 aggregates[ri->localIndexPair().local()] =
213 newMapping[aggregates[ri->localIndexPair().local()]];
219 template<
typename T,
typename O>
220 struct AggregatesPublisher<T,O,SequentialInformation>
223 typedef SequentialInformation ParallelInformation;
227 ParallelInformation& pinfo,
240 template<
typename T,
typename TI>
241 struct CommPolicy<Amg::GlobalAggregatesMap<T,TI> >
243 typedef Amg::AggregatesMap<T>
Type;
244 typedef typename Amg::GlobalAggregatesMap<T,TI>::IndexedType
IndexedType;
Provides classes for the Coloring process of AMG.
int rank() const
Return rank, is between 0 and size()-1.
Definition: mpicollectivecommunication.hh:162
A pair consisting of a global and local index.
Definition: indexset.hh:85
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition: owneroverlapcopy.hh:173
const SolverCategory::Category getSolverCategory() const
Set Solver Category.
Definition: owneroverlapcopy.hh:302
void copyCopyToAll(const T &source, T &dest) const
Communicate values from copy data points to all other data points.
Definition: owneroverlapcopy.hh:335
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition: owneroverlapcopy.hh:318
const RemoteIndices & remoteIndices() const
Get the underlying remote indices.
Definition: owneroverlapcopy.hh:475
const_iterator end() const
Get an iterator over all remote index lists.
Definition: remoteindices.hh:1525
const_iterator find(int proc) const
Find an iterator over the remote index lists of a specific process.
Definition: remoteindices.hh:1511
TL LocalIndex
The type of the local index, e.g. ParallelLocalIndex.
Definition: indexset.hh:239
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:226
static const Vertex ISOLATED
Identifier of isolated vertices.
Definition: aggregates.hh:509
static const Vertex UNAGGREGATED
Identifier of not yet aggregated vertices.
Definition: aggregates.hh:504
Provides a map between global and local indices.
Dune namespace.
Definition: alignment.hh:14
V::value_type IndexedType
The type we get at each index with operator[].
Definition: communicator.hh:140
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:146
V Type
The type the policy is for.
Definition: communicator.hh:133
@ nonoverlapping
Category for on overlapping solvers.
Definition: solvercategory.hh:24
Definition of the DUNE_UNUSED macro for the case that config.h is not available.
#define DUNE_UNUSED_PARAMETER(parm)
A macro to mark intentional unused function parameters with.
Definition: unused.hh:18