From d58492728abc4a314408799c2abb12d1899795f0 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Tue, 31 May 2022 13:17:00 +0200 Subject: [PATCH] MatrixFree: Do not construct hanging nodes structure for non-adapted meshes --- include/deal.II/matrix_free/hanging_nodes_internal.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/deal.II/matrix_free/hanging_nodes_internal.h b/include/deal.II/matrix_free/hanging_nodes_internal.h index c946ad4339..d7bfbb3143 100644 --- a/include/deal.II/matrix_free/hanging_nodes_internal.h +++ b/include/deal.II/matrix_free/hanging_nodes_internal.h @@ -376,6 +376,17 @@ namespace internal inline void HangingNodes<3>::setup_line_to_cell(const Triangulation<3> &triangulation) { + // Check if we there are no hanging nodes on the current MPI process, + // which we do by checking if the second finest level holds no active + // non-artificial cell + if (triangulation.n_levels() <= 1 || + std::none_of(triangulation.begin_active(triangulation.n_levels() - 2), + triangulation.end_active(triangulation.n_levels() - 2), + [](const CellAccessor<3, 3> &cell) { + return !cell.is_artificial(); + })) + return; + const unsigned int n_raw_lines = triangulation.n_raw_lines(); this->line_to_cells.resize(n_raw_lines); -- 2.39.5