From d728360360f08da19333ff5ca08a8b6b876fdd8c Mon Sep 17 00:00:00 2001 From: Markus Blatt <mblatt@dune-project.org> Date: Thu, 8 Dec 2005 11:22:30 +0000 Subject: [PATCH] Removed introduced segfault. [[Imported from SVN: r3557]] --- istl/paamg/graphcreator.hh | 13 ++++++++++++- istl/paamg/hierarchy.hh | 13 ++++++++++--- istl/paamg/indicescoarsener.hh | 3 --- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/istl/paamg/graphcreator.hh b/istl/paamg/graphcreator.hh index 2a2432a33..03979dd48 100644 --- a/istl/paamg/graphcreator.hh +++ b/istl/paamg/graphcreator.hh @@ -34,7 +34,7 @@ namespace Dune typedef Tuple<MatrixGraph*,PropertiesGraph*> GraphTuple; template<class OF, class T> - static GraphTuple create(const M& matrix, T& excluded, + static GraphTuple create(const MatrixGraph& matrix, T& excluded, const SequentialInformation& pinfo, const OF&) { @@ -43,6 +43,11 @@ namespace Dune return GraphTuple(mg,pg); } + static void free(GraphTuple& graphs) + { + delete Element<1>::get(graphs); + } + }; template<class M> @@ -79,6 +84,12 @@ namespace Dune PropertiesGraph* pg = new PropertiesGraph(*sg, IdentityMap(), sg->getEdgeIndexMap()); return GraphTuple(mg,pg,sg); } + + static void free(GraphTuple& graphs) + { + delete Element<2>::get(graphs); + delete Element<1>::get(graphs); + } }; } //namespace Amg diff --git a/istl/paamg/hierarchy.hh b/istl/paamg/hierarchy.hh index a085e2326..1d53db667 100644 --- a/istl/paamg/hierarchy.hh +++ b/istl/paamg/hierarchy.hh @@ -515,6 +515,8 @@ namespace Dune *aggregatesMap, *coarseInfo); + GraphCreator::free(graphs); + parallelInformation_.addCoarser(*coarseInfo); PInfoIterator fineInfo = infoLevel; @@ -548,6 +550,8 @@ namespace Dune *aggregatesMap, aggregates, OverlapFlags()); + + delete Element<0>::get(graphs); productBuilder.calculate(mlevel->getmat(), *aggregatesMap, *coarseMatrix); dinfo<<"Calculation of Galerkin product took "<<watch.elapsed()<<" seconds."<<std::endl; @@ -584,13 +588,16 @@ namespace Dune typedef typename ParallelInformationHierarchy::Iterator InfoIterator; AggregatesMapIterator amap = aggregatesMaps_.rbegin(); - InfoIterator info = parallelInformation_.finest(); - + InfoIterator info = parallelInformation_.coarsest(); + int i=0; for(Iterator level=matrices_.coarsest(), finest=matrices_.finest(); level != finest; --level, --info, ++amap) { + std::cout<<"Freeing level "<<i++<<std::endl; + (*amap)->free(); delete *amap; delete &level->getmat(); - delete &(*info); } + delete *amap; + delete &(*info); } template<class M, class IS, class A> diff --git a/istl/paamg/indicescoarsener.hh b/istl/paamg/indicescoarsener.hh index 51a2a4abf..9ff8642ba 100644 --- a/istl/paamg/indicescoarsener.hh +++ b/istl/paamg/indicescoarsener.hh @@ -227,9 +227,6 @@ namespace Dune coarseIndices.endResize(); - assert(coarseIndices.size()==renumberer); - assert((coarseIndices.begin()+(coarseIndices.size()-1))->local()==renumberer-1); - // Reset the visited flags typedef typename Graph::ConstVertexIterator VertexIterator; VertexIterator vend = fineGraph.end(); -- GitLab