From 4440bc4235aaf21a7cc196e5cdbe31d32f0d4634 Mon Sep 17 00:00:00 2001 From: Simon Sticko Date: Wed, 12 Jul 2023 09:08:50 +0200 Subject: [PATCH] Simplify a few places using cell->as_dof_handler_iterator(..). --- source/non_matching/mesh_classifier.cc | 12 ++---------- source/non_matching/quadrature_generator.cc | 7 ++----- tests/base/cell_data_storage_01.cc | 7 +++---- tests/base/cell_data_storage_02.cc | 3 +-- tests/base/quadrature_point_data.cc | 7 +++---- tests/base/quadrature_point_data_02.cc | 7 +++---- tests/base/quadrature_point_data_03.cc | 7 +++---- tests/bits/step-51.cc | 10 ++-------- tests/bits/step-51p.cc | 10 ++-------- 9 files changed, 21 insertions(+), 49 deletions(-) diff --git a/source/non_matching/mesh_classifier.cc b/source/non_matching/mesh_classifier.cc index 78b1dfb2ff..743342bad1 100644 --- a/source/non_matching/mesh_classifier.cc +++ b/source/non_matching/mesh_classifier.cc @@ -157,11 +157,7 @@ namespace NonMatching const unsigned int face_index, Vector &local_levelset_values) { - typename DoFHandler::active_cell_iterator cell_with_dofs( - &dof_handler->get_triangulation(), - cell->level(), - cell->index(), - dof_handler); + const auto cell_with_dofs = cell->as_dof_handler_iterator(*dof_handler); const unsigned int n_dofs_per_face = dof_handler->get_fe().n_dofs_per_face(); @@ -183,11 +179,7 @@ namespace NonMatching DiscreteLevelSetDescription::active_fe_index( const typename Triangulation::active_cell_iterator &cell) const { - typename DoFHandler::active_cell_iterator cell_with_dofs( - &dof_handler->get_triangulation(), - cell->level(), - cell->index(), - dof_handler); + const auto cell_with_dofs = cell->as_dof_handler_iterator(*dof_handler); return cell_with_dofs->active_fe_index(); } diff --git a/source/non_matching/quadrature_generator.cc b/source/non_matching/quadrature_generator.cc index bfc731b6b3..df5e9bb56c 100644 --- a/source/non_matching/quadrature_generator.cc +++ b/source/non_matching/quadrature_generator.cc @@ -1440,11 +1440,8 @@ namespace NonMatching "The incoming cell must belong to the triangulation associated with " "the DoFHandler passed to the constructor.")); - const typename DoFHandler::active_cell_iterator dof_handler_cell( - &dof_handler->get_triangulation(), - cell->level(), - cell->index(), - dof_handler); + const auto dof_handler_cell = + cell->as_dof_handler_iterator(*dof_handler); // Save the element and the local dof values, since this is what we need // to evaluate the function. diff --git a/tests/base/cell_data_storage_01.cc b/tests/base/cell_data_storage_01.cc index 015cef56d1..de070aaf2c 100644 --- a/tests/base/cell_data_storage_01.cc +++ b/tests/base/cell_data_storage_01.cc @@ -93,8 +93,8 @@ check_qph(Triangulation &tr, for (cell = tr.begin_active(); cell != tr.end(); ++cell) if (cell->is_locally_owned()) { - typename DoFHandler::active_cell_iterator dof_cell(*cell, - &dof_handler); + const auto dof_cell = cell->as_dof_handler_iterator(dof_handler); + fe_values.reinit(dof_cell); const std::vector> &q_points = fe_values.get_quadrature_points(); @@ -159,8 +159,7 @@ test() for (cell = tr.begin_active(); cell != tr.end(); ++cell) if (cell->is_locally_owned()) { - typename DoFHandler::active_cell_iterator dof_cell(*cell, - &dof_handler); + const auto dof_cell = cell->as_dof_handler_iterator(dof_handler); fe_values.reinit(dof_cell); const std::vector> &q_points = fe_values.get_quadrature_points(); diff --git a/tests/base/cell_data_storage_02.cc b/tests/base/cell_data_storage_02.cc index f38853c2a6..9c077943d0 100644 --- a/tests/base/cell_data_storage_02.cc +++ b/tests/base/cell_data_storage_02.cc @@ -97,8 +97,7 @@ test() for (cell = tr.begin_active(); cell != tr.end(); ++cell) if (cell->is_locally_owned()) { - typename DoFHandler::active_cell_iterator dof_cell(*cell, - &dof_handler); + const auto dof_cell = cell->as_dof_handler_iterator(dof_handler); fe_values.reinit(dof_cell); const std::vector> &q_points = fe_values.get_quadrature_points(); diff --git a/tests/base/quadrature_point_data.cc b/tests/base/quadrature_point_data.cc index f806ecfe32..c7b130753b 100644 --- a/tests/base/quadrature_point_data.cc +++ b/tests/base/quadrature_point_data.cc @@ -116,8 +116,8 @@ check_qph(parallel::distributed::Triangulation &tr, for (cell = tr.begin_active(); cell != tr.end(); ++cell) if (cell->is_locally_owned()) { - typename DoFHandler::active_cell_iterator dof_cell(*cell, - &dof_handler); + const auto dof_cell = cell->as_dof_handler_iterator(dof_handler); + fe_values.reinit(dof_cell); const std::vector> &q_points = fe_values.get_quadrature_points(); @@ -163,8 +163,7 @@ test() for (cell = tr.begin_active(); cell != tr.end(); ++cell) if (cell->is_locally_owned()) { - typename DoFHandler::active_cell_iterator dof_cell(*cell, - &dof_handler); + const auto dof_cell = cell->as_dof_handler_iterator(dof_handler); fe_values.reinit(dof_cell); const std::vector> &q_points = fe_values.get_quadrature_points(); diff --git a/tests/base/quadrature_point_data_02.cc b/tests/base/quadrature_point_data_02.cc index ca2100610c..e9fa181508 100644 --- a/tests/base/quadrature_point_data_02.cc +++ b/tests/base/quadrature_point_data_02.cc @@ -120,8 +120,8 @@ check_qph(parallel::distributed::Triangulation &tr, for (cell = tr.begin_active(); cell != tr.end(); ++cell) if (cell->is_locally_owned()) { - typename DoFHandler::active_cell_iterator dof_cell(*cell, - &dof_handler); + const auto dof_cell = cell->as_dof_handler_iterator(dof_handler); + fe_values.reinit(dof_cell); const std::vector> &q_points = fe_values.get_quadrature_points(); @@ -172,8 +172,7 @@ test() for (cell = tr.begin_active(); cell != tr.end(); ++cell) if (cell->is_locally_owned()) { - typename DoFHandler::active_cell_iterator dof_cell(*cell, - &dof_handler); + const auto dof_cell = cell->as_dof_handler_iterator(dof_handler); fe_values.reinit(dof_cell); const std::vector> &q_points = fe_values.get_quadrature_points(); diff --git a/tests/base/quadrature_point_data_03.cc b/tests/base/quadrature_point_data_03.cc index ab7da7856b..0ccb9c2ab9 100644 --- a/tests/base/quadrature_point_data_03.cc +++ b/tests/base/quadrature_point_data_03.cc @@ -127,8 +127,8 @@ check_qph(parallel::distributed::Triangulation &tr, for (cell = tr.begin_active(); cell != tr.end(); ++cell) if (cell->is_locally_owned()) { - typename DoFHandler::active_cell_iterator dof_cell(*cell, - &dof_handler); + const auto dof_cell = cell->as_dof_handler_iterator(dof_handler); + fe_values.reinit(dof_cell); const std::vector> &q_points = fe_values.get_quadrature_points(); @@ -178,8 +178,7 @@ test() for (cell = tr.begin_active(); cell != tr.end(); ++cell) if (cell->is_locally_owned()) { - typename DoFHandler::active_cell_iterator dof_cell(*cell, - &dof_handler); + const auto dof_cell = cell->as_dof_handler_iterator(dof_handler); fe_values.reinit(dof_cell); const std::vector> &q_points = fe_values.get_quadrature_points(); diff --git a/tests/bits/step-51.cc b/tests/bits/step-51.cc index 894dac5053..93c481358c 100644 --- a/tests/bits/step-51.cc +++ b/tests/bits/step-51.cc @@ -574,10 +574,7 @@ namespace Step51 ScratchData & scratch, PerTaskData & task_data) { - typename DoFHandler::active_cell_iterator loc_cell(&triangulation, - cell->level(), - cell->index(), - &dof_handler_local); + const auto loc_cell = cell->as_dof_handler_iterator(dof_handler_local); const unsigned int n_q_points = scratch.fe_values_local.get_quadrature().size(); @@ -890,10 +887,7 @@ namespace Step51 PostProcessScratchData & scratch, unsigned int &) { - typename DoFHandler::active_cell_iterator loc_cell(&triangulation, - cell->level(), - cell->index(), - &dof_handler_local); + const auto loc_cell = cell->as_dof_handler_iterator(dof_handler_local); scratch.fe_values_local.reinit(loc_cell); scratch.fe_values.reinit(cell); diff --git a/tests/bits/step-51p.cc b/tests/bits/step-51p.cc index e765ed7060..3e08499783 100644 --- a/tests/bits/step-51p.cc +++ b/tests/bits/step-51p.cc @@ -574,10 +574,7 @@ namespace Step51 ScratchData & scratch, PerTaskData & task_data) { - typename DoFHandler::active_cell_iterator loc_cell(&triangulation, - cell->level(), - cell->index(), - &dof_handler_local); + const auto loc_cell = cell->as_dof_handler_iterator(dof_handler_local); const unsigned int n_q_points = scratch.fe_values_local.get_quadrature().size(); @@ -888,10 +885,7 @@ namespace Step51 PostProcessScratchData & scratch, unsigned int &) { - typename DoFHandler::active_cell_iterator loc_cell(&triangulation, - cell->level(), - cell->index(), - &dof_handler_local); + const auto loc_cell = cell->as_dof_handler_iterator(dof_handler_local); scratch.fe_values_local.reinit(loc_cell); scratch.fe_values.reinit(cell); -- 2.39.5