// 3. Quads
for (unsigned int quad_number = 0;
quad_number <
- (dim == 2 ? 1 :
- (dim == 3 ? dealii::internal::ReferenceCell::get_cell(
- fes.front()->reference_cell())
- .n_faces() :
- 0));
+ (dim == 2 ?
+ 1 :
+ (dim == 3 ? fes.front()->reference_cell().n_faces() : 0));
++quad_number)
{
for (unsigned int base = 0; base < fes.size(); ++base)
// 3. Quads
for (unsigned int quad_number = 0;
quad_number <
- (dim == 2 ? 1 :
- (dim == 3 ? dealii::internal::ReferenceCell::get_cell(
- fes.front()->reference_cell())
- .n_faces() :
- 0));
+ (dim == 2 ?
+ 1 :
+ (dim == 3 ? fes.front()->reference_cell().n_faces() : 0));
++quad_number)
{
unsigned int comp_start = 0;
// 3. Quads
for (unsigned int quad_number = 0;
quad_number <
- (dim == 2 ? 1 :
- (dim == 3 ? dealii::internal::ReferenceCell::get_cell(
- fe.reference_cell())
- .n_faces() :
- 0));
+ (dim == 2 ? 1 : (dim == 3 ? fe.reference_cell().n_faces() : 0));
++quad_number)
{
unsigned int comp_start = 0;
unsigned int total_index = 0;
for (unsigned int vertex_number = 0;
vertex_number <
- dealii::internal::ReferenceCell::get_face(fe.reference_cell(),
- face_no)
- .n_vertices();
+ fe.reference_cell().face_reference_cell(face_no).n_vertices();
++vertex_number)
{
unsigned int comp_start = 0;
// 2. Lines
for (unsigned int line_number = 0;
line_number <
- dealii::internal::ReferenceCell::get_face(fe.reference_cell(),
- face_no)
- .n_lines();
+ fe.reference_cell().face_reference_cell(face_no).n_lines();
++line_number)
{
unsigned int comp_start = 0;
{
unsigned int face_dof = 0;
for (unsigned int i = 0;
- i < dealii::internal::ReferenceCell::get_face(fe.reference_cell(),
- face_no)
- .n_vertices();
+ i < fe.reference_cell().face_reference_cell(face_no).n_vertices();
++i)
{
const unsigned int offset_c =
}
for (unsigned int i = 1;
- i <= dealii::internal::ReferenceCell::get_face(fe.reference_cell(),
- face_no)
- .n_lines();
+ i <= fe.reference_cell().face_reference_cell(face_no).n_lines();
++i)
{
const unsigned int offset_c =
const Quadrature<dim> &
get_nodal_type_quadrature() const;
+ /**
+ * @}
+ */
+
+ /**
+ * @name Querying the number of building blocks of a reference cell
+ * @{
+ */
+
+ /**
+ * Return the number of vertices that make up the reference
+ * cell in question. A vertex is a "corner" (a zero-dimensional
+ * object) of the reference cell.
+ */
+ unsigned int
+ n_vertices() const;
+
+ /**
+ * Return the number of lines that make up the reference
+ * cell in question. A line is an "edge" (a one-dimensional
+ * object) of the reference cell.
+ */
+ unsigned int
+ n_lines() const;
+
+ /**
+ * Return the number of faces that make up the reference
+ * cell in question. A face is a `(dim-1)`-dimensional
+ * object bounding the reference cell.
+ */
+ unsigned int
+ n_faces() const;
+
+ /**
+ * Return the reference-cell type of face @p face_no of the current
+ * object. For example, if the current object is
+ * ReferenceCells::Tetrahedron, then `face_no` must be between
+ * in the interval $[0,4)$ and the function will always return
+ * ReferenceCells::Triangle. If the current object is
+ * ReferenceCells::Hexahedron, then `face_no` must be between
+ * in the interval $[0,6)$ and the function will always return
+ * ReferenceCells::Quadrilateral. For wedges and pyramids, the
+ * returned object may be either ReferenceCells::Triangle or
+ * ReferenceCells::Quadrilateral, depending on the given index.
+ */
+ ReferenceCell
+ face_reference_cell(const unsigned int face_no) const;
+
/**
* @}
*/
+inline unsigned int
+ReferenceCell::n_vertices() const
+{
+ if (*this == ReferenceCells::Vertex)
+ return 1;
+ else if (*this == ReferenceCells::Line)
+ return 2;
+ else if (*this == ReferenceCells::Triangle)
+ return 3;
+ else if (*this == ReferenceCells::Quadrilateral)
+ return 4;
+ else if (*this == ReferenceCells::Tetrahedron)
+ return 4;
+ else if (*this == ReferenceCells::Pyramid)
+ return 5;
+ else if (*this == ReferenceCells::Wedge)
+ return 6;
+ else if (*this == ReferenceCells::Hexahedron)
+ return 8;
+
+ Assert(false, ExcNotImplemented());
+ return numbers::invalid_unsigned_int;
+}
+
+
+
+inline unsigned int
+ReferenceCell::n_lines() const
+{
+ if (*this == ReferenceCells::Vertex)
+ return 0;
+ else if (*this == ReferenceCells::Line)
+ return 1;
+ else if (*this == ReferenceCells::Triangle)
+ return 3;
+ else if (*this == ReferenceCells::Quadrilateral)
+ return 4;
+ else if (*this == ReferenceCells::Tetrahedron)
+ return 6;
+ else if (*this == ReferenceCells::Pyramid)
+ return 7;
+ else if (*this == ReferenceCells::Wedge)
+ return 9;
+ else if (*this == ReferenceCells::Hexahedron)
+ return 12;
+
+ Assert(false, ExcNotImplemented());
+ return numbers::invalid_unsigned_int;
+}
+
+
+
+inline unsigned int
+ReferenceCell::n_faces() const
+{
+ if (*this == ReferenceCells::Vertex)
+ return 0;
+ else if (*this == ReferenceCells::Line)
+ return 2;
+ else if (*this == ReferenceCells::Triangle)
+ return 3;
+ else if (*this == ReferenceCells::Quadrilateral)
+ return 4;
+ else if (*this == ReferenceCells::Tetrahedron)
+ return 4;
+ else if (*this == ReferenceCells::Pyramid)
+ return 5;
+ else if (*this == ReferenceCells::Wedge)
+ return 5;
+ else if (*this == ReferenceCells::Hexahedron)
+ return 6;
+
+ Assert(false, ExcNotImplemented());
+ return numbers::invalid_unsigned_int;
+}
+
+
+
+inline ReferenceCell
+ReferenceCell::face_reference_cell(const unsigned int face_no) const
+{
+ AssertIndexRange(face_no, n_faces());
+
+ if (*this == ReferenceCells::Vertex)
+ return ReferenceCells::Invalid;
+ else if (*this == ReferenceCells::Line)
+ return ReferenceCells::Vertex;
+ else if (*this == ReferenceCells::Triangle)
+ return ReferenceCells::Line;
+ else if (*this == ReferenceCells::Quadrilateral)
+ return ReferenceCells::Line;
+ else if (*this == ReferenceCells::Tetrahedron)
+ return ReferenceCells::Triangle;
+ else if (*this == ReferenceCells::Pyramid)
+ {
+ if (face_no == 0)
+ return ReferenceCells::Quadrilateral;
+ else
+ return ReferenceCells::Triangle;
+ }
+ else if (*this == ReferenceCells::Wedge)
+ {
+ if (face_no > 1)
+ return ReferenceCells::Quadrilateral;
+ else
+ return ReferenceCells::Triangle;
+ }
+ else if (*this == ReferenceCells::Hexahedron)
+ return ReferenceCells::Quadrilateral;
+
+ Assert(false, ExcNotImplemented());
+ return ReferenceCells::Invalid;
+}
+
+
+
namespace ReferenceCells
{
template <int dim>
*/
virtual ~Base() = default;
+ private:
/**
* Number of vertices.
*/
return 0;
}
+ public:
/**
* Return an object that can be thought of as an array containing all
* indices from zero to n_vertices().
return true;
}
+ private:
/**
* Return reference-cell type of face @p face_no.
*/
return ReferenceCells::Invalid;
}
+ public:
/**
* Map face line number to cell line number.
*/
inline const internal::ReferenceCell::Base &
get_face(const dealii::ReferenceCell &type, const unsigned int face_no)
{
- return get_cell(get_cell(type).face_reference_cell(face_no));
+ return get_cell(type.face_reference_cell(face_no));
}
} // namespace ReferenceCell
{
out << "[";
- const unsigned int n_vertices =
- internal::ReferenceCell::get_cell(entity_type).n_vertices();
+ const unsigned int n_vertices = entity_type.n_vertices();
for (unsigned int i = 0; i < n_vertices; ++i)
{
ReferenceCell::compute_orientation(const std::array<T, N> &vertices_0,
const std::array<T, N> &vertices_1) const
{
- AssertIndexRange(internal::ReferenceCell::get_cell(*this).n_vertices(),
- N + 1);
+ AssertIndexRange(n_vertices(), N + 1);
if (*this == ReferenceCells::Line)
{
const std::array<T, 2> i{{vertices_0[0], vertices_0[1]}};
unsigned int
TriaAccessor<structdim, dim, spacedim>::n_vertices() const
{
- return this->reference_cell_info().n_vertices();
+ return this->reference_cell().n_vertices();
}
unsigned int
TriaAccessor<structdim, dim, spacedim>::n_lines() const
{
- return this->reference_cell_info().n_lines();
+ return this->reference_cell().n_lines();
}
{
AssertDimension(structdim, dim);
- return this->reference_cell_info().n_faces();
+ return this->reference_cell().n_faces();
}
for (unsigned int face_no = 0; face_no < quad_face.size();
++face_no)
- n_max_vertices = std::max(n_max_vertices,
- internal::ReferenceCell::get_face(
- reference_cell_type, face_no)
- .n_vertices());
+ n_max_vertices =
+ std::max(n_max_vertices,
+ reference_cell_type.face_reference_cell(face_no)
+ .n_vertices());
const auto projected_quad_face =
QProjector<dim>::project_to_all_faces(reference_cell_type,
{
const unsigned int n_face_orientations =
dim == 2 ? 2 :
- (2 * internal::ReferenceCell::get_face(
- reference_cell_type, f)
+ (2 * reference_cell_type.face_reference_cell(f)
.n_vertices());
const unsigned int n_q_points_face = quad_face[f].size();
else
{
Assert(patch.n_subdivisions == 1, ExcNotImplemented());
- const auto &info =
- internal::ReferenceCell::get_cell(patch.reference_cell);
- n_nodes += info.n_vertices();
+ n_nodes += patch.reference_cell.n_vertices();
n_cells += 1;
}
}
// patches
Assert(patches.size() > 0, ExcNoPatches());
- const auto &cell_info =
- internal::ReferenceCell::get_cell(patches[0].reference_cell);
-
hid_t h5_mesh_file_id = -1, h5_solution_file_id, file_plist_id, plist_id;
hid_t node_dataspace, node_dataset, node_file_dataspace,
node_memory_dataspace;
AssertThrow(node_dataspace >= 0, ExcIO());
cell_ds_dim[0] = global_node_cell_count[1];
- cell_ds_dim[1] = cell_info.n_vertices();
+ cell_ds_dim[1] = patches[0].reference_cell.n_vertices();
cell_dataspace = H5Screate_simple(2, cell_ds_dim, nullptr);
AssertThrow(cell_dataspace >= 0, ExcIO());
// And repeat for cells
count[0] = local_node_cell_count[1];
- count[1] = cell_info.n_vertices();
+ count[1] = patches[0].reference_cell.n_vertices();
offset[0] = global_node_cell_offsets[1];
offset[1] = 0;
cell_memory_dataspace = H5Screate_simple(2, count, nullptr);
const auto reference_cell = cell->reference_cell();
- const auto &cell_rc =
- dealii::internal::ReferenceCell::get_cell(reference_cell);
- const auto &face_rc =
- dealii::internal::ReferenceCell::get_face(reference_cell,
- face);
-
- const unsigned int n_vertices_per_cell = cell_rc.n_vertices();
- const unsigned int n_lines_per_cell = cell_rc.n_lines();
- const unsigned int n_vertices_per_face = face_rc.n_vertices();
- const unsigned int n_lines_per_face = face_rc.n_lines();
+ const unsigned int n_vertices_per_cell =
+ reference_cell.n_vertices();
+ const unsigned int n_lines_per_cell = reference_cell.n_lines();
+ const unsigned int n_vertices_per_face =
+ reference_cell.face_reference_cell(face).n_vertices();
+ const unsigned int n_lines_per_face =
+ reference_cell.face_reference_cell(face).n_lines();
const unsigned int dofs_per_face = fe.n_dofs_per_face(face);
face_dof_indices.resize(dofs_per_face);
for (unsigned int f = 0; f < this->n_unique_quads(); ++f)
{
- adjust_quad_dof_index_for_face_orientation_table[f] = Table<2, int>(
- this->n_dofs_per_quad(f),
- internal::ReferenceCell::get_cell(this->reference_cell())
- .face_reference_cell(f) == ReferenceCells::Quadrilateral ?
- 8 :
- 6);
+ adjust_quad_dof_index_for_face_orientation_table[f] =
+ Table<2, int>(this->n_dofs_per_quad(f),
+ this->reference_cell().face_reference_cell(f) ==
+ ReferenceCells::Quadrilateral ?
+ 8 :
+ 6);
adjust_quad_dof_index_for_face_orientation_table[f].fill(0);
}
}
internal::ReferenceCell::get_cell(this->reference_cell());
AssertIndexRange(face_index, this->n_dofs_per_face(face));
- AssertIndexRange(face, refence_cell.n_faces());
+ AssertIndexRange(face, this->reference_cell().n_faces());
// TODO: we could presumably solve the 3d case below using the
// adjust_quad_dof_index_for_face_orientation_table field. for the
AssertIndexRange(index, this->n_dofs_per_quad(face));
Assert(adjust_quad_dof_index_for_face_orientation_table
[this->n_unique_quads() == 1 ? 0 : face]
- .n_elements() ==
- (internal::ReferenceCell::get_cell(this->reference_cell())
- .face_reference_cell(face) == ReferenceCells::Quadrilateral ?
- 8 :
- 6) *
- this->n_dofs_per_quad(face),
+ .n_elements() == (this->reference_cell().face_reference_cell(
+ face) == ReferenceCells::Quadrilateral ?
+ 8 :
+ 6) *
+ this->n_dofs_per_quad(face),
ExcInternalError());
return index +
adjust_quad_dof_index_for_face_orientation_table
// first_line_index
const unsigned int first_line_index =
- (internal::ReferenceCell::get_cell(cell_type).n_vertices() *
- dofs_per_vertex);
+ (cell_type.n_vertices() * dofs_per_vertex);
result.object_index[1][0] = first_line_index;
// first_quad_index
const unsigned int first_quad_index =
- (first_line_index +
- internal::ReferenceCell::get_cell(cell_type).n_lines() * dofs_per_line);
+ (first_line_index + cell_type.n_lines() * dofs_per_line);
result.object_index[2][0] = first_quad_index;
// first_hex_index
result.object_index[3][0] =
(first_quad_index +
- (dim == 2 ?
- 1 :
- (dim == 3 ? internal::ReferenceCell::get_cell(cell_type).n_faces() :
- 0)) *
- dofs_per_quad);
+ (dim == 2 ? 1 : (dim == 3 ? cell_type.n_faces() : 0)) * dofs_per_quad);
// first_face_line_index
result.first_object_index_on_face[1][0] =
- (internal::ReferenceCell::get_face(cell_type, face_no).n_vertices() *
- dofs_per_vertex);
+ (cell_type.face_reference_cell(face_no).n_vertices() * dofs_per_vertex);
// first_face_quad_index
result.first_object_index_on_face[2][0] =
- ((dim == 3 ?
- internal::ReferenceCell::get_face(cell_type, face_no).n_vertices() *
- dofs_per_vertex :
- internal::ReferenceCell::get_cell(cell_type).n_vertices() *
- dofs_per_vertex) +
- internal::ReferenceCell::get_face(cell_type, face_no).n_lines() *
- dofs_per_line);
+ ((dim == 3 ? cell_type.face_reference_cell(face_no).n_vertices() *
+ dofs_per_vertex :
+ cell_type.n_vertices() * dofs_per_vertex) +
+ cell_type.face_reference_cell(face_no).n_lines() * dofs_per_line);
// dofs_per_face
result.dofs_per_object_inclusive[dim - 1][0] =
- (internal::ReferenceCell::get_face(cell_type, face_no).n_vertices() *
- dofs_per_vertex +
- internal::ReferenceCell::get_face(cell_type, face_no).n_lines() *
- dofs_per_line +
+ (cell_type.face_reference_cell(face_no).n_vertices() * dofs_per_vertex +
+ cell_type.face_reference_cell(face_no).n_lines() * dofs_per_line +
(dim == 3 ? 1 : 0) * dofs_per_quad);
// dofs_per_cell
result.dofs_per_object_inclusive[dim][0] =
- (internal::ReferenceCell::get_cell(cell_type).n_vertices() *
- dofs_per_vertex +
- internal::ReferenceCell::get_cell(cell_type).n_lines() * dofs_per_line +
- (dim == 2 ?
- 1 :
- (dim == 3 ? internal::ReferenceCell::get_cell(cell_type).n_faces() :
- 0)) *
- dofs_per_quad +
+ (cell_type.n_vertices() * dofs_per_vertex +
+ cell_type.n_lines() * dofs_per_line +
+ (dim == 2 ? 1 : (dim == 3 ? cell_type.n_faces() : 0)) * dofs_per_quad +
(dim == 3 ? 1 : 0) * dofs_per_hex);
return result;
}
} // namespace internal
+
+
template <int dim>
FiniteElementData<dim>::FiniteElementData(
const std::vector<unsigned int> &dofs_per_object,
, quadrature(quadrature)
{
Assert(quadrature.size() == 1 ||
- quadrature.size() ==
- internal::ReferenceCell::get_cell(fe.reference_cell()).n_faces(),
+ quadrature.size() == fe.reference_cell().n_faces(),
ExcInternalError());
}
// Compute tangentials to the unit cell.
const auto reference_cell = this->fe.reference_cell();
- const auto n_faces =
- internal::ReferenceCell::get_cell(reference_cell).n_faces();
+ const auto n_faces = reference_cell.n_faces();
for (unsigned int i = 0; i < n_faces; ++i)
{
const auto reference_cell = fe.reference_cell();
- const unsigned int n_points = mapping_support_points.size();
- const unsigned int n_shape_functions =
- internal::ReferenceCell::get_cell(reference_cell).n_vertices();
+ const unsigned int n_points = mapping_support_points.size();
+ const unsigned int n_shape_functions = reference_cell.n_vertices();
this->mapping_support_point_weights =
Table<2, double>(n_points, n_shape_functions);
// TODO: only a single reference cell type possible...
const auto reference_cell =
this->euler_dof_handler->get_fe().reference_cell();
- const auto n_faces =
- internal::ReferenceCell::get_cell(reference_cell).n_faces();
+ const auto n_faces = reference_cell.n_faces();
// Compute tangentials to the unit cell.
for (unsigned int i = 0; i < n_faces; ++i)