From 070237ca855d05561e893f52f5cc5a1e4a2f2edd Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Mon, 13 Mar 2023 21:22:30 -0400 Subject: [PATCH] clean up a test --- .../flux_sparsity_pattern_visiting_once.cc | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/tests/sparsity/flux_sparsity_pattern_visiting_once.cc b/tests/sparsity/flux_sparsity_pattern_visiting_once.cc index 649019513a..6689c36546 100644 --- a/tests/sparsity/flux_sparsity_pattern_visiting_once.cc +++ b/tests/sparsity/flux_sparsity_pattern_visiting_once.cc @@ -14,11 +14,11 @@ * --------------------------------------------------------------------- */ -// @sect3{This test considers two elements which share a common, regular face. +// This test considers two elements which share a common, regular face. // The logic of make_flux_sparsity_pattern() loops over all faces and filters // some of them according to a predicate face_has_flux_coupling(). We check // that the only internal face in the current setup is visited exactly once and -// that the predicate face_has_flux_coupling() is evaluated once for this face.} +// that the predicate face_has_flux_coupling() is evaluated once for this face. #include @@ -63,18 +63,21 @@ create_and_output_flux_sparsity_with_filter( std::function::active_cell_iterator, const unsigned int)> filter) { - DynamicSparsityPattern dsp(dof_handler.n_dofs(), dof_handler.n_dofs()); - DoFTools::make_flux_sparsity_pattern( - dof_handler, - dsp, - AffineConstraints(), - true, - Table<2, DoFTools::Coupling>(1, 1, new auto(DoFTools::always)), - Table<2, DoFTools::Coupling>(1, 1, new auto(DoFTools::always)), - numbers::invalid_subdomain_id, - [&](const auto &cell, const unsigned int face_index) { - return filter(cell, face_index); - }); + DynamicSparsityPattern dsp(dof_handler.n_dofs(), dof_handler.n_dofs()); + Table<2, DoFTools::Coupling> coupling(1, 1); + coupling.fill(DoFTools::always); + + DoFTools::make_flux_sparsity_pattern(dof_handler, + dsp, + AffineConstraints(), + true, + coupling, + coupling, + numbers::invalid_subdomain_id, + [&](const auto & cell, + const unsigned int face_index) { + return filter(cell, face_index); + }); dsp.print(deallog.get_file_stream()); } @@ -82,12 +85,11 @@ template void check() { - // create a square with two elements const Triangulation tria = make_two_elements(); - // Generate Q1 dofs for the mesh grid + DoFHandler dof_handler(tria); dof_handler.distribute_dofs(FE_Q(1)); - // create and output the sparsity pattern by using a filter + create_and_output_flux_sparsity_with_filter(dof_handler, is_face_on_OY); } -- 2.39.5