deal.II version GIT relicensing-7182-g951947b1c4 2026-11-26 10:30:01+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
reference_cell.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2020 - 2026 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_tria_reference_cell_h
14#define dealii_tria_reference_cell_h
15
16#include <deal.II/base/config.h>
17
21#include <deal.II/base/point.h>
22#include <deal.II/base/tensor.h>
23#include <deal.II/base/types.h>
25
28
29#include <boost/container/small_vector.hpp>
30
31#include <iosfwd>
32#include <string>
33
35
36// Forward declarations
37#ifndef DOXYGEN
38template <int dim, int spacedim>
39class Mapping;
40
41template <int dim>
42class Quadrature;
43
44template <int dim>
45class ReferenceCell;
46#endif
47
48
49namespace internal
50{
63 template <int dim>
64 constexpr ReferenceCell<dim>
65 make_reference_cell_from_int(const std::uint8_t kind);
66} // namespace internal
67
68
69
76enum class IsotropicRefinementChoice : std::uint8_t
77{
85 cut_tet_68 = 1,
89 cut_tet_57 = 2,
93 cut_tet_49 = 3,
94};
95
96
97
128template <int dim>
130{
131public:
142 "Use ReferenceCells::n_vertices_to_reference_cell() instead")
143 static ReferenceCell
144 n_vertices_to_type(const int dim_, const unsigned int n_vertices);
145
154 constexpr ReferenceCell();
155
166 constexpr bool
168
172 constexpr bool
173 is_simplex() const;
174
180 constexpr unsigned int
182
202 double
203 d_linear_shape_function(const Point<dim> &xi, const unsigned int i) const;
204
211 const unsigned int i) const;
212
222 template <int spacedim = dim>
223 std::unique_ptr<Mapping<dim, spacedim>>
224 get_default_mapping(const unsigned int degree) const;
225
237 template <int spacedim = dim>
240
250 get_gauss_type_quadrature(const unsigned n_points_1d) const;
251
263
277 const Quadrature<dim> &
279
294 constexpr unsigned int
295 n_vertices() const;
296
303
312 vertex(const unsigned int v) const;
313
319 constexpr unsigned int
320 n_lines() const;
321
328
334 constexpr unsigned int
335 n_faces() const;
336
343
350 face_indices_by_type(const ReferenceCell<dim - 1> &face_ref_type) const;
351
355 constexpr unsigned int
357
362 get_isotropic_refinement_choice(const unsigned int ref_choice) const;
363
375 constexpr unsigned int
377
382 unsigned int
385
392
412 std::pair<unsigned int, RefinementCase<dim - 1>>
414 const types::geometric_orientation combined_face_orientation,
415 const internal::SubfaceCase<dim> subface_case,
416 const unsigned int subface_no) const;
417
427
437 constexpr bool
438 is_compatible_with(const RefinementChoice<dim> &refinement_choice) const;
439
452 constexpr ReferenceCell<dim - 1>
453 face_reference_cell(const unsigned int face_index) const;
454
504 unsigned int
506 const unsigned int face,
507 const unsigned int subface,
508 const types::geometric_orientation combined_orientation) const;
509
519 std::array<unsigned int, 2>
521
531 std::array<unsigned int, 2>
532 standard_line_to_face_and_line_index(const unsigned int line) const;
533
542 unsigned int
543 line_to_cell_vertices(const unsigned int line,
544 const unsigned int vertex) const;
545
564 unsigned int
565 face_to_cell_lines(const unsigned int face,
566 const unsigned int line,
567 const types::geometric_orientation face_orientation) const;
568
585 unsigned int
587 const unsigned int face,
588 const unsigned int vertex,
589 const types::geometric_orientation face_orientation) const;
590
611 unsigned int
613 const unsigned int face,
614 const unsigned int line,
615 const unsigned int vertex,
616 const types::geometric_orientation face_orientation) const;
617
638 face_vertex_location(const unsigned int face,
639 const unsigned int vertex) const;
640
656 const unsigned int face_no,
657 const unsigned int subface_no,
658 const unsigned int subface_vertex_no,
659 const RefinementCase<dim - 1> face_refinement_case) const;
660
665 unsigned int
667 const unsigned int vertex,
668 const unsigned int face,
669 const types::geometric_orientation face_orientation) const;
670
675 unsigned int
677 const unsigned int line,
678 const unsigned int face,
679 const types::geometric_orientation face_orientation) const;
680
705 const unsigned int face_line_no,
706 const unsigned int face_no,
707 const types::geometric_orientation face_orientation,
708 const types::geometric_orientation line_orientation) const;
709
735 unsigned int
736 opposite_face_index(const unsigned int face_no) const;
737
761 double
762 volume() const;
763
779 double
780 face_measure(const unsigned int face_no) const;
781
795 barycenter() const;
796
816 bool
817 contains_point(const Point<dim> &p, const double tolerance = 0) const;
818
824 closest_point(const Point<dim> &p) const;
825
834 face_tangent_vector(const unsigned int face_no, const unsigned int i) const;
835
840 face_normal_vector(const unsigned int face_no) const;
841
847 unsigned int
848 n_face_orientations(const unsigned int face_no) const;
849
866 template <typename T, std::size_t N>
868 compute_orientation(const std::array<T, N> &vertices_0,
869 const std::array<T, N> &vertices_1) const;
870
895 template <typename T>
898 const ArrayView<const T> &vertices_1) const;
899
911 template <typename T>
912 boost::container::small_vector<T, 8>
914 const ArrayView<const T> &vertices,
915 const types::geometric_orientation orientation) const;
916
924 const types::geometric_orientation orientation) const;
925
930 faces_for_given_vertex(const unsigned int vertex_index) const;
931
945 const RefinementChoice<dim> &refinement_choice) const;
946
954 DEAL_II_DEPRECATED_EARLY_WITH_COMMENT(
955 "Use the version of this function which takes a RefinementChoice instead.")
956 const ndarray<unsigned int, 13, 4> &
957 new_isotropic_child_face_lines(const unsigned int refinement_choice) const;
958
972 const ndarray<unsigned int, 13, 4, 2> &
974 const RefinementChoice<dim> &refinement_choice) const;
975
983 DEAL_II_DEPRECATED_EARLY_WITH_COMMENT(
984 "Use the version of this function which takes a RefinementChoice instead.")
985 const ndarray<unsigned int, 13, 4, 2> &
987 const unsigned int refinement_choice) const;
988
1000 const ndarray<unsigned int, 10, 6> &
1002 const RefinementChoice<dim> &refinement_choice) const;
1003
1011 DEAL_II_DEPRECATED_EARLY_WITH_COMMENT(
1012 "Use the version of this function which takes a RefinementChoice instead.")
1013 const ndarray<unsigned int, 10, 6> &
1014 new_isotropic_child_cell_faces(const unsigned int refinement_choice) const;
1015
1027 const ndarray<unsigned int, 10, 8> &
1029 const RefinementChoice<dim> &refinement_choice) const;
1030
1038 DEAL_II_DEPRECATED_EARLY_WITH_COMMENT(
1039 "Use the version of this function which takes a RefinementChoice instead.")
1040 const ndarray<unsigned int, 10, 8> &
1041 new_isotropic_child_cell_vertices(const unsigned int refinement_choice) const;
1042
1055 unsigned int
1056 exodusii_vertex_to_deal_vertex(const unsigned int vertex_n) const;
1057
1061 unsigned int
1062 exodusii_face_to_deal_face(const unsigned int face_n) const;
1063
1067 unsigned int
1068 ucd_vertex_to_deal_vertex(const unsigned int vertex_n) const;
1069
1073 unsigned int
1074 unv_vertex_to_deal_vertex(const unsigned int vertex_n) const;
1075
1079 unsigned int
1080 vtk_linear_type() const;
1081
1086 unsigned int
1087 vtk_quadratic_type() const;
1088
1093 unsigned int
1094 vtk_lagrange_type() const;
1095
1108 unsigned int
1110 const std::array<unsigned, dim> &node_indices,
1111 const std::array<unsigned, dim> &nodes_per_direction,
1112 const bool legacy_format) const;
1113
1117 unsigned int
1118 vtk_vertex_to_deal_vertex(const unsigned int vertex_index) const;
1119
1123 unsigned int
1124 gmsh_element_type() const;
1125
1139 std::string
1140 to_string() const;
1141
1145 constexpr
1146 operator std::uint8_t() const;
1147
1151 constexpr bool
1152 operator==(const ReferenceCell<dim> &type) const;
1153
1161 template <int dim2>
1162 constexpr bool
1163 operator==(const ReferenceCell<dim2> &type) const;
1164
1168 constexpr bool
1169 operator!=(const ReferenceCell<dim> &type) const;
1170
1178 template <int dim2>
1179 constexpr bool
1180 operator!=(const ReferenceCell<dim2> &type) const;
1181
1187 template <class Archive>
1188 void
1189 serialize(Archive &archive, const unsigned int /*version*/);
1190
1194 static constexpr std::size_t
1196
1201private:
1206 RefinementChoice<dim>
1207 isotropic_refinement_choice_from_index(const unsigned int index) const;
1208
1213
1220 explicit constexpr ReferenceCell(const std::uint8_t kind);
1221
1227 static constexpr ndarray<unsigned int, 1, 1> vertex_vertex_permutations = {
1228 {{{0}}}};
1229
1236
1247
1252 static constexpr ndarray<unsigned int, 8, 4>
1254 {{0, 1, 2, 3}},
1255 {{0, 2, 1, 3}},
1256 {{2, 0, 3, 1}},
1257 {{2, 3, 0, 1}},
1258 {{3, 2, 1, 0}},
1259 {{3, 1, 2, 0}},
1260 {{1, 3, 0, 2}},
1261 {{1, 0, 3, 2}},
1262 }};
1263
1268 {{{0, 1, 2}},
1269 {{2, 1, 0}},
1270 {{2, 0, 1}},
1271 {{1, 0, 2}},
1272 {{1, 2, 0}},
1273 {{0, 2, 1}}}};
1274
1280 {{
1281 {{0, 1, 2, 3}},
1282 {{2, 3, 0, 1}},
1283 {{3, 2, 0, 1}},
1284 {{0, 1, 3, 2}},
1285 {{1, 0, 3, 2}},
1286 {{3, 2, 1, 0}},
1287 {{2, 3, 1, 0}},
1288 {{1, 0, 2, 3}},
1289 }};
1290
1295 template <int dim_>
1296 friend constexpr ReferenceCell<dim_>
1298
1299 template <int dim_>
1300 friend std::ostream &
1301 operator<<(std::ostream &out, const ReferenceCell<dim_> &reference_cell);
1302
1303 template <int dim_>
1304 friend std::istream &
1305 operator>>(std::istream &in, ReferenceCell<dim_> &reference_cell);
1306};
1307
1308
1317template <int dim>
1318std::ostream &
1319operator<<(std::ostream &out, const ReferenceCell<dim> &reference_cell);
1320
1328template <int dim>
1329std::istream &
1330operator>>(std::istream &in, ReferenceCell<dim> &reference_cell);
1331
1332
1333
1334template <int dim>
1335inline constexpr ReferenceCell<dim>::ReferenceCell(const std::uint8_t kind)
1336 : kind(kind)
1337{}
1338
1339
1340
1341template <int dim>
1342inline constexpr ReferenceCell<dim>::
1343operator std::uint8_t() const
1344{
1345 return kind;
1346}
1347
1348
1349
1350template <int dim>
1351inline constexpr bool
1353{
1354 return kind == type.kind;
1355}
1356
1357
1358
1359template <int dim>
1360template <int dim2>
1361inline constexpr bool
1363{
1364 return false;
1365}
1366
1367
1368
1369template <int dim>
1370inline constexpr bool
1372{
1373 return kind != type.kind;
1374}
1375
1376
1377
1378template <int dim>
1379template <int dim2>
1380inline constexpr bool
1382{
1383 return true;
1384}
1385
1386
1387
1388namespace internal
1389{
1390 template <int dim>
1391 inline constexpr ReferenceCell<dim>
1392 make_reference_cell_from_int(const std::uint8_t kind)
1393 {
1394#ifndef DEAL_II_CXX14_CONSTEXPR_BUG
1395 // Make sure these are the only indices from which objects can be
1396 // created.
1397 Assert((kind == std::numeric_limits<std::uint8_t>::max()) || (kind < 8),
1399#endif
1400
1401 // Call the private constructor, which we can from here because this
1402 // function is a 'friend'.
1403 return ReferenceCell<dim>(kind);
1404 }
1405} // namespace internal
1406
1407
1408
1417{
1419 internal::make_reference_cell_from_int<0>(0);
1421 internal::make_reference_cell_from_int<1>(1);
1423 internal::make_reference_cell_from_int<2>(2);
1425 internal::make_reference_cell_from_int<2>(3);
1427 internal::make_reference_cell_from_int<3>(4);
1429 internal::make_reference_cell_from_int<3>(5);
1431 internal::make_reference_cell_from_int<3>(6);
1433 internal::make_reference_cell_from_int<3>(7);
1434
1435 template <int dim>
1437 internal::make_reference_cell_from_int<dim>(
1438 std::numeric_limits<std::uint8_t>::max());
1439
1444 template <int dim>
1445 constexpr const std::vector<ReferenceCell<dim>>
1447
1453 template <int dim>
1454 constexpr const ReferenceCell<dim> &
1455 get_simplex();
1456
1462 template <int dim>
1463 constexpr const ReferenceCell<dim> &
1464 get_hypercube();
1465
1470 template <int dim>
1471 constexpr unsigned int
1473
1486 template <int dim>
1488 n_vertices_to_reference_cell(const unsigned int n_vertices);
1489
1497 template <int dim>
1498 constexpr unsigned int
1500
1508 template <int dim>
1509 constexpr unsigned int
1510 max_n_lines();
1511
1527 template <int dim>
1528 constexpr unsigned int
1529 max_n_faces();
1530
1540 template <int dim>
1541 constexpr unsigned int
1543} // namespace ReferenceCells
1544
1545
1546
1547template <int dim>
1549 : ReferenceCell(ReferenceCells::Invalid<dim>)
1550{}
1551
1552
1553
1554template <int dim>
1555template <class Archive>
1556inline void
1557ReferenceCell<dim>::serialize(Archive &archive, const unsigned int /*version*/)
1558{
1559 archive & kind;
1560}
1561
1562
1563
1564template <int dim>
1565inline constexpr std::size_t
1567{
1568 return sizeof(ReferenceCells::Invalid<dim>);
1569}
1570
1571
1572
1573template <int dim>
1575ReferenceCell<dim>::faces_for_given_vertex(const unsigned int vertex) const
1576{
1577 AssertIndexRange(vertex, n_vertices());
1578 if constexpr (dim == 0)
1580 else if constexpr (dim == 1)
1581 return {&GeometryInfo<1>::vertex_to_face[vertex][0], 1};
1582 else if constexpr (dim == 2)
1583 {
1584 switch (this->kind)
1585 {
1587 return {&GeometryInfo<2>::vertex_to_face[vertex][0], 2};
1589 {
1590 static constexpr ndarray<unsigned int, 3, 2> table = {
1591 {{{0, 2}}, {{0, 1}}, {{1, 2}}}};
1592 return table[vertex];
1593 }
1594 default:
1596 }
1597 }
1598 else if constexpr (dim == 3)
1599 {
1600 switch (this->kind)
1601 {
1603 {
1604 static constexpr ndarray<unsigned int, 4, 3> table = {
1605 {{{0, 1, 2}}, {{0, 1, 3}}, {{0, 2, 3}}, {{1, 2, 3}}}};
1606
1607 return table[vertex];
1608 }
1610 {
1611 static constexpr unsigned int X = numbers::invalid_unsigned_int;
1612 static constexpr ndarray<unsigned int, 5, 4> table = {
1613 {{{0, 1, 3, X}},
1614 {{0, 2, 3, X}},
1615 {{0, 1, 4, X}},
1616 {{0, 2, 4, X}},
1617 {{1, 2, 3, 4}}}};
1618
1619 return {&table[vertex][0], vertex == 4 ? 4u : 3u};
1620 }
1622 {
1623 AssertIndexRange(vertex, 6);
1624 static constexpr ndarray<unsigned int, 6, 3> table = {
1625 {{{0, 2, 4}},
1626 {{0, 2, 3}},
1627 {{0, 3, 4}},
1628 {{1, 2, 4}},
1629 {{1, 2, 3}},
1630 {{1, 3, 4}}}};
1631
1632 return table[vertex];
1633 }
1635 return {&GeometryInfo<3>::vertex_to_face[vertex][0], 3};
1636 default:
1638 }
1639 }
1640 else
1642
1643 return {};
1644}
1645
1646
1647
1648template <int dim>
1651 const RefinementChoice<dim> &refinement_choice) const
1652{
1653 Assert(refinement_choice != RefinementChoices::None<dim> &&
1654 is_compatible_with(refinement_choice),
1655 ExcMessage("The given RefinementChoice is not valid for this "
1656 "ReferenceCell."));
1657
1658 const unsigned int X = numbers::invalid_unsigned_int;
1659 if constexpr (dim == 3)
1660 {
1661 switch (this->kind)
1662 {
1664 switch (refinement_choice.new_tetrahedron_line())
1665 {
1666 case 0:
1667 {
1668 // new line is (6,8)
1669 static constexpr ndarray<unsigned int, 13, 4> table_68 = {
1670 {{{2, 3, 8, X}},
1671 {{0, 9, 5, X}},
1672 {{1, 6, 11, X}},
1673 {{4, 10, 7, X}},
1674 {{2, 12, 5, X}},
1675 {{1, 9, 12, X}},
1676 {{4, 8, 12, X}},
1677 {{6, 12, 10, X}},
1678 {{X, X, X, X}},
1679 {{X, X, X, X}},
1680 {{X, X, X, X}},
1681 {{X, X, X, X}},
1682 {{X, X, X, X}}}};
1683 return table_68;
1684 }
1685 case 1:
1686 {
1687 // new line is (5,7)
1688 static constexpr ndarray<unsigned int, 13, 4> table_57 = {
1689 {{{2, 3, 8, X}},
1690 {{0, 9, 5, X}},
1691 {{1, 6, 11, X}},
1692 {{4, 10, 7, X}},
1693 {{0, 3, 12, X}},
1694 {{1, 12, 8, X}},
1695 {{4, 12, 9, X}},
1696 {{7, 11, 12, X}},
1697 {{X, X, X, X}},
1698 {{X, X, X, X}},
1699 {{X, X, X, X}},
1700 {{X, X, X, X}},
1701 {{X, X, X, X}}}};
1702 return table_57;
1703 }
1704 case 2:
1705 {
1706 // new line is (4,9)
1707 static constexpr ndarray<unsigned int, 13, 4> table_49 = {
1708 {{{2, 3, 8, X}},
1709 {{0, 9, 5, X}},
1710 {{1, 6, 11, X}},
1711 {{4, 10, 7, X}},
1712 {{0, 12, 11, X}},
1713 {{2, 6, 12, X}},
1714 {{3, 12, 7, X}},
1715 {{5, 10, 12, X}},
1716 {{X, X, X, X}},
1717 {{X, X, X, X}},
1718 {{X, X, X, X}},
1719 {{X, X, X, X}},
1720 {{X, X, X, X}}}};
1721 return table_49;
1722 }
1723 default:
1725 }
1726
1728 {
1729 static constexpr ndarray<unsigned int, 13, 4>
1730 new_quad_lines_pyramid = {
1731 {{{0, 10, 16, X}}, // child 0
1732 {{2, 16, 6, X}},
1733 {{0, 17, 12, X}}, // child 1
1734 {{3, 7, 17, X}},
1735 {{1, 18, 15, X}}, // child 2
1736 {{2, 4, 18, X}},
1737 {{1, 13, 19, X}}, // child 3
1738 {{3, 19, 9, X}},
1739 {{5, 8, 11, 14}}, // child 9 (top)
1740 {{11, 17, 16, X}}, // child 8 (upside down)
1741 {{14, 18, 19, X}},
1742 {{5, 16, 18, X}},
1743 {{8, 19, 17, X}}}};
1744 return new_quad_lines_pyramid;
1745 }
1746
1748 {
1749 static constexpr ndarray<unsigned int, 13, 4>
1750 new_quad_lines_wedge = {{{{2, 20, 11, X}}, // mid tri
1751 {{3, 6, 18, X}},
1752 {{19, 7, 10, X}},
1753 {{18, 19, 20, X}},
1754 {{4, 0, 14, 18}}, // lower
1755 {{0, 8, 12, 20}},
1756 {{8, 4, 13, 19}},
1757 {{5, 1, 18, 15}}, // upper
1758 {{1, 9, 20, 17}},
1759 {{9, 5, 19, 16}},
1760 {{X, X, X, X}},
1761 {{X, X, X, X}},
1762 {{X, X, X, X}}}};
1763 return new_quad_lines_wedge;
1764 }
1765
1767 {
1768 static constexpr ndarray<unsigned int, 13, 4> new_quad_lines_hex =
1769 {{{{10, 28, 16, 24}},
1770 {{28, 14, 17, 25}},
1771 {{11, 29, 24, 20}},
1772 {{29, 15, 25, 21}},
1773 {{18, 26, 0, 28}},
1774 {{26, 22, 1, 29}},
1775 {{19, 27, 28, 4}},
1776 {{27, 23, 29, 5}},
1777 {{2, 24, 8, 26}},
1778 {{24, 6, 9, 27}},
1779 {{3, 25, 26, 12}},
1780 {{25, 7, 27, 13}},
1781 {{X, X, X, X}}}};
1782 return new_quad_lines_hex;
1783 }
1784
1785 default:
1787 }
1788 }
1789 else
1790 // We should never get here except in the 3d case.
1792
1793 static constexpr ndarray<unsigned int, 13, 4> empty{};
1794 return empty;
1795}
1796
1797
1798
1799template <int dim>
1800inline const ndarray<unsigned int, 13, 4> &
1802 const unsigned int refinement_choice) const
1803{
1804 return new_isotropic_child_face_lines(
1805 isotropic_refinement_choice_from_index(refinement_choice));
1806}
1807
1808
1809
1810template <int dim>
1813 const RefinementChoice<dim> &refinement_choice) const
1814{
1815 Assert(refinement_choice != RefinementChoices::None<dim> &&
1816 is_compatible_with(refinement_choice),
1817 ExcMessage("The given RefinementChoice is not valid for this "
1818 "ReferenceCell."));
1819
1820 const unsigned int X = numbers::invalid_unsigned_int;
1821 if constexpr (dim == 3)
1822 {
1823 switch (this->kind)
1824 {
1826 switch (refinement_choice.new_tetrahedron_line())
1827 {
1828 case 0:
1829 {
1830 // new line is (6, 8)
1831 static constexpr ndarray<unsigned int, 13, 4, 2> table_68 =
1832 {{{{{{6, 4}}, {{4, 7}}, {{7, 6}}, {{X, X}}}},
1833 {{{{4, 5}}, {{5, 8}}, {{8, 4}}, {{X, X}}}},
1834 {{{{5, 6}}, {{6, 9}}, {{9, 5}}, {{X, X}}}},
1835 {{{{7, 8}}, {{8, 9}}, {{9, 7}}, {{X, X}}}},
1836 {{{{4, 6}}, {{6, 8}}, {{8, 4}}, {{X, X}}}},
1837 {{{{6, 5}}, {{5, 8}}, {{8, 6}}, {{X, X}}}},
1838 {{{{8, 7}}, {{7, 6}}, {{6, 8}}, {{X, X}}}},
1839 {{{{9, 6}}, {{6, 8}}, {{8, 9}}, {{X, X}}}},
1840 {{{{X, X}}, {{X, X}}, {{X, X}}, {{X, X}}}},
1841 {{{{X, X}}, {{X, X}}, {{X, X}}, {{X, X}}}},
1842 {{{{X, X}}, {{X, X}}, {{X, X}}, {{X, X}}}},
1843 {{{{X, X}}, {{X, X}}, {{X, X}}, {{X, X}}}},
1844 {{{{X, X}}, {{X, X}}, {{X, X}}, {{X, X}}}}}};
1845 return table_68;
1846 }
1847 case 1:
1848 {
1849 // new line is (5, 7)
1850 static constexpr ndarray<unsigned int, 13, 4, 2> table_57 =
1851 {{{{{{6, 4}}, {{4, 7}}, {{7, 6}}, {{X, X}}}},
1852 {{{{4, 5}}, {{5, 8}}, {{8, 4}}, {{X, X}}}},
1853 {{{{5, 6}}, {{6, 9}}, {{9, 5}}, {{X, X}}}},
1854 {{{{7, 8}}, {{8, 9}}, {{9, 7}}, {{X, X}}}},
1855 {{{{5, 4}}, {{4, 7}}, {{7, 5}}, {{X, X}}}},
1856 {{{{6, 5}}, {{5, 7}}, {{7, 6}}, {{X, X}}}},
1857 {{{{8, 7}}, {{7, 5}}, {{5, 8}}, {{X, X}}}},
1858 {{{{7, 9}}, {{9, 5}}, {{5, 7}}, {{X, X}}}},
1859 {{{{X, X}}, {{X, X}}, {{X, X}}, {{X, X}}}},
1860 {{{{X, X}}, {{X, X}}, {{X, X}}, {{X, X}}}},
1861 {{{{X, X}}, {{X, X}}, {{X, X}}, {{X, X}}}},
1862 {{{{X, X}}, {{X, X}}, {{X, X}}, {{X, X}}}},
1863 {{{{X, X}}, {{X, X}}, {{X, X}}, {{X, X}}}}}};
1864 return table_57;
1865 }
1866 case 2:
1867 {
1868 // new line is (4, 9)
1869 static constexpr ndarray<unsigned int, 13, 4, 2> table_49 =
1870 {{{{{{6, 4}}, {{4, 7}}, {{7, 6}}, {{X, X}}}},
1871 {{{{4, 5}}, {{5, 8}}, {{8, 4}}, {{X, X}}}},
1872 {{{{5, 6}}, {{6, 9}}, {{9, 5}}, {{X, X}}}},
1873 {{{{7, 8}}, {{8, 9}}, {{9, 7}}, {{X, X}}}},
1874 {{{{5, 4}}, {{4, 9}}, {{9, 5}}, {{X, X}}}},
1875 {{{{4, 6}}, {{6, 9}}, {{9, 4}}, {{X, X}}}},
1876 {{{{7, 4}}, {{4, 9}}, {{9, 7}}, {{X, X}}}},
1877 {{{{4, 8}}, {{8, 9}}, {{9, 4}}, {{X, X}}}},
1878 {{{{X, X}}, {{X, X}}, {{X, X}}, {{X, X}}}},
1879 {{{{X, X}}, {{X, X}}, {{X, X}}, {{X, X}}}},
1880 {{{{X, X}}, {{X, X}}, {{X, X}}, {{X, X}}}},
1881 {{{{X, X}}, {{X, X}}, {{X, X}}, {{X, X}}}},
1882 {{{{X, X}}, {{X, X}}, {{X, X}}, {{X, X}}}}}};
1883 return table_49;
1884 }
1885 default:
1887 }
1888
1890 {
1891 static constexpr ndarray<unsigned int, 13, 4, 2>
1892 quad_lines_vertices_pyramid = {
1893 {// child 0
1894 {{{{13, 7}}, {{7, 9}}, {{9, 13}}, {{X, X}}}},
1895 {{{{5, 13}}, {{13, 9}}, {{9, 5}}, {{X, X}}}},
1896 // child 1
1897 {{{{7, 13}}, {{13, 10}}, {{10, 7}}, {{X, X}}}},
1898 {{{{13, 6}}, {{6, 10}}, {{10, 13}}, {{X, X}}}},
1899 // child 2
1900 {{{{8, 13}}, {{13, 11}}, {{11, 8}}, {{X, X}}}},
1901 {{{{13, 5}}, {{5, 11}}, {{11, 13}}, {{X, X}}}},
1902 // child 3
1903 {{{{13, 8}}, {{8, 12}}, {{12, 13}}, {{X, X}}}},
1904 {{{{6, 13}}, {{13, 12}}, {{12, 6}}, {{X, X}}}},
1905 // child 9 (top)
1906 {{{{9, 11}}, {{10, 12}}, {{9, 10}}, {{11, 12}}}},
1907 // child 8 (upside down)
1908 {{{{9, 10}}, {{10, 13}}, {{13, 9}}, {{X, X}}}},
1909 {{{{12, 11}}, {{11, 13}}, {{13, 12}}, {{X, X}}}},
1910 {{{{11, 9}}, {{9, 13}}, {{13, 11}}, {{X, X}}}},
1911 {{{{10, 12}}, {{12, 13}}, {{13, 10}}, {{X, X}}}}}};
1912 return quad_lines_vertices_pyramid;
1913 }
1914
1916 {
1917 static constexpr ndarray<unsigned int, 13, 4, 2>
1918 quad_lines_vertices_wedge = {
1919 {// mid tri
1920 {{{{12, 15}}, {{15, 17}}, {{17, 12}}, {{X, X}}}},
1921 {{{{15, 13}}, {{13, 16}}, {{16, 15}}, {{X, X}}}},
1922 {{{{17, 16}}, {{16, 14}}, {{14, 17}}, {{X, X}}}},
1923 {{{{15, 16}}, {{16, 17}}, {{17, 15}}, {{X, X}}}},
1924 // lower
1925 {{{{7, 16}}, {{6, 15}}, {{7, 6}}, {{16, 15}}}},
1926 {{{{6, 15}}, {{8, 17}}, {{6, 8}}, {{15, 17}}}},
1927 {{{{8, 17}}, {{7, 16}}, {{8, 7}}, {{17, 16}}}},
1928 // upper
1929 {{{{16, 10}}, {{15, 9}}, {{16, 15}}, {{10, 9}}}},
1930 {{{{15, 9}}, {{17, 11}}, {{15, 17}}, {{9, 11}}}},
1931 {{{{17, 11}}, {{16, 10}}, {{17, 16}}, {{11, 10}}}},
1932 {{{{X, X}}, {{X, X}}, {{X, X}}, {{X, X}}}},
1933 {{{{X, X}}, {{X, X}}, {{X, X}}, {{X, X}}}},
1934 {{{{X, X}}, {{X, X}}, {{X, X}}, {{X, X}}}}}};
1935 return quad_lines_vertices_wedge;
1936 }
1937
1939 {
1940 static constexpr ndarray<unsigned int, 13, 4, 2>
1941 quad_lines_vertices_hex = {
1942 {{{{{10, 22}}, {{24, 26}}, {{10, 24}}, {{22, 26}}}},
1943 {{{{24, 26}}, {{11, 23}}, {{24, 11}}, {{26, 23}}}},
1944 {{{{22, 14}}, {{26, 25}}, {{22, 26}}, {{14, 25}}}},
1945 {{{{26, 25}}, {{23, 15}}, {{26, 23}}, {{25, 15}}}},
1946 {{{{8, 24}}, {{20, 26}}, {{8, 20}}, {{24, 26}}}},
1947 {{{{20, 26}}, {{12, 25}}, {{20, 12}}, {{26, 25}}}},
1948 {{{{24, 9}}, {{26, 21}}, {{24, 26}}, {{9, 21}}}},
1949 {{{{26, 21}}, {{25, 13}}, {{26, 25}}, {{21, 13}}}},
1950 {{{{16, 20}}, {{22, 26}}, {{16, 22}}, {{20, 26}}}},
1951 {{{{22, 26}}, {{17, 21}}, {{22, 17}}, {{26, 21}}}},
1952 {{{{20, 18}}, {{26, 23}}, {{20, 26}}, {{18, 23}}}},
1953 {{{{26, 23}}, {{21, 19}}, {{26, 21}}, {{23, 19}}}},
1954 {{{{X, X}}, {{X, X}}, {{X, X}}, {{X, X}}}}}};
1955 return quad_lines_vertices_hex;
1956 }
1957 default:
1959 }
1960 }
1961 else
1962 // We should never get here except in the 3d case.
1964
1965 static constexpr ndarray<unsigned int, 13, 4, 2> empty{};
1966 return empty;
1967}
1968
1969
1970
1971template <int dim>
1974 const unsigned int refinement_choice) const
1975{
1976 return new_isotropic_child_face_line_vertices(
1977 isotropic_refinement_choice_from_index(refinement_choice));
1978}
1979
1980
1981
1982template <int dim>
1985 const RefinementChoice<dim> &refinement_choice) const
1986{
1987 Assert(refinement_choice != RefinementChoices::None<dim> &&
1988 is_compatible_with(refinement_choice),
1989 ExcMessage("The given RefinementChoice is not valid for this "
1990 "ReferenceCell."));
1991
1992 const unsigned int X = numbers::invalid_unsigned_int;
1993 if constexpr (dim == 3)
1994 {
1995 switch (this->kind)
1996 {
1998 switch (refinement_choice.new_tetrahedron_line())
1999 {
2000 case 0:
2001 {
2002 // new line is (6, 8)
2003 static constexpr ndarray<unsigned int, 10, 6> table_68 = {{
2004 {{8, 13, 16, 0, X, X}},
2005 {{9, 12, 1, 21, X, X}},
2006 {{10, 2, 17, 20, X, X}},
2007 {{3, 14, 18, 22, X, X}},
2008 {{11, 1, 4, 5, X, X}},
2009 {{15, 0, 4, 6, X, X}},
2010 {{19, 7, 6, 3, X, X}},
2011 {{23, 5, 2, 7, X, X}},
2012 {{X, X, X, X, X, X}},
2013 {{X, X, X, X, X, X}},
2014 }};
2015 return table_68;
2016 }
2017 case 1:
2018 {
2019 // new line is (5, 7)
2020 static constexpr ndarray<unsigned int, 10, 6> table_57 = {{
2021 {{8, 13, 16, 0, X, X}},
2022 {{9, 12, 1, 21, X, X}},
2023 {{10, 2, 17, 20, X, X}},
2024 {{3, 14, 18, 22, X, X}},
2025 {{11, 4, 0, 5, X, X}},
2026 {{15, 4, 1, 6, X, X}},
2027 {{19, 2, 5, 7, X, X}},
2028 {{23, 6, 7, 3, X, X}},
2029 {{X, X, X, X, X, X}},
2030 {{X, X, X, X, X, X}},
2031 }};
2032 return table_57;
2033 }
2034 case 2:
2035 {
2036 // new line is (4, 9)
2037 static constexpr ndarray<unsigned int, 10, 6> table_49 = {{
2038 {{8, 13, 16, 0, X, X}},
2039 {{9, 12, 1, 21, X, X}},
2040 {{10, 2, 17, 20, X, X}},
2041 {{3, 14, 18, 22, X, X}},
2042 {{11, 4, 5, 2, X, X}},
2043 {{15, 6, 7, 3, X, X}},
2044 {{19, 5, 0, 6, X, X}},
2045 {{23, 1, 4, 7, X, X}},
2046 {{X, X, X, X, X, X}},
2047 {{X, X, X, X, X, X}},
2048 }};
2049 return table_49;
2050 }
2051 default:
2053 }
2054
2056 {
2057 static constexpr ndarray<unsigned int, 10, 6> cell_quads_pyramid =
2058 {{
2059 {{13, 17, 0, 26, 1, X}}, // bottom pyramids
2060 {{14, 2, 22, 25, 3, X}}, //
2061 {{15, 18, 4, 5, 29, X}}, //
2062 {{16, 6, 21, 7, 30, X}}, //
2063 {{5, 1, 20, 11, X, X}}, // bottom wedges
2064 {{7, 3, 12, 24, X, X}}, //
2065 {{0, 2, 28, 9, X, X}}, //
2066 {{4, 6, 10, 32, X, X}}, //
2067 {{8, 9, 10, 11, 12, X}}, // upside down pyramid
2068 {{8, 19, 23, 27, 31, X}} // top pyramid
2069 }};
2070 return cell_quads_pyramid;
2071 }
2072
2074 {
2075 // Considerations that went into creating this table
2076 // - Keep aspect ratio of 1.0 if parent had 1.0 (this is why the
2077 // centre wedge is rotated by 180 degrees compared to the
2078 // parent)
2079 // - Order of children is similar to the order of a reference
2080 // triangle in the x-y-plane (i.e. like the top triangle of the
2081 // parent)
2082 static constexpr ndarray<unsigned int, 10, 6> cell_quads_wedge = {
2083 {
2084 {{23, 0, 10, 5, 19, X}}, // bottom children
2085 {{22, 1, 11, 14, 4, X}}, //
2086 {{24, 2, 6, 15, 18, X}}, //
2087 {{25, 3, 6, 5, 4, X}}, //
2088 {{0, 26, 12, 8, 21, X}}, // top children
2089 {{1, 27, 13, 16, 7, X}}, //
2090 {{2, 28, 9, 17, 20, X}}, //
2091 {{3, 29, 9, 8, 7, X}}, //
2092 {{X, X, X, X, X, X}},
2093 {{X, X, X, X, X, X}},
2094 }};
2095 return cell_quads_wedge;
2096 }
2097
2099 {
2100 static constexpr ndarray<unsigned int, 10, 6> cell_quads_hex = {{
2101 {{12, 0, 20, 4, 28, 8}}, // bottom children
2102 {{0, 16, 22, 6, 29, 9}}, //
2103 {{13, 1, 4, 24, 30, 10}}, //
2104 {{1, 17, 6, 26, 31, 11}}, //
2105 {{14, 2, 21, 5, 8, 32}}, // top children
2106 {{2, 18, 23, 7, 9, 33}}, //
2107 {{15, 3, 5, 25, 10, 34}}, //
2108 {{3, 19, 7, 27, 11, 35}}, //
2109 {{X, X, X, X, X, X}},
2110 {{X, X, X, X, X, X}},
2111 }};
2112 return cell_quads_hex;
2113 }
2114 default:
2116 }
2117 }
2118 else
2119 // We should never get here except in the 3d case.
2121
2122 static constexpr ndarray<unsigned int, 10, 6> empty{};
2123 return empty;
2124}
2125
2126
2127
2128template <int dim>
2129inline const ndarray<unsigned int, 10, 6> &
2131 const unsigned int refinement_choice) const
2132{
2133 return new_isotropic_child_cell_faces(
2134 isotropic_refinement_choice_from_index(refinement_choice));
2135}
2136
2137
2138
2139template <int dim>
2142 const RefinementChoice<dim> &refinement_choice) const
2143{
2144 Assert(refinement_choice != RefinementChoices::None<dim> &&
2145 is_compatible_with(refinement_choice),
2146 ExcMessage("The given RefinementChoice is not valid for this "
2147 "ReferenceCell."));
2148
2149 constexpr unsigned int X = numbers::invalid_unsigned_int;
2150 if constexpr (dim == 3)
2151 {
2152 switch (this->kind)
2153 {
2155 switch (refinement_choice.new_tetrahedron_line())
2156 {
2157 case 0:
2158 {
2159 // new line is (6,8)
2160 static constexpr ndarray<unsigned int, 10, 8> table_68 = {{
2161 {{0, 4, 6, 7, X, X, X, X}},
2162 {{4, 1, 5, 8, X, X, X, X}},
2163 {{6, 5, 2, 9, X, X, X, X}},
2164 {{7, 8, 9, 3, X, X, X, X}},
2165 {{4, 5, 6, 8, X, X, X, X}},
2166 {{4, 7, 8, 6, X, X, X, X}},
2167 {{6, 9, 7, 8, X, X, X, X}},
2168 {{5, 8, 9, 6, X, X, X, X}},
2169 {{X, X, X, X, X, X, X, X}},
2170 {{X, X, X, X, X, X, X, X}},
2171 }};
2172 return table_68;
2173 }
2174 case 1:
2175 {
2176 // new line is (5,7)
2177 static constexpr ndarray<unsigned int, 10, 8> table_57 = {{
2178 {{0, 4, 6, 7, X, X, X, X}},
2179 {{4, 1, 5, 8, X, X, X, X}},
2180 {{6, 5, 2, 9, X, X, X, X}},
2181 {{7, 8, 9, 3, X, X, X, X}},
2182 {{4, 5, 6, 7, X, X, X, X}},
2183 {{4, 7, 8, 5, X, X, X, X}},
2184 {{6, 9, 7, 5, X, X, X, X}},
2185 {{5, 8, 9, 7, X, X, X, X}},
2186 {{X, X, X, X, X, X, X, X}},
2187 {{X, X, X, X, X, X, X, X}},
2188 }};
2189 return table_57;
2190 }
2191 case 2:
2192 {
2193 // new line is (4,9)
2194 static constexpr ndarray<unsigned int, 10, 8> table_49 = {{
2195 {{0, 4, 6, 7, X, X, X, X}},
2196 {{4, 1, 5, 8, X, X, X, X}},
2197 {{6, 5, 2, 9, X, X, X, X}},
2198 {{7, 8, 9, 3, X, X, X, X}},
2199 {{4, 5, 6, 9, X, X, X, X}},
2200 {{4, 7, 8, 9, X, X, X, X}},
2201 {{6, 9, 7, 4, X, X, X, X}},
2202 {{5, 8, 9, 4, X, X, X, X}},
2203 {{X, X, X, X, X, X, X, X}},
2204 {{X, X, X, X, X, X, X, X}},
2205 }};
2206 return table_49;
2207 }
2208
2209 default:
2211 }
2213 {
2214 static constexpr ndarray<unsigned int, 10, 8>
2215 cell_vertices_pyramid = {{
2216 {{0, 7, 5, 13, 9, X, X, X}}, // bottom pyramid
2217 {{7, 1, 13, 6, 10, X, X, X}}, //
2218 {{5, 13, 2, 8, 11, X, X, X}}, //
2219 {{13, 6, 8, 3, 12, X, X, X}}, //
2220 {{5, 13, 11, 9, X, X, X, X}}, // bottom wedges
2221 {{13, 6, 12, 10, X, X, X, X}}, //
2222 {{7, 13, 9, 10, X, X, X, X}}, //
2223 {{13, 8, 11, 12, X, X, X, X}}, //
2224 {{9, 11, 10, 12, 13, X, X, X}}, // upside down pyramid
2225 {{9, 10, 11, 12, 4, X, X, X}}, // top pyramid
2226 }};
2227 return cell_vertices_pyramid;
2228 }
2229
2231 {
2232 static constexpr ndarray<unsigned int, 10, 8>
2233 cell_vertices_wedge = {{
2234 {{0, 6, 8, 12, 15, 17, X, X}}, // bottom children
2235 {{6, 1, 7, 15, 13, 16, X, X}}, //
2236 {{8, 7, 2, 17, 16, 14, X, X}}, //
2237 {{7, 8, 6, 16, 17, 15, X, X}}, //
2238 {{12, 15, 17, 3, 9, 11, X, X}}, // top children
2239 {{15, 13, 16, 9, 4, 10, X, X}}, //
2240 {{17, 16, 14, 11, 10, 5, X, X}}, //
2241 {{16, 17, 15, 10, 11, 9, X, X}}, //
2242 {{X, X, X, X, X, X, X, X}},
2243 {{X, X, X, X, X, X, X, X}},
2244 }};
2245 return cell_vertices_wedge;
2246 }
2247
2249 {
2250 static constexpr ndarray<unsigned int, 10, 8> cell_vertices_hex =
2251 {{
2252 {{0, 10, 8, 24, 16, 22, 20, 26}}, // bottom children
2253 {{10, 1, 24, 9, 22, 17, 26, 21}}, //
2254 {{8, 24, 2, 11, 20, 26, 18, 23}}, //
2255 {{24, 9, 11, 3, 26, 21, 23, 19}}, //
2256 {{16, 22, 20, 26, 4, 14, 12, 25}}, // top children
2257 {{22, 17, 26, 21, 14, 5, 25, 13}}, //
2258 {{20, 26, 18, 23, 12, 25, 6, 15}}, //
2259 {{26, 21, 23, 19, 25, 13, 15, 7}}, //
2260 {{X, X, X, X, X, X, X, X}},
2261 {{X, X, X, X, X, X, X, X}},
2262 }};
2263 return cell_vertices_hex;
2264 }
2265
2266 default:
2268 }
2269 }
2270 else
2271 // We should never get here except in the 3d case.
2273
2274 static constexpr ndarray<unsigned int, 10, 8> empty{};
2275 return empty;
2276}
2277
2278
2279
2280template <int dim>
2281inline const ndarray<unsigned int, 10, 8> &
2283 const unsigned int refinement_choice) const
2284{
2285 return new_isotropic_child_cell_vertices(
2286 isotropic_refinement_choice_from_index(refinement_choice));
2287}
2288
2289
2290
2291template <int dim>
2292inline constexpr bool
2294{
2295 return (*this == ReferenceCells::Vertex || *this == ReferenceCells::Line ||
2298}
2299
2300
2301
2302template <int dim>
2303inline constexpr bool
2305{
2306 return (*this == ReferenceCells::Vertex || *this == ReferenceCells::Line ||
2307 *this == ReferenceCells::Triangle ||
2309}
2310
2311
2312
2313template <int dim>
2314inline constexpr unsigned int
2316{
2317 return dim;
2318}
2319
2320
2321
2322template <int dim>
2325{
2326 return Quadrature<dim>(std::vector<Point<dim>>({barycenter()}),
2327 std::vector<double>({volume()}));
2328}
2329
2330
2331
2332template <int dim>
2333inline constexpr unsigned int
2335{
2336 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
2337
2338 if constexpr (dim == 0)
2339 return 1;
2340 else if constexpr (dim == 1)
2341 return 2;
2342 else if constexpr (dim == 2)
2343 {
2344 switch (this->kind)
2345 {
2347 return 3;
2349 return 4;
2350 default:
2352 }
2353 }
2354 else if constexpr (dim == 3)
2355 {
2356 switch (this->kind)
2357 {
2359 return 4;
2361 return 5;
2363 return 6;
2365 return 8;
2366 default:
2368 }
2369 }
2370 else
2372
2374}
2375
2376
2377
2378template <int dim>
2379inline constexpr unsigned int
2381{
2382 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
2383
2384 if constexpr (dim == 0)
2385 return 0;
2386 else if constexpr (dim == 1)
2387 return 1;
2388 else if constexpr (dim == 2)
2389 {
2390 switch (this->kind)
2391 {
2393 return 3;
2395 return 4;
2396 default:
2398 }
2399 }
2400 else if constexpr (dim == 3)
2401 {
2402 switch (this->kind)
2403 {
2405 return 6;
2407 return 8;
2409 return 9;
2411 return 12;
2412 default:
2414 }
2415 }
2416 else
2418
2420}
2421
2422
2423
2424template <int dim>
2426ReferenceCell<dim>::vertex(const unsigned int v) const
2427{
2428 AssertIndexRange(v, n_vertices());
2429 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
2430
2431 if constexpr (dim == 0)
2432 return Point<dim>();
2433 else if constexpr (dim == 1)
2434 {
2435 static const Point<dim> vertices[2] = {
2436 Point<dim>(), // the origin
2437 Point<dim>::unit_vector(0) // unit point along x-axis
2438 };
2439 return vertices[v];
2440 }
2441 else if constexpr (dim == 2)
2442 {
2443 switch (this->kind)
2444 {
2446 {
2447 static const Point<dim> vertices[3] = {
2448 Point<dim>(), // the origin
2449 Point<dim>::unit_vector(0), // unit point along x-axis
2450 Point<dim>::unit_vector(1) // unit point along y-axis
2451 };
2452 return vertices[v];
2453 }
2455 {
2456 static const Point<dim> vertices[4] = {
2457 // First the two points on the x-axis
2458 Point<dim>(),
2460 // Then these two points shifted in the y-direction
2463 return vertices[v];
2464 }
2465 }
2466 }
2467 else if constexpr (dim == 3)
2468 {
2469 switch (this->kind)
2470 {
2472 {
2473 static const Point<dim> vertices[4] = {
2474 Point<dim>(), // the origin
2475 Point<dim>::unit_vector(0), // unit point along x-axis
2476 Point<dim>::unit_vector(1), // unit point along y-axis
2477 Point<dim>::unit_vector(2) // unit point along z-axis
2478 };
2479 return vertices[v];
2480 }
2482 {
2483 static const Point<dim> vertices[5] = {
2484 Point<dim>{-1.0, -1.0, 0.0},
2485 Point<dim>{+1.0, -1.0, 0.0},
2486 Point<dim>{-1.0, +1.0, 0.0},
2487 Point<dim>{+1.0, +1.0, 0.0},
2488 Point<dim>{+0.0, +0.0, 1.0}};
2489 return vertices[v];
2490 }
2492 {
2493 static const Point<dim> vertices[6] = {
2494 // First the three points on the triangular base of the
2495 // wedge:
2496 Point<dim>(),
2499 // And now everything shifted in the z-direction again
2503 return vertices[v];
2504 }
2506 {
2507 static const Point<dim> vertices[8] = {
2508 // First the two points on the x-axis
2509 Point<dim>(),
2511 // Then these two points shifted in the y-direction
2514 // And now all four points shifted in the z-direction
2521 return vertices[v];
2522 }
2523 }
2524 }
2525
2527 return Point<dim>();
2528}
2529
2530
2531
2532template <int dim>
2533inline constexpr unsigned int
2535{
2536 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
2537
2538 if constexpr (dim == 0)
2539 return 0;
2540 else if constexpr (dim == 1)
2541 return 2;
2542 else if constexpr (dim == 2)
2543 {
2544 switch (this->kind)
2545 {
2547 return 3;
2549 return 4;
2550 }
2551 }
2552 else if constexpr (dim == 3)
2553 {
2554 switch (this->kind)
2555 {
2557 return 4;
2559 return 5;
2561 return 5;
2563 return 6;
2564 }
2565 }
2566
2569}
2570
2571
2572
2573template <int dim>
2580
2581
2582
2583template <int dim>
2586 const ReferenceCell<dim - 1> &face_ref_type) const
2587{
2588 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
2589 Assert(face_ref_type != ReferenceCells::Invalid<dim - 1>,
2591
2592 if constexpr (dim == 0)
2593 {
2594 return this->face_indices(); // no faces
2595 }
2596 else if constexpr (dim == 1)
2597 {
2598 return this->face_indices();
2599 }
2600 else if constexpr (dim == 2)
2601 {
2602 return this->face_indices();
2603 }
2604 else if constexpr (dim == 3)
2605 {
2606 switch (this->kind)
2607 {
2609 {
2610 if (face_ref_type == ReferenceCells::Triangle)
2611 return this->face_indices();
2612 else
2614 0U, 0U);
2615 }
2617 {
2618 if (face_ref_type == ReferenceCells::Triangle)
2620 1U, 5U);
2621 else
2623 0U, 1U);
2624 }
2626 {
2627 if (face_ref_type == ReferenceCells::Triangle)
2629 0U, 2U);
2630 else
2632 2U, 5U);
2633 }
2635 {
2636 if (face_ref_type == ReferenceCells::Quadrilateral)
2637 return this->face_indices();
2638 else
2640 0U, 0U);
2641 }
2642 }
2643 }
2644
2647}
2648
2649
2650
2651template <int dim>
2652inline constexpr unsigned int
2654{
2655 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
2656
2657 if constexpr (dim == 0)
2658 return 1;
2659 else if constexpr (dim == 1)
2660 return 1;
2661 else if constexpr (dim == 2)
2662 return 1;
2663 else if constexpr (dim == 3)
2664 {
2665 switch (this->kind)
2666 {
2668 return 3;
2670 return 1;
2672 return 1;
2674 return 1;
2675 }
2676 }
2677
2680}
2681
2682
2683
2684template <int dim>
2685inline constexpr bool
2687 const RefinementChoice<dim> &refinement_choice) const
2688{
2689 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
2690
2691 // None is always compatible:
2692 if (refinement_choice == RefinementChoices::None<dim>)
2693 return true;
2694
2695 // First cover the special Tetrahedron choices:
2696 if constexpr (dim == 3)
2697 {
2698 if (*this == ReferenceCells::Tetrahedron)
2699 return refinement_choice.is_tetrahedral();
2700 else if (refinement_choice.is_tetrahedral())
2701 return false;
2702 }
2703
2704 // Then hypercubes:
2705 if (this->is_hyper_cube())
2706 return true;
2707 // Finally, Wedge and Pyramid only support isotropic refinement:
2708 return refinement_choice == RefinementChoices::Isotropic<dim>;
2709}
2710
2711
2712
2713template <int dim>
2716 const unsigned int index) const
2717{
2718 if constexpr (dim == 3)
2719 if (*this == ReferenceCells::Tetrahedron)
2720 {
2721 AssertIndexRange(index, 3);
2722 constexpr std::array<RefinementChoice<3>, 3> choices = {
2723 {RefinementChoices::Cut68<3>,
2724 RefinementChoices::Cut57<3>,
2725 RefinementChoices::Cut49<3>}};
2726 return choices[index];
2727 }
2728
2729 // All other ReferenceCells support exactly one kind of isotropic refinement
2730 AssertIndexRange(index, 1);
2731 return RefinementChoices::Isotropic<dim>;
2732}
2733
2734
2735
2736template <int dim>
2739 const unsigned int ref_choice) const
2740{
2741 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
2742 AssertIndexRange(ref_choice, n_isotropic_refinement_choices());
2743
2744 if constexpr (dim == 0)
2746 else if constexpr (dim == 1)
2748 else if constexpr (dim == 2)
2750 else if constexpr (dim == 3)
2751 {
2752 switch (this->kind)
2753 {
2755 {
2757 isotropic_ref_choices = {
2761 return isotropic_ref_choices[ref_choice];
2762 }
2763 default:
2765 }
2766 }
2767
2770}
2771
2772
2773
2774template <int dim>
2775inline constexpr unsigned int
2777{
2778 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
2779
2780 if constexpr (dim == 0)
2781 return 1;
2782 else if constexpr (dim == 1)
2783 return 2;
2784 else if constexpr (dim == 2)
2785 return 4;
2786 else if constexpr (dim == 3)
2787 {
2788 switch (this->kind)
2789 {
2791 return 8;
2793 return 10;
2795 return 8;
2797 return 8;
2798 }
2799 }
2800
2803}
2804
2805
2806
2807template <int dim>
2808unsigned int
2810{
2811 // Use GeometryInfo here to keep it the single source of truth
2812 if (this->is_hyper_cube())
2813 return GeometryInfo<dim>::n_children(ref_case);
2814
2815 // TODO: Rewrite once refinement cases are cleaned up
2816 // For all other cells, we assume that only isotropic refinement is
2817 // implemented. This is a strong assumption that should be removed as soon as
2818 // the issue regarding the uniqueness of refinement cases is resolved.
2819 //
2820 // This is a short outline of the issue: Different refinement options are
2821 // stored as an enum, primarily focusing on hypercubes. They therefore are (to
2822 // some extent) unsuitable for other cell types. For example, there are
2823 // multiple ways to isotropically refine a tetrahedron. Distinguishing between
2824 // these required the introduction of the additional
2825 // `IsotropicRefinementChoice` enum. However, this leads to a conflict where
2826 // the same integer value is assigned to multiple different refinement options
2827 // across the existing refinement cases. The most critical conflict is likely
2828 // `IsotropicRefinementChoice::isotropic_refinement` shadowing
2829 // `RefinementPossibilities<~>::no_refinement`.
2830 // The following code attempts to circumvent this mess by predicting whether
2831 // the given refinement case is isotropic and then returning either the number
2832 // of isotropic children or `0` (see below for why `0` is used).
2833
2834 // Detect isotropic refinement.
2835 // Only in 3D and only for Tetrahedrons we have ambiguity. But first assume
2836 // that we don't have a tet.
2837 bool is_isotropic =
2839
2840 // check if assumption of line above was correct, else apply fix for tet
2841 if constexpr (dim == 3) // check for dim first (only 3D relevant for tet)
2842 if (*this == ReferenceCells::Tetrahedron) // tets
2843 is_isotropic =
2844 ((ref_case == //
2846 // We must not check
2847 // `IsotropicRefinementChoice::isotropic_refinement`
2848 // because it coincides with
2849 // `RefinementPossibilities<dim>::no_refinement`
2850 // (both are 0).
2851 (ref_case ==
2852 static_cast<typename RefinementPossibilities<dim>::Possibilities>(
2854 (ref_case ==
2855 static_cast<typename RefinementPossibilities<dim>::Possibilities>(
2857 (ref_case ==
2858 static_cast<typename RefinementPossibilities<dim>::Possibilities>(
2860
2861
2862 // return the according value
2863 if (is_isotropic)
2864 return n_isotropic_children();
2865
2866 // Unsupported case
2867
2868 // DEAL_II_NOT_IMPLEMENTED();
2869 // We must return some data. Many parts of the code aren't aware
2870 // which refinement cases are actually supported, calling this
2871 // function with impossible refinement cases and expecting some
2872 // output. One example is the constructor of `FiniteElement`.
2873 return 0;
2874}
2875
2876
2877
2878template <int dim>
2885
2886
2887
2888template <int dim>
2895
2896
2897
2898template <int dim>
2905
2906
2907
2908template <int dim>
2911{
2912 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
2913
2914 if constexpr (dim == 0)
2915 {
2916 // Like equivalent_refinement_case(), to better enable generic
2917 // programming, return a value implying vertices can be refined since 1d
2918 // Triangulations can be refined.
2919 static constexpr std::array<RefinementCase<0>, 1> possibilities{
2921 return make_array_view(possibilities);
2922 }
2923 else if constexpr (dim == 1)
2924 {
2925 static constexpr std::array<RefinementCase<1>, 1> possibilities{
2927 return make_array_view(possibilities);
2928 }
2929 else if constexpr (dim == 2)
2930 {
2931 switch (this->kind)
2932 {
2934 {
2935 static constexpr std::array<RefinementCase<2>, 1> possibilities{
2937 return make_array_view(possibilities);
2938 }
2940 {
2941 static constexpr std::array<RefinementCase<2>, 3> possibilities{
2945 return make_array_view(possibilities);
2946 }
2947 }
2948 }
2949 else if constexpr (dim == 3)
2950 {
2951 switch (this->kind)
2952 {
2956 {
2957 static constexpr std::array<RefinementCase<3>, 1> possibilities{
2959 return make_array_view(possibilities);
2960 }
2962 {
2963 static constexpr std::array<RefinementCase<3>, 7> possibilities{
2971 return make_array_view(possibilities);
2972 }
2973 }
2974 }
2975
2978}
2979
2980
2981
2982template <int dim>
2983inline constexpr ReferenceCell<dim - 1>
2984ReferenceCell<dim>::face_reference_cell(const unsigned int face_no) const
2985{
2986 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
2987 AssertIndexRange(face_no, n_faces());
2988
2989 if constexpr (dim == 0)
2990 return ReferenceCells::Invalid<dim - 1>;
2991 else if constexpr (dim == 1)
2993 else if constexpr (dim == 2)
2994 return ReferenceCells::Line;
2995 else if constexpr (dim == 3)
2996 {
2997 switch (this->kind)
2998 {
3002 if (face_no == 0)
3004 else
3007 if (face_no > 1)
3009 else
3013 }
3014 }
3015
3017 return ReferenceCells::Invalid<dim - 1>;
3018}
3019
3020
3021
3022template <int dim>
3023inline unsigned int
3025 const unsigned int face,
3026 const unsigned int subface,
3027 const types::geometric_orientation combined_orientation) const
3028{
3029 (void)combined_orientation;
3030
3031 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
3032 AssertIndexRange(face, n_faces());
3033 AssertIndexRange(subface, face_reference_cell(face).n_isotropic_children());
3034
3035 if constexpr (dim == 0)
3037 else if constexpr (dim == 1)
3039 else if constexpr (dim == 2)
3040 {
3041 switch (this->kind)
3042 {
3044 {
3045 static constexpr ndarray<unsigned int, 3, 2> subcells = {
3046 {{{0, 1}}, {{1, 2}}, {{2, 0}}}};
3047
3048 Assert(combined_orientation ==
3050 combined_orientation ==
3053 return subcells[face][combined_orientation ==
3055 subface :
3056 1 - subface];
3057 }
3059 {
3060 const auto [face_orientation, face_rotation, face_flip] =
3061 internal::split_face_orientation(combined_orientation);
3062
3066 face,
3067 subface,
3068 face_orientation,
3069 face_flip,
3070 face_rotation);
3071 }
3072 }
3073 }
3074 else if constexpr (dim == 3)
3075 {
3076 switch (this->kind)
3077 {
3081 {
3083 break;
3084 }
3086 {
3087 const auto [face_orientation, face_rotation, face_flip] =
3088 internal::split_face_orientation(combined_orientation);
3089
3093 face,
3094 subface,
3095 face_orientation,
3096 face_flip,
3097 face_rotation);
3098 }
3099 }
3100 }
3101
3104}
3105
3106
3107
3108template <int dim>
3109inline std::array<unsigned int, 2>
3111 const unsigned int vertex) const
3112{
3113 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
3114 AssertIndexRange(vertex, n_vertices());
3115 // Work around a GCC warning at higher optimization levels by making all of
3116 // these tables the same size
3117 constexpr unsigned int X = numbers::invalid_unsigned_int;
3118
3119 if constexpr (dim == 0)
3121 else if constexpr (dim == 1)
3122 {
3123 static constexpr ndarray<unsigned int, 2, 2> table = {
3124 {{{0, 0}}, {{1, 0}}}};
3125
3126 return table[vertex];
3127 }
3128 else if constexpr (dim == 2)
3129 {
3130 switch (this->kind)
3131 {
3133 {
3134 static constexpr ndarray<unsigned int, 6, 2> table = {
3135 {{{0, 0}}, {{0, 1}}, {{1, 1}}, {{X, X}}, {{X, X}}, {{X, X}}}};
3136
3137 return table[vertex];
3138 }
3140 {
3142 vertex);
3143 }
3144 }
3145 }
3146 else if constexpr (dim == 3)
3147 {
3148 switch (this->kind)
3149 {
3151 {
3152 static constexpr ndarray<unsigned int, 6, 2> table = {
3153 {{{0, 0}}, {{0, 1}}, {{0, 2}}, {{1, 2}}, {{X, X}}, {{X, X}}}};
3154
3155 return table[vertex];
3156 }
3158 {
3159 static constexpr ndarray<unsigned int, 6, 2> table = {
3160 {{{0, 0}}, {{0, 1}}, {{0, 2}}, {{0, 3}}, {{1, 2}}, {{X, X}}}};
3161
3162 return table[vertex];
3163 }
3165 {
3166 static constexpr ndarray<unsigned int, 6, 2> table = {
3167 {{{0, 1}}, {{0, 0}}, {{0, 2}}, {{1, 0}}, {{1, 1}}, {{1, 2}}}};
3168
3169 return table[vertex];
3170 }
3172 {
3174 vertex);
3175 }
3176 }
3177 }
3178
3180 return {};
3181}
3182
3183
3184
3185template <int dim>
3186inline std::array<unsigned int, 2>
3188 const unsigned int line) const
3189{
3190 AssertIndexRange(line, n_lines());
3191
3192 if constexpr (dim == 0)
3194 else if constexpr (dim == 1)
3196 else if constexpr (dim == 2)
3198 else if constexpr (dim == 3)
3199 {
3200 switch (this->kind)
3201 {
3203 {
3204 static const std::array<unsigned int, 2> table[6] = {
3205 {{0, 0}}, {{0, 1}}, {{0, 2}}, {{1, 1}}, {{1, 2}}, {{2, 1}}};
3206
3207 return table[line];
3208 }
3210 {
3211 static const std::array<unsigned int, 2> table[8] = {{{0, 0}},
3212 {{0, 1}},
3213 {{0, 2}},
3214 {{0, 3}},
3215 {{1, 2}},
3216 {{2, 1}},
3217 {{1, 1}},
3218 {{2, 2}}};
3219
3220 return table[line];
3221 }
3223 {
3224 static const std::array<unsigned int, 2> table[9] = {{{0, 0}},
3225 {{0, 2}},
3226 {{0, 1}},
3227 {{1, 0}},
3228 {{1, 1}},
3229 {{1, 2}},
3230 {{2, 0}},
3231 {{2, 1}},
3232 {{3, 1}}};
3233
3234 return table[line];
3235 }
3237 {
3239 line);
3240 }
3241 }
3242 }
3243
3245 return {};
3246}
3247
3248
3249
3250template <int dim>
3251inline unsigned int
3253 const unsigned int vertex) const
3254{
3255 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
3256 AssertIndexRange(vertex, 2);
3257 AssertIndexRange(line, n_lines());
3258
3259 if constexpr (dim == 0)
3260 return vertex;
3261 else if constexpr (dim == 1)
3262 return vertex;
3263 else if constexpr (dim == 2)
3264 {
3265 switch (this->kind)
3266 {
3268 {
3269 static constexpr ndarray<unsigned int, 3, 2> table = {
3270 {{{0, 1}}, {{1, 2}}, {{2, 0}}}};
3271 return table[line][vertex];
3272 }
3274 {
3275 static constexpr ndarray<unsigned int, 4, 2> table = {
3276 {{{0, 2}}, {{1, 3}}, {{0, 1}}, {{2, 3}}}};
3277 return table[line][vertex];
3278 }
3279 }
3280 }
3281 else if constexpr (dim == 3)
3282 {
3283 switch (this->kind)
3284 {
3286 {
3287 static constexpr ndarray<unsigned int, 6, 2> table = {
3288 {{{0, 1}}, {{1, 2}}, {{2, 0}}, {{0, 3}}, {{1, 3}}, {{2, 3}}}};
3289 return table[line][vertex];
3290 }
3292 {
3293 static constexpr ndarray<unsigned int, 8, 2> table = {{{{0, 2}},
3294 {{1, 3}},
3295 {{0, 1}},
3296 {{2, 3}},
3297 {{0, 4}},
3298 {{1, 4}},
3299 {{2, 4}},
3300 {{3, 4}}}};
3301 return table[line][vertex];
3302 }
3304 {
3305 static constexpr ndarray<unsigned int, 9, 2> table = {{{{0, 1}},
3306 {{1, 2}},
3307 {{2, 0}},
3308 {{3, 4}},
3309 {{4, 5}},
3310 {{5, 3}},
3311 {{0, 3}},
3312 {{1, 4}},
3313 {{2, 5}}}};
3314 return table[line][vertex];
3315 }
3317 {
3318 // first four lines comprise the bottom face, next four are the
3319 // top, and the last four are 'bottom to top'
3320 static constexpr ndarray<unsigned int, 12, 2> table = {
3321 {{{0, 2}},
3322 {{1, 3}},
3323 {{0, 1}},
3324 {{2, 3}},
3325 {{4, 6}},
3326 {{5, 7}},
3327 {{4, 5}},
3328 {{6, 7}},
3329 {{0, 4}},
3330 {{1, 5}},
3331 {{2, 6}},
3332 {{3, 7}}}};
3333 return table[line][vertex];
3334 }
3335 }
3336 }
3337
3340}
3341
3342
3343
3344template <int dim>
3345inline unsigned int
3347 const unsigned int face,
3348 const unsigned int line,
3349 const types::geometric_orientation combined_face_orientation) const
3350{
3351 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
3352 AssertIndexRange(face, n_faces());
3353 AssertIndexRange(line, face_reference_cell(face).n_lines());
3354 (void)combined_face_orientation;
3355
3356 static constexpr unsigned int X = numbers::invalid_unsigned_int;
3357
3358 if constexpr (dim == 0)
3359 // We can't get here based on the assertions above: vertices
3360 // have no faces.
3362 else if constexpr (dim == 1)
3363 // We can't get here based on the assertions above: lines
3364 // have vertices as faces, which have no bounding lines.
3366 else if constexpr (dim == 2)
3367 // 2d cells have only one line per face, so the line we are
3368 // looking for is actually the face we were given:
3369 return face;
3370 else if constexpr (dim == 3)
3371 {
3372 switch (this->kind)
3373 {
3375 {
3376 static constexpr ndarray<unsigned int, 4, 3> table = {
3377 {{{0, 1, 2}}, {{0, 3, 4}}, {{2, 5, 3}}, {{1, 4, 5}}}};
3378
3379 return table[face][standard_to_real_face_line(
3380 line, face, combined_face_orientation)];
3381 }
3383 {
3384 static constexpr ndarray<unsigned int, 5, 4> table = {
3385 {{{0, 1, 2, 3}},
3386 {{0, 6, 4, X}},
3387 {{1, 5, 7, X}},
3388 {{2, 4, 5, X}},
3389 {{3, 7, 6, X}}}};
3390
3391 return table[face][standard_to_real_face_line(
3392 line, face, combined_face_orientation)];
3393 }
3395 {
3396 static constexpr ndarray<unsigned int, 5, 4> table = {
3397 {{{0, 2, 1, X}},
3398 {{3, 4, 5, X}},
3399 {{6, 7, 0, 3}},
3400 {{7, 8, 1, 4}},
3401 {{8, 6, 2, 5}}}};
3402
3403 return table[face][standard_to_real_face_line(
3404 line, face, combined_face_orientation)];
3405 }
3407 {
3408 const auto [face_orientation, face_rotation, face_flip] =
3409 internal::split_face_orientation(combined_face_orientation);
3410
3412 face, line, face_orientation, face_flip, face_rotation);
3413 }
3414 }
3415 }
3416
3419}
3420
3421
3422
3423template <int dim>
3424inline unsigned int
3426 const unsigned int face,
3427 const unsigned int vertex,
3428 const types::geometric_orientation combined_face_orientation) const
3429{
3430 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
3431 AssertIndexRange(face, n_faces());
3432 AssertIndexRange(vertex, face_reference_cell(face).n_vertices());
3433 AssertIndexRange(combined_face_orientation, n_face_orientations(face));
3434 AssertDimension(dim, get_dimension());
3435
3436 if constexpr (dim == 0)
3437 // We can't get here based on the assertions above: vertices
3438 // have no faces.
3440 else if constexpr (dim == 1)
3441 // A line has only one vertex per face, so the vertex we are
3442 // looking for is actually the face we were given:
3443 return face;
3444 else if constexpr (dim == 2)
3445 {
3446 switch (this->kind)
3447 {
3449 {
3450 static constexpr ndarray<unsigned int, 3, 2> table = {
3451 {{{0, 1}}, {{1, 2}}, {{2, 0}}}};
3452
3453 return table[face][combined_face_orientation ==
3455 vertex :
3456 (1 - vertex)];
3457 }
3459 {
3460 const auto [face_orientation, face_rotation, face_flip] =
3461 internal::split_face_orientation(combined_face_orientation);
3462
3464 face, vertex, face_orientation, face_flip, face_rotation);
3465 }
3466 }
3467 }
3468 else if constexpr (dim == 3)
3469 {
3470 switch (this->kind)
3471 {
3473 {
3474 static constexpr ndarray<unsigned int, 4, 3> table = {
3475 {{{0, 1, 2}}, {{1, 0, 3}}, {{0, 2, 3}}, {{2, 1, 3}}}};
3476
3477 return table[face][standard_to_real_face_vertex(
3478 vertex, face, combined_face_orientation)];
3479 }
3481 {
3482 constexpr auto X = numbers::invalid_unsigned_int;
3483 static constexpr ndarray<unsigned int, 5, 4> table = {
3484 {{{0, 1, 2, 3}},
3485 {{0, 2, 4, X}},
3486 {{3, 1, 4, X}},
3487 {{1, 0, 4, X}},
3488 {{2, 3, 4, X}}}};
3489
3490 return table[face][standard_to_real_face_vertex(
3491 vertex, face, combined_face_orientation)];
3492 }
3494 {
3495 constexpr auto X = numbers::invalid_unsigned_int;
3496 static constexpr ndarray<unsigned int, 6, 4> table = {
3497 {{{1, 0, 2, X}},
3498 {{3, 4, 5, X}},
3499 {{0, 1, 3, 4}},
3500 {{1, 2, 4, 5}},
3501 {{2, 0, 5, 3}}}};
3502
3503 return table[face][standard_to_real_face_vertex(
3504 vertex, face, combined_face_orientation)];
3505 }
3507 {
3508 const auto [face_orientation, face_rotation, face_flip] =
3509 internal::split_face_orientation(combined_face_orientation);
3510
3512 face, vertex, face_orientation, face_flip, face_rotation);
3513 }
3514 }
3515 }
3516
3519}
3520
3521
3522
3523template <int dim>
3524inline unsigned int
3526 const unsigned int face,
3527 const unsigned int line,
3528 const unsigned int vertex,
3529 const types::geometric_orientation combined_face_orientation) const
3530{
3531 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
3532 AssertIndexRange(face, n_faces());
3533 AssertIndexRange(line, this->face_reference_cell(face).n_lines());
3534 AssertIndexRange(vertex, 2);
3535 AssertIndexRange(combined_face_orientation, n_face_orientations(face));
3536
3537 if constexpr (dim == 0)
3538 // We can't get here based on the assertions above: vertices
3539 // have no faces.
3541 else if constexpr (dim == 1)
3542 // We can't get here based on the assertions above: Lines'
3543 // faces are vertices that have no lines as sub-objects.
3545 else if constexpr (dim == 2)
3546 // For 2d objects, each face has (and is identical to) exactly
3547 // one line, so we can ask the other function:
3548 return face_to_cell_vertices(face, vertex, combined_face_orientation);
3549 else if constexpr (dim == 3)
3550 {
3551 switch (this->kind)
3552 {
3554 {
3555 Assert(combined_face_orientation ==
3558
3559 const static ::ndarray<unsigned int, 4, 3, 2> table = {
3560 {{{{{0, 1}}, {{1, 2}}, {{2, 0}}}},
3561 {{{{1, 0}}, {{0, 3}}, {{3, 1}}}},
3562 {{{{0, 2}}, {{2, 3}}, {{3, 0}}}},
3563 {{{{2, 1}}, {{1, 3}}, {{3, 2}}}}}};
3564
3565 return table[face][line][vertex];
3566 }
3568 {
3569 Assert(combined_face_orientation ==
3572
3573 static const unsigned int X = static_cast<unsigned int>(-1);
3574 const static ::ndarray<unsigned int, 5, 4, 2> table = {
3575 {{{{{0, 2}}, {{1, 3}}, {{0, 1}}, {{2, 3}}}},
3576 {{{{0, 2}}, {{2, 4}}, {{4, 0}}, {{X, X}}}},
3577 {{{{3, 1}}, {{1, 4}}, {{4, 3}}, {{X, X}}}},
3578 {{{{1, 0}}, {{0, 4}}, {{4, 1}}, {{X, X}}}},
3579 {{{{2, 3}}, {{3, 4}}, {{4, 2}}, {{X, X}}}}}};
3580
3581 return table[face][line][vertex];
3582 }
3584 {
3585 Assert(combined_face_orientation ==
3588
3589 static const unsigned int X = static_cast<unsigned int>(-1);
3590 const static ::ndarray<unsigned int, 5, 4, 2> table = {
3591 {{{{{1, 0}}, {{0, 2}}, {{2, 1}}, {{X, X}}}},
3592 {{{{3, 4}}, {{4, 5}}, {{5, 3}}, {{X, X}}}},
3593 {{{{0, 3}}, {{1, 4}}, {{0, 1}}, {{3, 4}}}},
3594 {{{{1, 4}}, {{2, 5}}, {{1, 2}}, {{4, 5}}}},
3595 {{{{2, 5}}, {{0, 3}}, {{2, 0}}, {{5, 3}}}}}};
3596
3597 return table[face][line][vertex];
3598 }
3600 {
3601 Assert(combined_face_orientation ==
3604
3605 const static ::ndarray<unsigned int, 6, 4, 2> table = {
3606 {{{{{0, 4}}, {{2, 6}}, {{0, 2}}, {{4, 6}}}},
3607 {{{{1, 5}}, {{3, 7}}, {{1, 3}}, {{5, 7}}}},
3608 {{{{0, 1}}, {{4, 5}}, {{0, 4}}, {{1, 5}}}},
3609 {{{{2, 3}}, {{6, 7}}, {{2, 6}}, {{3, 7}}}},
3610 {{{{0, 2}}, {{1, 3}}, {{0, 1}}, {{2, 3}}}},
3611 {{{{4, 6}}, {{5, 7}}, {{4, 5}}, {{6, 7}}}}}};
3612
3613 return table[face][line][vertex];
3614 }
3615 }
3616 }
3617
3618
3621}
3622
3623
3624
3625template <int dim>
3628 const unsigned int vertex) const
3629{
3630 return this->vertex(face_to_cell_vertices(
3632}
3633
3634
3635
3636template <int dim>
3637inline unsigned int
3639 const unsigned int vertex,
3640 const unsigned int face,
3641 const types::geometric_orientation face_orientation) const
3642{
3643 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
3644 AssertIndexRange(face, n_faces());
3645 AssertIndexRange(vertex, face_reference_cell(face).n_vertices());
3646 AssertIndexRange(face_orientation, n_face_orientations(face));
3647
3648 if constexpr (dim == 1)
3649 return vertex;
3650 else if constexpr (dim == 2)
3651 return line_vertex_permutations[face_orientation][vertex];
3652 else if constexpr (dim == 3)
3653 {
3654 switch (this->kind)
3655 {
3657 return triangle_vertex_permutations[face_orientation][vertex];
3658
3660 if (face == 0)
3661 return quadrilateral_vertex_permutations[face_orientation]
3662 [vertex];
3663 else
3664 return triangle_vertex_permutations[face_orientation][vertex];
3665
3667 if (face < 2)
3668 return triangle_vertex_permutations[face_orientation][vertex];
3669 else
3670 return quadrilateral_vertex_permutations[face_orientation]
3671 [vertex];
3672
3674 return quadrilateral_vertex_permutations[face_orientation][vertex];
3675 }
3676 }
3677
3680}
3681
3682
3683
3684template <int dim>
3685inline unsigned int
3687 const unsigned int line,
3688 const unsigned int face,
3689 const types::geometric_orientation face_orientation) const
3690{
3691 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
3692 AssertIndexRange(face, n_faces());
3693 AssertIndexRange(line, face_reference_cell(face).n_lines());
3694 AssertIndexRange(face_orientation, n_face_orientations(face));
3695
3696 if constexpr (dim == 0)
3698 else if constexpr (dim == 1)
3700 else if constexpr (dim == 2)
3702 else if constexpr (dim == 3)
3703 {
3704 switch (this->kind)
3705 {
3707 return triangle_line_permutations[face_orientation][line];
3708
3710 if (face == 0)
3711 return quadrilateral_line_permutations[face_orientation][line];
3712 else
3713 return triangle_line_permutations[face_orientation][line];
3714
3716 if (face < 2)
3717 return triangle_line_permutations[face_orientation][line];
3718 else
3719 return quadrilateral_line_permutations[face_orientation][line];
3720
3722 return quadrilateral_line_permutations[face_orientation][line];
3723 }
3724 }
3725
3728}
3729
3730
3731
3732namespace ReferenceCells
3733{
3734 template <int dim>
3735 constexpr const std::vector<ReferenceCell<dim>>
3737 {
3738 if constexpr (dim == 0)
3739 return {{ReferenceCells::Vertex}};
3740 else if constexpr (dim == 1)
3741 return {{ReferenceCells::Line}};
3742 else if constexpr (dim == 2)
3744 else if constexpr (dim == 3)
3749 else
3751
3752 return {};
3753 }
3754
3755
3756
3757 template <int dim>
3758 inline constexpr const ReferenceCell<dim> &
3760 {
3761 if constexpr (dim == 0)
3763 else if constexpr (dim == 1)
3764 return ReferenceCells::Line;
3765 else if constexpr (dim == 2)
3767 else if constexpr (dim == 3)
3769 else
3771
3772 return ReferenceCells::Invalid<dim>;
3773 }
3774
3775
3776
3777 template <int dim>
3778 inline constexpr const ReferenceCell<dim> &
3780 {
3781 if constexpr (dim == 0)
3783 else if constexpr (dim == 1)
3784 return ReferenceCells::Line;
3785 else if constexpr (dim == 2)
3787 else if constexpr (dim == 3)
3789 else
3791
3792 return ReferenceCells::Invalid<dim>;
3793 }
3794
3795
3796
3797 template <int dim>
3798 inline constexpr unsigned int
3800 {
3801 if constexpr (dim == 0 || dim == 1)
3802 return 1; // Vertex or Line
3803 else if (dim == 2)
3804 return 2; // Quad and Tri
3805 else if (dim == 3)
3806 return 4; // Tet, Pyramid, Wedge and Hex
3807 else
3809
3810 return 0;
3811 }
3812
3813
3814
3815 template <int dim>
3816 inline ReferenceCell<dim>
3817 n_vertices_to_reference_cell(const unsigned int n_vertices)
3818 {
3819 if constexpr (dim == 0)
3820 if (n_vertices == 1)
3822
3823 if constexpr (dim == 1)
3824 if (n_vertices == 2)
3825 return ReferenceCells::Line;
3826
3827 if constexpr (dim == 2)
3828 {
3829 if (n_vertices == 3)
3831 else if (n_vertices == 4)
3833 }
3834
3835 if constexpr (dim == 3)
3836 {
3837 if (n_vertices == 4)
3839 else if (n_vertices == 5)
3841 if (n_vertices == 6)
3842 return ReferenceCells::Wedge;
3843 else if (n_vertices == 8)
3845 }
3846
3847 Assert(false,
3848 ExcMessage("The combination of dim = " + std::to_string(dim) +
3849 " and n_vertices = " + std::to_string(n_vertices) +
3850 " does not correspond to a known reference cell type."));
3851 return ReferenceCells::Invalid<dim>;
3852 }
3853
3854
3855
3856 template <int dim>
3857 inline constexpr unsigned int
3862
3863
3864
3865 template <int dim>
3866 inline constexpr unsigned int
3871
3872
3873
3874 template <int dim>
3875 inline constexpr unsigned int
3880
3881
3882
3883 template <int dim>
3884 inline constexpr unsigned int
3886 {
3887 // Pyramids (3D) have 10 children.
3888 return dim == 3 ? 10 : GeometryInfo<dim>::max_children_per_cell;
3889 }
3890} // namespace ReferenceCells
3891
3892
3893
3894template <int dim>
3895inline ReferenceCell<dim>
3897 const unsigned int n_vertices)
3898{
3899 AssertDimension(dim, dim_);
3900 return ReferenceCells::n_vertices_to_reference_cell<dim>(n_vertices);
3901}
3902
3903
3904
3905template <int dim>
3906inline double
3908 const unsigned int i) const
3909{
3910 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
3911 AssertIndexRange(i, n_vertices());
3912
3913 if constexpr (dim == 0)
3914 {
3915 (void)xi;
3916 return 1.0;
3917 }
3918 else if constexpr (dim == 1)
3919 {
3921 }
3922 else if constexpr (dim == 2)
3923 {
3924 switch (this->kind)
3925 {
3929 {
3930 // see also BarycentricPolynomials<2>::compute_value
3931 switch (i)
3932 {
3933 case 0:
3934 return 1.0 - xi[std::min(0, dim - 1)] -
3935 xi[std::min(1, dim - 1)];
3936 case 1:
3937 return xi[std::min(0, dim - 1)];
3938 case 2:
3939 return xi[std::min(1, dim - 1)];
3940 default:
3942 }
3943 }
3944 }
3945 }
3946 else if constexpr (dim == 3)
3947 {
3948 switch (this->kind)
3949 {
3952
3954 {
3955 // see also BarycentricPolynomials<3>::compute_value
3956 switch (i)
3957 {
3958 case 0:
3959 return 1.0 - xi[std::min(0, dim - 1)] -
3960 xi[std::min(1, dim - 1)] - xi[std::min(2, dim - 1)];
3961 case 1:
3962 return xi[std::min(0, dim - 1)];
3963 case 2:
3964 return xi[std::min(1, dim - 1)];
3965 case 3:
3966 return xi[std::min(2, dim - 1)];
3967 default:
3969 }
3970 }
3971
3973 {
3974 // see also ScalarLagrangePolynomialPyramid::compute_value()
3975 const double Q14 = 0.25;
3976
3977 const double r = xi[std::min(0, dim - 1)];
3978 const double s = xi[std::min(1, dim - 1)];
3979 const double t = xi[std::min(2, dim - 1)];
3980
3981 const double ratio =
3982 (std::fabs(t - 1.0) > 1.0e-14 ? (r * s * t) / (1.0 - t) : 0.0);
3983
3984 if (i == 0)
3985 return Q14 * ((1.0 - r) * (1.0 - s) - t + ratio);
3986 if (i == 1)
3987 return Q14 * ((1.0 + r) * (1.0 - s) - t - ratio);
3988 if (i == 2)
3989 return Q14 * ((1.0 - r) * (1.0 + s) - t - ratio);
3990 if (i == 3)
3991 return Q14 * ((1.0 + r) * (1.0 + s) - t + ratio);
3992 else
3993 return t;
3994 }
3995
3997 // see also ScalarLagrangePolynomialWedge::compute_value()
3999 Point<2>(xi[std::min(0, dim - 1)],
4000 xi[std::min(1, dim - 1)]),
4001 i % 3) *
4002 ReferenceCells::Line.d_linear_shape_function(
4003 Point<1>(xi[std::min(2, dim - 1)]), i / 3);
4004 }
4005 }
4006
4008 return 0.0;
4009}
4010
4011
4012
4013template <int dim>
4014inline Tensor<1, dim>
4016 const unsigned int i) const
4017{
4018 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
4019
4020 if constexpr (dim == 0)
4022 else if constexpr (dim == 1)
4024 else if constexpr (dim == 2)
4025 {
4026 switch (this->kind)
4027 {
4030
4032 // see also BarycentricPolynomials<2>::compute_grad()
4033 switch (i)
4034 {
4035 case 0:
4036 return Point<dim>(-1.0, -1.0);
4037 case 1:
4038 return Point<dim>(+1.0, +0.0);
4039 case 2:
4040 return Point<dim>(+0.0, +1.0);
4041 default:
4043 }
4044 }
4045 }
4046 else if constexpr (dim == 3)
4047 {
4048 switch (this->kind)
4049 {
4052 default:
4054 }
4055 }
4056
4058 return Point<dim>(+0.0, +0.0, +0.0);
4059}
4060
4061
4062
4063template <int dim>
4064inline double
4066{
4067 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
4068
4069 if constexpr (dim == 0)
4070 return 1;
4071 else if constexpr (dim == 1)
4072 return 1;
4073 else if constexpr (dim == 2)
4074 {
4075 switch (this->kind)
4076 {
4078 return 1. / 2.;
4080 return 1;
4081 }
4082 }
4083 else if constexpr (dim == 3)
4084 {
4085 switch (this->kind)
4086 {
4088 return 1. / 6.;
4090 return 4. / 3.;
4092 return 1. / 2.;
4094 return 1;
4095 }
4096 }
4097
4099 return 0.0;
4100}
4101
4102
4103
4104template <int dim>
4105inline double
4106ReferenceCell<dim>::face_measure(const unsigned int face_no) const
4107{
4108 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
4109 AssertIndexRange(face_no, n_faces());
4110 constexpr double X = std::numeric_limits<double>::signaling_NaN();
4111
4112 if constexpr (dim == 0)
4113 return 1.0;
4114 else if constexpr (dim == 1)
4115 return 1.0;
4116 else if constexpr (dim == 2)
4117 {
4118 switch (this->kind)
4119 {
4121 return 1.0;
4123 static const std::array<double, 5> tri_faces{
4124 {1.0, std::sqrt(2.0), 1.0, X, X}};
4125 return tri_faces[face_no];
4126 }
4127 }
4128 else if constexpr (dim == 3)
4129 {
4130 switch (this->kind)
4131 {
4133 return 1.0;
4135 {
4136 static const std::array<double, 5> tet_faces{
4137 {0.5, 0.5, 0.5, std::sqrt(3.0) / 2.0, X}};
4138 return tet_faces[face_no];
4139 }
4141 {
4142 static const std::array<double, 5> pyramid_faces{
4143 {4,
4144 std::sqrt(2.0),
4145 std::sqrt(2.0),
4146 std::sqrt(2.0),
4147 std::sqrt(2.0)}};
4148 return pyramid_faces[face_no];
4149 }
4151 {
4152 const std::array<double, 5> wedge_faces{
4153 {0.5, 0.5, 1.0, std::sqrt(2.0), 1.0}};
4154 return wedge_faces[face_no];
4155 }
4156 }
4157 }
4158
4160 return X;
4161}
4162
4163
4164
4165template <int dim>
4166inline Point<dim>
4168{
4169 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
4170
4171 if constexpr (dim == 0)
4172 return Point<dim>();
4173 else if constexpr (dim == 1)
4174 return Point<dim>(1. / 2.);
4175 else if constexpr (dim == 2)
4176 {
4177 switch (this->kind)
4178 {
4180 return Point<dim>(1. / 3., 1. / 3.);
4182 return Point<dim>(1. / 2., 1. / 2.);
4183 }
4184 }
4185 else if constexpr (dim == 3)
4186 {
4187 switch (this->kind)
4188 {
4190 return Point<dim>(1. / 4., 1. / 4., 1. / 4.);
4192 return Point<dim>(0, 0, 1. / 4.);
4194 return Point<dim>(1. / 3, 1. / 3, 1. / 2.);
4196 return Point<dim>(1. / 2., 1. / 2., 1. / 2.);
4197 }
4198 }
4199
4201 return Point<dim>();
4202}
4203
4204
4205
4206template <int dim>
4207inline bool
4209 const double tolerance) const
4210{
4211 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
4212
4213 if constexpr (dim == 0)
4214 {
4215 // Vertices are special cases in that they do not actually
4216 // have coordinates. Error out if this function is called
4217 // with a vertex:
4218 Assert(false,
4219 ExcMessage("Vertices are zero-dimensional objects and "
4220 "as a consequence have no coordinates. You "
4221 "cannot meaningfully ask whether a point is "
4222 "inside a vertex (within a certain tolerance) "
4223 "without coordinate values."));
4224 return false;
4225 }
4226 else if constexpr (dim == 1)
4227 {
4228 for (unsigned int d = 0; d < dim; ++d)
4229 if ((p[d] < -tolerance) || (p[d] > 1 + tolerance))
4230 return false;
4231 return true;
4232 }
4233 else if constexpr (dim == 2)
4234 {
4235 switch (this->kind)
4236 {
4238 {
4239 for (unsigned int d = 0; d < dim; ++d)
4240 if ((p[d] < -tolerance) || (p[d] > 1 + tolerance))
4241 return false;
4242 return true;
4243 }
4245 {
4246 // First make sure that we are in the first quadrant or octant
4247 for (unsigned int d = 0; d < dim; ++d)
4248 if (p[d] < -tolerance)
4249 return false;
4250
4251 // Now we also need to make sure that we are below the diagonal
4252 // line or plane that delineates the simplex. This diagonal is
4253 // given by sum(p[d])<=1, and a diagonal a distance eps away is
4254 // given by sum(p[d])<=1+eps*sqrt(d). (For example, the point at
4255 // (1,1) is a distance of 1/sqrt(2) away from the diagonal. That
4256 // is, its sum satisfies
4257 // sum(p[d]) = 2 <= 1 + (1/sqrt(2)) * sqrt(2)
4258 // in other words, it satisfies the predicate with eps=1/sqrt(2).)
4259 double sum = 0;
4260 for (unsigned int d = 0; d < dim; ++d)
4261 sum += p[d];
4262 return (sum <= 1 + tolerance * std::sqrt(1. * dim));
4263 }
4264 }
4265 }
4266 else if constexpr (dim == 3)
4267 {
4268 switch (this->kind)
4269 {
4271 {
4272 for (unsigned int d = 0; d < dim; ++d)
4273 if ((p[d] < -tolerance) || (p[d] > 1 + tolerance))
4274 return false;
4275 return true;
4276 }
4277
4279 {
4280 // First make sure that we are in the first quadrant or octant
4281 for (unsigned int d = 0; d < dim; ++d)
4282 if (p[d] < -tolerance)
4283 return false;
4284
4285 // Now we also need to make sure that we are below the diagonal
4286 // line or plane that delineates the simplex. This diagonal is
4287 // given by sum(p[d])<=1, and a diagonal a distance eps away is
4288 // given by sum(p[d])<=1+eps*sqrt(d). (For example, the point at
4289 // (1,1) is a distance of 1/sqrt(2) away from the diagonal. That
4290 // is, its sum satisfies
4291 // sum(p[d]) = 2 <= 1 + (1/sqrt(2)) * sqrt(2)
4292 // in other words, it satisfies the predicate with eps=1/sqrt(2).)
4293 double sum = 0;
4294 for (unsigned int d = 0; d < dim; ++d)
4295 sum += p[d];
4296 return (sum <= 1 + tolerance * std::sqrt(1. * dim));
4297 }
4298
4300 {
4301 // A pyramid only lives in the upper half-space:
4302 if (p[2] < -tolerance)
4303 return false;
4304
4305 // It also only lives in the space below z=1:
4306 if (p[2] > 1 + tolerance)
4307 return false;
4308
4309 // Within what's left of the space, a pyramid is a cone that
4310 // tapers towards the top. First compute the distance of the point
4311 // to the axis in the max norm (this is the right norm because the
4312 // vertices of the pyramid are at points +/-1, +/-1):
4313 const double distance_from_axis =
4314 std::max(std::fabs(p[0]), std::fabs(p[1]));
4315
4316 // We are inside the pyramid if the distance from the axis is less
4317 // than (1-z)
4318 return (distance_from_axis <= 1 + tolerance - p[2]);
4319 }
4320
4322 {
4323 // The wedge we use is a triangle extruded into the third
4324 // dimension by one unit. So we can use the same logic as for
4325 // triangles above (i.e., for the simplex above, using dim==2)
4326 // and then check the third dimension separately.
4327
4328 if ((p[0] < -tolerance) || (p[1] < -tolerance))
4329 return false;
4330
4331 const double sum = p[0] + p[1];
4332 if (sum > 1 + tolerance * std::sqrt(2.0))
4333 return false;
4334
4335 if (p[2] < -tolerance)
4336 return false;
4337 if (p[2] > 1 + tolerance)
4338 return false;
4339
4340 return true;
4341 }
4342 }
4343 }
4344
4346 return false;
4347}
4348
4349
4350
4351template <int dim>
4352inline Tensor<1, dim>
4354 const unsigned int i) const
4355{
4356 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
4357 AssertIndexRange(face_no, n_faces());
4358 AssertIndexRange(i, dim - 1);
4359
4360 if constexpr (dim == 0)
4361 // 0d cells (vertices) have no faces
4363 else if constexpr (dim == 1)
4364 // 1d cells (lines) have points as faces which have no
4365 // tangent space
4367 else if constexpr (dim == 2)
4368 {
4369 switch (this->kind)
4370 {
4374 {
4375 constexpr std::array<Tensor<1, dim>, 3> table = {
4376 {Point<dim>(1, 0),
4378 Point<dim>(0, -1)}};
4379
4380 return table[face_no];
4381 }
4382 }
4383 }
4384 else if constexpr (dim == 3)
4385 {
4386 switch (this->kind)
4387 {
4391 {
4392 // We need std::pow(1.0/3.0, 0.25) in a constexpr context, but
4393 // that function isn't constexpr yet so hard-code the value and
4394 // assert that it is close
4395 constexpr double third_r4 = 0.7598356856515925473311877;
4396 Assert(std::abs((third_r4 * third_r4) * (third_r4 * third_r4) -
4397 1.0 / 3.0) < 1e-14,
4399 constexpr ndarray<Tensor<1, dim>, 4, 2> table = {
4400 {{{Point<dim>(0, 1, 0), Point<dim>(1, 0, 0)}},
4401 {{Point<dim>(1, 0, 0), Point<dim>(0, 0, 1)}},
4402 {{Point<dim>(0, 0, 1), Point<dim>(0, 1, 0)}},
4403 {{Point<dim>(-third_r4, +third_r4, 0),
4404 Point<dim>(-third_r4, 0, +third_r4)}}}};
4405
4406 return table[face_no][i];
4407 }
4409 {
4410 constexpr ndarray<Tensor<1, dim>, 5, 2> table = {
4411 {{{Point<dim>(0, 1, 0), Point<dim>(1, 0, 0)}},
4413 Point<dim>(0, 1, 0)}},
4415 Point<dim>(0, 1, 0)}},
4416 {{Point<dim>(1, 0, 0),
4418 {{Point<dim>(1, 0, 0),
4420
4421 return table[face_no][i];
4422 }
4424 {
4425 constexpr ndarray<Tensor<1, dim>, 5, 2> table = {
4426 {{{Point<dim>(0, 1, 0), Point<dim>(1, 0, 0)}},
4427 {{Point<dim>(1, 0, 0), Point<dim>(0, 1, 0)}},
4428 {{Point<dim>(1, 0, 0), Point<dim>(0, 0, 1)}},
4430 Point<dim>(0, 0, 1)}},
4431 {{Point<dim>(0, 0, 1), Point<dim>(0, 1, 0)}}}};
4432
4433 return table[face_no][i];
4434 }
4435 }
4436 }
4437
4439 return {};
4440}
4441
4442
4443
4444template <int dim>
4445inline Tensor<1, dim>
4446ReferenceCell<dim>::face_normal_vector(const unsigned int face_no) const
4447{
4448 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
4449 AssertIndexRange(face_no, n_faces());
4450
4451 if (is_hyper_cube())
4453 else if constexpr (dim == 2)
4454 {
4456
4457 // Return the rotated vector
4458 return cross_product_2d(face_tangent_vector(face_no, 0));
4459 }
4460 else if constexpr (dim == 3)
4461 return cross_product_3d(face_tangent_vector(face_no, 0),
4462 face_tangent_vector(face_no, 1));
4463
4465 return {};
4466}
4467
4468
4469
4470template <int dim>
4471inline unsigned int
4472ReferenceCell<dim>::n_face_orientations(const unsigned int face_no) const
4473{
4474 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
4475 AssertIndexRange(face_no, n_faces());
4476
4477 switch (face_reference_cell(face_no))
4478 {
4480 return 1;
4482 return 2;
4484 return 6;
4486 return 8;
4487 default:
4489 }
4490
4493}
4494
4495
4496
4497template <int dim>
4500 const unsigned int face_line_no,
4501 const unsigned int face_no,
4502 const types::geometric_orientation combined_face_orientation,
4503 const types::geometric_orientation line_orientation) const
4504{
4505 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
4506 (void)face_line_no;
4507 (void)face_no;
4508 (void)combined_face_orientation;
4509 (void)line_orientation;
4510
4511 if constexpr (dim == 0)
4513 else if constexpr (dim == 1)
4515 else if constexpr (dim == 2)
4517 else if constexpr (dim == 3)
4518 {
4519 constexpr auto D = numbers::default_geometric_orientation;
4520 constexpr auto R = numbers::reverse_line_orientation;
4521 constexpr unsigned int X = numbers::invalid_unsigned_int;
4522
4523 auto quad_face = [=]() {
4524 static constexpr ::ndarray<types::geometric_orientation, 2, 8>
4525 orientation_quad{
4526 {{{D, D, D, R, R, R, R, D}}, {{D, D, R, D, R, R, D, R}}}};
4527 // We use face_line_no / 2 here since lines i and i + 1 are parallel
4528 // and, on a given face, have the same relative orientations.
4529 const bool match =
4530 (line_orientation ==
4531 orientation_quad[face_line_no / 2][combined_face_orientation]);
4532
4535 };
4536
4537 constexpr ::ndarray<types::geometric_orientation, 2, 6>
4538 orientation_triangle{{{{D, R, D, R, D, R}}, {{R, D, R, D, R, D}}}};
4539
4540 switch (this->kind)
4541 {
4543 {
4544 static constexpr ::ndarray<unsigned int, 4, 3>
4545 combined_lines{
4546 {{{0, 0, 0}}, {{X, 0, 1}}, {{X, 0, X}}, {{X, X, X}}}};
4547 const auto combined_line = combined_lines[face_no][face_line_no];
4548
4549 Assert(
4550 combined_line != X,
4551 ExcMessage(
4552 "This function can only be called for following face-line "
4553 "combinations: (0,0), (0,1), (0,2), (1,1), (1,2), (2,1)"));
4554
4555 const bool match =
4556 (line_orientation ==
4557 orientation_triangle[combined_line]
4558 [combined_face_orientation]);
4561 }
4563 if (face_no < 2)
4564 {
4565 // lines 0,1,2 (face 0, face_line_no 0,1,2) are not
4566 // oriented the same way in the cell and on the face
4567 // lines 4,5,6 (face 1, face_line 0,1,2) are
4568 // oriented the same way in the cell and on the faces
4569 static constexpr ::ndarray<unsigned int, 2, 3>
4570 combined_lines{{{{1, 1, 1}}, {{0, 0, 0}}}};
4571 const auto combined_line =
4572 combined_lines[face_no][face_line_no];
4573
4574 const bool match =
4575 (line_orientation ==
4576 orientation_triangle[combined_line]
4577 [combined_face_orientation]);
4580 }
4581 else
4582 return quad_face();
4584 if (face_no == 0)
4585 return quad_face();
4586 else
4587 {
4588 // face_line_no 0 already done above
4589 Assert(face_line_no == 1 || face_line_no == 2,
4590 ExcMessage(
4591 "Invalid face line number for the triangular faces"));
4592
4593 // face 0 with lines 0-3 already done above
4594 // lines 6 (face 1, face_line_no 1) and 5 (face 2, face_line_no
4595 // 1) are oriented the same way in the cell and on the faces
4596 // lines 4 (face 1, face_line 2) and 7 (face 2, face_line 2) are
4597 // not oriented the same way in the cell and on the faces
4598 static constexpr ::ndarray<unsigned int, 3, 3>
4599 combined_lines{{{{X, X, X}}, {{X, 0, 1}}, {{X, 0, 1}}}};
4600
4601 const auto combined_line =
4602 combined_lines[face_no][face_line_no];
4603
4604 const bool match =
4605 (line_orientation ==
4606 orientation_triangle[combined_line]
4607 [combined_face_orientation]);
4610 }
4612 return quad_face();
4613 }
4614 }
4615
4618}
4619
4620
4621
4622template <int dim>
4623inline unsigned int
4624ReferenceCell<dim>::opposite_face_index(const unsigned int face_no) const
4625{
4626 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
4627 AssertIndexRange(face_no, n_faces());
4628
4629 if constexpr (dim == 0)
4631 else if constexpr (dim == 1)
4632 return (face_no + 1) % (this->get_dimension() + 1);
4633 else if constexpr (dim == 2)
4634 {
4635 switch (this->kind)
4636 {
4638 return GeometryInfo<2>::opposite_face[face_no];
4640 return (face_no + 1) % (this->get_dimension() + 1);
4641 }
4642 }
4643 else if constexpr (dim == 3)
4644 {
4645 switch (this->kind)
4646 {
4648 return GeometryInfo<3>::opposite_face[face_no];
4650 return (face_no + 1) % (this->get_dimension() + 1);
4652 {
4653 switch (face_no)
4654 {
4655 case 0:
4656 return 0;
4657 case 1:
4658 return 2;
4659 case 2:
4660 return 1;
4661 case 3:
4662 return 4;
4663 case 4:
4664 return 3;
4665 default:
4668 }
4669 }
4671 {
4672 switch (face_no)
4673 {
4674 case 0:
4675 return 1;
4676 case 1:
4677 return 0;
4678 case 2:
4679 return 3;
4680 case 3:
4681 return 4;
4682 case 4:
4683 return 2;
4684 default:
4687 }
4688 }
4689 }
4690 }
4691
4694}
4695
4696
4697
4698namespace internal
4699{
4700 template <int dim, typename T>
4702 {
4703 public:
4717
4721 virtual ~NoPermutation() noexcept override = default;
4722
4726 virtual void
4727 print_info(std::ostream &out) const override
4728 {
4729 out << '[';
4730
4731 const unsigned int n_vertices = entity_type.n_vertices();
4732
4733 for (unsigned int i = 0; i < n_vertices; ++i)
4734 {
4735 out << vertices_0[i];
4736 if (i + 1 != n_vertices)
4737 out << ',';
4738 }
4739
4740 out << "] is not a valid permutation of [";
4741
4742 for (unsigned int i = 0; i < n_vertices; ++i)
4743 {
4744 out << vertices_1[i];
4745 if (i + 1 != n_vertices)
4746 out << ',';
4747 }
4748
4749 out << "]." << std::endl;
4750 }
4751
4756
4761
4766 };
4767
4768} // namespace internal
4769
4770
4771
4772template <int dim>
4773template <typename T, std::size_t N>
4776 const std::array<T, N> &vertices_0,
4777 const std::array<T, N> &vertices_1) const
4778{
4779 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
4780 Assert(N >= n_vertices(),
4781 ExcMessage("The number of array elements must be equal to or "
4782 "greater than the number of vertices of the cell "
4783 "referenced by this object."));
4784
4785 // Call the non-deprecated function, taking care of calling it only with
4786 // those array elements that we actually care about (see the note
4787 // in the documentation about the arguments potentially being
4788 // larger arrays than necessary).
4789 return get_combined_orientation(
4790 make_array_view(vertices_0.begin(), vertices_0.begin() + n_vertices()),
4791 make_array_view(vertices_1.begin(), vertices_1.begin() + n_vertices()));
4792}
4793
4794
4795
4796template <int dim>
4797template <typename T>
4800 const ArrayView<const T> &vertices_0,
4801 const ArrayView<const T> &vertices_1) const
4802{
4803 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
4804 Assert(vertices_0.size() == n_vertices(),
4805 ExcMessage("The number of array elements must be equal to "
4806 "the number of vertices of the cell "
4807 "referenced by this object."));
4808 Assert(vertices_1.size() == n_vertices(),
4809 ExcMessage("The number of array elements must be equal to "
4810 "the number of vertices of the cell "
4811 "referenced by this object."));
4812
4813 auto compute_orientation = [&](const auto &table,
4814 const unsigned int n_vertices) {
4815 for (types::geometric_orientation o = 0; o < table.size(); ++o)
4816 {
4817 bool match = true;
4818 for (unsigned int j = 0; j < n_vertices; ++j)
4819 {
4820 match &= (vertices_0[j] == vertices_1[table[o][j]]);
4821 if (match == false)
4822 break;
4823 }
4824
4825 if (match == true)
4826 return o;
4827 }
4828
4829 // Do not use `this` in Assert because nvcc when using C++20 assumes that
4830 // `this` is an integer and we get the following error: invalid type
4831 // argument of unary '*' (have 'int')
4832 [[maybe_unused]] const auto &ref_cell = *this;
4833 Assert(false,
4834 (internal::NoPermutation<dim, T>(ref_cell, vertices_0, vertices_1)));
4835 return std::numeric_limits<types::geometric_orientation>::max();
4836 };
4837
4838 if constexpr (dim == 0)
4839 return compute_orientation(vertex_vertex_permutations, 1);
4840 else if constexpr (dim == 1)
4841 return compute_orientation(line_vertex_permutations, 2);
4842 else if constexpr (dim == 2)
4843 {
4844 switch (this->kind)
4845 {
4847 return compute_orientation(triangle_vertex_permutations, 3);
4849 return compute_orientation(quadrilateral_vertex_permutations, 4);
4850 }
4851 }
4852 else if constexpr (dim == 3)
4854
4855 Assert(false,
4856 (internal::NoPermutation<dim, T>(*this, vertices_0, vertices_1)));
4857 return std::numeric_limits<types::geometric_orientation>::max();
4858}
4859
4860
4861
4862template <int dim>
4863template <typename T>
4864boost::container::small_vector<T, 8>
4866 const ArrayView<const T> &vertices,
4867 const types::geometric_orientation orientation) const
4868{
4869 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
4870 AssertDimension(vertices.size(), n_vertices());
4871
4872 const auto permute =
4873 [this, &vertices](const auto &table,
4874 const types::geometric_orientation orientation) {
4875 AssertIndexRange(orientation, table.size());
4876
4877 boost::container::small_vector<T, 8> result(this->n_vertices());
4878 for (unsigned int j = 0; j < result.size(); ++j)
4879 result[j] = vertices[table[orientation][j]];
4880 return result;
4881 };
4882
4883 if constexpr (dim == 0)
4884 return permute(vertex_vertex_permutations, orientation);
4885 else if constexpr (dim == 1)
4886 return permute(line_vertex_permutations, orientation);
4887 else if constexpr (dim == 2)
4888 {
4889 switch (this->kind)
4890 {
4892 return permute(triangle_vertex_permutations, orientation);
4894 return permute(quadrilateral_vertex_permutations, orientation);
4895 }
4896 }
4897 else if constexpr (dim == 3)
4899
4901 return {};
4902}
4903
4904
4905
4906template <int dim>
4909 const types::geometric_orientation orientation) const
4910{
4911 Assert(*this != ReferenceCells::Invalid<dim>, ExcNotImplemented());
4912
4913 if constexpr (dim == 0)
4914 // Things are always default-oriented in 1D
4915 return orientation;
4916 else if constexpr (dim == 1)
4917 // the 1d orientations are the identity and a flip: i.e., the
4918 // identity and an involutory mapping
4919 return orientation;
4920 else if constexpr (dim == 2)
4921 {
4922 switch (this->kind)
4923 {
4925 {
4926 AssertIndexRange(orientation, 6);
4927 constexpr std::array<types::geometric_orientation, 6> inverses{
4928 {0, 1, 4, 3, 2, 5}};
4929 return inverses[orientation];
4930 }
4932 {
4933 AssertIndexRange(orientation, 8);
4934 constexpr std::array<types::geometric_orientation, 8> inverses{
4935 {0, 1, 6, 3, 4, 5, 2, 7}};
4936 return inverses[orientation];
4937 }
4938 }
4939 }
4940 else
4941 {
4942 (void)orientation;
4944 }
4945
4947 return std::numeric_limits<types::geometric_orientation>::max();
4948}
4949
4950
4952
4953#endif
ArrayView< std::remove_reference_t< typename std::iterator_traits< Iterator >::reference >, MemorySpaceType > make_array_view(const Iterator begin, const Iterator end)
std::size_t size() const
Definition array_view.h:737
Abstract base class for mapping classes.
Definition mapping.h:318
Definition point.h:111
static constexpr Point< dim, Number > unit_vector(const unsigned int i)
unsigned int unv_vertex_to_deal_vertex(const unsigned int vertex_n) const
const Quadrature< dim > & get_nodal_type_quadrature() const
unsigned int face_to_cell_lines(const unsigned int face, const unsigned int line, const types::geometric_orientation face_orientation) const
static constexpr ndarray< unsigned int, 8, 4 > quadrilateral_vertex_permutations
constexpr bool is_simplex() const
double volume() const
constexpr unsigned int n_vertices() const
types::geometric_orientation compute_orientation(const std::array< T, N > &vertices_0, const std::array< T, N > &vertices_1) const
const ndarray< unsigned int, 10, 6 > & new_isotropic_child_cell_faces(const RefinementChoice< dim > &refinement_choice) const
constexpr bool is_compatible_with(const RefinementChoice< dim > &refinement_choice) const
IsotropicRefinementChoice get_isotropic_refinement_choice(const unsigned int ref_choice) const
types::geometric_orientation face_to_cell_line_orientation(const unsigned int face_line_no, const unsigned int face_no, const types::geometric_orientation face_orientation, const types::geometric_orientation line_orientation) const
Convert a line orientation defined relative to a face to the canonical per-cell line orientation.
void serialize(Archive &archive, const unsigned int)
double face_measure(const unsigned int face_no) const
constexpr bool is_hyper_cube() const
RefinementChoice< dim > isotropic_refinement_choice_from_index(const unsigned int index) const
std_cxx20::ranges::iota_view< unsigned int, unsigned int > line_indices() const
ArrayView< const unsigned int > faces_for_given_vertex(const unsigned int vertex_index) const
unsigned int ucd_vertex_to_deal_vertex(const unsigned int vertex_n) const
unsigned int vtk_quadratic_type() const
Point< dim > closest_point(const Point< dim > &p) const
Quadrature< dim > get_midpoint_quadrature() const
double d_linear_shape_function(const Point< dim > &xi, const unsigned int i) const
constexpr unsigned int get_dimension() const
static ReferenceCell n_vertices_to_type(const int dim_, const unsigned int n_vertices)
unsigned int vtk_lagrange_type() const
types::geometric_orientation get_combined_orientation(const ArrayView< const T > &vertices_0, const ArrayView< const T > &vertices_1) const
std::array< unsigned int, 2 > standard_vertex_to_face_and_vertex_index(const unsigned int vertex) const
ArrayView< const RefinementCase< dim > > refinement_cases() const
Quadrature< dim > get_gauss_type_quadrature(const unsigned n_points_1d) const
unsigned int line_to_cell_vertices(const unsigned int line, const unsigned int vertex) const
std::uint8_t kind
std_cxx20::ranges::iota_view< unsigned int, unsigned int > vertex_indices() const
constexpr ReferenceCell< dim - 1 > face_reference_cell(const unsigned int face_index) const
friend std::istream & operator>>(std::istream &in, ReferenceCell< dim_ > &reference_cell)
unsigned int n_children(const RefinementCase< dim > ref_case=RefinementCase< dim >::isotropic_refinement) const
constexpr unsigned int n_faces() const
constexpr ReferenceCell()
const ndarray< unsigned int, 10, 8 > & new_isotropic_child_cell_vertices(const RefinementChoice< dim > &refinement_choice) const
unsigned int standard_to_real_face_line(const unsigned int line, const unsigned int face, const types::geometric_orientation face_orientation) const
Point< dim > barycenter() const
constexpr unsigned int n_isotropic_refinement_choices() const
static constexpr ndarray< unsigned int, 8, 4 > quadrilateral_line_permutations
unsigned int vtk_vertex_to_deal_vertex(const unsigned int vertex_index) const
static constexpr ndarray< unsigned int, 3, 4 > line_vertex_permutations
constexpr unsigned int n_lines() 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 types::geometric_orientation face_orientation) const
std::pair< unsigned int, RefinementCase< dim - 1 > > equivalent_refinement_case(const types::geometric_orientation combined_face_orientation, const internal::SubfaceCase< dim > subface_case, const unsigned int subface_no) const
static constexpr ndarray< unsigned int, 6, 3 > triangle_line_permutations
unsigned int opposite_face_index(const unsigned int face_no) const
Return the index of the face opposite to a given face on the reference cell.
std::unique_ptr< Mapping< dim, spacedim > > get_default_mapping(const unsigned int degree) const
static constexpr ndarray< unsigned int, 1, 1 > vertex_vertex_permutations
Tensor< 1, dim > d_linear_shape_function_gradient(const Point< dim > &xi, const unsigned int i) const
constexpr operator std::uint8_t() const
std::string to_string() const
unsigned int n_face_orientations(const unsigned int face_no) const
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
const ndarray< unsigned int, 13, 4 > & new_isotropic_child_face_lines(const RefinementChoice< dim > &refinement_choice) const
static constexpr ndarray< unsigned int, 6, 4 > triangle_vertex_permutations
unsigned int gmsh_element_type() const
constexpr bool operator!=(const ReferenceCell< dim > &type) const
std_cxx20::ranges::iota_view< unsigned int, unsigned int > isotropic_child_indices() const
const ndarray< unsigned int, 13, 4, 2 > & new_isotropic_child_face_line_vertices(const RefinementChoice< dim > &refinement_choice) const
friend std::ostream & operator<<(std::ostream &out, const ReferenceCell< dim_ > &reference_cell)
std::array< unsigned int, 2 > standard_line_to_face_and_line_index(const unsigned int line) const
Point< dim > face_vertex_location(const unsigned int face, const unsigned int vertex) const
Tensor< 1, dim > face_tangent_vector(const unsigned int face_no, const unsigned int i) const
unsigned int face_to_cell_vertices(const unsigned int face, const unsigned int vertex, const types::geometric_orientation face_orientation) const
unsigned int exodusii_vertex_to_deal_vertex(const unsigned int vertex_n) const
std_cxx20::ranges::iota_view< unsigned int, unsigned int > face_indices_by_type(const ReferenceCell< dim - 1 > &face_ref_type) const
unsigned int child_cell_on_face(const unsigned int face, const unsigned int subface, const types::geometric_orientation combined_orientation) const
const Mapping< dim, spacedim > & get_default_linear_mapping() const
boost::container::small_vector< T, 8 > permute_by_combined_orientation(const ArrayView< const T > &vertices, const types::geometric_orientation orientation) const
types::geometric_orientation get_inverse_combined_orientation(const types::geometric_orientation orientation) const
static constexpr std::size_t memory_consumption()
Tensor< 1, dim > face_normal_vector(const unsigned int face_no) const
constexpr unsigned int n_isotropic_children() const
Point< dim > subface_vertex_location(const unsigned int face_no, const unsigned int subface_no, const unsigned int subface_vertex_no, const RefinementCase< dim - 1 > face_refinement_case) const
bool contains_point(const Point< dim > &p, const double tolerance=0) const
unsigned int exodusii_face_to_deal_face(const unsigned int face_n) const
unsigned int face_and_line_to_cell_vertices(const unsigned int face, const unsigned int line, const unsigned int vertex, const types::geometric_orientation face_orientation) const
unsigned int vtk_linear_type() const
constexpr bool operator==(const ReferenceCell< dim > &type) const
std_cxx20::ranges::iota_view< unsigned int, unsigned int > face_indices() const
A class which enumerates refinement possibilities for all supported ReferenceCell objects.
constexpr unsigned int new_tetrahedron_line() const
constexpr bool is_tetrahedral() const
const ArrayView< const T > vertices_1
virtual void print_info(std::ostream &out) const override
const ReferenceCell< dim > entity_type
NoPermutation(const ReferenceCell< dim > &entity_type, const ArrayView< const T > &vertices_0, const ArrayView< const T > &vertices_1)
virtual ~NoPermutation() noexcept override=default
const ArrayView< const T > vertices_0
#define DEAL_II_DEPRECATED
Definition config.h:294
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_DEPRECATED_WITH_COMMENT(comment)
Definition config.h:295
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
#define DEAL_II_ASSERT_UNREACHABLE()
#define DEAL_II_NOT_IMPLEMENTED()
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)
constexpr unsigned int max_n_children()
constexpr ReferenceCell< 3 > Hexahedron
constexpr ReferenceCell< 2 > Quadrilateral
ReferenceCell< dim > n_vertices_to_reference_cell(const unsigned int n_vertices)
constexpr ReferenceCell< 1 > Line
constexpr unsigned int max_n_lines()
constexpr const std::vector< ReferenceCell< dim > > get_reference_cells_in_dim()
constexpr ReferenceCell< 2 > Triangle
constexpr unsigned int max_n_vertices()
constexpr ReferenceCell< 3 > Tetrahedron
constexpr const ReferenceCell< dim > & get_simplex()
constexpr unsigned int max_n_faces()
constexpr ReferenceCell< dim > Invalid
constexpr ReferenceCell< 3 > Pyramid
constexpr const ReferenceCell< dim > & get_hypercube()
constexpr unsigned int n_reference_cells_in_dim()
constexpr ReferenceCell< 3 > Wedge
constexpr ReferenceCell< 0 > Vertex
std::tuple< bool, bool, bool > split_face_orientation(const types::geometric_orientation combined_orientation)
constexpr ReferenceCell< dim > make_reference_cell_from_int(const std::uint8_t kind)
constexpr types::geometric_orientation invalid_geometric_orientation
Definition types.h:369
constexpr unsigned int invalid_unsigned_int
Definition types.h:228
constexpr double SQRT1_2
Definition numbers.h:260
constexpr types::geometric_orientation reverse_line_orientation
Definition types.h:355
constexpr types::geometric_orientation default_geometric_orientation
Definition types.h:342
boost::integer_range< IncrementableType > iota_view
Definition iota_view.h:43
STL namespace.
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > abs(const ::VectorizedArray< Number, width > &)
std::uint8_t geometric_orientation
Definition types.h:38
typename internal::ndarray::HelperArray< T, Ns... >::type ndarray
Definition ndarray.h:105
IsotropicRefinementChoice
std::istream & operator>>(std::istream &in, ReferenceCell< dim > &reference_cell)
std::ostream & operator<<(std::ostream &out, const ReferenceCell< dim > &reference_cell)
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 std::array< unsigned int, 2 > standard_hex_vertex_to_quad_vertex_index(const unsigned int vertex)
static std::array< unsigned int, 2 > standard_quad_vertex_to_line_vertex_index(const unsigned int vertex)
static double d_linear_shape_function(const Point< dim > &xi, const unsigned int i)
static unsigned int n_children(const RefinementCase< dim > &refinement_case)
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 Tensor< 1, dim > d_linear_shape_function_gradient(const Point< dim > &xi, const unsigned int i)