From: Wolfgang Bangerth Date: Wed, 1 May 2024 15:38:17 +0000 (+0530) Subject: Ensure we only set boundary ids on boundary faces. X-Git-Tag: v9.6.0-rc1~326^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F16947%2Fhead;p=dealii.git Ensure we only set boundary ids on boundary faces. --- diff --git a/examples/step-3/doc/results.dox b/examples/step-3/doc/results.dox index d5baf27f87..7aade07768 100644 --- a/examples/step-3/doc/results.dox +++ b/examples/step-3/doc/results.dox @@ -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.