From 4d60dd60d71f4887c61cdd78195db8d5daab288b Mon Sep 17 00:00:00 2001 From: wolf Date: Fri, 12 Feb 1999 18:24:18 +0000 Subject: [PATCH] Fix a memory leak and do some other things related to the third space dimension. git-svn-id: https://svn.dealii.org/trunk@792 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/Attic/examples/dof/dof_test.cc | 15 ++++++++++----- tests/big-tests/dof/dof_test.cc | 15 ++++++++++----- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/deal.II/deal.II/Attic/examples/dof/dof_test.cc b/deal.II/deal.II/Attic/examples/dof/dof_test.cc index 4c67adf615..72b109e72e 100644 --- a/deal.II/deal.II/Attic/examples/dof/dof_test.cc +++ b/deal.II/deal.II/Attic/examples/dof/dof_test.cc @@ -143,7 +143,9 @@ void TestCases::run (ParameterHandler &prm) { if (test=="random") test_case = 4; else cerr << "This test seems not to be implemented!" << endl; + + Boundary *boundary = 0; switch (test_case) { @@ -178,9 +180,9 @@ void TestCases::run (ParameterHandler &prm) { case 3: { // set the boundary function - Boundary *boundary = (test_case==2 ? - static_cast*>(new Ball()) : - static_cast*>(new CurvedLine())); + boundary = (test_case==2 ? + static_cast*>(new Ball()) : + static_cast*>(new CurvedLine())); tria->set_boundary (boundary); // refine once @@ -188,7 +190,7 @@ void TestCases::run (ParameterHandler &prm) { tria->execute_refinement (); Triangulation::active_cell_iterator cell, endc; - for (int i=0; i<4; ++i) + for (int i=0; i<6-dim; ++i) { cell = tria->begin_active(); endc = tria->end(); @@ -212,7 +214,7 @@ void TestCases::run (ParameterHandler &prm) { tria->execute_refinement (); Triangulation::active_cell_iterator cell, endc; - for (int i=0; i<(dim==2 ? 12 : 20); ++i) + for (int i=0; i<(dim==2 ? 12 : (dim==3 ? 7 : 20)); ++i) { int n_levels = tria->n_levels(); cell = tria->begin_active(); @@ -291,6 +293,9 @@ void TestCases::run (ParameterHandler &prm) { // release the lock that dof has to the // finite element object dof->clear (); + tria->set_boundary (0); + if (boundary) + delete boundary; }; diff --git a/tests/big-tests/dof/dof_test.cc b/tests/big-tests/dof/dof_test.cc index 4c67adf615..72b109e72e 100644 --- a/tests/big-tests/dof/dof_test.cc +++ b/tests/big-tests/dof/dof_test.cc @@ -143,7 +143,9 @@ void TestCases::run (ParameterHandler &prm) { if (test=="random") test_case = 4; else cerr << "This test seems not to be implemented!" << endl; + + Boundary *boundary = 0; switch (test_case) { @@ -178,9 +180,9 @@ void TestCases::run (ParameterHandler &prm) { case 3: { // set the boundary function - Boundary *boundary = (test_case==2 ? - static_cast*>(new Ball()) : - static_cast*>(new CurvedLine())); + boundary = (test_case==2 ? + static_cast*>(new Ball()) : + static_cast*>(new CurvedLine())); tria->set_boundary (boundary); // refine once @@ -188,7 +190,7 @@ void TestCases::run (ParameterHandler &prm) { tria->execute_refinement (); Triangulation::active_cell_iterator cell, endc; - for (int i=0; i<4; ++i) + for (int i=0; i<6-dim; ++i) { cell = tria->begin_active(); endc = tria->end(); @@ -212,7 +214,7 @@ void TestCases::run (ParameterHandler &prm) { tria->execute_refinement (); Triangulation::active_cell_iterator cell, endc; - for (int i=0; i<(dim==2 ? 12 : 20); ++i) + for (int i=0; i<(dim==2 ? 12 : (dim==3 ? 7 : 20)); ++i) { int n_levels = tria->n_levels(); cell = tria->begin_active(); @@ -291,6 +293,9 @@ void TestCases::run (ParameterHandler &prm) { // release the lock that dof has to the // finite element object dof->clear (); + tria->set_boundary (0); + if (boundary) + delete boundary; }; -- 2.39.5