diff --git a/dune/istl/paamg/graphcreator.hh b/dune/istl/paamg/graphcreator.hh index 9aa59895e39e7f3224eb0b4816fa7734b0a91dd9..4e9a58d682d644ff2d4da9f319755b00e4ff4f6a 100644 --- a/dune/istl/paamg/graphcreator.hh +++ b/dune/istl/paamg/graphcreator.hh @@ -91,6 +91,47 @@ namespace Dune } }; + template<class M> + struct PropertiesGraphCreator<M,SolverCategory::nonoverlapping> + { + 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 Dune::tuple<MatrixGraph*,PropertiesGraph*,SubGraph*> GraphTuple; + + template<class OF, class T, class PI> + static GraphTuple create(const M& matrix, T& excluded, + PI& pinfo, const OF& of) + { + typedef OF OverlapFlags; + 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 get<2>(graphs); + delete get<1>(graphs); + } + }; + } //namespace Amg } // namespace Dune #endif