From eb7e4957b0d2b74a7d7bdd348429218b96cb42a0 Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Fri, 8 Sep 2023 15:19:27 -0600 Subject: [PATCH] Do not use deprecated extract_locally_* functions in code-gallery. --- Distributed_LDG_Method/LDGPoisson.cc | 7 +++---- .../Distributed_Moving_Laser_Heating.cc | 4 ++-- NavierStokes_TRBDF2_DG/navier_stokes_TRBDF2_DG.cc | 3 +-- cdr/solver/cdr.cc | 4 ++-- goal_oriented_elastoplasticity/elastoplastic.cc | 7 +++---- .../time_dependent_navier_stokes.cc | 2 +- two_phase_flow/LevelSetSolver.cc | 8 ++++---- two_phase_flow/MultiPhase.cc | 15 ++++++--------- two_phase_flow/NavierStokesSolver.cc | 14 +++++++------- two_phase_flow/TestLevelSet.cc | 15 ++++++--------- two_phase_flow/TestNavierStokes.cc | 15 ++++++--------- 11 files changed, 41 insertions(+), 53 deletions(-) diff --git a/Distributed_LDG_Method/LDGPoisson.cc b/Distributed_LDG_Method/LDGPoisson.cc index 3fd0b1f..6cbf74c 100644 --- a/Distributed_LDG_Method/LDGPoisson.cc +++ b/Distributed_LDG_Method/LDGPoisson.cc @@ -320,15 +320,14 @@ make_dofs() // Now we get the locally owned dofs, that is the dofs that our local // to this processor. These dofs corresponding entries in the // matrix and vectors that we will write to. - IndexSet locally_owned_dofs = dof_handler.locally_owned_dofs(); + const IndexSet &locally_owned_dofs = dof_handler.locally_owned_dofs(); // In additon to the locally owned dofs, we also need the the locally // relevant dofs. These are the dofs that have read access to and we // need in order to do computations on our processor, but, that // we do not have the ability to write to. - IndexSet locally_relevant_dofs; - DoFTools::extract_locally_relevant_dofs(dof_handler, - locally_relevant_dofs); + const IndexSet locally_relevant_dofs = + DoFTools::extract_locally_relevant_dofs(dof_handler); const std::vector dofs_per_component = DoFTools::count_dofs_per_fe_component(dof_handler); diff --git a/Distributed_Moving_Laser_Heating/Distributed_Moving_Laser_Heating.cc b/Distributed_Moving_Laser_Heating/Distributed_Moving_Laser_Heating.cc index d49ce9b..1760e7f 100644 --- a/Distributed_Moving_Laser_Heating/Distributed_Moving_Laser_Heating.cc +++ b/Distributed_Moving_Laser_Heating/Distributed_Moving_Laser_Heating.cc @@ -207,8 +207,8 @@ void LaserHeating::setup_system () << dof_handler.n_dofs() << std::endl; - locally_owned_dofs = dof_handler.locally_owned_dofs(); - DoFTools::extract_locally_relevant_dofs (dof_handler, locally_relevant_dofs); + locally_owned_dofs = dof_handler.locally_owned_dofs(); + locally_relevant_dofs = DoFTools::extract_locally_relevant_dofs (dof_handler); // we want to output solution, so here should have ghost cells old_solution_T.reinit (locally_owned_dofs,locally_relevant_dofs,mpi_communicator); diff --git a/NavierStokes_TRBDF2_DG/navier_stokes_TRBDF2_DG.cc b/NavierStokes_TRBDF2_DG/navier_stokes_TRBDF2_DG.cc index 5572ab5..f5b0f80 100644 --- a/NavierStokes_TRBDF2_DG/navier_stokes_TRBDF2_DG.cc +++ b/NavierStokes_TRBDF2_DG/navier_stokes_TRBDF2_DG.cc @@ -2709,8 +2709,7 @@ namespace NS_TRBDF2 { TimerOutput::Scope t(time_table, "Refine mesh"); /*--- We first create a proper vector for computing estimator ---*/ - IndexSet locally_relevant_dofs; - DoFTools::extract_locally_relevant_dofs(dof_handler_velocity, locally_relevant_dofs); + const IndexSet locally_relevant_dofs = DoFTools::extract_locally_relevant_dofs(dof_handler_velocity); LinearAlgebra::distributed::Vector tmp_velocity; tmp_velocity.reinit(dof_handler_velocity.locally_owned_dofs(), locally_relevant_dofs, MPI_COMM_WORLD); tmp_velocity = u_n; diff --git a/cdr/solver/cdr.cc b/cdr/solver/cdr.cc index 4b62f1e..aebc298 100644 --- a/cdr/solver/cdr.cc +++ b/cdr/solver/cdr.cc @@ -162,8 +162,8 @@ CDRProblem::setup_dofs() dof_handler.distribute_dofs(fe); pcout << "Number of degrees of freedom: " << dof_handler.n_dofs() << std::endl; - locally_owned_dofs = dof_handler.locally_owned_dofs(); - DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs); + locally_owned_dofs = dof_handler.locally_owned_dofs(); + locally_relevant_dofs = DoFTools::extract_locally_relevant_dofs(dof_handler); constraints.clear(); constraints.reinit(locally_relevant_dofs); diff --git a/goal_oriented_elastoplasticity/elastoplastic.cc b/goal_oriented_elastoplasticity/elastoplastic.cc index eca6183..5a14527 100644 --- a/goal_oriented_elastoplasticity/elastoplastic.cc +++ b/goal_oriented_elastoplasticity/elastoplastic.cc @@ -4066,10 +4066,9 @@ namespace ElastoPlastic << dof_handler.n_dofs() << std::endl; - locally_owned_dofs = dof_handler.locally_owned_dofs(); - locally_relevant_dofs.clear(); - DoFTools::extract_locally_relevant_dofs(dof_handler, - locally_relevant_dofs); + locally_owned_dofs = dof_handler.locally_owned_dofs(); + locally_relevant_dofs = + DoFTools::extract_locally_relevant_dofs(dof_handler); } /* setup hanging nodes and Dirichlet constraints */ diff --git a/time_dependent_navier_stokes/time_dependent_navier_stokes.cc b/time_dependent_navier_stokes/time_dependent_navier_stokes.cc index 060f42c..0a1f756 100644 --- a/time_dependent_navier_stokes/time_dependent_navier_stokes.cc +++ b/time_dependent_navier_stokes/time_dependent_navier_stokes.cc @@ -653,7 +653,7 @@ namespace fluid owned_partitioning[0] = dof_handler.locally_owned_dofs().get_view(0, dof_u); owned_partitioning[1] = dof_handler.locally_owned_dofs().get_view(dof_u, dof_u + dof_p); - DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs); + locally_relevant_dofs = DoFTools::extract_locally_relevant_dofs(dof_handler); relevant_partitioning.resize(2); relevant_partitioning[0] = locally_relevant_dofs.get_view(0, dof_u); relevant_partitioning[1] = diff --git a/two_phase_flow/LevelSetSolver.cc b/two_phase_flow/LevelSetSolver.cc index feddd4b..7aa2d8a 100644 --- a/two_phase_flow/LevelSetSolver.cc +++ b/two_phase_flow/LevelSetSolver.cc @@ -424,12 +424,12 @@ void LevelSetSolver::setup() //////////////////////////// // setup system LS dof_handler_LS.distribute_dofs (fe_LS); - locally_owned_dofs_LS = dof_handler_LS.locally_owned_dofs (); - DoFTools::extract_locally_relevant_dofs (dof_handler_LS,locally_relevant_dofs_LS); + locally_owned_dofs_LS = dof_handler_LS.locally_owned_dofs (); + locally_relevant_dofs_LS = DoFTools::extract_locally_relevant_dofs (dof_handler_LS); // setup system U dof_handler_U.distribute_dofs (fe_U); - locally_owned_dofs_U = dof_handler_U.locally_owned_dofs (); - DoFTools::extract_locally_relevant_dofs (dof_handler_U,locally_relevant_dofs_U); + locally_owned_dofs_U = dof_handler_U.locally_owned_dofs (); + locally_relevant_dofs_U = DoFTools::extract_locally_relevant_dofs (dof_handler_U); ////////////////////// // INIT CONSTRAINTS // ////////////////////// diff --git a/two_phase_flow/MultiPhase.cc b/two_phase_flow/MultiPhase.cc index 9c2d8a7..6a07370 100644 --- a/two_phase_flow/MultiPhase.cc +++ b/two_phase_flow/MultiPhase.cc @@ -187,19 +187,16 @@ void MultiPhase::setup() { // setup system LS dof_handler_LS.distribute_dofs (fe_LS); - locally_owned_dofs_LS = dof_handler_LS.locally_owned_dofs (); - DoFTools::extract_locally_relevant_dofs (dof_handler_LS, - locally_relevant_dofs_LS); + locally_owned_dofs_LS = dof_handler_LS.locally_owned_dofs (); + locally_relevant_dofs_LS = DoFTools::extract_locally_relevant_dofs (dof_handler_LS); // setup system U dof_handler_U.distribute_dofs (fe_U); - locally_owned_dofs_U = dof_handler_U.locally_owned_dofs (); - DoFTools::extract_locally_relevant_dofs (dof_handler_U, - locally_relevant_dofs_U); + locally_owned_dofs_U = dof_handler_U.locally_owned_dofs (); + locally_relevant_dofs_U = DoFTools::extract_locally_relevant_dofs (dof_handler_U); // setup system P // dof_handler_P.distribute_dofs (fe_P); - locally_owned_dofs_P = dof_handler_P.locally_owned_dofs (); - DoFTools::extract_locally_relevant_dofs (dof_handler_P, - locally_relevant_dofs_P); + locally_owned_dofs_P = dof_handler_P.locally_owned_dofs (); + locally_relevant_dofs_P = DoFTools::extract_locally_relevant_dofs (dof_handler_P); // init vectors for phi locally_relevant_solution_phi.reinit(locally_owned_dofs_LS,locally_relevant_dofs_LS,mpi_communicator); locally_relevant_solution_phi = 0; diff --git a/two_phase_flow/NavierStokesSolver.cc b/two_phase_flow/NavierStokesSolver.cc index 7422847..628b160 100644 --- a/two_phase_flow/NavierStokesSolver.cc +++ b/two_phase_flow/NavierStokesSolver.cc @@ -472,16 +472,16 @@ void NavierStokesSolver::setup_DOF() degree_MAX=std::max(degree_LS,degree_U); // setup system LS dof_handler_LS.distribute_dofs(fe_LS); - locally_owned_dofs_LS=dof_handler_LS.locally_owned_dofs(); - DoFTools::extract_locally_relevant_dofs(dof_handler_LS,locally_relevant_dofs_LS); + locally_owned_dofs_LS = dof_handler_LS.locally_owned_dofs(); + locally_relevant_dofs_LS = DoFTools::extract_locally_relevant_dofs(dof_handler_LS); // setup system U dof_handler_U.distribute_dofs(fe_U); - locally_owned_dofs_U=dof_handler_U.locally_owned_dofs(); - DoFTools::extract_locally_relevant_dofs(dof_handler_U,locally_relevant_dofs_U); - // setup system P // + locally_owned_dofs_U = dof_handler_U.locally_owned_dofs(); + locally_relevant_dofs_U = DoFTools::extract_locally_relevant_dofs(dof_handler_U); + // setup system P dof_handler_P.distribute_dofs(fe_P); - locally_owned_dofs_P=dof_handler_P.locally_owned_dofs(); - DoFTools::extract_locally_relevant_dofs(dof_handler_P,locally_relevant_dofs_P); + locally_owned_dofs_P = dof_handler_P.locally_owned_dofs(); + locally_relevant_dofs_P = DoFTools::extract_locally_relevant_dofs(dof_handler_P); } template diff --git a/two_phase_flow/TestLevelSet.cc b/two_phase_flow/TestLevelSet.cc index 541a56f..0f5146a 100644 --- a/two_phase_flow/TestLevelSet.cc +++ b/two_phase_flow/TestLevelSet.cc @@ -285,19 +285,16 @@ void TestLevelSet::setup() degree = std::max(degree_LS,degree_U); // setup system LS dof_handler_LS.distribute_dofs (fe_LS); - locally_owned_dofs_LS = dof_handler_LS.locally_owned_dofs (); - DoFTools::extract_locally_relevant_dofs (dof_handler_LS, - locally_relevant_dofs_LS); + locally_owned_dofs_LS = dof_handler_LS.locally_owned_dofs (); + locally_relevant_dofs_LS = DoFTools::extract_locally_relevant_dofs (dof_handler_LS); // setup system U dof_handler_U.distribute_dofs (fe_U); - locally_owned_dofs_U = dof_handler_U.locally_owned_dofs (); - DoFTools::extract_locally_relevant_dofs (dof_handler_U, - locally_relevant_dofs_U); + locally_owned_dofs_U = dof_handler_U.locally_owned_dofs (); + locally_relevant_dofs_U = DoFTools::extract_locally_relevant_dofs (dof_handler_U); // setup system U for disp field dof_handler_U_disp_field.distribute_dofs (fe_U_disp_field); - locally_owned_dofs_U_disp_field = dof_handler_U_disp_field.locally_owned_dofs (); - DoFTools::extract_locally_relevant_dofs (dof_handler_U_disp_field, - locally_relevant_dofs_U_disp_field); + locally_owned_dofs_U_disp_field = dof_handler_U_disp_field.locally_owned_dofs (); + locally_relevant_dofs_U_disp_field = DoFTools::extract_locally_relevant_dofs (dof_handler_U_disp_field); // init vectors for phi locally_relevant_solution_phi.reinit(locally_owned_dofs_LS, locally_relevant_dofs_LS, diff --git a/two_phase_flow/TestNavierStokes.cc b/two_phase_flow/TestNavierStokes.cc index 0e074ac..e7e9720 100644 --- a/two_phase_flow/TestNavierStokes.cc +++ b/two_phase_flow/TestNavierStokes.cc @@ -170,19 +170,16 @@ void TestNavierStokes::setup() { // setup system LS dof_handler_LS.distribute_dofs (fe_LS); - locally_owned_dofs_LS = dof_handler_LS.locally_owned_dofs (); - DoFTools::extract_locally_relevant_dofs (dof_handler_LS, - locally_relevant_dofs_LS); + locally_owned_dofs_LS = dof_handler_LS.locally_owned_dofs (); + locally_relevant_dofs_LS = DoFTools::extract_locally_relevant_dofs (dof_handler_LS); // setup system U dof_handler_U.distribute_dofs (fe_U); - locally_owned_dofs_U = dof_handler_U.locally_owned_dofs (); - DoFTools::extract_locally_relevant_dofs (dof_handler_U, - locally_relevant_dofs_U); + locally_owned_dofs_U = dof_handler_U.locally_owned_dofs (); + locally_relevant_dofs_U = DoFTools::extract_locally_relevant_dofs (dof_handler_U); // setup system P // dof_handler_P.distribute_dofs (fe_P); - locally_owned_dofs_P = dof_handler_P.locally_owned_dofs (); - DoFTools::extract_locally_relevant_dofs (dof_handler_P, - locally_relevant_dofs_P); + locally_owned_dofs_P = dof_handler_P.locally_owned_dofs (); + locally_relevant_dofs_P = DoFTools::extract_locally_relevant_dofs (dof_handler_P); init_constraints(); // init vectors for rho locally_relevant_solution_rho.reinit (locally_owned_dofs_LS,locally_relevant_dofs_LS,mpi_communicator); -- 2.39.5