]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Ensure we only set boundary ids on boundary faces. 16947/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 1 May 2024 15:38:17 +0000 (21:08 +0530)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 1 May 2024 15:38:17 +0000 (21:08 +0530)
examples/step-3/doc/results.dox

index d5baf27f87f2b10214a50935cc7294990af078f8..7aade077689774db7d6d09b539313b24b0338657 100644 (file)
@@ -122,13 +122,14 @@ suggestions:
   For example, we can label all of the cells along the top and
   bottom boundaries with a boundary indicator 1 by checking to
   see if the cell centers' y-coordinates are within a tolerance
-  (here 1e-12) of -1 and 1. Try this immediately after calling
+  (here `1e-12`) of -1 and 1. Try this immediately after calling
   GridGenerator::hyper_cube(), as before:
   @code
   for (auto &face : triangulation.active_face_iterators())
-    if (std::fabs(face->center()(1) - (-1.0)) < 1e-12 ||
-        std::fabs(face->center()(1) - (1.0)) < 1e-12)
-      face->set_boundary_id(1);
+    if (face->at_boundary())
+      if (std::fabs(face->center()(1) - (-1.0)) < 1e-12 ||
+          std::fabs(face->center()(1) - (1.0)) < 1e-12)
+        face->set_boundary_id(1);
   @endcode
   Although this code is a bit longer than before, it is useful for
   complex geometries, as it does not require knowledge of face labels.

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.