]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Do not serialize active cell indices; rather, re-compute them upon loading a mesh.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 10 Apr 2015 21:21:44 +0000 (16:21 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 13 Apr 2015 00:10:17 +0000 (19:10 -0500)
include/deal.II/grid/tria.h
include/deal.II/grid/tria_levels.h

index 703e97698b85298edcea2a5a7396dd888e52c08f..c6dc8f031488e8b452fc75bb1909bd0ec9e9a1e2 100644 (file)
@@ -3315,6 +3315,27 @@ Triangulation<dim,spacedim>::load (Archive &ar,
   ar &anisotropic_refinement;
   ar &number_cache;
 
+  // the levels do not serialize the active_cell_indices because
+  // they are easy enough to rebuild upon re-loading data. do
+  // this here. don't forget to first resize the fields appropriately
+  {
+    for (unsigned int l=0; l<levels.size(); ++l)
+      levels[l]->active_cell_indices.resize (levels[l]->refine_flags.size());
+
+    unsigned int active_cell_index = 0;
+    for (cell_iterator cell=begin(); cell!=end(); ++cell)
+      if (cell->has_children())
+        cell->set_active_cell_index (numbers::invalid_unsigned_int);
+      else
+        {
+          cell->set_active_cell_index (active_cell_index);
+          ++active_cell_index;
+        }
+
+    Assert (active_cell_index == n_active_cells(), ExcInternalError());
+  }
+
+
   bool my_check_for_distorted_cells;
   ar &my_check_for_distorted_cells;
 
index a29050e498587f8fa15a77da0ba151bdccaf6e8d..e95cf64e1cf2aa3391c3361715fbfab4abc1a488 100644 (file)
@@ -274,7 +274,11 @@ namespace internal
                                    const unsigned int)
     {
       ar &refine_flags &coarsen_flags;
-      ar &active_cell_indices;
+
+      // do not serialize 'active_cell_indices' here. instead of storing them
+      // to the stream and re-reading them again later, we just rebuild them
+      // in Triangulation::load()
+
       ar &neighbors;
       ar &subdomain_ids;
       ar &level_subdomain_ids;
@@ -290,7 +294,11 @@ namespace internal
                                  const unsigned int)
     {
       ar &refine_flags &coarsen_flags;
-      ar &active_cell_indices;
+
+      // do not serialize 'active_cell_indices' here. instead of storing them
+      // to the stream and re-reading them again later, we just rebuild them
+      // in Triangulation::load()
+
       ar &neighbors;
       ar &subdomain_ids;
       ar &level_subdomain_ids;

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.