From a1a56e529f9f194f14339b8528732aa7487c8962 Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 22 Jan 2014 19:13:57 +0000 Subject: [PATCH] Patch by Martin Steigemann: Handle the case of zero error indicators better when finding the threshold for mesh refinement. git-svn-id: https://svn.dealii.org/trunk@32286 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 11 +++++++++++ deal.II/source/distributed/grid_refinement.cc | 11 ++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 69ee2024b2..40dee84da4 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -84,6 +84,17 @@ inconvenience this causes.

Specific improvements

    +
  1. Improved: In rare cases when the vector of error indicators + has entries equal to zero the adjust_interesting_range method + produces a negative lower bound. As a result the + parallel::distributed::GridRefinement::refine_and_coarsen_fixed_* + methods flagged the wrong number of cells for coarsening and refinement. + This is now changed by adjusting the lower bound in adjust_interesting_range + only, if not equal to zero. +
    + (Martin Steigemann, 2014/01/22) +
  2. +
  3. Changed: It was previously possible to set the active_fe_index on non-active cells of an hp::DoFHandler. However, this was prone to mistakes because it may lead to the assumption diff --git a/deal.II/source/distributed/grid_refinement.cc b/deal.II/source/distributed/grid_refinement.cc index f7f185ff4e..e4a5e8f414 100644 --- a/deal.II/source/distributed/grid_refinement.cc +++ b/deal.II/source/distributed/grid_refinement.cc @@ -199,11 +199,16 @@ namespace Assert (interesting_range[0] <= interesting_range[1], ExcInternalError()); + Assert (interesting_range[0] >= 0, + ExcInternalError()); + + // adjust the lower bound only + // if the end point is not equal + // to zero, otherwise it could + // happen, that the result + // becomes negative if (interesting_range[0] > 0) interesting_range[0] *= 0.99; - else - interesting_range[0] - -= 0.01 * (interesting_range[1] - interesting_range[0]); if (interesting_range[1] > 0) interesting_range[1] *= 1.01; -- 2.39.5