From 2a52a6a0d33fc2d2aa6c4493ac50a4cfb8f7c5ad Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 1 May 2024 21:08:17 +0530 Subject: [PATCH] Ensure we only set boundary ids on boundary faces. --- examples/step-3/doc/results.dox | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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. -- 2.39.5