From d125d5e056c7c0b3c29c0d29e3632fa151833dd8 Mon Sep 17 00:00:00 2001 From: Chris Richardson Date: Wed, 26 Jun 2024 08:03:57 +0100 Subject: [PATCH] Improve check for facet->cell connectivity (#3281) * Improve check * Update utils.cpp --- cpp/dolfinx/mesh/utils.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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) {