3#ifndef DUNE_GLOBALAGGREGATES_HH
4#define DUNE_GLOBALAGGREGATES_HH
18#include <dune/common/parallel/indexset.hh>
25 template<
typename T,
typename TI>
35 typedef typename ParallelIndexSet::LocalIndex
LocalIndex;
40 const GlobalLookupIndexSet<ParallelIndexSet>& indexset)
41 : aggregates_(aggregates), indexset_(indexset)
46 const Vertex& aggregate = aggregates_[index];
49 return isolatedMarker;
51 const Dune::IndexPair<GlobalIndex,LocalIndex >* pair = indexset_.pair(aggregate);
53 return pair->global();
60 const Vertex& aggregate = aggregates_[index];
62 const Dune::IndexPair<GlobalIndex,LocalIndex >* pair = indexset_.pair(aggregate);
70 Proxy(
const GlobalLookupIndexSet<ParallelIndexSet>& indexset,
Vertex& aggregate)
71 : indexset_(&indexset), aggregate_(&aggregate)
76 if(global==isolatedMarker)
80 *aggregate_ = indexset_->operator[](global).local();
85 const GlobalLookupIndexSet<ParallelIndexSet>* indexset_;
91 return Proxy(indexset_, aggregates_[index]);
96 aggregates_[i]=indexset_[global].local();
102 const GlobalLookupIndexSet<ParallelIndexSet>& indexset_;
106 template<
typename T,
typename TI>
107 const typename TI::GlobalIndex GlobalAggregatesMap<T,TI>::isolatedMarker =
108 std::numeric_limits<typename TI::GlobalIndex>::max();
110 template<
typename T,
typename TI>
127 template<
typename T,
typename O,
typename I>
139 template<
class T1,
class T2>
156 template<
typename T,
typename O,
typename T1,
typename T2>
170 GlobalMap gmap(aggregates, globalLookup);
177 typedef typename ParallelInformation::RemoteIndices::const_iterator Lists;
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>
234 template<
typename T,
typename TI>
235 struct CommPolicy<Amg::GlobalAggregatesMap<T,TI> >
Provides classes for the Coloring process of AMG.
ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet
Definition: globalaggregates.hh:162
const GlobalIndex & operator[](std::size_t index) const
Definition: globalaggregates.hh:44
O OverlapFlags
Definition: globalaggregates.hh:160
static int getSize(const Type &, int)
Definition: globalaggregates.hh:240
Amg::GlobalAggregatesMap< T, TI >::IndexedType IndexedType
Definition: globalaggregates.hh:238
GlobalIndex & get(std::size_t index)
Definition: globalaggregates.hh:58
T Vertex
Definition: globalaggregates.hh:159
static void publish(AggregatesMap< Vertex > &aggregates, ParallelInformation &pinfo, const GlobalLookupIndexSet &globalLookup)
Definition: globalaggregates.hh:224
SequentialInformation ParallelInformation
Definition: globalaggregates.hh:221
ParallelIndexSet::GlobalIndex GlobalIndex
Definition: globalaggregates.hh:31
ParallelInformation::ParallelIndexSet IndexSet
Definition: globalaggregates.hh:163
void put(const GlobalIndex &global, size_t i)
Definition: globalaggregates.hh:94
T Vertex
Definition: globalaggregates.hh:37
GlobalAggregatesMap(AggregatesMap< Vertex > &aggregates, const GlobalLookupIndexSet< ParallelIndexSet > &indexset)
Definition: globalaggregates.hh:39
TI ParallelIndexSet
Definition: globalaggregates.hh:29
Amg::AggregatesMap< T > Type
Definition: globalaggregates.hh:237
static void scatter(GlobalAggregatesMap< T, TI > &ga, GlobalIndex global, size_t i)
Definition: globalaggregates.hh:121
OwnerOverlapCopyCommunication< T1, T2 > ParallelInformation
Definition: globalaggregates.hh:161
const_iterator begin() const
Definition: aggregates.hh:723
SizeOne IndexedTypeFlag
Definition: globalaggregates.hh:239
Proxy(const GlobalLookupIndexSet< ParallelIndexSet > &indexset, Vertex &aggregate)
Definition: globalaggregates.hh:70
const_iterator end() const
Definition: aggregates.hh:728
static void publish(AggregatesMap< Vertex > &aggregates, ParallelInformation &pinfo, const GlobalLookupIndexSet &globalLookup)
Definition: globalaggregates.hh:165
ParallelIndexSet::GlobalIndex GlobalIndex
Definition: globalaggregates.hh:114
ParallelIndexSet::LocalIndex LocalIndex
Definition: globalaggregates.hh:35
TI ParallelIndexSet
Definition: globalaggregates.hh:113
T Vertex
Definition: globalaggregates.hh:220
ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet
Definition: globalaggregates.hh:222
static const GlobalIndex & gather(const GlobalAggregatesMap< T, TI > &ga, size_t i)
Definition: globalaggregates.hh:116
Proxy & operator=(const GlobalIndex &global)
Definition: globalaggregates.hh:74
ParallelIndexSet::GlobalIndex IndexedType
Definition: globalaggregates.hh:33
Proxy operator[](std::size_t index)
Definition: globalaggregates.hh:89
Definition: allocator.hh:9
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
Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet
The type of the reverse lookup of indices.
Definition: owneroverlapcopy.hh:454
const CollectiveCommunication< MPI_Comm > & communicator() const
Definition: owneroverlapcopy.hh:297
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
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet
The type of the parallel index set.
Definition: owneroverlapcopy.hh:447
Definition: globalaggregates.hh:27
Definition: globalaggregates.hh:68
Definition: globalaggregates.hh:112
Definition: globalaggregates.hh:129
int GlobalLookupIndexSet
Definition: pinfo.hh:52
@ 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