]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Clear maps, rather than reset pointers. 15877/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 17 Aug 2023 11:54:03 +0000 (05:54 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 17 Aug 2023 11:54:08 +0000 (05:54 -0600)
source/grid/tria.cc

index 4b0c65fa4139922a54740837901ba3e244b1d2e8..83218e36319b694bf04e5a47995b200f58d68e67 100644 (file)
@@ -16086,11 +16086,19 @@ void Triangulation<dim, spacedim>::clear_despite_subscriptions()
   // In 1d, also reset vertex-to-(boundary|manifold) maps to empty maps
   if (dim == 1)
     {
-      vertex_to_boundary_id_map_1d =
-        std::make_unique<std::map<unsigned int, types::boundary_id>>();
-      vertex_to_manifold_id_map_1d =
-        std::make_unique<std::map<unsigned int, types::manifold_id>>();
+      Assert(vertex_to_boundary_id_map_1d != nullptr, ExcInternalError());
+      vertex_to_boundary_id_map_1d->clear();
+
+      Assert(vertex_to_manifold_id_map_1d != nullptr, ExcInternalError());
+      vertex_to_manifold_id_map_1d->clear();
     }
+  else
+    {
+      // For dim>1, these maps should simply not exist.
+      Assert(vertex_to_boundary_id_map_1d == nullptr, ExcInternalError());
+      Assert(vertex_to_manifold_id_map_1d == nullptr, ExcInternalError());
+    }
+
 
   number_cache = internal::TriangulationImplementation::NumberCache<dim>();
 }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.