From 62def686e9dda3a058e216f647eb62a21ba2d35c Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Wed, 8 Mar 2017 11:10:16 +0100 Subject: [PATCH] Add additional listener to grid movement --- include/deal.II/grid/grid_tools.h | 2 +- include/deal.II/grid/tria.h | 9 +++++++++ source/fe/fe_values.cc | 4 ++++ source/grid/tria.cc | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index 7b1f2e9369..fb8341a644 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -1729,7 +1729,7 @@ namespace GridTools } // Make sure FEValues notices that the mesh has changed - triangulation.signals.post_refinement(); + triangulation.signals.mesh_movement(); } diff --git a/include/deal.II/grid/tria.h b/include/deal.II/grid/tria.h index b1380ae512..c1ddaf5764 100644 --- a/include/deal.II/grid/tria.h +++ b/include/deal.II/grid/tria.h @@ -2090,6 +2090,15 @@ public: */ boost::signals2::signal post_refinement; + /** + * This signal is triggered when a function in deal.II moves the grid + * points of a mesh, e.g. GridTools::transform. Unfortunately, + * modification of a vertex in user code through + * cell_iterator->vertex(v) = xxxx cannot be detected by this + * method. + */ + boost::signals2::signal mesh_movement; + /** * This signal is triggered for each cell that is going to be coarsened. * diff --git a/source/fe/fe_values.cc b/source/fe/fe_values.cc index 9736e93d30..f94e2cc106 100644 --- a/source/fe/fe_values.cc +++ b/source/fe/fe_values.cc @@ -3492,6 +3492,10 @@ maybe_invalidate_previous_present_cell (const typename Triangulationget_triangulation().signals.mesh_movement.connect + (std_cxx11::bind (&FEValuesBase::invalidate_present_cell, + std_cxx11::ref(static_cast&>(*this)))); tria_listener = cell->get_triangulation().signals.post_refinement.connect (std_cxx11::bind (&FEValuesBase::invalidate_present_cell, diff --git a/source/grid/tria.cc b/source/grid/tria.cc index 6a5ac44105..a52cde1fd4 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -8968,6 +8968,7 @@ Triangulation (const MeshSmoothing smooth_grid, signals.create.connect (signals.any_change); signals.post_refinement.connect (signals.any_change); signals.clear.connect (signals.any_change); + signals.mesh_movement.connect (signals.any_change); } -- 2.39.5