Assert(subcelldata.check_consistency(dim), ExcInternalError());
- // make sure that only either simplex or hypercube cells are available
- //
// TODO: the functions below (GridTools::delete_unused_vertices(),
// GridTools::invert_all_cells_of_negative_grid(),
- // GridReordering::reorder_cells(),
- // Triangulation::create_triangulation_compatibility()) need to be
- // revisited for simplex meshes
- AssertThrow(dim == 1 || (is_tria_or_tet_mesh ^ is_quad_or_hex_mesh),
- ExcNotImplemented());
+ // GridReordering::reorder_cells()) need to be
+ // revisited for simplex/mixed meshes
- if (dim == 1 || is_quad_or_hex_mesh)
+ if (dim == 1 || (is_quad_or_hex_mesh && !is_tria_or_tet_mesh))
{
GridTools::delete_unused_vertices(vertices, cells, subcelldata);
}
else
{
- tria->create_triangulation(vertices, cells, subcelldata);
+ // simplex or mixed mesh
+ tria->create_triangulation_compatibility(vertices,
+ cells,
+ subcelldata);
}
}
else
// check that we actually read some cells.
AssertThrow(cells.size() > 0, ExcGmshNoCellInformation());
- // make sure that only either simplex or hypercube cells are available
- //
// TODO: the functions below (GridTools::delete_unused_vertices(),
// GridTools::invert_all_cells_of_negative_grid(),
- // GridReordering::reorder_cells(),
- // Triangulation::create_triangulation_compatibility()) need to be revisited
- // for simplex meshes
- AssertThrow(dim == 1 || (is_tria_or_tet_mesh ^ is_quad_or_hex_mesh),
- ExcNotImplemented());
+ // GridReordering::reorder_cells()) need to be revisited
+ // for simplex/mixed meshes
- if (dim == 1 || is_quad_or_hex_mesh)
+ if (dim == 1 || (is_quad_or_hex_mesh && !is_tria_or_tet_mesh))
{
// do some clean-up on vertices...
GridTools::delete_unused_vertices(vertices, cells, subcelldata);
}
else
{
- tria->create_triangulation(vertices, cells, subcelldata);
+ // simplex or mixed mesh
+ tria->create_triangulation_compatibility(vertices, cells, subcelldata);
}
// in 1d, we also have to attach boundary ids to vertices, which does not
const SubCellData &)
{
for (auto &cell : cells)
- std::swap(cell.vertices[2], cell.vertices[3]);
+ if (cell.vertices.size() == GeometryInfo<2>::vertices_per_cell)
+ std::swap(cell.vertices[2], cell.vertices[3]);
}
{
unsigned int tmp[GeometryInfo<3>::vertices_per_cell];
for (auto &cell : cells)
- {
- for (const unsigned int i : GeometryInfo<3>::vertex_indices())
- tmp[i] = cell.vertices[i];
- for (const unsigned int i : GeometryInfo<3>::vertex_indices())
- cell.vertices[GeometryInfo<3>::ucd_to_deal[i]] = tmp[i];
- }
+ if (cell.vertices.size() == GeometryInfo<3>::vertices_per_cell)
+ {
+ for (const unsigned int i : GeometryInfo<3>::vertex_indices())
+ tmp[i] = cell.vertices[i];
+ for (const unsigned int i : GeometryInfo<3>::vertex_indices())
+ cell.vertices[GeometryInfo<3>::ucd_to_deal[i]] = tmp[i];
+ }
// now points in boundary quads
- std::vector<CellData<2>>::iterator boundary_quad =
- subcelldata.boundary_quads.begin();
- std::vector<CellData<2>>::iterator end_quad =
- subcelldata.boundary_quads.end();
- for (unsigned int quad_no = 0; boundary_quad != end_quad;
- ++boundary_quad, ++quad_no)
- std::swap(boundary_quad->vertices[2], boundary_quad->vertices[3]);
+ for (auto &boundary_quad : subcelldata.boundary_quads)
+ if (boundary_quad.vertices.size() == GeometryInfo<2>::vertices_per_cell)
+ std::swap(boundary_quad.vertices[2], boundary_quad.vertices[3]);
}