diff --git a/cpp/dolfinx/mesh/Topology.cpp b/cpp/dolfinx/mesh/Topology.cpp index 451965634fd..0c688e24753 100644 --- a/cpp/dolfinx/mesh/Topology.cpp +++ b/cpp/dolfinx/mesh/Topology.cpp @@ -773,7 +773,8 @@ Topology::Topology( // Cell Types _entity_types.insert(_entity_types.end(), cell_types.begin(), cell_types.end()); - _entity_type_offsets.push_back(_entity_types.size()); + if (tdim > 0) + _entity_type_offsets.push_back(_entity_types.size()); std::int8_t conn_size = _entity_type_offsets.back(); _index_map.resize(conn_size); diff --git a/python/test/unit/mesh/test_mesh.py b/python/test/unit/mesh/test_mesh.py index e620e1c0569..7d721f1d4f7 100644 --- a/python/test/unit/mesh/test_mesh.py +++ b/python/test/unit/mesh/test_mesh.py @@ -522,6 +522,7 @@ def test_submesh_full(d, n, codim, marker, ghost_mode, simplex): edim = max(mesh.topology.dim - codim, 0) entities = locate_entities(mesh, edim, marker) submesh, entity_map, vertex_map, geom_map = create_submesh(mesh, edim, entities) + assert submesh.topology.dim == edim submesh_topology_test(mesh, submesh, entity_map, vertex_map, edim) submesh_geometry_test(mesh, submesh, entity_map, geom_map, edim)