3#ifndef DUNE_AMG_GRAPHCREATOR_HH
4#define DUNE_AMG_GRAPHCREATOR_HH
18 template<
class M,
int cat=M::category>
19 struct PropertiesGraphCreator
23 struct PropertiesGraphCreator<M,SolverCategory::sequential>
25 typedef typename M::matrix_type Matrix;
33 IdentityMap> PropertiesGraph;
35 typedef Dune::tuple<MatrixGraph*,PropertiesGraph*> GraphTuple;
37 template<
class OF,
class T>
38 static GraphTuple create(
const M& matrix, T& excluded,
39 const SequentialInformation& pinfo,
44 MatrixGraph* mg =
new MatrixGraph(matrix.getmat());
45 PropertiesGraph* pg =
new PropertiesGraph(*mg, IdentityMap(), IdentityMap());
46 return GraphTuple(mg,pg);
49 static void free(GraphTuple& graphs)
51 delete get<1>(graphs);
57 struct PropertiesGraphCreator<M,SolverCategory::overlapping>
59 typedef typename M::matrix_type Matrix;
62 std::vector<bool> > SubGraph;
67 typename SubGraph::EdgeIndexMap>
70 typedef Dune::tuple<MatrixGraph*,PropertiesGraph*,SubGraph*> GraphTuple;
72 template<
class OF,
class T,
class PI>
73 static GraphTuple create(
const M& matrix, T& excluded,
74 PI& pinfo,
const OF& of)
76 MatrixGraph* mg =
new MatrixGraph(matrix.getmat());
77 typedef typename PI::ParallelIndexSet ParallelIndexSet;
79 IndexIterator iend = pinfo.indexSet().end();
81 for(IndexIterator index = pinfo.indexSet().begin(); index != iend; ++index)
82 excluded[index->local()] = of.contains(index->local().attribute());
84 SubGraph* sg=
new SubGraph(*mg, excluded);
85 PropertiesGraph* pg =
new PropertiesGraph(*sg, IdentityMap(), sg->getEdgeIndexMap());
86 return GraphTuple(mg,pg,sg);
89 static void free(GraphTuple& graphs)
91 delete get<2>(graphs);
92 delete get<1>(graphs);
97 struct PropertiesGraphCreator<M,SolverCategory::nonoverlapping>
99 typedef typename M::matrix_type Matrix;
102 std::vector<bool> > SubGraph;
107 typename SubGraph::EdgeIndexMap>
110 typedef Dune::tuple<MatrixGraph*,PropertiesGraph*,SubGraph*> GraphTuple;
112 template<
class OF,
class T,
class PI>
113 static GraphTuple create(
const M& matrix, T& excluded,
114 PI& pinfo,
const OF& of)
116 MatrixGraph* mg =
new MatrixGraph(matrix.getmat());
117 typedef typename PI::ParallelIndexSet ParallelIndexSet;
119 IndexIterator iend = pinfo.indexSet().end();
121 for(IndexIterator index = pinfo.indexSet().begin(); index != iend; ++index)
122 excluded[index->local()] = of.contains(index->local().attribute());
124 SubGraph* sg=
new SubGraph(*mg, excluded);
125 PropertiesGraph* pg =
new PropertiesGraph(*sg, IdentityMap(), sg->getEdgeIndexMap());
126 return GraphTuple(mg,pg,sg);
129 static void free(GraphTuple& graphs)
131 delete get<2>(graphs);
132 delete 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:10
Define general, extensible interface for operators. The available implementation wraps a matrix.
Fallback implementation of the std::tuple class.
Definition of the DUNE_UNUSED macro for the case that config.h is not available.
#define DUNE_UNUSED_PARAMETER(parm)
A macro to mark intentional unused function parameters with.
Definition: unused.hh:18