From 0dff6431545fa8901ad999de4deb1a014876a056 Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Wed, 24 Mar 2021 14:15:10 -0600 Subject: [PATCH] New Triangulation signal `post_p4est_refinement`. --- include/deal.II/grid/tria.h | 9 +++++++++ source/distributed/tria.cc | 4 ++++ source/dofs/dof_handler.cc | 13 ++++++++++--- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/include/deal.II/grid/tria.h b/include/deal.II/grid/tria.h index 8b9c753406..0a6b7c0f27 100644 --- a/include/deal.II/grid/tria.h +++ b/include/deal.II/grid/tria.h @@ -2219,6 +2219,15 @@ public: */ boost::signals2::signal pre_distributed_refinement; + /** + * This signal is triggered during execution of the + * parallel::distributed::Triangulation::execute_coarsening_and_refinement() + * function. At the time this signal is triggered, the p4est oracle has been + * refined and the cell relations have been updated. The triangulation is + * unchanged otherwise, and the p4est oracle has not yet been repartitioned. + */ + boost::signals2::signal post_p4est_refinement; + /** * This signal is triggered at the end of execution of the * parallel::distributed::Triangulation::execute_coarsening_and_refinement() diff --git a/source/distributed/tria.cc b/source/distributed/tria.cc index 583464bbfc..6510f76761 100644 --- a/source/distributed/tria.cc +++ b/source/distributed/tria.cc @@ -2689,6 +2689,10 @@ namespace parallel // has happened, we need to update the quadrant cell relations update_cell_relations(); + // signals that parallel_forest has been refined and cell relations have + // been updated + this->signals.post_p4est_refinement(); + // before repartitioning the mesh, save a copy of the current positions of // quadrants // only if data needs to be transferred later diff --git a/source/dofs/dof_handler.cc b/source/dofs/dof_handler.cc index 0fb78f4f63..7529d0e29e 100644 --- a/source/dofs/dof_handler.cc +++ b/source/dofs/dof_handler.cc @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -3049,8 +3050,14 @@ DoFHandler::connect_to_triangulation_signals() // attach corresponding callback functions dealing with the transfer of // active FE indices depending on the type of triangulation if (dynamic_cast< - const dealii::parallel::DistributedTriangulationBase *>( - &this->get_triangulation())) + const dealii::parallel::fullydistributed::Triangulation + *>(&this->get_triangulation())) + { + // no transfer of active FE indices for this class + } + else if (dynamic_cast< + const dealii::parallel::distributed::Triangulation + *>(&this->get_triangulation())) { // repartitioning signals this->tria_listeners_for_transfer.push_back( @@ -3067,7 +3074,7 @@ DoFHandler::connect_to_triangulation_signals() // refinement signals this->tria_listeners_for_transfer.push_back( - this->tria->signals.pre_distributed_refinement.connect( + this->tria->signals.post_p4est_refinement.connect( [this]() { this->pre_distributed_transfer_action(); })); this->tria_listeners_for_transfer.push_back( this->tria->signals.post_distributed_refinement.connect( -- 2.39.5