diff --git a/cpp/dolfinx/mesh/utils.cpp b/cpp/dolfinx/mesh/utils.cpp index bb0aa4037e8..ae6bb36c144 100644 --- a/cpp/dolfinx/mesh/utils.cpp +++ b/cpp/dolfinx/mesh/utils.cpp @@ -58,14 +58,15 @@ mesh::extract_topology(CellType cell_type, const fem::ElementDofLayout& layout, std::vector mesh::exterior_facet_indices(const Topology& topology) { const int tdim = topology.dim(); - auto facet_map = topology.index_map(tdim - 1); - if (!facet_map) - throw std::runtime_error("Facets have not been computed."); - + auto f_to_c = topology.connectivity(tdim - 1, tdim); + if (!f_to_c) + { + throw std::runtime_error( + "Facet to cell connectivity has not been computed."); + } // Find all owned facets (not ghost) with only one attached cell + auto facet_map = topology.index_map(tdim - 1); const int num_facets = facet_map->size_local(); - auto f_to_c = topology.connectivity(tdim - 1, tdim); - assert(f_to_c); std::vector facets; for (std::int32_t f = 0; f < num_facets; ++f) {