3 #ifndef DUNE_GLOBALAGGREGATES_HH 4 #define DUNE_GLOBALAGGREGATES_HH 18 #include <dune/common/parallel/indexset.hh> 19 #include <dune/common/unused.hh> 26 template<
typename T,
typename TI>
36 typedef typename ParallelIndexSet::LocalIndex
LocalIndex;
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;
52 const Dune::IndexPair<GlobalIndex,LocalIndex >* pair = indexset_.pair(aggregate);
54 return pair->global();
59 inline GlobalIndex&
get(std::size_t index)
61 const Vertex& aggregate = aggregates_[index];
63 const Dune::IndexPair<GlobalIndex,LocalIndex >* pair = indexset_.pair(aggregate);
65 return const_cast<GlobalIndex&
>(pair->global());
71 Proxy(
const GlobalLookupIndexSet<ParallelIndexSet>& indexset, Vertex& aggregate)
72 : indexset_(&indexset), aggregate_(&aggregate)
77 if(global==isolatedMarker)
81 *aggregate_ = indexset_->operator[](global).local();
86 const GlobalLookupIndexSet<ParallelIndexSet>* indexset_;
92 return Proxy(indexset_, aggregates_[index]);
95 inline void put(
const GlobalIndex& global,
size_t i)
97 aggregates_[i]=indexset_[global].local();
103 const GlobalLookupIndexSet<ParallelIndexSet>& indexset_;
104 static const GlobalIndex isolatedMarker;
107 template<
typename T,
typename TI>
109 std::numeric_limits<typename TI::GlobalIndex>::max();
111 template<
typename T,
typename TI>
128 template<
typename T,
typename O,
typename I>
140 template<
class T1,
class T2>
157 template<
typename T,
typename O,
typename T1,
typename T2>
167 ParallelInformation& pinfo,
168 const GlobalLookupIndexSet& globalLookup)
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>
227 ParallelInformation& pinfo,
228 const GlobalLookupIndexSet& globalLookup)
230 DUNE_UNUSED_PARAMETER(aggregates);
231 DUNE_UNUSED_PARAMETER(pinfo);
232 DUNE_UNUSED_PARAMETER(globalLookup);
240 template<
typename T,
typename TI>
Definition: globalaggregates.hh:27
Amg::GlobalAggregatesMap< T, TI >::IndexedType IndexedType
Definition: globalaggregates.hh:244
Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet
The type of the reverse lookup of indices.
Definition: owneroverlapcopy.hh:457
Definition: globalaggregates.hh:112
GlobalAggregatesMap(AggregatesMap< Vertex > &aggregates, const GlobalLookupIndexSet< ParallelIndexSet > &indexset)
Definition: globalaggregates.hh:40
T Vertex
Definition: globalaggregates.hh:222
O OverlapFlags
Definition: globalaggregates.hh:161
ParallelIndexSet::GlobalIndex GlobalIndex
Definition: globalaggregates.hh:115
SolverCategory::Category getSolverCategory() const
Get Solver Category.
Definition: owneroverlapcopy.hh:299
ParallelIndexSet::LocalIndex LocalIndex
Definition: globalaggregates.hh:36
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition: owneroverlapcopy.hh:315
TI ParallelIndexSet
Definition: globalaggregates.hh:114
void copyCopyToAll(const T &source, T &dest) const
Communicate values from copy data points to all other data points.
Definition: owneroverlapcopy.hh:332
static void scatter(GlobalAggregatesMap< T, TI > &ga, GlobalIndex global, size_t i)
Definition: globalaggregates.hh:122
ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet
Definition: globalaggregates.hh:163
static int getSize(const Type &, int)
Definition: globalaggregates.hh:246
static void publish(AggregatesMap< Vertex > &aggregates, ParallelInformation &pinfo, const GlobalLookupIndexSet &globalLookup)
Definition: globalaggregates.hh:166
ParallelIndexSet::GlobalIndex GlobalIndex
Definition: globalaggregates.hh:32
ParallelIndexSet::GlobalIndex IndexedType
Definition: globalaggregates.hh:34
Proxy operator[](std::size_t index)
Definition: globalaggregates.hh:90
Definition: basearray.hh:19
Proxy & operator=(const GlobalIndex &global)
Definition: globalaggregates.hh:75
int GlobalLookupIndexSet
Definition: pinfo.hh:56
Proxy(const GlobalLookupIndexSet< ParallelIndexSet > &indexset, Vertex &aggregate)
Definition: globalaggregates.hh:71
const CollectiveCommunication< MPI_Comm > & communicator() const
Definition: owneroverlapcopy.hh:303
T Vertex
Definition: globalaggregates.hh:160
ParallelInformation::ParallelIndexSet IndexSet
Definition: globalaggregates.hh:164
Definition: globalaggregates.hh:68
Provides classes for the Coloring process of AMG.
const_iterator end() const
Definition: aggregates.hh:717
void put(const GlobalIndex &global, size_t i)
Definition: globalaggregates.hh:95
ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet
Definition: globalaggregates.hh:224
static const GlobalIndex & gather(const GlobalAggregatesMap< T, TI > &ga, size_t i)
Definition: globalaggregates.hh:117
const_iterator begin() const
Definition: aggregates.hh:712
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition: owneroverlapcopy.hh:171
static void publish(AggregatesMap< Vertex > &aggregates, ParallelInformation &pinfo, const GlobalLookupIndexSet &globalLookup)
Definition: globalaggregates.hh:226
const GlobalIndex & operator[](std::size_t index) const
Definition: globalaggregates.hh:45
Definition: globalaggregates.hh:129
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet
The type of the parallel index set.
Definition: owneroverlapcopy.hh:450
TI ParallelIndexSet
Definition: globalaggregates.hh:30
T Vertex
Definition: globalaggregates.hh:38
OwnerOverlapCopyCommunication< T1, T2 > ParallelInformation
Definition: globalaggregates.hh:162
const RemoteIndices & remoteIndices() const
Get the underlying remote indices.
Definition: owneroverlapcopy.hh:472
SizeOne IndexedTypeFlag
Definition: globalaggregates.hh:245
SequentialInformation ParallelInformation
Definition: globalaggregates.hh:223
Category for non-overlapping solvers.
Definition: solvercategory.hh:23
Amg::AggregatesMap< T > Type
Definition: globalaggregates.hh:243