return Point<dim>(+0.0, +0.0, +0.0);
}
- /*
+ /**
* Return i-th unit tangential vector of a face of the reference cell.
* The vectors are arranged such that the
* cross product between the two vectors returns the unit normal vector.
return {};
}
+ /**
+ * Return the unit normal vector of a face of the reference cell.
+ */
+ template <int dim>
+ inline Tensor<1, dim>
+ unit_normal_vectors(const Type &reference_cell, const unsigned int face_no)
+ {
+ AssertDimension(dim, get_dimension(reference_cell));
+
+ if (reference_cell == get_hypercube(dim))
+ {
+ AssertIndexRange(face_no, GeometryInfo<dim>::faces_per_cell);
+ return GeometryInfo<dim>::unit_normal_vector[face_no];
+ }
+ else if (dim == 2)
+ {
+ const auto tangential =
+ unit_tangential_vectors<dim>(reference_cell, face_no, 0);
+
+ Tensor<1, dim> result;
+
+ result[0] = tangential[1];
+ result[1] = -tangential[0];
+
+ return result;
+ }
+ else if (dim == 3)
+ {
+ return cross_product_3d(
+ unit_tangential_vectors<dim>(reference_cell, face_no, 0),
+ unit_tangential_vectors<dim>(reference_cell, face_no, 1));
+ }
+
+ Assert(false, ExcNotImplemented());
+
+ return {};
+ }
+
/*
* Create a (coarse) grid with a single cell of the shape of the provided
* reference cell.
// ---------------------------------------------------------------------
-// Test ReferenceCell::unit_tangential_vectors() for all reference-cell types.
+// Test ReferenceCell::unit_tangential_vectors() and ::unit_normal_vectors()
+// for all reference-cell types.
#include <deal.II/grid/reference_cell.h>
{
for (const auto face_no :
ReferenceCell::internal::Info::get_cell(reference_cell).face_indices())
- for (unsigned int i = 0; i < dim - 1; ++i)
- deallog << ReferenceCell::unit_tangential_vectors<dim>(reference_cell,
- face_no,
- i)
+ {
+ deallog << ReferenceCell::unit_normal_vectors<dim>(reference_cell,
+ face_no)
<< std::endl;
+
+ for (unsigned int i = 0; i < dim - 1; ++i)
+ deallog << ReferenceCell::unit_tangential_vectors<dim>(reference_cell,
+ face_no,
+ i)
+ << std::endl;
+ }
deallog << std::endl;
}
+DEAL::0.00000 -1.00000
DEAL::1.00000 0.00000
+DEAL::0.707107 0.707107
DEAL::-0.707107 0.707107
+DEAL::-1.00000 0.00000
DEAL::0.00000 -1.00000
DEAL::
+DEAL::-1.00000 0.00000
DEAL::0.00000 -1.00000
+DEAL::1.00000 0.00000
DEAL::0.00000 1.00000
+DEAL::0.00000 -1.00000
DEAL::1.00000 0.00000
+DEAL::0.00000 1.00000
DEAL::-1.00000 0.00000
DEAL::
+DEAL::0.00000 0.00000 -1.00000
DEAL::0.00000 1.00000 0.00000
DEAL::1.00000 0.00000 0.00000
+DEAL::0.00000 -1.00000 0.00000
DEAL::1.00000 0.00000 0.00000
DEAL::0.00000 0.00000 1.00000
+DEAL::-1.00000 0.00000 0.00000
DEAL::0.00000 0.00000 1.00000
DEAL::0.00000 1.00000 0.00000
+DEAL::0.577350 0.577350 0.577350
DEAL::-0.759836 0.759836 0.00000
DEAL::-0.759836 0.00000 0.759836
DEAL::
+DEAL::0.00000 0.00000 -1.00000
DEAL::0.00000 1.00000 0.00000
DEAL::1.00000 0.00000 0.00000
+DEAL::-0.707107 0.00000 0.707107
DEAL::0.707107 0.00000 0.707107
DEAL::0.00000 1.00000 0.00000
+DEAL::0.707107 0.00000 0.707107
DEAL::0.707107 0.00000 -0.707107
DEAL::0.00000 1.00000 0.00000
+DEAL::0.00000 -0.707107 0.707107
DEAL::1.00000 0.00000 0.00000
DEAL::0.00000 0.707107 0.707107
+DEAL::0.00000 0.707107 0.707107
DEAL::1.00000 0.00000 0.00000
DEAL::0.00000 0.707107 -0.707107
DEAL::
+DEAL::0.00000 0.00000 -1.00000
DEAL::0.00000 1.00000 0.00000
DEAL::1.00000 0.00000 0.00000
+DEAL::0.00000 -1.00000 0.00000
DEAL::1.00000 0.00000 0.00000
DEAL::0.00000 0.00000 1.00000
+DEAL::0.707107 0.707107 0.00000
DEAL::-0.707107 0.707107 0.00000
DEAL::0.00000 0.00000 1.00000
+DEAL::-1.00000 0.00000 0.00000
DEAL::0.00000 0.00000 1.00000
DEAL::0.00000 1.00000 0.00000
+DEAL::0.00000 -1.00000 0.00000
DEAL::1.00000 0.00000 0.00000
DEAL::0.00000 0.00000 1.00000
DEAL::
+DEAL::-1.00000 0.00000 0.00000
DEAL::0.00000 -1.00000 0.00000
DEAL::0.00000 0.00000 1.00000
+DEAL::1.00000 0.00000 0.00000
DEAL::0.00000 1.00000 0.00000
DEAL::0.00000 0.00000 1.00000
+DEAL::0.00000 -1.00000 0.00000
DEAL::0.00000 0.00000 -1.00000
DEAL::1.00000 0.00000 0.00000
+DEAL::0.00000 1.00000 0.00000
DEAL::0.00000 0.00000 1.00000
DEAL::1.00000 0.00000 0.00000
+DEAL::0.00000 0.00000 -1.00000
DEAL::-1.00000 0.00000 0.00000
DEAL::0.00000 1.00000 0.00000
+DEAL::0.00000 0.00000 1.00000
DEAL::1.00000 0.00000 0.00000
DEAL::0.00000 1.00000 0.00000
DEAL::