From: Simon Sticko Date: Fri, 17 Jan 2020 16:59:07 +0000 (+0100) Subject: Fix 1D bug in one version of make_flux_sparsity_pattern. X-Git-Tag: v9.2.0-rc1~629^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=29c5030bfa875412c8be0297587a665b9e8a09a7;p=dealii.git Fix 1D bug in one version of make_flux_sparsity_pattern. When a neighbor has children, the function loops over each face and the children of each face_iterator. But in 1D the number of children of a face is always zero. The result is that flux-couplings are missed in the 1D case when not all cells are on the same level. Fix this by avoiding to iterate over the children of the face in 1D. This is the same solutions that is already used in line 597 of source/dofs/dof_tools_sparsity.cc. --- diff --git a/source/dofs/dof_tools_sparsity.cc b/source/dofs/dof_tools_sparsity.cc index 67c1536dce..b3c05e9e93 100644 --- a/source/dofs/dof_tools_sparsity.cc +++ b/source/dofs/dof_tools_sparsity.cc @@ -880,6 +880,16 @@ namespace DoFTools cell->periodic_neighbor_face_no(face_n) : cell->neighbor_face_no(face_n); + + // 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 below. We need to + // do this since we otherwise iterate over the children of + // the face, which are always 0 in 1D. + if (DoFHandlerType::dimension == 1) + while (neighbor->has_children()) + neighbor = neighbor->child(face_n == 0 ? 1 : 0); + if (neighbor->has_children()) { for (unsigned int sub_nr = 0; @@ -1174,6 +1184,15 @@ namespace DoFTools neighbor->is_locally_owned()) continue; // (the neighbor is finer) + // 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 below. We need to + // do this since we otherwise iterate over the children of + // the face, which are always 0 in 1D. + if (dim == 1) + while (neighbor->has_children()) + neighbor = neighbor->child(face == 0 ? 1 : 0); + if (neighbor->has_children()) { for (unsigned int sub_nr = 0;