]> https://gitweb.dealii.org/ - dealii.git/commitdiff
p:f:Tria: Fix bug when a process does not own cells on a level
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Fri, 7 May 2021 21:18:25 +0000 (23:18 +0200)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Sat, 8 May 2021 09:53:17 +0000 (11:53 +0200)
source/distributed/fully_distributed_tria.cc
source/grid/tria.cc

index 802d8b599690c2c374f3e6a9b59fe0114b60fac7..ca160614c8dcf7b78a1a5ce26a3efe47abf27043 100644 (file)
@@ -184,7 +184,9 @@ namespace parallel
             }
 
           // 4b) set actual (level_)subdomain_ids
-          for (unsigned int level = 0; level < cell_infos.size(); ++level)
+          for (unsigned int level = 0;
+               level < cell_infos.size() && !cell_infos[level].empty();
+               ++level)
             {
               auto cell      = this->begin(level);
               auto cell_info = cell_infos[level].begin();
index 2f737a0bb4dce4af1b36c1fd5acd2913d70b6a22..d7900e35c1f0bb2a72654862c20ef7273ae68a92 100644 (file)
@@ -10660,8 +10660,12 @@ Triangulation<dim, spacedim>::create_triangulation(
           return a_id < b_id;
       });
 
-  // 2) create all levels via a sequence of refinements
-  for (unsigned int level = 0; level < cell_infos.size(); ++level)
+  // 2) create all levels via a sequence of refinements. note that
+  //    we must make sure that we actually have cells on this level,
+  //    which is not clear in a parallel context for some processes
+  for (unsigned int level = 0;
+       level < cell_infos.size() && !cell_infos[level].empty();
+       ++level)
     {
       // a) set manifold ids here (because new vertices have to be
       //    positioned correctly during each refinement step)
@@ -10714,7 +10718,9 @@ Triangulation<dim, spacedim>::create_triangulation(
     }
 
   // 3) set boundary ids
-  for (unsigned int level = 0; level < cell_infos.size(); ++level)
+  for (unsigned int level = 0;
+       level < cell_infos.size() && !cell_infos[level].empty();
+       ++level)
     {
       auto cell      = this->begin(level);
       auto cell_info = cell_infos[level].begin();

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.