From fa0eaa7bbc14beece374d5c92a75472b423fd6b2 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Thu, 2 May 2013 01:12:05 +0000 Subject: [PATCH] throw exception if p4est maximum refinement level is reached git-svn-id: https://svn.dealii.org/trunk@29423 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 6 ++++++ deal.II/source/distributed/tria.cc | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 9136c23751..415883084e 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -111,6 +111,12 @@ this function.
    +
  1. Fixed: Generate an error if the users tries to refine a cell +that is already on the maximum level in a distributed triangulation. +
    +(Timo Heister, 2013/05/01) +
  2. +
  3. Fixed: The version of ParameterHandler::set that takes a boolean as second argument was broken and did not work. This is now fixed.
    diff --git a/deal.II/source/distributed/tria.cc b/deal.II/source/distributed/tria.cc index ebc48f1483..f8052d1a2c 100644 --- a/deal.II/source/distributed/tria.cc +++ b/deal.II/source/distributed/tria.cc @@ -197,6 +197,8 @@ namespace internal static size_t (&connectivity_memory_used) (types<2>::connectivity *p4est); + + static const unsigned max_level; }; int (&functions<2>::quadrant_compare) (const void *v1, const void *v2) @@ -327,6 +329,7 @@ namespace internal size_t (&functions<2>::connectivity_memory_used) (types<2>::connectivity *p4est) = p4est_connectivity_memory_used; + const unsigned int functions<2>::max_level = P4EST_MAXLEVEL; template <> struct functions<3> { @@ -457,6 +460,8 @@ namespace internal static size_t (&connectivity_memory_used) (types<3>::connectivity *p4est); + + static const unsigned max_level; }; @@ -590,6 +595,7 @@ namespace internal size_t (&functions<3>::connectivity_memory_used) (types<3>::connectivity *p4est) = p8est_connectivity_memory_used; + const unsigned int functions<3>::max_level = P8EST_MAXLEVEL; template @@ -2849,6 +2855,18 @@ namespace parallel #endif + // safety check: p4est has an upper limit on the level of a cell + if (this->n_levels()==dealii::internal::p4est::functions::max_level) + { + for (typename Triangulation::active_cell_iterator + cell = this->begin_active(dealii::internal::p4est::functions::max_level-1); + cell != this->end(dealii::internal::p4est::functions::max_level-1); ++cell) + { + AssertThrow(cell->refine_flag_set(), + ExcMessage("Fatal Error: maximum refinement level of p4est reached.")); + } + } + // now do the work we're // supposed to do when we are // in charge -- 2.39.5