* get the same result using <code>cell-@>measure()</code>, but this
* function also works for cells that do not exist except that you make it
* up by naming its vertices from the list.
- *
- * @note Since <code>dim</code> does not explicitly appear in the function
- * signature, you must explicitly specify both dimensions when using this
- * function.
*/
- template <int dim, int spacedim>
- double cell_measure (const std::vector<Point<spacedim> > &all_vertices,
+ template <int dim>
+ double cell_measure (const std::vector<Point<dim> > &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.
+ * A version of the last function that can accept input for nonzero
+ * codimension cases. This function only exists to aid generic programming
+ * and calling it will just raise an exception.
*/
- template <int dim>
- double cell_measure (const std::vector<Point<dim> > &all_vertices,
- const unsigned int (&vertex_indices)[GeometryInfo<dim>::vertices_per_cell]);
+ template <int dim, typename T>
+ double cell_measure (const T &, ...);
/*@}*/
/**
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])
+ template <int dim, typename T>
+ double cell_measure (const T &, ...)
{
- return cell_measure<dim, dim>(all_vertices, vertex_indices);
+ Assert(false, ExcNotImplemented());
+ return std::numeric_limits<double>::quiet_NaN();
}
-
-
template <int dim, typename Predicate, int spacedim>
void transform (const Predicate &predicate,
Triangulation<dim, spacedim> &triangulation)
template <>
double
- cell_measure<1, 1>
+ cell_measure<1>
(const std::vector<Point<1> > &all_vertices,
const unsigned int (&vertex_indices)[GeometryInfo<1>::vertices_per_cell])
{
template <>
double
- cell_measure<1, 2>
- (const std::vector<Point<2> > &,
- const unsigned int (&)[GeometryInfo<1>::vertices_per_cell])
- {
- Assert(false, ExcNotImplemented());
- return std::numeric_limits<double>::quiet_NaN();
- }
-
-
-
- template <>
- double
- cell_measure<1, 3>
- (const std::vector<Point<3> > &,
- const unsigned int (&)[GeometryInfo<1>::vertices_per_cell])
- {
- Assert(false, ExcNotImplemented());
- return std::numeric_limits<double>::quiet_NaN();
- }
-
-
-
- template <>
- double
- cell_measure<2, 3>
- (const std::vector<Point<3> > &,
- const unsigned int (&)[GeometryInfo<2>::vertices_per_cell])
- {
- Assert(false, ExcNotImplemented());
- return std::numeric_limits<double>::quiet_NaN();
- }
-
-
-
- template <>
- double
- cell_measure<3, 3>
+ cell_measure<3>
(const std::vector<Point<3> > &all_vertices,
const unsigned int (&vertex_indices)[GeometryInfo<3>::vertices_per_cell])
{
template <>
double
- cell_measure<2, 2>
+ cell_measure<2>
(const std::vector<Point<2> > &all_vertices,
const unsigned int (&vertex_indices) [GeometryInfo<2>::vertices_per_cell])
{
// throw an exception if no such cells should exist.
if (!triangulation.check_for_distorted_cells)
{
- const double cell_measure = GridTools::cell_measure<1, spacedim>
+ const double cell_measure = GridTools::cell_measure<1>
(triangulation.vertices, cells[cell_no].vertices);
AssertThrow(cell_measure > 0, ExcGridHasInvalidCell(cell_no));
}
// See the note in the 1D function on this if statement.
if (!triangulation.check_for_distorted_cells)
{
- const double cell_measure = GridTools::cell_measure<2, spacedim>
+ const double cell_measure = GridTools::cell_measure<2>
(triangulation.vertices, cells[cell_no].vertices);
AssertThrow(cell_measure > 0, ExcGridHasInvalidCell(cell_no));
}
// See the note in the 1D function on this if statement.
if (!triangulation.check_for_distorted_cells)
{
- const double cell_measure = GridTools::cell_measure<3, spacedim>
+ const double cell_measure = GridTools::cell_measure<3>
(triangulation.vertices, cells[cell_no].vertices);
AssertThrow(cell_measure > 0, ExcGridHasInvalidCell(cell_no));
}