unsigned int
n_lines() const;
+ /**
+ * Return the maximum number of lines an object of dimension `structdim` can
+ * have. This is always the number of lines of a `structdim`-dimensional
+ * hypercube.
+ *
+ * @see ReferenceCell::max_n_faces()
+ */
+ template <int structdim>
+ static constexpr unsigned int
+ max_n_lines();
+
/**
* Return an object that can be thought of as an array containing all
* indices from zero to n_lines().
+template <int structdim>
+inline constexpr unsigned int
+ReferenceCell::max_n_lines()
+{
+ return GeometryInfo<structdim>::lines_per_cell;
+}
+
+
+
template <int dim>
Point<dim>
ReferenceCell::vertex(const unsigned int v) const
else if constexpr (structdim == 2 && dim == 3)
{
// line orientations in 3d are stored in their own array
- Assert(this->present_index * GeometryInfo<3>::lines_per_face + line <
+ Assert(this->present_index * ReferenceCell::max_n_lines<2>() + line <
this->tria->faces->quads_line_orientations.size(),
ExcInternalError());
return this->tria->faces->quads_line_orientations
- [this->present_index * GeometryInfo<3>::lines_per_face + line];
+ [this->present_index * ReferenceCell::max_n_lines<2>() + line];
}
else if constexpr (structdim == 3 && dim == 3)
{
// We set line orientations per face, not per cell, so this only works for
// faces in 3d
Assert(structdim == 2, ExcNotImplemented());
- Assert(this->present_index * GeometryInfo<3>::lines_per_face + line <
+ Assert(this->present_index * ReferenceCell::max_n_lines<2>() + line <
this->tria->faces->quads_line_orientations.size(),
ExcInternalError());
this->tria->faces->quads_line_orientations
- [this->present_index * GeometryInfo<3>::lines_per_face + line] = value;
+ [this->present_index * ReferenceCell::max_n_lines<2>() + line] = value;
}
}
{
// reserve the field of the derived class
tria_faces.quads_line_orientations.resize(
- new_size * GeometryInfo<3>::lines_per_face, true);
+ new_size * ReferenceCell::max_n_lines<2>(), true);
auto &q_is_q = tria_faces.quad_is_quadrilateral;
q_is_q.reserve(new_size);
for (unsigned int q = 0, k = 0; q < n_quads; ++q)
{
// set entity type of quads
- faces.set_quad_type(q, connectivity.entity_types(2)[q]);
+ const auto reference_cell = connectivity.entity_types(2)[q];
+ faces.set_quad_type(q, reference_cell);
// loop over all its lines
for (unsigned int i = crs.ptr[q], j = 0; i < crs.ptr[q + 1];
++i, ++j, ++k)
{
+ AssertIndexRange(j, reference_cell.n_lines());
// set line index
- quads_0.cells[q * GeometryInfo<3>::lines_per_face + j] =
+ quads_0.cells[q * ReferenceCell::max_n_lines<2>() + j] =
crs.col[i];
// set line orientations
ReferenceCell::reversed_combined_line_orientation(),
ExcInternalError());
faces.quads_line_orientations
- [q * GeometryInfo<3>::lines_per_face + j] =
+ [q * ReferenceCell::max_n_lines<2>() + j] =
combined_orientation ==
ReferenceCell::default_combined_face_orientation();
}