From 633d133fec63013ef5c40a0656d5ea2fef1e9765 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Wed, 11 Nov 2020 23:11:17 +0100 Subject: [PATCH] Deprecate MatrixFree::reinit() functions with default Mapping argument --- .../changes/incompatibilities/20201111Munch | 4 ++++ examples/step-37/step-37.cc | 16 +++++++------- examples/step-48/step-48.cc | 21 ++++++++++++------- examples/step-50/step-50.cc | 6 ++++-- examples/step-59/step-59.cc | 14 +++++++------ include/deal.II/matrix_free/matrix_free.h | 14 +++++++++---- 6 files changed, 49 insertions(+), 26 deletions(-) create mode 100644 doc/news/changes/incompatibilities/20201111Munch diff --git a/doc/news/changes/incompatibilities/20201111Munch b/doc/news/changes/incompatibilities/20201111Munch new file mode 100644 index 0000000000..8acc0cf06a --- /dev/null +++ b/doc/news/changes/incompatibilities/20201111Munch @@ -0,0 +1,4 @@ +Deprecated: All `MatrixFree::reinit()` functions without `Mapping` as argument +have been deprecated. Use the functions that explicit provide the Mapping instead. +
+(Peter Munch, 2020/11/11) diff --git a/examples/step-37/step-37.cc b/examples/step-37/step-37.cc index 7a99630058..663bd0f160 100644 --- a/examples/step-37/step-37.cc +++ b/examples/step-37/step-37.cc @@ -688,6 +688,8 @@ namespace Step37 FE_Q fe; DoFHandler dof_handler; + MappingQ1 mapping; + AffineConstraints constraints; using SystemMatrixType = LaplaceOperator; @@ -796,10 +798,8 @@ namespace Step37 constraints.clear(); constraints.reinit(locally_relevant_dofs); DoFTools::make_hanging_node_constraints(dof_handler, constraints); - VectorTools::interpolate_boundary_values(dof_handler, - 0, - Functions::ZeroFunction(), - constraints); + VectorTools::interpolate_boundary_values( + mapping, dof_handler, 0, Functions::ZeroFunction(), constraints); constraints.close(); setup_time += time.wall_time(); time_details << "Distribute DoFs & B.C. (CPU/wall) " << time.cpu_time() @@ -814,7 +814,8 @@ namespace Step37 (update_gradients | update_JxW_values | update_quadrature_points); std::shared_ptr> system_mf_storage( new MatrixFree()); - system_mf_storage->reinit(dof_handler, + system_mf_storage->reinit(mapping, + dof_handler, constraints, QGauss<1>(fe.degree + 1), additional_data); @@ -869,7 +870,8 @@ namespace Step37 additional_data.mg_level = level; std::shared_ptr> mg_mf_storage_level( new MatrixFree()); - mg_mf_storage_level->reinit(dof_handler, + mg_mf_storage_level->reinit(mapping, + dof_handler, level_constraints, QGauss<1>(fe.degree + 1), additional_data); @@ -1126,7 +1128,7 @@ namespace Step37 solution.update_ghost_values(); data_out.attach_dof_handler(dof_handler); data_out.add_data_vector(solution, "solution"); - data_out.build_patches(); + data_out.build_patches(mapping); DataOutBase::VtkFlags flags; flags.compression_level = DataOutBase::VtkFlags::best_speed; diff --git a/examples/step-48/step-48.cc b/examples/step-48/step-48.cc index 5006e9433a..7d455339a1 100644 --- a/examples/step-48/step-48.cc +++ b/examples/step-48/step-48.cc @@ -308,8 +308,11 @@ namespace Step48 #else Triangulation triangulation; #endif - FE_Q fe; - DoFHandler dof_handler; + FE_Q fe; + DoFHandler dof_handler; + + MappingQ1 mapping; + AffineConstraints constraints; IndexSet locally_relevant_dofs; @@ -434,7 +437,8 @@ namespace Step48 additional_data.tasks_parallel_scheme = MatrixFree::AdditionalData::TasksParallelScheme::partition_partition; - matrix_free_data.reinit(dof_handler, + matrix_free_data.reinit(mapping, + dof_handler, constraints, QGaussLobatto<1>(fe_degree + 1), additional_data); @@ -479,7 +483,8 @@ namespace Step48 Vector norm_per_cell(triangulation.n_active_cells()); solution.update_ghost_values(); - VectorTools::integrate_difference(dof_handler, + VectorTools::integrate_difference(mapping, + dof_handler, solution, Functions::ZeroFunction(), norm_per_cell, @@ -498,7 +503,7 @@ namespace Step48 data_out.attach_dof_handler(dof_handler); data_out.add_data_vector(solution, "solution"); - data_out.build_patches(); + data_out.build_patches(mapping); data_out.write_vtu_with_pvtu_record( "./", "solution", timestep_number, MPI_COMM_WORLD, 3); @@ -563,10 +568,12 @@ namespace Step48 // get later consumed by the SineGordonOperation::apply() function. Next, // an instance of the SineGordonOperation class based on // the finite element degree specified at the top of this file is set up. - VectorTools::interpolate(dof_handler, + VectorTools::interpolate(mapping, + dof_handler, InitialCondition(1, time), solution); - VectorTools::interpolate(dof_handler, + VectorTools::interpolate(mapping, + dof_handler, InitialCondition(1, time - time_step), old_solution); output_results(0); diff --git a/examples/step-50/step-50.cc b/examples/step-50/step-50.cc index a949ce81c9..349b8d93a9 100644 --- a/examples/step-50/step-50.cc +++ b/examples/step-50/step-50.cc @@ -513,7 +513,8 @@ void LaplaceProblem::setup_system() (update_gradients | update_JxW_values | update_quadrature_points); std::shared_ptr> mf_storage = std::make_shared>(); - mf_storage->reinit(dof_handler, + mf_storage->reinit(mapping, + dof_handler, constraints, QGauss<1>(degree + 1), additional_data); @@ -615,7 +616,8 @@ void LaplaceProblem::setup_multigrid() additional_data.mg_level = level; std::shared_ptr> mf_storage_level( new MatrixFree()); - mf_storage_level->reinit(dof_handler, + mf_storage_level->reinit(mapping, + dof_handler, level_constraints, QGauss<1>(degree + 1), additional_data); diff --git a/examples/step-59/step-59.cc b/examples/step-59/step-59.cc index 4df20ebcd7..8d03e3c96c 100644 --- a/examples/step-59/step-59.cc +++ b/examples/step-59/step-59.cc @@ -931,6 +931,8 @@ namespace Step59 FE_DGQHermite fe; DoFHandler dof_handler; + MappingQ1 mapping; + using SystemMatrixType = LaplaceOperator; SystemMatrixType system_matrix; @@ -1022,10 +1024,8 @@ namespace Step59 update_quadrature_points); const auto system_mf_storage = std::make_shared>(); - system_mf_storage->reinit(dof_handler, - dummy, - QGauss<1>(fe.degree + 1), - additional_data); + system_mf_storage->reinit( + mapping, dof_handler, dummy, QGauss<1>(fe.degree + 1), additional_data); system_matrix.initialize(system_mf_storage); } @@ -1054,7 +1054,8 @@ namespace Step59 additional_data.mg_level = level; const auto mg_mf_storage_level = std::make_shared>(); - mg_mf_storage_level->reinit(dof_handler, + mg_mf_storage_level->reinit(mapping, + dof_handler, dummy, QGauss<1>(fe.degree + 1), additional_data); @@ -1290,7 +1291,8 @@ namespace Step59 void LaplaceProblem::analyze_results() const { Vector error_per_cell(triangulation.n_active_cells()); - VectorTools::integrate_difference(dof_handler, + VectorTools::integrate_difference(mapping, + dof_handler, solution, Solution(), error_per_cell, diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index 7dadca5886..dce6e4b812 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -591,9 +591,11 @@ public: /** * Initializes the data structures. Same as above, but using a $Q_1$ * mapping. + * + * @deprecated Use the overload taking a Mapping object instead. */ template - void + DEAL_II_DEPRECATED void reinit(const DoFHandler & dof_handler, const AffineConstraints &constraint, const QuadratureType & quad, @@ -644,9 +646,11 @@ public: /** * Initializes the data structures. Same as above, but using a $Q_1$ * mapping. + * + * @deprecated Use the overload taking a Mapping object instead. */ template - void + DEAL_II_DEPRECATED void reinit(const std::vector *> & dof_handler, const std::vector *> &constraint, const std::vector & quad, @@ -658,7 +662,7 @@ public: * @deprecated Use the overload taking a DoFHandler object instead. */ template - void + DEAL_II_DEPRECATED void reinit(const std::vector *> & dof_handler_hp, const std::vector *> &constraint, const std::vector & quad, @@ -695,9 +699,11 @@ public: /** * Initializes the data structures. Same as above, but using a $Q_1$ * mapping. + * + * @deprecated Use the overload taking a Mapping object instead. */ template - void + DEAL_II_DEPRECATED void reinit(const std::vector *> & dof_handler, const std::vector *> &constraint, const QuadratureType & quad, -- 2.39.5