* @pre The template argument `dim` must equal the dimension
* of the space in which the reference cell you are querying
* lives (i.e., it must equal the result of get_dimension()).
+ *
+ * For ReferenceCells::Vertex, the reference cell is a zero-dimensional point
+ * in a zero-dimensional space: i.e., asking about the value of a polynomial
+ * doesn't make sense since there cannot be any independent variables. To
+ * enable dimension-independent programming we define the zero-dimensional
+ * value to be 1.
*/
template <int dim>
double
switch (this->kind)
{
case ReferenceCells::Vertex:
+ return 1.0;
case ReferenceCells::Line:
case ReferenceCells::Quadrilateral:
case ReferenceCells::Hexahedron:
- return GeometryInfo<dim>::d_linear_shape_function(xi, i);
+ if constexpr (dim > 0)
+ return GeometryInfo<dim>::d_linear_shape_function(xi, i);
+ DEAL_II_ASSERT_UNREACHABLE();
// see also BarycentricPolynomials<2>::compute_value
case ReferenceCells::Triangle:
{
DEAL_II_NOT_IMPLEMENTED();
}
+ DEAL_II_ASSERT_UNREACHABLE();
return 0.0;
}
switch (this->kind)
{
case ReferenceCells::Vertex:
- return 0;
+ return 1;
case ReferenceCells::Line:
return 1;
case ReferenceCells::Triangle: