Dune Core Modules (2.4.1)

renumberer.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_AMG_RENUMBERER_HH
4#define DUNE_AMG_RENUMBERER_HH
5
6#include "aggregates.hh"
7
8namespace Dune
9{
10 namespace Amg
11 {
12 template<class G>
13 class AggregateRenumberer
14 {
15 public:
17 typedef typename G::VertexDescriptor Vertex;
18
23 AggregateRenumberer(AggregatesMap<Vertex>& aggregates);
24
26 operator Vertex() const;
27
28 void operator()(const typename G::ConstEdgeIterator& edge);
29
30 void operator++();
31
32 protected:
33 Vertex number_;
34 AggregatesMap<Vertex>& aggregates_;
35 };
36
37 template<class G>
38 AggregateRenumberer<G>::AggregateRenumberer(AggregatesMap<Vertex>& aggregates)
39 : number_(0), aggregates_(aggregates)
40 {}
41
42 template<class G>
43 AggregateRenumberer<G>::operator Vertex() const
44 {
45 return number_;
46 }
47
48 template<class G>
49 void AggregateRenumberer<G>::operator()(const typename G::ConstEdgeIterator& edge)
50 {
51 aggregates_[edge.target()]=number_;
52 }
53
54 template<class G>
55 void AggregateRenumberer<G>::operator++()
56 {
57 ++number_;
58 }
59
60 template<class G, class I, class V>
61 void renumberAggregates(const G& graph, I index, I endIndex, V& visitedMap,
62 AggregatesMap<typename G::VertexDescriptor>& aggregates)
63 {
64 AggregateRenumberer<G> renumberer(aggregates);
65
66 for(I index1=index; index1 != endIndex; ++index1)
67 if(aggregates[index1.index()]!=AggregatesMap<typename G::VertexDescriptor>::ISOLATED &&
68 !get(visitedMap, index1.index())) {
69
70 aggregates.template breadthFirstSearch<false>(index1.index(), aggregates[index1.index()],
71 graph, renumberer, visitedMap);
72 aggregates[index1.index()] = renumberer;
73 ++renumberer;
74 }
75 for(; index != endIndex; ++index)
76 put(visitedMap, index.index(), false);
77 }
78
79 } // namespace AMG
80} // namespace Dune
81#endif
Provides classes for the Coloring process of AMG.
Dune namespace.
Definition: alignment.hh:10
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)