From f3840e1b8ad0c730668547bfc2585c147803da9e Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 17 Jan 2013 16:18:45 +0000 Subject: [PATCH] Adjust the test so that mesh refinement no longer depends on an estimated error. We had problems where this test produced different meshes on different machines. git-svn-id: https://svn.dealii.org/trunk@28102 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/deal.II/inhomogeneous_constraints.cc | 59 ++------------- .../inhomogeneous_constraints/cmp/generic | 72 +++++++++---------- 2 files changed, 43 insertions(+), 88 deletions(-) diff --git a/tests/deal.II/inhomogeneous_constraints.cc b/tests/deal.II/inhomogeneous_constraints.cc index 50bc3a333a..6a0c760c38 100644 --- a/tests/deal.II/inhomogeneous_constraints.cc +++ b/tests/deal.II/inhomogeneous_constraints.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2009 by the deal.II authors +// Copyright (C) 2009, 2013 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -526,58 +526,13 @@ template void LaplaceProblem::postprocess () { Vector estimated_error_per_cell (triangulation.n_active_cells()); - KellyErrorEstimator::estimate (dof_handler, - face_quadrature_collection, - typename FunctionMap::type(), - solution, - estimated_error_per_cell); - - Vector smoothness_indicators (triangulation.n_active_cells()); - estimate_smoothness (smoothness_indicators); - - - { - GridRefinement::refine_and_coarsen_fixed_number (triangulation, - estimated_error_per_cell, - 0.3, 0.03); - - float max_smoothness = *std::min_element (smoothness_indicators.begin(), - smoothness_indicators.end()), - min_smoothness = *std::max_element (smoothness_indicators.begin(), - smoothness_indicators.end()); - { - typename hp::DoFHandler::active_cell_iterator - cell = dof_handler.begin_active(), - endc = dof_handler.end(); - for (unsigned int index=0; cell!=endc; ++cell, ++index) - if (cell->refine_flag_set()) - { - max_smoothness = std::max (max_smoothness, - smoothness_indicators(index)); - min_smoothness = std::min (min_smoothness, - smoothness_indicators(index)); - } - } - const float threshold_smoothness = (max_smoothness + min_smoothness) / 2; + for (unsigned int i=0; i::active_cell_iterator - cell = dof_handler.begin_active(), - endc = dof_handler.end(); - for (unsigned int index=0; cell!=endc; ++cell, ++index) - if (cell->refine_flag_set() - && - (smoothness_indicators(index) > threshold_smoothness) - && - (cell->active_fe_index()+1 < fe_collection.size())) - { - cell->clear_refine_flag(); - cell->set_active_fe_index (cell->active_fe_index() + 1); - } - } - - triangulation.execute_coarsening_and_refinement (); - } + GridRefinement::refine_and_coarsen_fixed_number (triangulation, + estimated_error_per_cell, + 0.3, 0.03); + triangulation.execute_coarsening_and_refinement (); } diff --git a/tests/deal.II/inhomogeneous_constraints/cmp/generic b/tests/deal.II/inhomogeneous_constraints/cmp/generic index 2a78e7a212..ae49e378f0 100644 --- a/tests/deal.II/inhomogeneous_constraints/cmp/generic +++ b/tests/deal.II/inhomogeneous_constraints/cmp/generic @@ -17,35 +17,35 @@ DEAL:2d:cg::Convergence step 26 value 2.2e-07 DEAL:2d::Distribute error: 0 DEAL:2d:: DEAL:2d:: -DEAL:2d:: Number of active cells: 237 -DEAL:2d:: Number of degrees of freedom: 1385 -DEAL:2d:: Number of hanging node constraints: 162 -DEAL:2d:: Total number of constraints: 380 -DEAL:2d:: Reference matrix nonzeros: 24829, actually: 15897 -DEAL:2d:: Test matrix 1 nonzeros: 24829, actually: 15897 +DEAL:2d:: Number of active cells: 363 +DEAL:2d:: Number of degrees of freedom: 1600 +DEAL:2d:: Number of hanging node constraints: 36 +DEAL:2d:: Total number of constraints: 284 +DEAL:2d:: Reference matrix nonzeros: 24284, actually: 17700 +DEAL:2d:: Test matrix 1 nonzeros: 24284, actually: 17700 DEAL:2d:: Matrix difference norm: 0 DEAL:2d:: RHS difference norm: 0 -DEAL:2d:: Test matrix 2 nonzeros: 24829, actually: 15897 +DEAL:2d:: Test matrix 2 nonzeros: 24284, actually: 17700 DEAL:2d:: Matrix difference norm: 0 DEAL:2d:: RHS difference norm: 0 -DEAL:2d:cg::Starting value 22. -DEAL:2d:cg::Convergence step 38 value 2.3e-07 +DEAL:2d:cg::Starting value 20. +DEAL:2d:cg::Convergence step 48 value 1.8e-07 DEAL:2d::Distribute error: 0 DEAL:2d:: DEAL:2d:: -DEAL:2d:: Number of active cells: 261 -DEAL:2d:: Number of degrees of freedom: 2021 -DEAL:2d:: Number of hanging node constraints: 327 -DEAL:2d:: Total number of constraints: 580 -DEAL:2d:: Reference matrix nonzeros: 48091, actually: 30641 -DEAL:2d:: Test matrix 1 nonzeros: 48091, actually: 30641 +DEAL:2d:: Number of active cells: 696 +DEAL:2d:: Number of degrees of freedom: 3006 +DEAL:2d:: Number of hanging node constraints: 108 +DEAL:2d:: Total number of constraints: 408 +DEAL:2d:: Reference matrix nonzeros: 46796, actually: 36608 +DEAL:2d:: Test matrix 1 nonzeros: 46796, actually: 36608 DEAL:2d:: Matrix difference norm: 0 DEAL:2d:: RHS difference norm: 0 -DEAL:2d:: Test matrix 2 nonzeros: 48091, actually: 30641 +DEAL:2d:: Test matrix 2 nonzeros: 46796, actually: 36608 DEAL:2d:: Matrix difference norm: 0 DEAL:2d:: RHS difference norm: 0 -DEAL:2d:cg::Starting value 30. -DEAL:2d:cg::Convergence step 52 value 3.9e-07 +DEAL:2d:cg::Starting value 23. +DEAL:2d:cg::Convergence step 74 value 2.8e-07 DEAL:2d::Distribute error: 0 DEAL:3d:: DEAL:3d:: @@ -65,33 +65,33 @@ DEAL:3d:cg::Convergence step 1 value 0 DEAL:3d::Distribute error: 0 DEAL:3d:: DEAL:3d:: -DEAL:3d:: Number of active cells: 43 -DEAL:3d:: Number of degrees of freedom: 145 -DEAL:3d:: Number of hanging node constraints: 40 -DEAL:3d:: Total number of constraints: 128 -DEAL:3d:: Reference matrix nonzeros: 3663, actually: 209 -DEAL:3d:: Test matrix 1 nonzeros: 3663, actually: 209 +DEAL:3d:: Number of active cells: 29 +DEAL:3d:: Number of degrees of freedom: 74 +DEAL:3d:: Number of hanging node constraints: 20 +DEAL:3d:: Total number of constraints: 68 +DEAL:3d:: Reference matrix nonzeros: 1302, actually: 86 +DEAL:3d:: Test matrix 1 nonzeros: 1302, actually: 86 DEAL:3d:: Matrix difference norm: 0 DEAL:3d:: RHS difference norm: 0 -DEAL:3d:: Test matrix 2 nonzeros: 3663, actually: 209 +DEAL:3d:: Test matrix 2 nonzeros: 1302, actually: 86 DEAL:3d:: Matrix difference norm: 0 DEAL:3d:: RHS difference norm: 0 -DEAL:3d:cg::Starting value 5.8 -DEAL:3d:cg::Convergence step 6 value 4.5e-09 +DEAL:3d:cg::Starting value 2.2 +DEAL:3d:cg::Convergence step 4 value 4.2e-09 DEAL:3d::Distribute error: 0 DEAL:3d:: DEAL:3d:: -DEAL:3d:: Number of active cells: 99 -DEAL:3d:: Number of degrees of freedom: 561 -DEAL:3d:: Number of hanging node constraints: 197 -DEAL:3d:: Total number of constraints: 422 -DEAL:3d:: Reference matrix nonzeros: 20835, actually: 3425 -DEAL:3d:: Test matrix 1 nonzeros: 20835, actually: 3425 +DEAL:3d:: Number of active cells: 120 +DEAL:3d:: Number of degrees of freedom: 230 +DEAL:3d:: Number of hanging node constraints: 61 +DEAL:3d:: Total number of constraints: 182 +DEAL:3d:: Reference matrix nonzeros: 4702, actually: 696 +DEAL:3d:: Test matrix 1 nonzeros: 4702, actually: 696 DEAL:3d:: Matrix difference norm: 0 DEAL:3d:: RHS difference norm: 0 -DEAL:3d:: Test matrix 2 nonzeros: 20835, actually: 3425 +DEAL:3d:: Test matrix 2 nonzeros: 4702, actually: 696 DEAL:3d:: Matrix difference norm: 0 DEAL:3d:: RHS difference norm: 0 -DEAL:3d:cg::Starting value 4.8 -DEAL:3d:cg::Convergence step 10 value 4.2e-08 +DEAL:3d:cg::Starting value 3.1 +DEAL:3d:cg::Convergence step 7 value 2.3e-09 DEAL:3d::Distribute error: 0 -- 2.39.5