/**
* Compute the value of the $i$-th linear shape function at location $\xi$
* for the current reference-cell type.
+ *
+ * @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()).
*/
template <int dim>
double
/**
* Compute the gradient of the $i$-th linear shape function at location
* $\xi$ for the current reference-cell type.
+ *
+ * @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()).
*/
template <int dim>
Tensor<1, dim>
* @param[in] n_points_1d The number of quadrature points in each direction
* (QGauss) or an indication of what polynomial degree needs to be
* integrated exactly for the other types.
+ *
+ * @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()).
*/
template <int dim>
Quadrature<dim>
*
* The object returned by this function generalizes what the QMidpoint class
* represents to other reference cells.
+ *
+ * @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()).
*/
template <int dim>
Quadrature<dim>
* consequently the object cannot usefully be used for actually
* computing integrals. This is in contrast to, for example, the QTrapezoid
* class that correctly sets quadrature weights.
+ *
+ * @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()).
*/
template <int dim>
const Quadrature<dim> &
*
* Because the ReferenceCell class does not have a `dim` argument,
* it has to be explicitly specified in the call to this function.
+ *
+ * @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()).
*/
template <int dim>
Point<dim>
/**
* Return the number of cells one would get by refining the
* current cell with the given refinement case.
+ *
+ * @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()).
*/
template <int dim>
unsigned int
* @return The location of the vertex so identified in `dim`-dimensional
* space.
*
+ * @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()).
+ *
* @post The output of calling `reference_cell.face_vertex_location<dim>(f,v)`
* is identical to calling
* `reference_cell.vertex<dim>(
* @f]
* where $V$ is the volume of the reference cell (see also the volume()
* function).
+ *
+ * @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()).
*/
template <int dim>
Point<dim>
*
* The tolerance parameter may be less than zero, indicating that the point
* should be safely inside the cell.
+ *
+ * @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()).
*/
template <int dim>
bool
/**
* Return the point on the surface of the reference cell closest (in the
* Euclidean norm) to @p p.
+ *
+ * @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()).
*/
template <int dim>
Point<dim>
* cross product between the two vectors returns the unit normal vector.
*
* @pre $i$ must be between zero and `dim-1`.
+ *
+ * @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()).
*/
template <int dim>
Tensor<1, dim>
/**
* Return the unit normal vector of a face of the reference cell.
+ *
+ * @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()).
*/
template <int dim>
Tensor<1, dim>
* The last argument, @p legacy_format, indicates whether to use the
* old, VTK legacy format (when `true`) or the new, VTU format (when
* `false`).
+ *
+ * @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()).
*/
template <int dim>
unsigned int
Quadrature<dim>
ReferenceCell::get_midpoint_quadrature() const
{
+ Assert(dim == get_dimension(),
+ ExcMessage("You can only call this function with arguments for "
+ "which 'dim' equals the dimension of the space in which "
+ "the current reference cell lives. You have dim=" +
+ std::to_string(dim) + " but the reference cell is " +
+ std::to_string(get_dimension()) + " dimensional."));
+
return Quadrature<dim>(std::vector<Point<dim>>({barycenter<dim>()}),
std::vector<double>({volume()}));
}
Point<dim>
ReferenceCell::vertex(const unsigned int v) const
{
- AssertDimension(dim, get_dimension());
+ Assert(dim == get_dimension(),
+ ExcMessage("You can only call this function with arguments for "
+ "which 'dim' equals the dimension of the space in which "
+ "the current reference cell lives. You have dim=" +
+ std::to_string(dim) + " but the reference cell is " +
+ std::to_string(get_dimension()) + " dimensional."));
AssertIndexRange(v, n_vertices());
switch (dim)
unsigned int
ReferenceCell::n_children(const RefinementCase<dim> ref_case) const
{
+ Assert(dim == get_dimension(),
+ ExcMessage("You can only call this function with arguments for "
+ "which 'dim' equals the dimension of the space in which "
+ "the current reference cell lives. You have dim=" +
+ std::to_string(dim) + " but the reference cell is " +
+ std::to_string(get_dimension()) + " dimensional."));
+
// Use GeometryInfo here to keep it the single source of truth
if (this->is_hyper_cube())
return GeometryInfo<dim>::n_children(ref_case);
ReferenceCell::face_vertex_location(const unsigned int face,
const unsigned int vertex) const
{
+ Assert(dim == get_dimension(),
+ ExcMessage("You can only call this function with arguments for "
+ "which 'dim' equals the dimension of the space in which "
+ "the current reference cell lives. You have dim=" +
+ std::to_string(dim) + " but the reference cell is " +
+ std::to_string(get_dimension()) + " dimensional."));
return this->template vertex<dim>(
face_to_cell_vertices(face, vertex, default_combined_face_orientation()));
}
ReferenceCell::d_linear_shape_function(const Point<dim> &xi,
const unsigned int i) const
{
- AssertDimension(dim, get_dimension());
+ Assert(dim == get_dimension(),
+ ExcMessage("You can only call this function with arguments for "
+ "which 'dim' equals the dimension of the space in which "
+ "the current reference cell lives. You have dim=" +
+ std::to_string(dim) + " but the reference cell is " +
+ std::to_string(get_dimension()) + " dimensional."));
AssertIndexRange(i, n_vertices());
switch (this->kind)
{
ReferenceCell::d_linear_shape_function_gradient(const Point<dim> &xi,
const unsigned int i) const
{
- AssertDimension(dim, get_dimension());
+ Assert(dim == get_dimension(),
+ ExcMessage("You can only call this function with arguments for "
+ "which 'dim' equals the dimension of the space in which "
+ "the current reference cell lives. You have dim=" +
+ std::to_string(dim) + " but the reference cell is " +
+ std::to_string(get_dimension()) + " dimensional."));
switch (this->kind)
{
case ReferenceCells::Vertex:
inline Point<dim>
ReferenceCell::barycenter() const
{
- AssertDimension(dim, get_dimension());
+ Assert(dim == get_dimension(),
+ ExcMessage("You can only call this function with arguments for "
+ "which 'dim' equals the dimension of the space in which "
+ "the current reference cell lives. You have dim=" +
+ std::to_string(dim) + " but the reference cell is " +
+ std::to_string(get_dimension()) + " dimensional."));
switch (this->kind)
{
inline bool
ReferenceCell::contains_point(const Point<dim> &p, const double tolerance) const
{
- AssertDimension(dim, get_dimension());
+ Assert(dim == get_dimension(),
+ ExcMessage("You can only call this function with arguments for "
+ "which 'dim' equals the dimension of the space in which "
+ "the current reference cell lives. You have dim=" +
+ std::to_string(dim) + " but the reference cell is " +
+ std::to_string(get_dimension()) + " dimensional."));
// Introduce abbreviations to silence compiler warnings about invalid
// array accesses (that can't happen, of course, but the compiler
ReferenceCell::unit_tangential_vectors(const unsigned int face_no,
const unsigned int i) const
{
- AssertDimension(dim, get_dimension());
+ Assert(dim == get_dimension(),
+ ExcMessage("You can only call this function with arguments for "
+ "which 'dim' equals the dimension of the space in which "
+ "the current reference cell lives. You have dim=" +
+ std::to_string(dim) + " but the reference cell is " +
+ std::to_string(get_dimension()) + " dimensional."));
AssertIndexRange(i, dim - 1);
switch (this->kind)
inline Tensor<1, dim>
ReferenceCell::unit_normal_vectors(const unsigned int face_no) const
{
- AssertDimension(dim, this->get_dimension());
+ Assert(dim == get_dimension(),
+ ExcMessage("You can only call this function with arguments for "
+ "which 'dim' equals the dimension of the space in which "
+ "the current reference cell lives. You have dim=" +
+ std::to_string(dim) + " but the reference cell is " +
+ std::to_string(get_dimension()) + " dimensional."));
if (is_hyper_cube())
{