ReferenceCell::Type::Hex)]
.reset(new CellTypeHex());
- // jump table to pick the right entity type
- static const ReferenceCell::Type X = ReferenceCell::Type::Invalid;
- static const std::array<const std::array<ReferenceCell::Type, 9>, 4>
- table = {{{{X, ReferenceCell::Type::Vertex, X, X, X, X, X, X, X}},
- {{X, X, ReferenceCell::Type::Line, X, X, X, X, X, X}},
- {{X,
- X,
- X,
- ReferenceCell::Type::Tri,
- ReferenceCell::Type::Quad,
- X,
- X,
- X,
- X}},
- {{X,
- X,
- X,
- X,
- ReferenceCell::Type::Tet,
- ReferenceCell::Type::Pyramid,
- ReferenceCell::Type::Wedge,
- X,
- ReferenceCell::Type::Hex}}}};
-
// determine cell types and process vertices
std::vector<T> cell_vertices;
cell_vertices.reserve(
// loop over cells and create CRS
for (const auto &cell : cells)
{
- // determine cell type
const ReferenceCell::Type cell_type =
- table[dim][cell.vertices.size()];
+ ReferenceCell::n_vertices_to_type(dim, cell.vertices.size());
Assert(cell_type != ReferenceCell::Type::Invalid,
ExcNotImplemented());
}
}
+ /**
+ * Retrieve the correct ReferenceCell::Type for a given structural dimension
+ * and number of vertices.
+ */
+ inline Type
+ n_vertices_to_type(const int dim, const unsigned int n_vertices)
+ {
+ AssertIndexRange(dim, 4);
+ AssertIndexRange(n_vertices, 9);
+ const auto X = Type::Invalid;
+
+ static constexpr std::array<std::array<ReferenceCell::Type, 9>, 4> table = {
+ {// dim 0
+ {{X, Type::Vertex, X, X, X, X, X, X, X}},
+ // dim 1
+ {{X, X, Type::Line, X, X, X, X, X, X}},
+ // dim 2
+ {{X, X, X, Type::Tri, Type::Quad, X, X, X, X}},
+ // dim 3
+ {{X, X, X, X, Type::Tet, Type::Pyramid, Type::Wedge, X, Type::Hex}}}};
+ return table[dim][n_vertices];
+ }
+
namespace internal
{
/**