From: Vladimir Yushutin Date: Sat, 11 Feb 2023 22:43:38 +0000 (-0500) Subject: face_has_flux_coupling may be a predicate made of multiple, complicated checks; It... X-Git-Tag: v9.5.0-rc1~484^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e02293128a47487bf974471ee9c32062a3705c2;p=dealii.git face_has_flux_coupling may be a predicate made of multiple, complicated checks; It's better to move it after the main logic the face loop; Moreover, face_has_flux_coupling may be impossible to run o if, for example, the neighbor is not active element; --- diff --git a/source/dofs/dof_tools_sparsity.cc b/source/dofs/dof_tools_sparsity.cc index 3646021f75..9309e9edd2 100644 --- a/source/dofs/dof_tools_sparsity.cc +++ b/source/dofs/dof_tools_sparsity.cc @@ -852,9 +852,6 @@ namespace DoFTools } else { - if (!face_has_flux_coupling(cell, face_n)) - continue; - typename DoFHandler::level_cell_iterator neighbor = @@ -888,6 +885,10 @@ namespace DoFTools neighbor->is_locally_owned()) continue; // (the neighbor is finer) + if (!face_has_flux_coupling(cell, face_n)) + continue; + + const unsigned int neighbor_face_n = periodic_neighbor ? cell->periodic_neighbor_face_no(face_n) : @@ -1197,9 +1198,6 @@ namespace DoFTools level_cell_iterator neighbor = cell->neighbor_or_periodic_neighbor(face); - if (!face_has_flux_coupling(cell, face)) - continue; - // Like the non-hp-case: If the cells are on the same // level (and both are active, locally-owned cells) // then only add to the sparsity pattern if the @@ -1229,6 +1227,10 @@ namespace DoFTools neighbor->is_locally_owned()) continue; // (the neighbor is finer) + + if (!face_has_flux_coupling(cell, face)) + continue; + // In 1d, go straight to the cell behind this // particular cell's most terminal cell. This makes us // skip the if (neighbor->has_children()) section