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)
47 const Vertex& aggregate = aggregates_[index];
50 return isolatedMarker;
52 const Dune::IndexPair<GlobalIndex,LocalIndex >* pair = indexset_.pair(aggregate);
54 return pair->global();
61 const Vertex& aggregate = aggregates_[index];
63 const Dune::IndexPair<GlobalIndex,LocalIndex >* pair = indexset_.pair(aggregate);
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]);
97 aggregates_[i]=indexset_[global].local();
103 const GlobalLookupIndexSet<ParallelIndexSet>& indexset_;
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>
128 template<
typename T,
typename O,
typename I>
140 template<
class T1,
class T2>
141 class OwnerOverlapCopyCommunication;
157 template<
typename T,
typename O,
typename T1,
typename T2>
158 struct AggregatesPublisher<T,O,OwnerOverlapCopyCommunication<T1,T2> >
161 typedef O OverlapFlags;
162 typedef OwnerOverlapCopyCommunication<T1,T2> ParallelInformation;
163 typedef typename ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet;
164 typedef typename ParallelInformation::ParallelIndexSet IndexSet;
166 static void publish(AggregatesMap<Vertex>& aggregates,
167 ParallelInformation& pinfo,
168 const GlobalLookupIndexSet& globalLookup)
171 GlobalMap gmap(aggregates, globalLookup);
172 pinfo.copyOwnerToAll(gmap,gmap);
176 pinfo.copyCopyToAll(gmap,gmap);
178 typedef typename ParallelInformation::RemoteIndices::const_iterator Lists;
179 Lists lists = pinfo.remoteIndices().find(pinfo.communicator().rank());
180 if(lists!=pinfo.remoteIndices().end()) {
185 Vertex maxAggregate =0;
187 for(Iter i=aggregates.begin(), end=aggregates.end(); i!=end; ++i)
188 maxAggregate = std::max(maxAggregate, *i);
191 std::map<Vertex,Vertex> newMapping;
194 typedef typename ParallelInformation::RemoteIndices::RemoteIndexList
195 ::const_iterator RIter;
196 for(RIter ri=lists->second.first->begin(), rend = lists->second.first->end();
198 if(O::contains(ri->localIndexPair().local().attribute()))
199 newMapping.insert(std::make_pair(aggregates[ri->localIndexPair().local()],
202 typedef typename std::map<Vertex,Vertex>::iterator MIter;
203 for(MIter mi=newMapping.begin(), mend=newMapping.end();
205 mi->second=++maxAggregate;
208 for(RIter ri=lists->second.first->begin(), rend = lists->second.first->end();
210 if(O::contains(ri->localIndexPair().local().attribute()))
211 aggregates[ri->localIndexPair().local()] =
212 newMapping[aggregates[ri->localIndexPair().local()]];
218 template<
typename T,
typename O>
229 DUNE_UNUSED_PARAMETER(aggregates);
230 DUNE_UNUSED_PARAMETER(pinfo);
231 DUNE_UNUSED_PARAMETER(globalLookup);
239 template<
typename T,
typename TI>
240 struct CommPolicy<Amg::GlobalAggregatesMap<T,TI> >
242 typedef Amg::AggregatesMap<T> Type;
244 typedef SizeOne IndexedTypeFlag;
245 static int getSize(
const Type&,
int)