From: Peter Munch Date: Tue, 30 Mar 2021 15:29:49 +0000 (+0200) Subject: Reset policy during Triangulation::load() X-Git-Tag: v9.3.0-rc1~264^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11983%2Fhead;p=dealii.git Reset policy during Triangulation::load() --- diff --git a/include/deal.II/grid/tria.h b/include/deal.II/grid/tria.h index 8b9c753406..4bdb4fac7a 100644 --- a/include/deal.II/grid/tria.h +++ b/include/deal.II/grid/tria.h @@ -3866,6 +3866,12 @@ private: void clear_despite_subscriptions(); + /** + * Reset triangulation policy. + */ + void + reset_policy(); + /** * For all cells, set the active cell indices so that active cells know the * how many-th active cell they are, and all other cells have an invalid @@ -4243,6 +4249,7 @@ Triangulation::load(Archive &ar, const unsigned int) reset_global_cell_indices(); } + reset_policy(); bool my_check_for_distorted_cells; ar & my_check_for_distorted_cells; diff --git a/source/grid/tria.cc b/source/grid/tria.cc index 129d57cfb8..10f106a297 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -10486,6 +10486,35 @@ Triangulation::create_triangulation_compatibility( } +template +void +Triangulation::reset_policy() +{ + this->update_reference_cells(); + + if (this->all_reference_cells_are_hyper_cube()) + { + this->policy = + std::make_unique>(); + } + else + { +#ifndef DEAL_II_WITH_SIMPLEX_SUPPORT + Assert(false, ExcNeedsSimplexSupport()); +#endif + + this->policy = + std::make_unique>(); + } +} + + template void @@ -10507,8 +10536,6 @@ Triangulation::create_triangulation( { internal::TriangulationImplementation::Implementation:: create_triangulation(v, cells, subcelldata, *this); - - this->update_reference_cells(); } catch (...) { @@ -10516,26 +10543,7 @@ Triangulation::create_triangulation( throw; } - if (this->all_reference_cells_are_hyper_cube()) - { - this->policy = - std::make_unique>(); - } - else - { -#ifndef DEAL_II_WITH_SIMPLEX_SUPPORT - Assert(false, ExcNeedsSimplexSupport()); -#endif - - this->policy = - std::make_unique>(); - } + reset_policy(); // update our counts of the various elements of a triangulation, and set // active_cell_indices of all cells diff --git a/tests/serialization/triangulation_02.cc b/tests/serialization/triangulation_02.cc index 90457a4135..a78b10ee75 100644 --- a/tests/serialization/triangulation_02.cc +++ b/tests/serialization/triangulation_02.cc @@ -169,6 +169,11 @@ test() do_boundary(tria_1); verify(tria_1, tria_2); + + // test if the policy has been set + tria_2.begin_active()->set_refine_flag(); + tria_2.prepare_coarsening_and_refinement(); + tria_2.execute_coarsening_and_refinement(); }