Dune Core Modules (2.9.0)

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