From 4ed6457454dc867969c63ad18bd57b4d78f6d769 Mon Sep 17 00:00:00 2001 From: Lei Qiao Date: Mon, 12 Oct 2015 19:19:45 -0500 Subject: [PATCH] add signal pre_coarsening_on_cell to Triangulation. --- include/deal.II/grid/tria.h | 7 +++++++ source/grid/tria.cc | 14 +++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/include/deal.II/grid/tria.h b/include/deal.II/grid/tria.h index a4dfba2c24..52a81a6a9a 100644 --- a/include/deal.II/grid/tria.h +++ b/include/deal.II/grid/tria.h @@ -1921,6 +1921,13 @@ public: boost::signals2::signal create; boost::signals2::signal pre_refinement; boost::signals2::signal post_refinement; + /** + * @note the signal parameter @p cell is correspond to the new active cell + * after coarsening is done rather than a current active cell. + * In another word, all children of @p cell will be deleted after coarsening + * and @p cell will become the new active cell then. + */ + boost::signals2::signal::cell_iterator &cell)> pre_coarsening_on_cell; boost::signals2::signal::cell_iterator &cell)> post_refinement_on_cell; boost::signals2::signal &original_tria)> copy; boost::signals2::signal clear; diff --git a/source/grid/tria.cc b/source/grid/tria.cc index a68cf0a8ff..be2f5b234e 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -11669,11 +11669,15 @@ void Triangulation::execute_coarsening () if (levels.size() >= 2) for (cell = last(); cell!=endc; --cell) if (cell->level()<=static_cast(levels.size()-2) && cell->user_flag_set()) - // use a separate function, - // since this is dimension - // specific - internal::Triangulation::Implementation - ::delete_children (*this, cell, line_cell_count, quad_cell_count); + { + // inform all listeners that cell coarsening is going to happen + signals.pre_coarsening_on_cell(cell); + // use a separate function, + // since this is dimension + // specific + internal::Triangulation::Implementation + ::delete_children (*this, cell, line_cell_count, quad_cell_count); + } // re-compute number of lines and // quads -- 2.39.5