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
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;
118 const IndexPair*
pair= lookup_.pair(
edge.target());
141 isPublic_ = isPublic_ || b;
146 globalIndex_ = std::numeric_limits<GlobalIndex>::max();
173 const GlobalLookupIndexSet& lookup_;
177 template<
typename Graph,
typename VM,
typename I>
185 template<
typename Graph,
typename I>
197 template<
typename G,
typename L,
typename E>
215 template<
typename Graph,
typename VM>
216 static typename Graph::VertexDescriptor
226 template<
typename T,
typename E>
227 template<
typename Graph,
typename VM>
228 inline typename Graph::VertexDescriptor
246 template<
typename T,
typename E>
247 template<
typename Graph,
typename VM,
typename I>
257 typedef typename Graph::ConstVertexIterator Iterator;
258 typedef typename ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet;
261 const GlobalLookupIndexSet&
lookup = pinfo.globalLookup();
268 for(Iterator index =
fineGraph.begin(); index != end; ++index) {
274 if(!
get(visitedMap, *index)) {
276 typedef typename GlobalLookupIndexSet::IndexPair IndexPair;
284 assert(!ExcludedAttributes::contains(
pair->local().attribute()));
294 typedef typename GlobalLookupIndexSet::IndexPair::GlobalIndex GlobalIndex;
296 if(
renumberer.globalIndex()!=std::numeric_limits<GlobalIndex>::max()) {
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
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
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:554
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
const GlobalIndex & globalIndex() const
Definition indicescoarsener.hh:160
Definition basearray.hh:19
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
Statistics about compression achieved in implicit mode.
Definition bcrsmatrix.hh:81
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:173
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:543
Definition indicescoarsener.hh:35
Definition indicescoarsener.hh:42
Definition renumberer.hh:14
void operator++()
Definition renumberer.hh:55
void operator()(const typename G::ConstEdgeIterator &edge)
Definition renumberer.hh:49
Vertex number_
Definition renumberer.hh:33