]> https://gitweb.dealii.org/ - dealii.git/commitdiff
TriaAccessor<0, dim, spacedim>: make the default measure 1.0. 18582/head
authorDavid Wells <drwells@email.unc.edu>
Sun, 15 Jun 2025 17:30:43 +0000 (13:30 -0400)
committerDavid Wells <drwells@email.unc.edu>
Thu, 26 Jun 2025 20:19:20 +0000 (16:19 -0400)
This is consistent with ReferenceCell.

doc/news/changes/minor/20250625Wells [new file with mode: 0644]
include/deal.II/grid/tria_accessor.h

diff --git a/doc/news/changes/minor/20250625Wells b/doc/news/changes/minor/20250625Wells
new file mode 100644 (file)
index 0000000..b15474a
--- /dev/null
@@ -0,0 +1,3 @@
+Fixed: TriaAccessor::measure() now returns 1 for all `structdim == 0` objects.
+<br>
+(David Wells, 2025/06/25)
index 6b2519a1e301ecb2c2b3fff2d18a53a2abc0c067..687b0c3d2ef2769b1c40e5541ddea451aa9befc4 100644 (file)
@@ -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 <int dim, int spacedim>
 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 <int spacedim>
+inline double
+TriaAccessor<0, 1, spacedim>::measure()
+{
+  return 1.0;
+}
+
+
+
 template <int spacedim>
 inline bool
 TriaAccessor<0, 1, spacedim>::at_boundary() const

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.