5#ifndef DUNE_AMG_GRAPHCREATOR_HH
6#define DUNE_AMG_GRAPHCREATOR_HH
20 template<
class M,
class PI>
21 struct PropertiesGraphCreator
23 typedef typename M::matrix_type Matrix;
26 std::vector<bool> > SubGraph;
31 typename SubGraph::EdgeIndexMap>
34 typedef std::tuple<MatrixGraph*,PropertiesGraph*,SubGraph*> GraphTuple;
36 template<
class OF,
class T>
37 static GraphTuple create(
const M& matrix, T& excluded,
38 PI& pinfo,
const OF& of)
40 MatrixGraph* mg =
new MatrixGraph(matrix.getmat());
41 typedef typename PI::ParallelIndexSet ParallelIndexSet;
43 IndexIterator iend = pinfo.indexSet().end();
45 for(IndexIterator index = pinfo.indexSet().begin(); index != iend; ++index)
46 excluded[index->local()] = of.contains(index->local().attribute());
48 SubGraph* sg=
new SubGraph(*mg, excluded);
49 PropertiesGraph* pg =
new PropertiesGraph(*sg, IdentityMap(), sg->getEdgeIndexMap());
50 return GraphTuple(mg,pg,sg);
53 static void free(GraphTuple& graphs)
55 delete std::get<2>(graphs);
56 delete std::get<1>(graphs);
61 struct PropertiesGraphCreator<M,SequentialInformation>
63 typedef typename M::matrix_type Matrix;
71 IdentityMap> PropertiesGraph;
73 typedef std::tuple<MatrixGraph*,PropertiesGraph*> GraphTuple;
75 template<
class OF,
class T>
76 static GraphTuple create([[maybe_unused]]
const M& matrix,
77 [[maybe_unused]] T& excluded,
78 [[maybe_unused]]
const SequentialInformation& pinfo,
81 MatrixGraph* mg =
new MatrixGraph(matrix.getmat());
82 PropertiesGraph* pg =
new PropertiesGraph(*mg, IdentityMap(), IdentityMap());
83 return GraphTuple(mg,pg);
86 static void free(GraphTuple& graphs)
88 delete std::get<1>(graphs);
The (undirected) graph of a matrix.
Definition: graph.hh:51
Attaches properties to the edges and vertices of a graph.
Definition: graph.hh:978
A subgraph of a graph.
Definition: graph.hh:443
Provides classes for initializing the link attributes of a matrix graph.
Implementation of the BCRSMatrix class.
Provides classes for building the matrix graph.
ArrayList< IndexPair, N >::const_iterator const_iterator
The constant iterator over the pairs.
Definition: indexset.hh:296
Dune namespace.
Definition: alignedallocator.hh:13
Define general, extensible interface for operators. The available implementation wraps a matrix.