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
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;
173 const GlobalLookupIndexSet& lookup_;
177 template<
typename Graph,
typename VM,
typename I>
183 ParallelAggregateRenumberer<Graph,I>& renumberer);
185 template<
typename Graph,
typename I>
186 static void buildCoarseRemoteIndices(
const RemoteIndices& fineRemote,
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,
239 coarseInfo.indexSet(), renumberer);
240 buildCoarseRemoteIndices(fineInfo.remoteIndices(), aggregates, coarseInfo.indexSet(),
241 coarseInfo.remoteIndices(), renumberer);
246 template<
typename T,
typename E>
247 template<
typename Graph,
typename VM,
typename I>
252 ParallelIndexSet& coarseIndices,
253 ParallelAggregateRenumberer<Graph,I>& renumberer)
257 typedef typename Graph::ConstVertexIterator Iterator;
258 typedef typename ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet;
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>
320 void ParallelIndicesCoarsener<T,E>::buildCoarseRemoteIndices(
const RemoteIndices& fineRemote,
321 const AggregatesMap<typename Graph::VertexDescriptor>& aggregates,
322 ParallelIndexSet& coarseIndices,
323 RemoteIndices& coarseRemote,
324 ParallelAggregateRenumberer<Graph,I>& renumberer)
326 std::vector<char> attributes(
static_cast<std::size_t
>(renumberer));
328 GlobalLookupIndexSet<ParallelIndexSet> coarseLookup(coarseIndices,
static_cast<std::size_t
>(renumberer));
330 typedef typename RemoteIndices::const_iterator Iterator;
331 Iterator end = fineRemote.end();
333 for(Iterator neighbour = fineRemote.begin();
334 neighbour != end; ++neighbour) {
335 int process = neighbour->first;
337 assert(neighbour->second.first==neighbour->second.second);
340 typedef typename std::vector<char>::iterator CIterator;
342 for(CIterator iter=attributes.begin(); iter!= attributes.end(); ++iter)
343 *iter = std::numeric_limits<char>::max();
345 typedef typename RemoteIndices::RemoteIndexList::const_iterator Iterator;
346 Iterator riEnd = neighbour->second.second->end();
348 for(Iterator index = neighbour->second.second->begin();
349 index != riEnd; ++index) {
350 if(!E::contains(index->localIndexPair().local().attribute()) &&
351 aggregates[index->localIndexPair().local()] !=
354 assert(aggregates[index->localIndexPair().local()]<attributes.size());
355 if (attributes[aggregates[index->localIndexPair().local()]] != 3)
356 attributes[aggregates[index->localIndexPair().local()]] = index->attribute();
361 typedef RemoteIndexListModifier<ParallelIndexSet,typename RemoteIndices::Allocator,false> Modifier;
362 typedef typename RemoteIndices::RemoteIndex RemoteIndex;
363 typedef typename ParallelIndexSet::const_iterator IndexIterator;
365 Modifier coarseList = coarseRemote.template getModifier<false,true>(process);
367 IndexIterator iend = coarseIndices.end();
368 for(IndexIterator index = coarseIndices.begin(); index != iend; ++index)
369 if(attributes[index->local()] != std::numeric_limits<char>::max()) {
371 coarseList.insert(RemoteIndex(Attribute(attributes[index->local()]), &(*index)));
377 assert(coarseRemote.neighbours()==fineRemote.neighbours());
381 IndicesSyncer<ParallelIndexSet> syncer(coarseIndices, coarseRemote);
382 syncer.sync(renumberer);
389 template<
typename Graph,
typename VM>
390 typename Graph::VertexDescriptor
396 typename Graph::VertexDescriptor noAggregates)
398 DUNE_UNUSED_PARAMETER(fineInfo);
399 DUNE_UNUSED_PARAMETER(fineGraph);
400 DUNE_UNUSED_PARAMETER(visitedMap);
401 DUNE_UNUSED_PARAMETER(aggregates);
402 DUNE_UNUSED_PARAMETER(coarseInfo);
403 DUNE_UNUSED_PARAMETER(noAggregates);
Classes providing communication interfaces for overlapping Schwarz methods.
void reset()
Definition: indicescoarsener.hh:144
LocalIndex::Attribute Attribute
The type of the attribute.
Definition: indicescoarsener.hh:69
void operator()(const typename G::ConstEdgeIterator &edge)
Definition: indicescoarsener.hh:115
void isPublic(bool b)
Definition: indicescoarsener.hh:139
ParallelInformation::ParallelIndexSet ParallelIndexSet
Definition: indicescoarsener.hh:54
bool isPublic()
Definition: indicescoarsener.hh:134
const GlobalIndex & globalIndex() const
Definition: indicescoarsener.hh:160
ParallelIndexSet::LocalIndex LocalIndex
The type of the local index.
Definition: indicescoarsener.hh:64
T ParallelInformation
The type of the parallel information.
Definition: indicescoarsener.hh:52
Attribute attribute()
Definition: indicescoarsener.hh:155
Vertex operator()(const GlobalIndex &global)
Definition: indicescoarsener.hh:126
static Graph::VertexDescriptor coarsen(ParallelInformation &fineInfo, Graph &fineGraph, VM &visitedMap, AggregatesMap< typename Graph::VertexDescriptor > &aggregates, ParallelInformation &coarseInfo, typename Graph::VertexDescriptor noAggregates)
Build the coarse index set after the aggregatio.
Definition: indicescoarsener.hh:229
static const V ISOLATED
Identifier of isolated vertices.
Definition: aggregates.hh:567
ParallelIndexSet::GlobalIndex GlobalIndex
The type of the global index.
Definition: indicescoarsener.hh:59
void attribute(const Attribute &attribute)
Definition: indicescoarsener.hh:150
E ExcludedAttributes
The set of excluded attributes.
Definition: indicescoarsener.hh:47
void globalIndex(const GlobalIndex &global)
Definition: indicescoarsener.hh:165
Dune::RemoteIndices< ParallelIndexSet > RemoteIndices
The type of the remote indices.
Definition: indicescoarsener.hh:74
ParallelAggregateRenumberer(AggregatesMap< Vertex > &aggregates, const I &lookup)
Definition: indicescoarsener.hh:109
Definition: allocator.hh:7
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition: dependency.hh:292
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition: owneroverlapcopy.hh:172
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet
The type of the parallel index set.
Definition: owneroverlapcopy.hh:459
Class providing information about the mapping of the vertices onto aggregates.
Definition: aggregates.hh:556
Definition: indicescoarsener.hh:35
Definition: indicescoarsener.hh:42
Definition: renumberer.hh:14
void operator()(const typename G::ConstEdgeIterator &edge)
Definition: renumberer.hh:49