Loading...
Searching...
No Matches
renumberer.hh
Go to the documentation of this file.
// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_AMG_RENUMBERER_HH
#define DUNE_AMG_RENUMBERER_HH
#include "aggregates.hh"
namespace Dune
{
namespace Amg
{
template<class G>
class AggregateRenumberer
{
public:
typedef typename G::VertexDescriptor Vertex;
AggregateRenumberer(AggregatesMap<Vertex>& aggregates);
operator Vertex() const;
void operator()(const typename G::ConstEdgeIterator& edge);
void operator++();
protected:
Vertex number_;
AggregatesMap<Vertex>& aggregates_;
};
template<class G>
AggregateRenumberer<G>::AggregateRenumberer(AggregatesMap<Vertex>& aggregates)
: number_(0), aggregates_(aggregates)
{}
template<class G>
AggregateRenumberer<G>::operator Vertex() const
{
return number_;
}
template<class G>
void AggregateRenumberer<G>::operator()(const typename G::ConstEdgeIterator& edge)
{
aggregates_[edge.target()]=number_;
}
template<class G>
void AggregateRenumberer<G>::operator++()
{
++number_;
}
template<class G, class I, class V>
void renumberAggregates(const G& graph, I index, I endIndex, V& visitedMap,
AggregatesMap<typename G::VertexDescriptor>& aggregates)
{
AggregateRenumberer<G> renumberer(aggregates);
for(I index1=index; index1 != endIndex; ++index1)
if(aggregates[index1.index()]!=AggregatesMap<typename G::VertexDescriptor>::ISOLATED &&
!get(visitedMap, index1.index())) {
aggregates.template breadthFirstSearch<false>(index1.index(), aggregates[index1.index()],
graph, renumberer, visitedMap);
aggregates[index1.index()] = renumberer;
++renumberer;
}
for(; index != endIndex; ++index)
put(visitedMap, index.index(), false);
}
} // namespace AMG
} // namespace Dune
#endif
aggregates.hh
Provides classes for the Coloring process of AMG.
Dune::Amg::AggregatesMap::ISOLATED
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:577
Dune
Definition allocator.hh:11
Dune::get
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:293
Dune::Amg
Definition novlpschwarz.hh:256
Dune::Amg::renumberAggregates
void renumberAggregates(const G &graph, I index, I endIndex, V &visitedMap, AggregatesMap< typename G::VertexDescriptor > &aggregates)
Definition renumberer.hh:63
Dune::Amg::AggregatesMap
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:566
Dune::Amg::AggregateRenumberer
Definition renumberer.hh:16
Dune::Amg::AggregateRenumberer::operator++
void operator++()
Definition renumberer.hh:57
Dune::Amg::AggregateRenumberer::Vertex
G::VertexDescriptor Vertex
The vertex type.
Definition renumberer.hh:19
Dune::Amg::AggregateRenumberer::operator()
void operator()(const typename G::ConstEdgeIterator &edge)
Definition renumberer.hh:51
Dune::Amg::AggregateRenumberer::aggregates_
AggregatesMap< Vertex > & aggregates_
Definition renumberer.hh:36
Dune::Amg::AggregateRenumberer::AggregateRenumberer
AggregateRenumberer(AggregatesMap< Vertex > &aggregates)
Constructor.
Definition renumberer.hh:40
Dune::Amg::AggregateRenumberer::number_
Vertex number_
Definition renumberer.hh:35