From: Wolfgang Bangerth Date: Fri, 8 Jul 2016 00:09:31 +0000 (-0500) Subject: Err on the safe side. X-Git-Tag: v8.5.0-rc1~905^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c585959155a6220229898a8d494fd26466005e9f;p=dealii.git Err on the safe side. Here, only ask for boundary_ids on faces we know actually are at the boundary. --- diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index 20354c17ee..c094fc2b0b 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -119,10 +119,11 @@ namespace GridGenerator typename Triangulation::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 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::cell_iterator cell = tria.begin(); cell != tria.end(); ++cell) { char id = 0; for (unsigned int d=0; dcenter()(d) > 0) id += 1 << d; + if (cell->center()(d) > 0) + id += (1 << d); cell->set_material_id(id); } }