dune-istl  2.9.0
renumberer.hh
Go to the documentation of this file.
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 
10 namespace Dune
11 {
12  namespace Amg
13  {
14  template<class G>
16  {
17  public:
19  typedef typename G::VertexDescriptor Vertex;
20 
26 
28  operator Vertex() const;
29 
30  void operator()(const typename G::ConstEdgeIterator& edge);
31 
32  void operator++();
33 
34  protected:
37  };
38 
39  template<class G>
41  : number_(0), aggregates_(aggregates)
42  {}
43 
44  template<class G>
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>
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,
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.
Definition: allocator.hh:11
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get([[maybe_unused]] const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition: dependency.hh:293
void renumberAggregates(const G &graph, I index, I endIndex, V &visitedMap, AggregatesMap< typename G::VertexDescriptor > &aggregates)
Definition: renumberer.hh:63
Definition: renumberer.hh:16
void operator++()
Definition: renumberer.hh:57
G::VertexDescriptor Vertex
The vertex type.
Definition: renumberer.hh:19
void operator()(const typename G::ConstEdgeIterator &edge)
Definition: renumberer.hh:51
AggregatesMap< Vertex > & aggregates_
Definition: renumberer.hh:36
AggregateRenumberer(AggregatesMap< Vertex > &aggregates)
Constructor.
Definition: renumberer.hh:40
Vertex number_
Definition: renumberer.hh:35