dune-istl  2.2.1
renumberer.hh
Go to the documentation of this file.
1 #ifndef DUNE_AMG_RENUMBERER_HH
2 #define DUNE_AMG_RENUMBERER_HH
3 
4 #include "aggregates.hh"
5 
6 namespace Dune
7 {
8  namespace Amg
9  {
10  template<class G>
12  {
13  public:
15  typedef typename G::VertexDescriptor Vertex;
16 
22 
24  operator Vertex() const;
25 
26  void operator()(const typename G::ConstEdgeIterator& edge);
27 
28  void operator++();
29 
30  protected:
33  };
34 
35  template<class G>
37  : number_(0), aggregates_(aggregates)
38  {}
39 
40  template<class G>
42  {
43  return number_;
44  }
45 
46  template<class G>
47  void AggregateRenumberer<G>::operator()(const typename G::ConstEdgeIterator& edge)
48  {
49  aggregates_[edge.target()]=number_;
50  }
51 
52  template<class G>
54  {
55  ++number_;
56  }
57 
58  template<class G, class I, class V>
59  void renumberAggregates(const G& graph, I index, I endIndex, V& visitedMap,
61  {
62  AggregateRenumberer<G> renumberer(aggregates);
63 
64  for(I index1=index; index1 != endIndex; ++index1)
65  if(aggregates[index1.index()]!=AggregatesMap<typename G::VertexDescriptor>::ISOLATED &&
66  !get(visitedMap, index1.index())){
67 
68  aggregates.template breadthFirstSearch<false>(index1.index(), aggregates[index1.index()],
69  graph, renumberer, visitedMap);
70  aggregates[index1.index()] = renumberer;
71  ++renumberer;
72  }
73  for(; index != endIndex; ++index)
74  put(visitedMap, index.index(), false);
75  }
76 
77  } // namespace AMG
78 } // namespace Dune
79 #endif