]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix a bug in 3D.
authorBruno Turcksin <bruno.turcksin@gmail.com>
Wed, 30 Sep 2015 21:09:23 +0000 (16:09 -0500)
committerBruno Turcksin <bruno.turcksin@gmail.com>
Wed, 30 Sep 2015 21:09:23 +0000 (16:09 -0500)
source/grid/grid_tools.cc

index 9756b80b16d0dbc2f01f1726f2179932e2fca902..71f0dadbeb0f40fd0454c1cfd07487ed1c0d5ff6 100644 (file)
@@ -1609,16 +1609,29 @@ next_cell:
     // Take care of hanging nodes
     cell = triangulation.begin_active();
     for (; cell!=endc; ++cell)
-      for (unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
-        {
-          if ((cell->at_boundary(i)==false) && (cell->neighbor_level(i)<cell->level()))
-            {
-              typename Triangulation<dim,spacedim>::active_cell_iterator adjacent_cell =
-                cell->neighbor(i);
-              for (unsigned int j=0; j<GeometryInfo<dim>::vertices_per_face; ++j)
-                vertex_to_cell_map[cell->face(i)->vertex_index(j)].insert(adjacent_cell);
-            }
-        }
+      {
+        for (unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
+          {
+            if ((cell->at_boundary(i)==false) && (cell->neighbor(i)->active()))
+              {
+                typename Triangulation<dim,spacedim>::active_cell_iterator adjacent_cell =
+                  cell->neighbor(i);
+                for (unsigned int j=0; j<GeometryInfo<dim>::vertices_per_face; ++j)
+                  vertex_to_cell_map[cell->face(i)->vertex_index(j)].insert(adjacent_cell);
+              }
+          }
+
+        // in 3d also loop over the edges
+        if (dim==3)
+          {
+            for (unsigned int i=0; i<GeometryInfo<dim>::lines_per_cell; ++i)
+              if (cell->line(i)->has_children())
+                // the only place where this vertex could have been
+                // hiding is on the mid-edge point of the edge we
+                // are looking at
+                vertex_to_cell_map[cell->line(i)->child(0)->vertex_index(1)].insert(cell);
+          }
+      }
 
     return vertex_to_cell_map;
   }

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.