From: Wolfgang Bangerth Date: Tue, 13 Jun 2023 19:22:51 +0000 (-0600) Subject: Clarify why n_faces() is only possible on cells. X-Git-Tag: v9.5.0-rc1~118^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F15356%2Fhead;p=dealii.git Clarify why n_faces() is only possible on cells. --- diff --git a/include/deal.II/grid/tria_accessor.h b/include/deal.II/grid/tria_accessor.h index a8d0da59dd..7148294c37 100644 --- a/include/deal.II/grid/tria_accessor.h +++ b/include/deal.II/grid/tria_accessor.h @@ -1740,9 +1740,13 @@ public: n_lines() const; /** - * Number of faces. - * - * @note Only implemented for cells (structdim==dim). + * Return the number of faces for a cell. This function is only + * implemented for cells (i.e., `structdim==dim`) to avoid the question + * of what exactly is meant in a construct such as + * `cell->face(f)->n_faces()`. If you want to ask how many bounding + * lines a face of a 3d cell has, use `cell->face(f)->n_lines()`; if + * you want to ask about the number of vertices of a face of a 2d cell, + * use `cell->face(f)->n_vertices()`. */ unsigned int n_faces() const; diff --git a/include/deal.II/grid/tria_accessor.templates.h b/include/deal.II/grid/tria_accessor.templates.h index e92a899271..f9b70a7d76 100644 --- a/include/deal.II/grid/tria_accessor.templates.h +++ b/include/deal.II/grid/tria_accessor.templates.h @@ -2397,7 +2397,10 @@ template unsigned int TriaAccessor::n_faces() const { - AssertDimension(structdim, dim); + Assert(structdim == dim, + ExcMessage("This function can only be used on objects " + "that are cells, but not on faces or edges " + "that bound cells.")); return this->reference_cell().n_faces(); }