From: Wolfgang Bangerth Date: Wed, 22 Jan 2020 02:59:54 +0000 (-0700) Subject: Provide GeometryInfo::face_indices(). X-Git-Tag: v9.2.0-rc1~615^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6f96d099622b366d20ce32473b0752bf12e88bf;p=dealii.git Provide GeometryInfo::face_indices(). --- diff --git a/include/deal.II/base/geometry_info.h b/include/deal.II/base/geometry_info.h index 496149883e..76e752e8e2 100644 --- a/include/deal.II/base/geometry_info.h +++ b/include/deal.II/base/geometry_info.h @@ -22,6 +22,8 @@ #include #include +#include + #include @@ -1835,6 +1837,23 @@ struct GeometryInfo */ static constexpr unsigned int faces_per_cell = 2 * dim; + /** + * Return an object that can be thought of as an array containing all + * indices from zero to `faces_per_cell`. This allows to write code + * using range-based for loops of the following kind: + * @code + * for (auto &cell : triangulation.active_cell_iterators()) + * for (auto face_index : GeometryInfo::face_indices) + * if (cell->face(face_index)->at_boundary()) + * ... do something ... + * @endcode + * Here, we are looping over all faces of all cells, with `face_index` + * taking on all valid indices for faces (zero and one in 1d, zero + * through three in 2d, and zero through 5 in 3d). + */ + static boost::integer_range + face_indices(); + /** * Maximum number of children of a refined face, i.e. the number of children * of an isotropically refined face. @@ -2667,6 +2686,14 @@ GeometryInfo<3>::unit_cell_vertex(const unsigned int vertex) +template +boost::integer_range +GeometryInfo::face_indices() +{ + return boost::irange(0U, faces_per_cell); +} + + template inline Point GeometryInfo::unit_cell_vertex(const unsigned int)