]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Err on the safe side. 2779/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 8 Jul 2016 00:09:31 +0000 (19:09 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 8 Jul 2016 00:09:31 +0000 (19:09 -0500)
Here, only ask for boundary_ids on faces we know actually are at the boundary.

source/grid/grid_generator.cc

index 20354c17ee1049b8ae78ae09d9f94e9ab7d9d83a..c094fc2b0bc0b950a836508059bfc2603b5633e9 100644 (file)
@@ -119,10 +119,11 @@ namespace GridGenerator
       typename Triangulation<dim,spacedim>::face_iterator face = tria.begin_face(),
                                                           endface = tria.end_face();
       for (; face!=endface; ++face)
-        {
+        if (face->at_boundary())
           if (face->boundary_id() == 0)
             {
               const Point<spacedim> center (face->center());
+
               if (std::abs(center(0)-p1[0]) < epsilon)
                 face->set_boundary_id(0);
               else if (std::abs(center(0) - p2[0]) < epsilon)
@@ -143,13 +144,14 @@ namespace GridGenerator
                 Assert (false, ExcInternalError());
 
             }
-        }
+
       for (typename Triangulation<dim,spacedim>::cell_iterator cell = tria.begin();
            cell != tria.end(); ++cell)
         {
           char id = 0;
           for (unsigned int d=0; d<dim; ++d)
-            if (cell->center()(d) > 0) id += 1 << d;
+            if (cell->center()(d) > 0)
+              id += (1 << d);
           cell->set_material_id(id);
         }
     }

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.