From d37ae7a7c3a148dd2cc1767244a1cf4f7e1f0a4a Mon Sep 17 00:00:00 2001 From: David Wells Date: Sun, 15 Jun 2025 13:30:43 -0400 Subject: [PATCH] TriaAccessor<0, dim, spacedim>: make the default measure 1.0. This is consistent with ReferenceCell. --- doc/news/changes/minor/20250625Wells | 3 ++ include/deal.II/grid/tria_accessor.h | 55 ++++++++++++++++++++++------ 2 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 doc/news/changes/minor/20250625Wells diff --git a/doc/news/changes/minor/20250625Wells b/doc/news/changes/minor/20250625Wells new file mode 100644 index 0000000000..b15474a043 --- /dev/null +++ b/doc/news/changes/minor/20250625Wells @@ -0,0 +1,3 @@ +Fixed: TriaAccessor::measure() now returns 1 for all `structdim == 0` objects. +
+(David Wells, 2025/06/25) diff --git a/include/deal.II/grid/tria_accessor.h b/include/deal.II/grid/tria_accessor.h index 6b2519a1e3..687b0c3d2e 100644 --- a/include/deal.II/grid/tria_accessor.h +++ b/include/deal.II/grid/tria_accessor.h @@ -1668,11 +1668,14 @@ public: barycenter() const; /** - * Compute the dim-dimensional measure of the object. For a dim-dimensional - * cell in dim-dimensional space, this equals its volume. On the other hand, - * for a 2d cell in 3d space, or if the current object pointed to is a 2d - * face of a 3d cell in 3d space, then the function computes the area the - * object occupies. For a one-dimensional object, return its length. + * Compute the `structdim`-dimensional measure of the object. For a + * `dim`-dimensional cell in `dim`-dimensional space, this equals its volume. + * On the other hand, for a 2d cell in 3d space, or if the current object + * pointed to is a 2d face of a 3d cell in 3d space, then the function + * computes the area the object occupies. For a one-dimensional (i.e., + * `structdim = 1`) object, regardless of `dim` and `spacedim`, return its + * length. Similarly, the measure of any vertex (i.e., `structdim = 0` + * objects) is 1. * * The function only computes the measure of cells, faces or edges assumed * to be represented by (bi-/tri-)linear mappings. In other words, it only @@ -2123,12 +2126,11 @@ public: const bool interpolate_from_surrounding = false) const; /** - * Compute the dim-dimensional measure of the object. For a dim-dimensional - * cell in dim-dimensional space, this equals its volume. On the other hand, - * for a 2d cell in 3d space, or if the current object pointed to is a 2d - * face of a 3d cell in 3d space, then the function computes the area the - * object occupies. For a one-dimensional object, return its length. For a - * zero-dimensional object, return zero. + * Compute the `structdim`-dimensional measure of the present object. Since, + * in this context, `structdim = 0`, this function always returns 1. + * + * @note This is consistent with what ReferenceCells::Vertex::volume() + * returns. */ double measure() const; @@ -2569,6 +2571,25 @@ public: * @} */ + /** + * @name Geometric information about an object + */ + /** + * @{ + */ + + /** + * Return 1. + * + * @note This is consistent with what ReferenceCells::Vertex::volume() + * returns. + */ + static double + measure(); + + /** + * @} + */ /** * Return whether this point is at the boundary of the one-dimensional @@ -6859,7 +6880,7 @@ template inline double TriaAccessor<0, dim, spacedim>::measure() const { - return 0.; + return 1.0; } @@ -7260,6 +7281,16 @@ TriaAccessor<0, 1, spacedim>::quad_index(const unsigned int) } + +template +inline double +TriaAccessor<0, 1, spacedim>::measure() +{ + return 1.0; +} + + + template inline bool TriaAccessor<0, 1, spacedim>::at_boundary() const -- 2.39.5