3 #ifndef DUNE_AMG_GRAPHCREATOR_HH 4 #define DUNE_AMG_GRAPHCREATOR_HH 13 #include <dune/common/unused.hh> 19 template<
class M,
int cat=M::category>
26 typedef typename M::matrix_type
Matrix;
36 typedef std::tuple<MatrixGraph*,PropertiesGraph*>
GraphTuple;
38 template<
class OF,
class T>
39 static GraphTuple
create(
const M& matrix, T& excluded,
43 DUNE_UNUSED_PARAMETER(excluded);
44 DUNE_UNUSED_PARAMETER(pinfo);
45 MatrixGraph* mg =
new MatrixGraph(matrix.getmat());
46 PropertiesGraph* pg =
new PropertiesGraph(*mg, IdentityMap(), IdentityMap());
47 return GraphTuple(mg,pg);
50 static void free(GraphTuple& graphs)
52 delete std::get<1>(graphs);
60 typedef typename M::matrix_type
Matrix;
71 typedef std::tuple<MatrixGraph*,PropertiesGraph*,SubGraph*>
GraphTuple;
73 template<
class OF,
class T,
class PI>
74 static GraphTuple
create(
const M& matrix, T& excluded,
75 PI& pinfo,
const OF& of)
77 MatrixGraph* mg =
new MatrixGraph(matrix.getmat());
78 typedef typename PI::ParallelIndexSet ParallelIndexSet;
79 typedef typename ParallelIndexSet::const_iterator IndexIterator;
80 IndexIterator iend = pinfo.indexSet().end();
82 for(IndexIterator index = pinfo.indexSet().begin(); index != iend; ++index)
83 excluded[index->local()] = of.contains(index->local().attribute());
85 SubGraph* sg=
new SubGraph(*mg, excluded);
87 return GraphTuple(mg,pg,sg);
90 static void free(GraphTuple& graphs)
92 delete std::get<2>(graphs);
93 delete std::get<1>(graphs);
111 typedef std::tuple<MatrixGraph*,PropertiesGraph*,SubGraph*>
GraphTuple;
113 template<
class OF,
class T,
class PI>
114 static GraphTuple
create(
const M& matrix, T& excluded,
115 PI& pinfo,
const OF& of)
117 MatrixGraph* mg =
new MatrixGraph(matrix.getmat());
118 typedef typename PI::ParallelIndexSet ParallelIndexSet;
119 typedef typename ParallelIndexSet::const_iterator IndexIterator;
120 IndexIterator iend = pinfo.indexSet().end();
122 for(IndexIterator index = pinfo.indexSet().begin(); index != iend; ++index)
123 excluded[index->local()] = of.contains(index->local().attribute());
125 SubGraph* sg=
new SubGraph(*mg, excluded);
127 return GraphTuple(mg,pg,sg);
130 static void free(GraphTuple& graphs)
132 delete std::get<2>(graphs);
133 delete std::get<1>(graphs);
Attaches properties to the edges and vertices of a graph.
Definition: graph.hh:975
Dune::Amg::PropertiesGraph< SubGraph, VertexProperties, EdgeProperties, IdentityMap, typename SubGraph::EdgeIndexMap > PropertiesGraph
Definition: graphcreator.hh:69
Dune::Amg::MatrixGraph< const Matrix > MatrixGraph
Definition: graphcreator.hh:28
static void free(GraphTuple &graphs)
Definition: graphcreator.hh:90
std::tuple< MatrixGraph *, PropertiesGraph * > GraphTuple
Definition: graphcreator.hh:36
Class representing the properties of an ede in the matrix graph.
Definition: dependency.hh:37
static GraphTuple create(const M &matrix, T &excluded, PI &pinfo, const OF &of)
Definition: graphcreator.hh:114
static GraphTuple create(const M &matrix, T &excluded, PI &pinfo, const OF &of)
Definition: graphcreator.hh:74
Dune::Amg::MatrixGraph< const Matrix > MatrixGraph
Definition: graphcreator.hh:61
A subgraph of a graph.
Definition: graph.hh:440
The (undirected) graph of a matrix.
Definition: graph.hh:48
Categories for the solvers.
Definition: solvercategory.hh:17
M::matrix_type Matrix
Definition: graphcreator.hh:100
EdgeIndexMap getEdgeIndexMap()
Get an edge index map for the graph.
Dune::Amg::SubGraph< MatrixGraph, std::vector< bool > > SubGraph
Definition: graphcreator.hh:103
static GraphTuple create(const M &matrix, T &excluded, const SequentialInformation &pinfo, const OF &)
Definition: graphcreator.hh:39
M::matrix_type Matrix
Definition: graphcreator.hh:26
std::tuple< MatrixGraph *, PropertiesGraph *, SubGraph * > GraphTuple
Definition: graphcreator.hh:111
static void free(GraphTuple &graphs)
Definition: graphcreator.hh:50
Definition: basearray.hh:19
Dune::Amg::PropertiesGraph< SubGraph, VertexProperties, EdgeProperties, IdentityMap, typename SubGraph::EdgeIndexMap > PropertiesGraph
Definition: graphcreator.hh:109
static void free(GraphTuple &graphs)
Definition: graphcreator.hh:130
Definition: graphcreator.hh:20
Provides classes for building the matrix graph.
Implementation of the BCRSMatrix class.
Provides classes for initializing the link attributes of a matrix graph.
Dune::Amg::PropertiesGraph< MatrixGraph, VertexProperties, EdgeProperties, IdentityMap, IdentityMap > PropertiesGraph
Definition: graphcreator.hh:34
std::tuple< MatrixGraph *, PropertiesGraph *, SubGraph * > GraphTuple
Definition: graphcreator.hh:71
Class representing a node in the matrix graph.
Definition: dependency.hh:125
Define general, extensible interface for operators. The available implementation wraps a matrix...
M::matrix_type Matrix
Definition: graphcreator.hh:60
An index map for mapping the edges to indices.
Definition: graph.hh:467
Dune::Amg::SubGraph< MatrixGraph, std::vector< bool > > SubGraph
Definition: graphcreator.hh:63
Dune::Amg::MatrixGraph< const Matrix > MatrixGraph
Definition: graphcreator.hh:101