3#ifndef DUNE_AMG_GRAPHCREATOR_HH
4#define DUNE_AMG_GRAPHCREATOR_HH
19 template<
class M,
int cat=M::category>
20 struct PropertiesGraphCreator
24 struct PropertiesGraphCreator<M,SolverCategory::sequential>
26 typedef typename M::matrix_type Matrix;
34 IdentityMap> PropertiesGraph;
36 typedef std::tuple<MatrixGraph*,PropertiesGraph*> GraphTuple;
38 template<
class OF,
class T>
39 static GraphTuple create(
const M& matrix, T& excluded,
40 const SequentialInformation& 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);
58 struct PropertiesGraphCreator<M,SolverCategory::overlapping>
60 typedef typename M::matrix_type Matrix;
63 std::vector<bool> > SubGraph;
68 typename SubGraph::EdgeIndexMap>
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;
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);
86 PropertiesGraph* pg =
new PropertiesGraph(*sg, IdentityMap(), sg->getEdgeIndexMap());
87 return GraphTuple(mg,pg,sg);
90 static void free(GraphTuple& graphs)
92 delete std::get<2>(graphs);
93 delete std::get<1>(graphs);
98 struct PropertiesGraphCreator<M,SolverCategory::nonoverlapping>
100 typedef typename M::matrix_type Matrix;
103 std::vector<bool> > SubGraph;
108 typename SubGraph::EdgeIndexMap>
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;
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);
126 PropertiesGraph* pg =
new PropertiesGraph(*sg, IdentityMap(), sg->getEdgeIndexMap());
127 return GraphTuple(mg,pg,sg);
130 static void free(GraphTuple& graphs)
132 delete std::get<2>(graphs);
133 delete std::get<1>(graphs);
Implementation of the BCRSMatrix class.
The (undirected) graph of a matrix.
Definition: graph.hh:49
Attaches properties to the edges and vertices of a graph.
Definition: graph.hh:976
A subgraph of a graph.
Definition: graph.hh:441
Provides classes for initializing the link attributes of a matrix graph.
Provides classes for building the matrix graph.
ArrayList< IndexPair, N >::const_iterator const_iterator
The constant iterator over the pairs.
Definition: indexset.hh:305
Dune namespace.
Definition: alignment.hh:11
Define general, extensible interface for operators. The available implementation wraps a matrix.
Definition of the DUNE_UNUSED macro for the case that config.h is not available.
#define DUNE_UNUSED_PARAMETER(parm)
A macro to mark intentionally unused function parameters with.
Definition: unused.hh:18