From: David Wells Date: Wed, 3 Aug 2016 02:39:17 +0000 (-0400) Subject: Redo the hp make_flux_sparsity_pattern logic. X-Git-Tag: v8.5.0-rc1~810^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7658eff686df98f04f5a24fc14025bac89a5015;p=dealii.git Redo the hp make_flux_sparsity_pattern logic. This now the same as the non-hp version, which was changed in 9b037871bb. In brief: this function uses the total ordering of cells instead of user flags to figure out when a face may be skipped. --- diff --git a/source/dofs/dof_tools_sparsity.cc b/source/dofs/dof_tools_sparsity.cc index 2eb8c011d6..1ac28b71b6 100644 --- a/source/dofs/dof_tools_sparsity.cc +++ b/source/dofs/dof_tools_sparsity.cc @@ -1024,8 +1024,6 @@ namespace DoFTools { const typename dealii::hp::DoFHandler::face_iterator cell_face = cell->face(face); - if (cell_face->user_flag_set ()) - continue; const bool periodic_neighbor = cell->has_periodic_neighbor (face); @@ -1048,15 +1046,37 @@ namespace DoFTools typename dealii::hp::DoFHandler::level_cell_iterator neighbor = cell->neighbor_or_periodic_neighbor(face); - // Refinement edges are taken care of by coarser cells - if ((!periodic_neighbor && cell->neighbor_is_coarser(face)) || - (periodic_neighbor && cell->periodic_neighbor_is_coarser(face))) + // 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 current cell + // is 'greater' in the total ordering. + if (neighbor->level () == cell->level () + && + neighbor->index () > cell->index () + && + neighbor->active () + && + neighbor->is_locally_owned ()) continue; - - const unsigned int - neighbor_face = periodic_neighbor? - cell->periodic_neighbor_of_periodic_neighbor(face): - cell->neighbor_of_neighbor(face); + // Again, like the non-hp case: If we are more refined + // then the neighbor, then we will automatically find + // the active neighbor cell when we call 'neighbor + // (face)' above. The opposite is not true; if the + // neighbor is more refined then the call 'neighbor + // (face)' will *not* return an active cell. Hence, + // only add things to the sparsity pattern if (when the + // levels are different) the neighbor is coarser than + // the current cell. + // + // Like above, do not use this optimization if the + // neighbor is not locally owned. + if (neighbor->level () != cell->level () + && + ((!periodic_neighbor && !cell->neighbor_is_coarser (face)) + ||(periodic_neighbor && !cell->periodic_neighbor_is_coarser (face))) + && + neighbor->is_locally_owned ()) + continue; // (the neighbor is finer) if (cell_face->has_children()) { @@ -1114,7 +1134,6 @@ namespace DoFTools } } } - sub_neighbor->face(neighbor_face)->set_user_flag (); } } else @@ -1162,7 +1181,6 @@ namespace DoFTools } } } - neighbor->face(neighbor_face)->set_user_flag (); } } }