From: David Wells <wellsd2@rpi.edu>
Date: Thu, 12 May 2016 00:38:57 +0000 (-0400)
Subject: Make cell_measure(...) work again.
X-Git-Tag: v8.5.0-rc1~1042^2
X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2587%2Fhead;p=dealii.git

Make cell_measure(...) work again.

A result of d8bafee27cc was that users can no longer write

cell_measure(...)

with no given template argument (in the codimension zero case). This
commit fixes that.

Note: since dim does not explicitly appear alone and unmodified in the
function arguments of cell_measure<dim, spacedim>, that function can
never have its type (more exactly, the value for dim) inferred correctly
from just the arguments. Put another way, one must always write
cell_measure<dim, spacedim> to use this function. This was not a problem
in the past when Point<dim> appeared instead of Point<spacedim>.
---

diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h
index fd35b9952d..6aca950fea 100644
--- a/include/deal.II/grid/grid_tools.h
+++ b/include/deal.II/grid/grid_tools.h
@@ -166,6 +166,22 @@ namespace GridTools
   double cell_measure (const std::vector<Point<spacedim> > &all_vertices,
                        const unsigned int (&vertex_indices)[GeometryInfo<dim>::vertices_per_cell]);
 
+
+  /**
+   * Same as the last function, but for the codimension zero case. This extra
+   * function allows one to write
+   *
+   * @code
+   * cell_measure(vertices, indices);
+   * @endcode
+   *
+   * and have the template function argument (i.e. <code>dim</code>) inferred
+   * automatically.
+   */
+  template <int dim>
+  double cell_measure (const std::vector<Point<dim> > &all_vertices,
+                       const unsigned int (&vertex_indices)[GeometryInfo<dim>::vertices_per_cell]);
+
   /*@}*/
   /**
    * @name Functions supporting the creation of meshes
@@ -1639,6 +1655,16 @@ namespace GridTools
 
 namespace GridTools
 {
+  // This function just wraps the general case: see the note in its
+  // documentation above.
+  template <int dim>
+  double cell_measure (const std::vector<Point<dim> > &all_vertices,
+                       const unsigned int (&vertex_indices)[GeometryInfo<dim>::vertices_per_cell])
+  {
+    return cell_measure<dim, dim>(all_vertices, vertex_indices);
+  }
+
+
 
   template <int dim, typename Predicate, int spacedim>
   void transform (const Predicate    &predicate,