5#ifndef DUNE_GLOBALAGGREGATES_HH
6#define DUNE_GLOBALAGGREGATES_HH
20#include <dune/common/parallel/indexset.hh>
27 template<
typename T,
typename TI>
37 typedef typename ParallelIndexSet::LocalIndex
LocalIndex;
42 const GlobalLookupIndexSet<ParallelIndexSet>& indexset)
43 : aggregates_(aggregates), indexset_(indexset)
48 const Vertex& aggregate = aggregates_[index];
51 return isolatedMarker;
53 const Dune::IndexPair<GlobalIndex,LocalIndex >* pair = indexset_.pair(aggregate);
55 return pair->global();
62 const Vertex& aggregate = aggregates_[index];
64 const Dune::IndexPair<GlobalIndex,LocalIndex >* pair = indexset_.pair(aggregate);
72 Proxy(
const GlobalLookupIndexSet<ParallelIndexSet>& indexset,
Vertex& aggregate)
73 : indexset_(&indexset), aggregate_(&aggregate)
78 if(global==isolatedMarker)
82 *aggregate_ = indexset_->operator[](global).local();
87 const GlobalLookupIndexSet<ParallelIndexSet>* indexset_;
93 return Proxy(indexset_, aggregates_[index]);
98 aggregates_[i]=indexset_[global].local();
104 const GlobalLookupIndexSet<ParallelIndexSet>& indexset_;
108 template<
typename T,
typename TI>
109 const typename TI::GlobalIndex GlobalAggregatesMap<T,TI>::isolatedMarker =
110 std::numeric_limits<typename TI::GlobalIndex>::max();
112 template<
typename T,
typename TI>
129 template<
typename T,
typename O,
typename I>
141 template<
class T1,
class T2>
158 template<
typename T,
typename O,
typename T1,
typename T2>
172 GlobalMap gmap(aggregates, globalLookup);
179 typedef typename ParallelInformation::RemoteIndices::const_iterator Lists;
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>
236 template<
typename T,
typename TI>
237 struct CommPolicy<Amg::GlobalAggregatesMap<T,TI> >
Provides classes for the Coloring process of AMG.
ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet
Definition: globalaggregates.hh:164
const GlobalIndex & operator[](std::size_t index) const
Definition: globalaggregates.hh:46
O OverlapFlags
Definition: globalaggregates.hh:162
static int getSize(const Type &, int)
Definition: globalaggregates.hh:242
Amg::GlobalAggregatesMap< T, TI >::IndexedType IndexedType
Definition: globalaggregates.hh:240
GlobalIndex & get(std::size_t index)
Definition: globalaggregates.hh:60
T Vertex
Definition: globalaggregates.hh:161
static void publish(AggregatesMap< Vertex > &aggregates, ParallelInformation &pinfo, const GlobalLookupIndexSet &globalLookup)
Definition: globalaggregates.hh:226
SequentialInformation ParallelInformation
Definition: globalaggregates.hh:223
ParallelIndexSet::GlobalIndex GlobalIndex
Definition: globalaggregates.hh:33
ParallelInformation::ParallelIndexSet IndexSet
Definition: globalaggregates.hh:165
void put(const GlobalIndex &global, size_t i)
Definition: globalaggregates.hh:96
T Vertex
Definition: globalaggregates.hh:39
GlobalAggregatesMap(AggregatesMap< Vertex > &aggregates, const GlobalLookupIndexSet< ParallelIndexSet > &indexset)
Definition: globalaggregates.hh:41
TI ParallelIndexSet
Definition: globalaggregates.hh:31
Amg::AggregatesMap< T > Type
Definition: globalaggregates.hh:239
static void scatter(GlobalAggregatesMap< T, TI > &ga, GlobalIndex global, size_t i)
Definition: globalaggregates.hh:123
OwnerOverlapCopyCommunication< T1, T2 > ParallelInformation
Definition: globalaggregates.hh:163
const_iterator begin() const
Definition: aggregates.hh:725
SizeOne IndexedTypeFlag
Definition: globalaggregates.hh:241
Proxy(const GlobalLookupIndexSet< ParallelIndexSet > &indexset, Vertex &aggregate)
Definition: globalaggregates.hh:72
const_iterator end() const
Definition: aggregates.hh:730
static void publish(AggregatesMap< Vertex > &aggregates, ParallelInformation &pinfo, const GlobalLookupIndexSet &globalLookup)
Definition: globalaggregates.hh:167
ParallelIndexSet::GlobalIndex GlobalIndex
Definition: globalaggregates.hh:116
ParallelIndexSet::LocalIndex LocalIndex
Definition: globalaggregates.hh:37
TI ParallelIndexSet
Definition: globalaggregates.hh:115
T Vertex
Definition: globalaggregates.hh:222
ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet
Definition: globalaggregates.hh:224
static const GlobalIndex & gather(const GlobalAggregatesMap< T, TI > &ga, size_t i)
Definition: globalaggregates.hh:118
Proxy & operator=(const GlobalIndex &global)
Definition: globalaggregates.hh:76
ParallelIndexSet::GlobalIndex IndexedType
Definition: globalaggregates.hh:35
Proxy operator[](std::size_t index)
Definition: globalaggregates.hh:91
Definition: allocator.hh:11
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition: owneroverlapcopy.hh:174
void copyCopyToAll(const T &source, T &dest) const
Communicate values from copy data points to all other data points.
Definition: owneroverlapcopy.hh:328
Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet
The type of the reverse lookup of indices.
Definition: owneroverlapcopy.hh:456
const Communication< MPI_Comm > & communicator() const
Definition: owneroverlapcopy.hh:299
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition: owneroverlapcopy.hh:311
const RemoteIndices & remoteIndices() const
Get the underlying remote indices.
Definition: owneroverlapcopy.hh:471
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet
The type of the parallel index set.
Definition: owneroverlapcopy.hh:449
Definition: globalaggregates.hh:29
Definition: globalaggregates.hh:70
Definition: globalaggregates.hh:114
Definition: globalaggregates.hh:131
int GlobalLookupIndexSet
Definition: pinfo.hh:54
@ nonoverlapping
Category for non-overlapping solvers.
Definition: solvercategory.hh:27
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:34