16 #ifndef dealii_tria_reference_cell_h
17 #define dealii_tria_reference_cell_h
28 #include <boost/container/small_vector.hpp>
37 template <
int dim,
int spacedim>
170 const unsigned int i)
const;
181 template <
int dim,
int spacedim = dim>
182 std::unique_ptr<Mapping<dim, spacedim>>
196 template <
int dim,
int spacedim = dim>
275 vertex(
const unsigned int v)
const;
356 static constexpr
unsigned char
369 static constexpr
unsigned char
415 const unsigned int subface,
416 const unsigned char face_orientation =
428 std::array<unsigned int, 2>
440 std::array<unsigned int, 2>
453 const unsigned int vertex)
const;
460 const unsigned int line,
461 const unsigned char face_orientation)
const;
468 const unsigned int vertex,
469 const unsigned char face_orientation)
const;
476 const unsigned int face,
477 const unsigned char face_orientation)
const;
484 const unsigned int face,
485 const unsigned char face_orientation)
const;
499 const unsigned char face_orientation,
500 const bool line_orientation)
const;
577 const unsigned int i)
const;
610 template <
typename T, std::
size_t N>
611 DEAL_II_DEPRECATED_EARLY
unsigned char
613 const std::array<T, N> &vertices_1)
const;
640 template <
typename T>
659 template <
typename T, std::
size_t N>
660 DEAL_II_DEPRECATED_EARLY std::array<T, N>
662 const unsigned int orientation)
const;
675 template <
typename T>
676 boost::container::small_vector<T, 8>
678 const unsigned char orientation)
const;
748 const std::array<unsigned, dim> &node_indices,
749 const std::array<unsigned, dim> &nodes_per_direction,
750 const bool legacy_format)
const;
783 constexpr
operator std::uint8_t()
const;
802 template <
class Archive>
804 serialize(Archive &archive,
const unsigned int );
809 static constexpr std::size_t
834 {{{1, 0}}, {{0, 1}}}};
868 friend std::ostream &
871 friend std::istream &
903 inline constexpr ReferenceCell::operator std::uint8_t()
const
910 inline constexpr
bool
918 inline constexpr
bool
931 #ifndef DEAL_II_CXX14_CONSTEXPR_BUG
1002 template <
class Archive>
1011 inline constexpr std::size_t
1032 {{{0, 2}}, {{0, 1}}, {{1, 2}}}};
1038 {{{0, 1, 2}}, {{0, 1, 3}}, {{0, 2, 3}}, {{1, 2, 3}}}};
1128 std::vector<double>({
volume()}));
1445 inline constexpr
unsigned char
1456 inline constexpr
unsigned char
1468 const unsigned int face,
1469 const unsigned int subface,
1470 const unsigned char combined_face_orientation)
const
1486 {{{0, 1}}, {{1, 2}}, {{2, 0}}}};
1488 return subcells[face][subface];
1492 const bool face_orientation =
1494 const bool face_flip =
1496 const bool face_rotation =
1516 const bool face_orientation =
1518 const bool face_flip =
1520 const bool face_rotation =
1540 inline std::array<unsigned int, 2>
1542 const unsigned int vertex)
const
1558 {{{0, 0}}, {{0, 1}}, {{1, 1}}, {{X, X}}, {{X, X}}, {{X, X}}}};
1570 {{{0, 0}}, {{0, 1}}, {{0, 2}}, {{1, 2}}, {{X, X}}, {{X, X}}}};
1577 {{{0, 0}}, {{0, 1}}, {{0, 2}}, {{0, 3}}, {{1, 2}}, {{X, X}}}};
1584 {{{0, 1}}, {{0, 0}}, {{0, 2}}, {{1, 0}}, {{1, 1}}, {{1, 2}}}};
1602 inline std::array<unsigned int, 2>
1604 const unsigned int line)
const
1620 static const std::array<unsigned int, 2> table[6] = {
1621 {{0, 0}}, {{0, 1}}, {{0, 2}}, {{1, 1}}, {{1, 2}}, {{2, 1}}};
1627 static const std::array<unsigned int, 2> table[8] = {{{0, 0}},
1640 static const std::array<unsigned int, 2> table[9] = {{{0, 0}},
1666 const unsigned int vertex)
const
1679 {{{0, 1}}, {{1, 2}}, {{2, 0}}}};
1680 return table[line][
vertex];
1685 {{{0, 2}}, {{1, 3}}, {{0, 1}}, {{2, 3}}}};
1686 return table[line][
vertex];
1691 {{{0, 1}}, {{1, 2}}, {{2, 0}}, {{0, 3}}, {{1, 3}}, {{2, 3}}}};
1692 return table[line][
vertex];
1704 return table[line][
vertex];
1717 return table[line][
vertex];
1735 return table[line][
vertex];
1748 const unsigned int line,
1749 const unsigned char face_orientation)
const
1788 {{{0, 1, 2}}, {{0, 3, 4}}, {{2, 5, 3}}, {{1, 4, 5}}}};
1791 line, face, face_orientation)];
1803 line, face, face_orientation)];
1815 line, face, face_orientation)];
1837 const unsigned int vertex,
1838 const unsigned char face_orientation)
const
1862 {{{0, 1}}, {{1, 2}}, {{2, 0}}}};
1864 return table[face][face_orientation != 0u ?
vertex : (1 -
vertex)];
1878 {{{0, 1, 2}}, {{1, 0, 3}}, {{0, 2, 3}}, {{2, 1, 3}}}};
1881 vertex, face, face_orientation)];
1894 vertex, face, face_orientation)];
1907 vertex, face, face_orientation)];
1929 const unsigned int vertex,
1930 const unsigned int face,
1931 const unsigned char face_orientation)
const
1973 const unsigned int line,
1974 const unsigned int face,
1975 const unsigned char face_orientation)
const
1997 return triangle_table[face_orientation][line];
2009 return triangle_table[face_orientation][line];
2021 return triangle_table[face_orientation][line];
2033 return table[face_orientation][line];
2125 " does not correspond to a known reference cell type."));
2134 const unsigned int i)
const
2151 return 1.0 - xi[
std::min(0, dim - 1)] -
2167 return 1.0 - xi[
std::min(0, dim - 1)] -
2182 const double Q14 = 0.25;
2184 const double r = xi[
std::min(0, dim - 1)];
2185 const double s = xi[
std::min(1, dim - 1)];
2186 const double t = xi[
std::min(2, dim - 1)];
2188 const double ratio =
2189 (
std::fabs(t - 1.0) > 1.0e-14 ? (r * s * t) / (1.0 - t) : 0.0);
2192 return Q14 * ((1.0 - r) * (1.0 - s) - t + ratio);
2194 return Q14 * ((1.0 + r) * (1.0 - s) - t - ratio);
2196 return Q14 * ((1.0 - r) * (1.0 + s) - t - ratio);
2198 return Q14 * ((1.0 + r) * (1.0 + s) - t + ratio);
2223 const unsigned int i)
const
2302 return Point<dim>(1. / 4., 1. / 4., 1. / 4.);
2308 return Point<dim>(1. / 2., 1. / 2., 1. / 2.);
2327 constexpr
unsigned int x_coordinate = 0;
2328 constexpr
unsigned int y_coordinate = (dim >= 2 ? 1 : 0);
2329 constexpr
unsigned int z_coordinate = (dim >= 3 ? 2 : 0);
2339 ExcMessage(
"Vertices are zero-dimensional objects and "
2340 "as a consequence have no coordinates. You "
2341 "cannot meaningfully ask whether a point is "
2342 "inside a vertex (within a certain tolerance) "
2343 "without coordinate values."));
2350 for (
unsigned int d = 0;
d < dim; ++
d)
2351 if ((p[
d] < -tolerance) || (p[
d] > 1 + tolerance))
2359 for (
unsigned int d = 0;
d < dim; ++
d)
2360 if (p[
d] < -tolerance)
2372 for (
unsigned int d = 0;
d < dim; ++
d)
2374 return (
sum <= 1 + tolerance * std::sqrt(1. * dim));
2379 if (p[z_coordinate] < -tolerance)
2383 if (p[z_coordinate] > 1 + tolerance)
2390 const double distance_from_axis =
2395 return (distance_from_axis < 1 + tolerance - p[z_coordinate]);
2404 if ((p[x_coordinate] < -tolerance) || (p[y_coordinate] < -tolerance))
2407 const double sum = p[x_coordinate] + p[y_coordinate];
2408 if (
sum > 1 + tolerance * std::sqrt(2.0))
2411 if (p[z_coordinate] < -tolerance)
2413 if (p[z_coordinate] > 1 + tolerance)
2430 const unsigned int i)
const
2446 static const std::array<Tensor<1, dim>, 3> table = {
2448 Point<dim>(-std::sqrt(0.5), +std::sqrt(0.5)),
2451 return table[face_no];
2460 {{
Point<dim>(-std::pow(1.0 / 3.0, 1.0 / 4.0),
2461 +std::pow(1.0 / 3.0, 1.0 / 4.0),
2465 +std::pow(1.0 / 3.0, 1.0 / 4.0))}}}};
2467 return table[face_no][i];
2474 {{
Point<dim>(+1.0 / sqrt(2.0), 0, +1.0 / sqrt(2.0)),
2476 {{
Point<dim>(+1.0 / sqrt(2.0), 0, -1.0 / sqrt(2.0)),
2479 Point<dim>(0, +1.0 / sqrt(2.0), +1.0 / sqrt(2.0))}},
2481 Point<dim>(0, +1.0 / sqrt(2.0), -1.0 / sqrt(2.0))}}}};
2483 return table[face_no][i];
2492 {{
Point<dim>(-1 / std::sqrt(2.0), +1 / std::sqrt(2.0), 0),
2496 return table[face_no][i];
2524 return cross_product_2d(unit_tangential_vectors<dim>(face_no, 0));
2528 return cross_product_3d(unit_tangential_vectors<dim>(face_no, 0),
2529 unit_tangential_vectors<dim>(face_no, 1));
2560 const unsigned int line,
2561 const unsigned char combined_face_orientation,
2562 const bool line_orientation)
const
2566 static constexpr ::ndarray<bool, 2, 8> bool_table{
2567 {{{
true,
true,
false,
true,
false,
false,
true,
false}},
2568 {{
true,
true,
true,
false,
false,
false,
false,
true}}}};
2570 return (line_orientation ==
2571 bool_table[line / 2][combined_face_orientation]);
2583 template <
typename T>
2616 for (
unsigned int i = 0; i < n_vertices; ++i)
2619 if (i + 1 != n_vertices)
2623 out <<
"] is not a valid permutation of [";
2625 for (
unsigned int i = 0; i < n_vertices; ++i)
2628 if (i + 1 != n_vertices)
2632 out <<
"]." << std::endl;
2654 template <
typename T, std::
size_t N>
2655 inline unsigned char
2657 const std::array<T, N> &vertices_1)
const
2660 ExcMessage(
"The number of array elements must be equal to or "
2661 "greater than the number of vertices of the cell "
2662 "referenced by this object."));
2675 template <
typename T>
2682 ExcMessage(
"The number of array elements must be equal to "
2683 "the number of vertices of the cell "
2684 "referenced by this object."));
2686 ExcMessage(
"The number of array elements must be equal to "
2687 "the number of vertices of the cell "
2688 "referenced by this object."));
2690 const auto v0_equals = [&](
const std::initializer_list<const T> &list) {
2699 if (v0_equals({vertices_1[0], vertices_1[1]}))
2703 if (v0_equals({vertices_1[1], vertices_1[0]}))
2708 if (v0_equals({vertices_1[0], vertices_1[1], vertices_1[2]}))
2712 if (v0_equals({vertices_1[1], vertices_1[2], vertices_1[0]}))
2716 if (v0_equals({vertices_1[2], vertices_1[0], vertices_1[1]}))
2720 if (v0_equals({vertices_1[0], vertices_1[2], vertices_1[1]}))
2724 if (v0_equals({vertices_1[2], vertices_1[1], vertices_1[0]}))
2728 if (v0_equals({vertices_1[1], vertices_1[0], vertices_1[2]}))
2734 {vertices_1[0], vertices_1[1], vertices_1[2], vertices_1[3]}))
2739 {vertices_1[2], vertices_1[0], vertices_1[3], vertices_1[1]}))
2744 {vertices_1[3], vertices_1[2], vertices_1[1], vertices_1[0]}))
2749 {vertices_1[1], vertices_1[3], vertices_1[0], vertices_1[2]}))
2754 {vertices_1[0], vertices_1[2], vertices_1[1], vertices_1[3]}))
2759 {vertices_1[2], vertices_1[3], vertices_1[0], vertices_1[1]}))
2764 {vertices_1[3], vertices_1[1], vertices_1[2], vertices_1[0]}))
2769 {vertices_1[1], vertices_1[0], vertices_1[3], vertices_1[2]}))
2782 template <
typename T, std::
size_t N>
2783 inline std::array<T, N>
2786 const unsigned int orientation)
const
2789 ExcMessage(
"The number of array elements must be equal to or "
2790 "greater than the number of vertices of the cell "
2791 "referenced by this object."));
2801 std::array<T, N> temp;
2802 std::copy(permutation.begin(), permutation.end(), temp.begin());
2809 template <
typename T>
2810 boost::container::small_vector<T, 8>
2813 const unsigned char orientation)
const
2816 ExcMessage(
"The number of array elements must be equal to "
2817 "the number of vertices of the cell "
2818 "referenced by this object."));
2823 switch (orientation)
2834 switch (orientation)
2853 switch (orientation)
2886 ReferenceCell::vtk_lexicographic_to_node_index<0>(
2887 const std::array<unsigned, 0> &node_indices,
2888 const std::array<unsigned, 0> &nodes_per_direction,
2889 const bool legacy_format)
const;
2893 ReferenceCell::vtk_lexicographic_to_node_index<1>(
2894 const std::array<unsigned, 1> &node_indices,
2895 const std::array<unsigned, 1> &nodes_per_direction,
2896 const bool legacy_format)
const;
2900 ReferenceCell::vtk_lexicographic_to_node_index<2>(
2901 const std::array<unsigned, 2> &node_indices,
2902 const std::array<unsigned, 2> &nodes_per_direction,
2903 const bool legacy_format)
const;
2907 ReferenceCell::vtk_lexicographic_to_node_index<3>(
2908 const std::array<unsigned, 3> &node_indices,
2909 const std::array<unsigned, 3> &nodes_per_direction,
2910 const bool legacy_format)
const;
ArrayView< typename std::remove_reference< typename std::iterator_traits< Iterator >::reference >::type, MemorySpaceType > make_array_view(const Iterator begin, const Iterator end)
OutputOperator< VectorType > & operator<<(OutputOperator< VectorType > &out, unsigned int step)
Abstract base class for mapping classes.
std::istream & operator>>(std::istream &in, Point< dim, Number > &p)
static Point< dim, Number > unit_vector(const unsigned int i)
ArrayView< const unsigned int > faces_for_given_vertex(const unsigned int vertex_index) const
unsigned int child_cell_on_face(const unsigned int face, const unsigned int subface, const unsigned char face_orientation=default_combined_face_orientation()) const
std_cxx20::ranges::iota_view< unsigned int, unsigned int > vertex_indices() const
unsigned int n_vertices() const
boost::container::small_vector< T, 8 > permute_by_combined_orientation(const ArrayView< const T > &vertices, const unsigned char orientation) const
bool is_hyper_cube() const
unsigned int vtk_linear_type() const
friend std::ostream & operator<<(std::ostream &out, const ReferenceCell &reference_cell)
void serialize(Archive &archive, const unsigned int)
friend std::istream & operator>>(std::istream &in, ReferenceCell &reference_cell)
unsigned int face_to_cell_vertices(const unsigned int face, const unsigned int vertex, const unsigned char face_orientation) const
static constexpr unsigned char default_combined_face_orientation()
unsigned char compute_orientation(const std::array< T, N > &vertices_0, const std::array< T, N > &vertices_1) const
std::array< unsigned int, 2 > standard_vertex_to_face_and_vertex_index(const unsigned int vertex) const
Quadrature< dim > get_gauss_type_quadrature(const unsigned n_points_1D) const
bool standard_vs_true_line_orientation(const unsigned int line, const unsigned char face_orientation, const bool line_orientation) const
Point< dim > vertex(const unsigned int v) const
unsigned int standard_to_real_face_vertex(const unsigned int vertex, const unsigned int face, const unsigned char face_orientation) const
std_cxx20::ranges::iota_view< unsigned int, unsigned int > isotropic_child_indices() const
std::array< unsigned int, 2 > standard_line_to_face_and_line_index(const unsigned int line) const
double d_linear_shape_function(const Point< dim > &xi, const unsigned int i) const
Tensor< 1, dim > unit_tangential_vectors(const unsigned int face_no, const unsigned int i) const
static constexpr ndarray< unsigned int, 2, 2 > line_vertex_permutations
unsigned int vtk_lexicographic_to_node_index(const std::array< unsigned, dim > &node_indices, const std::array< unsigned, dim > &nodes_per_direction, const bool legacy_format) const
std::array< T, N > permute_according_orientation(const std::array< T, N > &vertices, const unsigned int orientation) const
bool contains_point(const Point< dim > &p, const double tolerance=0) const
unsigned int n_isotropic_children() const
unsigned int gmsh_element_type() const
unsigned int n_face_orientations(const unsigned int face_no) const
static constexpr ndarray< unsigned int, 8, 4 > quadrilateral_vertex_permutations
unsigned int n_faces() const
unsigned int line_to_cell_vertices(const unsigned int line, const unsigned int vertex) const
constexpr ReferenceCell()
unsigned int exodusii_vertex_to_deal_vertex(const unsigned int vertex_n) const
unsigned int unv_vertex_to_deal_vertex(const unsigned int vertex_n) const
unsigned int vtk_vertex_to_deal_vertex(const unsigned int vertex_index) const
std::unique_ptr< Mapping< dim, spacedim > > get_default_mapping(const unsigned int degree) const
Quadrature< dim > get_midpoint_quadrature() const
unsigned int vtk_quadratic_type() const
static constexpr unsigned char reversed_combined_line_orientation()
unsigned int n_lines() const
unsigned int vtk_lagrange_type() const
std_cxx20::ranges::iota_view< unsigned int, unsigned int > line_indices() const
unsigned int get_dimension() const
ReferenceCell face_reference_cell(const unsigned int face_no) const
unsigned int exodusii_face_to_deal_face(const unsigned int face_n) const
static ReferenceCell n_vertices_to_type(const int dim, const unsigned int n_vertices)
unsigned int standard_to_real_face_line(const unsigned int line, const unsigned int face, const unsigned char face_orientation) const
static constexpr std::size_t memory_consumption()
const Mapping< dim, spacedim > & get_default_linear_mapping() const
std::string to_string() const
unsigned int face_to_cell_lines(const unsigned int face, const unsigned int line, const unsigned char face_orientation) const
constexpr bool operator!=(const ReferenceCell &type) const
unsigned char get_combined_orientation(const ArrayView< const T > &vertices_0, const ArrayView< const T > &vertices_1) const
constexpr bool operator==(const ReferenceCell &type) const
Point< dim > barycenter() const
const Quadrature< dim > & get_nodal_type_quadrature() const
Tensor< 1, dim > unit_normal_vectors(const unsigned int face_no) const
std_cxx20::ranges::iota_view< unsigned int, unsigned int > face_indices() const
static constexpr ndarray< unsigned int, 6, 3 > triangle_vertex_permutations
Tensor< 1, dim > d_linear_shape_function_gradient(const Point< dim > &xi, const unsigned int i) const
virtual void print_info(std::ostream &out) const override
const ReferenceCell entity_type
virtual ~NoPermutation() noexcept override=default
const ArrayView< const T > vertices_0
const ArrayView< const T > vertices_1
NoPermutation(const ReferenceCell &entity_type, const ArrayView< const T > &vertices_0, const ArrayView< const T > &vertices_1)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcInternalError()
#define Assert(cond, exc)
static ::ExceptionBase & ExcNotImplemented()
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
Expression fabs(const Expression &x)
void reference_cell(Triangulation< dim, spacedim > &tria, const ReferenceCell &reference_cell)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
constexpr const ReferenceCell Tetrahedron
constexpr const ReferenceCell Quadrilateral
constexpr const ReferenceCell Wedge
constexpr const ReferenceCell Pyramid
constexpr const ReferenceCell Invalid
constexpr const ReferenceCell Triangle
constexpr const ReferenceCell Hexahedron
constexpr const ReferenceCell & get_hypercube()
constexpr const ReferenceCell Vertex
constexpr const ReferenceCell Line
constexpr const ReferenceCell & get_simplex()
VectorType::value_type * begin(VectorType &V)
T sum(const T &t, const MPI_Comm &mpi_communicator)
bool get_bit(const unsigned char number, const unsigned int n)
void copy(const T *begin, const T *end, U *dest)
constexpr ReferenceCell make_reference_cell_from_int(const std::uint8_t kind)
static const unsigned int invalid_unsigned_int
boost::integer_range< IncrementableType > iota_view
typename internal::ndarray::HelperArray< T, Ns... >::type ndarray
static unsigned int child_cell_on_face(const RefinementCase< dim > &ref_case, const unsigned int face, const unsigned int subface, const bool face_orientation=true, const bool face_flip=false, const bool face_rotation=false, const RefinementCase< dim - 1 > &face_refinement_case=RefinementCase< dim - 1 >::isotropic_refinement)
static unsigned int face_to_cell_vertices(const unsigned int face, const unsigned int vertex, const bool face_orientation=true, const bool face_flip=false, const bool face_rotation=false)
static std::array< unsigned int, 2 > standard_hex_line_to_quad_line_index(const unsigned int line)
static unsigned int standard_to_real_face_line(const unsigned int line, const bool face_orientation=true, const bool face_flip=false, const bool face_rotation=false)
static double d_linear_shape_function(const Point< dim > &xi, const unsigned int i)
static Tensor< 1, dim > d_linear_shape_function_gradient(const Point< dim > &xi, const unsigned int i)
static unsigned int face_to_cell_lines(const unsigned int face, const unsigned int line, const bool face_orientation=true, const bool face_flip=false, const bool face_rotation=false)
static std::array< unsigned int, 2 > standard_quad_vertex_to_line_vertex_index(const unsigned int vertex)
static std::array< unsigned int, 2 > standard_hex_vertex_to_quad_vertex_index(const unsigned int vertex)