3 #ifndef DUNE_AMG_INDICESCOARSENER_HH 4 #define DUNE_AMG_INDICESCOARSENER_HH 6 #include <dune/common/parallel/indicessyncer.hh> 7 #include <dune/common/unused.hh> 33 template<
typename T,
typename E>
40 template<
typename T,
typename E>
64 typedef typename ParallelIndexSet::LocalIndex
LocalIndex;
87 template<
typename Graph,
typename VM>
88 static typename Graph::VertexDescriptor
89 coarsen(ParallelInformation& fineInfo,
93 ParallelInformation& coarseInfo,
94 typename Graph::VertexDescriptor noAggregates);
97 template<
typename G,
typename I>
100 typedef typename G::VertexDescriptor Vertex;
102 typedef I GlobalLookupIndexSet;
104 typedef typename GlobalLookupIndexSet::IndexPair IndexPair;
106 typedef typename IndexPair::GlobalIndex GlobalIndex;
111 globalIndex_(
std::numeric_limits<GlobalIndex>::max())
118 const IndexPair* pair= lookup_.pair(edge.target());
120 globalIndex(pair->global());
121 attribute(pair->local().attribute());
122 isPublic(pair->local().isPublic());
128 DUNE_UNUSED_PARAMETER(global);
129 Vertex current = this->number_;
141 isPublic_ = isPublic_ || b;
146 globalIndex_ = std::numeric_limits<GlobalIndex>::max();
152 attribute_=attribute;
167 globalIndex_ = global;
172 Attribute attribute_;
173 const GlobalLookupIndexSet& lookup_;
174 GlobalIndex globalIndex_;
177 template<
typename Graph,
typename VM,
typename I>
178 static void buildCoarseIndexSet(
const ParallelInformation& pinfo,
182 ParallelIndexSet& coarseIndices,
183 ParallelAggregateRenumberer<Graph,I>& renumberer);
185 template<
typename Graph,
typename I>
186 static void buildCoarseRemoteIndices(
const RemoteIndices& fineRemote,
188 ParallelIndexSet& coarseIndices,
189 RemoteIndices& coarseRemote,
190 ParallelAggregateRenumberer<Graph,I>& renumberer);
197 template<
typename G,
typename L,
typename E>
215 template<
typename Graph,
typename VM>
216 static typename Graph::VertexDescriptor
222 typename Graph::VertexDescriptor noAggregates);
226 template<
typename T,
typename E>
227 template<
typename Graph,
typename VM>
228 inline typename Graph::VertexDescriptor
234 typename Graph::VertexDescriptor noAggregates)
236 DUNE_UNUSED_PARAMETER(noAggregates);
237 ParallelAggregateRenumberer<Graph,typename ParallelInformation::GlobalLookupIndexSet> renumberer(aggregates, fineInfo.
globalLookup());
238 buildCoarseIndexSet(fineInfo, fineGraph, visitedMap, aggregates,
246 template<
typename T,
typename E>
247 template<
typename Graph,
typename VM,
typename I>
253 ParallelAggregateRenumberer<Graph,I>& renumberer)
257 typedef typename Graph::ConstVertexIterator Iterator;
260 Iterator end = fineGraph.end();
261 const GlobalLookupIndexSet& lookup = pinfo.
globalLookup();
263 coarseIndices.beginResize();
268 for(Iterator index = fineGraph.begin(); index != end; ++index) {
274 if(!
get(visitedMap, *index)) {
276 typedef typename GlobalLookupIndexSet::IndexPair IndexPair;
277 const IndexPair* pair= lookup.pair(*index);
284 assert(!ExcludedAttributes::contains(pair->local().attribute()));
285 renumberer.attribute(pair->local().attribute());
286 renumberer.isPublic(pair->local().isPublic());
287 renumberer.globalIndex(pair->global());
291 aggregates.template breadthFirstSearch<false>(*index, aggregates[*index],
292 fineGraph, renumberer, visitedMap);
294 typedef typename GlobalLookupIndexSet::IndexPair::GlobalIndex
GlobalIndex;
296 if(renumberer.globalIndex()!=std::numeric_limits<GlobalIndex>::max()) {
299 coarseIndices.add(renumberer.globalIndex(),
300 LocalIndex(renumberer, renumberer.attribute(),
301 renumberer.isPublic()));
304 aggregates[*index] = renumberer;
309 coarseIndices.endResize();
311 assert(static_cast<std::size_t>(renumberer) >= coarseIndices.size());
314 for(Iterator vertex=fineGraph.begin(); vertex != end; ++vertex)
315 put(visitedMap, *vertex,
false);
318 template<
typename T,
typename E>
319 template<
typename Graph,
typename I>