Loading...
Searching...
No Matches
graphcreator.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_GRAPHCREATOR_HH
#define DUNE_AMG_GRAPHCREATOR_HH
#include <tuple>
#include "graph.hh"
#include "dependency.hh"
#include "pinfo.hh"
#include <dune/istl/operators.hh>
#include <dune/istl/bcrsmatrix.hh>
namespace Dune
{
namespace Amg
{
template<class M, class PI>
struct PropertiesGraphCreator
{
typedef typename M::matrix_type Matrix;
typedef Dune::Amg::MatrixGraph<const Matrix> MatrixGraph;
typedef Dune::Amg::SubGraph<MatrixGraph,
std::vector<bool> > SubGraph;
typedef Dune::Amg::PropertiesGraph<SubGraph,
VertexProperties,
EdgeProperties,
IdentityMap,
typename SubGraph::EdgeIndexMap>
PropertiesGraph;
typedef std::tuple<MatrixGraph*,PropertiesGraph*,SubGraph*> GraphTuple;
template<class OF, class T>
static GraphTuple create(const M& matrix, T& excluded,
PI& pinfo, const OF& of)
{
MatrixGraph* mg = new MatrixGraph(matrix.getmat());
typedef typename PI::ParallelIndexSet ParallelIndexSet;
typedef typename ParallelIndexSet::const_iterator IndexIterator;
IndexIterator iend = pinfo.indexSet().end();
for(IndexIterator index = pinfo.indexSet().begin(); index != iend; ++index)
excluded[index->local()] = of.contains(index->local().attribute());
SubGraph* sg= new SubGraph(*mg, excluded);
PropertiesGraph* pg = new PropertiesGraph(*sg, IdentityMap(), sg->getEdgeIndexMap());
return GraphTuple(mg,pg,sg);
}
static void free(GraphTuple& graphs)
{
delete std::get<2>(graphs);
delete std::get<1>(graphs);
}
};
template<class M>
struct PropertiesGraphCreator<M,SequentialInformation>
{
typedef typename M::matrix_type Matrix;
typedef Dune::Amg::MatrixGraph<const Matrix> MatrixGraph;
typedef Dune::Amg::PropertiesGraph<MatrixGraph,
VertexProperties,
EdgeProperties,
IdentityMap,
IdentityMap> PropertiesGraph;
typedef std::tuple<MatrixGraph*,PropertiesGraph*> GraphTuple;
template<class OF, class T>
static GraphTuple create([[maybe_unused]] const M& matrix,
[[maybe_unused]] T& excluded,
[[maybe_unused]] const SequentialInformation& pinfo,
const OF&)
{
MatrixGraph* mg = new MatrixGraph(matrix.getmat());
PropertiesGraph* pg = new PropertiesGraph(*mg, IdentityMap(), IdentityMap());
return GraphTuple(mg,pg);
}
static void free(GraphTuple& graphs)
{
delete std::get<1>(graphs);
}
};
} //namespace Amg
} // namespace Dune
#endif
bcrsmatrix.hh
Implementation of the BCRSMatrix class.
dependency.hh
Provides classes for initializing the link attributes of a matrix graph.
graph.hh
Provides classes for building the matrix graph.
pinfo.hh
operators.hh
Define general, extensible interface for operators. The available implementation wraps a matrix.
Dune
Definition allocator.hh:11
Dune::Amg
Definition novlpschwarz.hh:256
Dune::Amg::EdgeProperties
Class representing the properties of an edge in the matrix graph.
Definition dependency.hh:39
Dune::Amg::VertexProperties
Class representing a node in the matrix graph.
Definition dependency.hh:126
Dune::Amg::MatrixGraph
The (undirected) graph of a matrix.
Definition graph.hh:51
Dune::Amg::SubGraph
A subgraph of a graph.
Definition graph.hh:443
Dune::Amg::SubGraph::getEdgeIndexMap
EdgeIndexMap getEdgeIndexMap()
Get an edge index map for the graph.
Dune::Amg::PropertiesGraph
Attaches properties to the edges and vertices of a graph.
Definition graph.hh:978
Dune::Amg::PropertiesGraphCreator
Definition graphcreator.hh:22
Dune::Amg::PropertiesGraphCreator::SubGraph
Dune::Amg::SubGraph< MatrixGraph, std::vector< bool > > SubGraph
Definition graphcreator.hh:26
Dune::Amg::PropertiesGraphCreator::PropertiesGraph
Dune::Amg::PropertiesGraph< SubGraph, VertexProperties, EdgeProperties, IdentityMap, typename SubGraph::EdgeIndexMap > PropertiesGraph
Definition graphcreator.hh:32
Dune::Amg::PropertiesGraphCreator::Matrix
M::matrix_type Matrix
Definition graphcreator.hh:23
Dune::Amg::PropertiesGraphCreator::create
static GraphTuple create(const M &matrix, T &excluded, PI &pinfo, const OF &of)
Definition graphcreator.hh:37
Dune::Amg::PropertiesGraphCreator::free
static void free(GraphTuple &graphs)
Definition graphcreator.hh:53
Dune::Amg::PropertiesGraphCreator::MatrixGraph
Dune::Amg::MatrixGraph< const Matrix > MatrixGraph
Definition graphcreator.hh:24
Dune::Amg::PropertiesGraphCreator::GraphTuple
std::tuple< MatrixGraph *, PropertiesGraph *, SubGraph * > GraphTuple
Definition graphcreator.hh:34
Dune::Amg::PropertiesGraphCreator< M, SequentialInformation >::MatrixGraph
Dune::Amg::MatrixGraph< const Matrix > MatrixGraph
Definition graphcreator.hh:65
Dune::Amg::PropertiesGraphCreator< M, SequentialInformation >::Matrix
M::matrix_type Matrix
Definition graphcreator.hh:63
Dune::Amg::PropertiesGraphCreator< M, SequentialInformation >::PropertiesGraph
Dune::Amg::PropertiesGraph< MatrixGraph, VertexProperties, EdgeProperties, IdentityMap, IdentityMap > PropertiesGraph
Definition graphcreator.hh:71
Dune::Amg::PropertiesGraphCreator< M, SequentialInformation >::GraphTuple
std::tuple< MatrixGraph *, PropertiesGraph * > GraphTuple
Definition graphcreator.hh:73
Dune::Amg::PropertiesGraphCreator< M, SequentialInformation >::create
static GraphTuple create(const M &matrix, T &excluded, const SequentialInformation &pinfo, const OF &)
Definition graphcreator.hh:76
Dune::Amg::PropertiesGraphCreator< M, SequentialInformation >::free
static void free(GraphTuple &graphs)
Definition graphcreator.hh:86
Dune::Amg::SequentialInformation
Definition pinfo.hh:28