Skip to content

Commit 0a1784a

Browse files
authored
Merge pull request #6616 from gassmoeller/fix_deprecation_warnings
Fix deprecation warnings with deal.II >9.7
2 parents 1078451 + 2fe184e commit 0a1784a

File tree

5 files changed

+69
-15
lines changed

5 files changed

+69
-15
lines changed

source/mesh_deformation/interface.cc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,14 +914,22 @@ namespace aspect
914914
mesh_matrix.compress (VectorOperation::add);
915915

916916
// Make the AMG preconditioner
917+
#if !DEAL_II_VERSION_GTE(9,7,0)
917918
std::vector<std::vector<bool>> constant_modes;
918919
DoFTools::extract_constant_modes (mesh_deformation_dof_handler,
919920
ComponentMask(dim, true),
920921
constant_modes);
922+
#endif
923+
921924
// TODO: think about keeping object between time steps
922925
LinearAlgebra::PreconditionAMG preconditioner_stiffness;
923926
LinearAlgebra::PreconditionAMG::AdditionalData Amg_data;
927+
#if !DEAL_II_VERSION_GTE(9,7,0)
924928
Amg_data.constant_modes = constant_modes;
929+
#else
930+
Amg_data.constant_modes = DoFTools::extract_constant_modes (mesh_deformation_dof_handler,
931+
ComponentMask(dim, true));
932+
#endif
925933
Amg_data.elliptic = true;
926934
Amg_data.higher_order_elements = false;
927935
Amg_data.smoother_sweeps = 2;
@@ -1514,7 +1522,7 @@ namespace aspect
15141522
// to transfer to the MG levels below. The conversion is done by
15151523
// going through a ReadWriteVector.
15161524
dealii::LinearAlgebra::distributed::Vector<double> displacements(mesh_deformation_dof_handler.locally_owned_dofs(),
1517-
this->get_triangulation().get_communicator());
1525+
this->get_mpi_communicator());
15181526
dealii::LinearAlgebra::ReadWriteVector<double> rwv;
15191527
rwv.reinit(mesh_displacements);
15201528
displacements.import_elements(rwv, VectorOperation::insert);

source/simulator/assembly.cc

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -476,10 +476,12 @@ namespace aspect
476476

477477
// then extract the other information necessary to build the
478478
// AMG preconditioners for the A and M blocks
479+
#if !DEAL_II_VERSION_GTE(9,7,0)
479480
std::vector<std::vector<bool>> constant_modes;
480481
DoFTools::extract_constant_modes (dof_handler,
481482
introspection.component_masks.velocities,
482483
constant_modes);
484+
#endif
483485

484486
// When we solve with melt migration, the pressure block contains
485487
// both pressures and contains an elliptic operator, so it makes
@@ -492,7 +494,12 @@ namespace aspect
492494
Amg_preconditioner = std::make_unique<LinearAlgebra::PreconditionAMG>();
493495

494496
LinearAlgebra::PreconditionAMG::AdditionalData Amg_data;
497+
#if !DEAL_II_VERSION_GTE(9,7,0)
495498
Amg_data.constant_modes = constant_modes;
499+
#else
500+
Amg_data.constant_modes = DoFTools::extract_constant_modes (dof_handler,
501+
introspection.component_masks.velocities);
502+
#endif
496503
Amg_data.elliptic = true;
497504
Amg_data.higher_order_elements = true;
498505

@@ -540,21 +547,27 @@ namespace aspect
540547
else
541548
{
542549
// in the case of melt transport we have an AMG preconditioner for the lower right block.
543-
LinearAlgebra::PreconditionAMG::AdditionalData Amg_data;
544-
std::vector<std::vector<bool>> constant_modes;
545550
dealii::ComponentMask cm_pressure = introspection.component_masks.pressure;
546551
if (parameters.include_melt_transport)
547552
cm_pressure = cm_pressure | introspection.variable("compaction pressure").component_mask;
548-
DoFTools::extract_constant_modes (dof_handler,
549-
cm_pressure,
550-
constant_modes);
551553

554+
LinearAlgebra::PreconditionAMG::AdditionalData Amg_data;
552555
Amg_data.elliptic = true;
553556
Amg_data.higher_order_elements = false;
554557

555558
Amg_data.smoother_sweeps = 2;
556559
Amg_data.coarse_type = "symmetric Gauss-Seidel";
560+
561+
#if !DEAL_II_VERSION_GTE(9,7,0)
562+
std::vector<std::vector<bool>> constant_modes;
563+
DoFTools::extract_constant_modes (dof_handler,
564+
cm_pressure,
565+
constant_modes);
557566
Amg_data.constant_modes = constant_modes;
567+
#else
568+
Amg_data.constant_modes = DoFTools::extract_constant_modes (dof_handler,
569+
cm_pressure);
570+
#endif
558571

559572
LinearAlgebra::PreconditionAMG *Mp_preconditioner_AMG
560573
= dynamic_cast<LinearAlgebra::PreconditionAMG *> (Mp_preconditioner.get());

source/simulator/checkpoint_restart.cc

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@
2727
#include <deal.II/base/mpi.h>
2828
#include <deal.II/base/utilities.h>
2929
#include <deal.II/grid/grid_tools.h>
30+
31+
#if DEAL_II_VERSION_GTE(9,7,0)
32+
#include <deal.II/numerics/solution_transfer.h>
33+
#else
3034
#include <deal.II/distributed/solution_transfer.h>
35+
#endif
36+
3137
#include <deal.II/fe/mapping_q_cache.h>
3238

3339
#include <cstring>
@@ -269,7 +275,11 @@ namespace aspect
269275
if (parameters.mesh_deformation_enabled)
270276
x_system.push_back( &mesh_deformation->mesh_velocity );
271277

272-
parallel::distributed::SolutionTransfer<dim, LinearAlgebra::BlockVector>
278+
#if !DEAL_II_VERSION_GTE(9,7,0)
279+
using namespace dealii::parallel::distributed;
280+
#endif
281+
282+
SolutionTransfer<dim, LinearAlgebra::BlockVector>
273283
system_trans (dof_handler);
274284

275285
system_trans.prepare_for_serialization (x_system);
@@ -278,14 +288,14 @@ namespace aspect
278288
// If we are deforming the mesh, also serialize the mesh vertices vector, which
279289
// uses its own dof handler
280290
std::vector<const LinearAlgebra::Vector *> x_fs_system;
281-
std::unique_ptr<parallel::distributed::SolutionTransfer<dim,LinearAlgebra::Vector>> mesh_deformation_trans;
291+
std::unique_ptr<SolutionTransfer<dim,LinearAlgebra::Vector>> mesh_deformation_trans;
282292
if (parameters.mesh_deformation_enabled)
283293
{
284294
x_fs_system.push_back (&mesh_deformation->mesh_displacements);
285295
x_fs_system.push_back (&mesh_deformation->initial_topography);
286296

287297
mesh_deformation_trans
288-
= std::make_unique<parallel::distributed::SolutionTransfer<dim,LinearAlgebra::Vector>>
298+
= std::make_unique<SolutionTransfer<dim,LinearAlgebra::Vector>>
289299
(mesh_deformation->mesh_deformation_dof_handler);
290300

291301
mesh_deformation_trans->prepare_for_serialization(x_fs_system);
@@ -522,7 +532,10 @@ namespace aspect
522532
if (parameters.mesh_deformation_enabled)
523533
x_system.push_back(&distributed_mesh_velocity);
524534

525-
parallel::distributed::SolutionTransfer<dim, LinearAlgebra::BlockVector>
535+
#if !DEAL_II_VERSION_GTE(9,7,0)
536+
using namespace dealii::parallel::distributed;
537+
#endif
538+
SolutionTransfer<dim, LinearAlgebra::BlockVector>
526539
system_trans (dof_handler);
527540

528541
system_trans.deserialize (x_system);
@@ -537,7 +550,7 @@ namespace aspect
537550
mesh_deformation->mesh_velocity = distributed_mesh_velocity;
538551

539552
// deserialize and copy the vectors using the mesh deformation dof handler
540-
parallel::distributed::SolutionTransfer<dim, LinearAlgebra::Vector> mesh_deformation_trans( mesh_deformation->mesh_deformation_dof_handler );
553+
SolutionTransfer<dim, LinearAlgebra::Vector> mesh_deformation_trans( mesh_deformation->mesh_deformation_dof_handler );
541554
LinearAlgebra::Vector distributed_mesh_displacements( mesh_deformation->mesh_locally_owned,
542555
mpi_communicator );
543556
LinearAlgebra::Vector distributed_initial_topography( mesh_deformation->mesh_locally_owned,

source/simulator/core.cc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@
6060
#include <deal.II/numerics/derivative_approximation.h>
6161
#include <deal.II/numerics/vector_tools.h>
6262

63+
#if DEAL_II_VERSION_GTE(9,7,0)
64+
#include <deal.II/numerics/solution_transfer.h>
65+
#else
6366
#include <deal.II/distributed/solution_transfer.h>
67+
#endif
6468
#include <deal.II/distributed/grid_refinement.h>
6569

6670
#include <fstream>
@@ -1647,11 +1651,21 @@ namespace aspect
16471651
void
16481652
Simulator<dim>::refine_mesh (const unsigned int max_grid_level)
16491653
{
1654+
1655+
#if !DEAL_II_VERSION_GTE(9,7,0)
16501656
parallel::distributed::SolutionTransfer<dim,LinearAlgebra::BlockVector>
16511657
system_trans(dof_handler);
16521658

16531659
std::unique_ptr<parallel::distributed::SolutionTransfer<dim,LinearAlgebra::Vector>>
16541660
mesh_deformation_trans;
1661+
#else
1662+
SolutionTransfer<dim,LinearAlgebra::BlockVector>
1663+
system_trans(dof_handler);
1664+
1665+
std::unique_ptr<SolutionTransfer<dim,LinearAlgebra::Vector>>
1666+
mesh_deformation_trans;
1667+
#endif
1668+
16551669

16561670
{
16571671
TimerOutput::Scope timer (computing_timer, "Refine mesh structure, part 1");
@@ -1721,9 +1735,15 @@ namespace aspect
17211735
x_fs_system.push_back (&mesh_deformation->mesh_displacements);
17221736
x_fs_system.push_back (&mesh_deformation->old_mesh_displacements);
17231737
x_fs_system.push_back (&mesh_deformation->initial_topography);
1738+
#if !DEAL_II_VERSION_GTE(9,7,0)
17241739
mesh_deformation_trans
17251740
= std::make_unique<parallel::distributed::SolutionTransfer<dim,LinearAlgebra::Vector>>
17261741
(mesh_deformation->mesh_deformation_dof_handler);
1742+
#else
1743+
mesh_deformation_trans
1744+
= std::make_unique<SolutionTransfer<dim,LinearAlgebra::Vector>>
1745+
(mesh_deformation->mesh_deformation_dof_handler);
1746+
#endif
17271747
}
17281748

17291749

source/simulator/solver/stokes_matrix_free_local_smoothing.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ namespace aspect
172172
void StokesMatrixFreeHandlerLocalSmoothingImplementation<dim, velocity_degree>::evaluate_material_model ()
173173
{
174174
dealii::LinearAlgebra::distributed::Vector<double> active_viscosity_vector(dof_handler_projection.locally_owned_dofs(),
175-
this->get_triangulation().get_communicator());
175+
this->get_mpi_communicator());
176176

177177
const Quadrature<dim> &quadrature_formula = this->introspection().quadratures.velocities;
178178

@@ -279,8 +279,8 @@ namespace aspect
279279
active_viscosity_vector.compress(VectorOperation::insert);
280280
}
281281

282-
minimum_viscosity = dealii::Utilities::MPI::min(minimum_viscosity_local, this->get_triangulation().get_communicator());
283-
maximum_viscosity = dealii::Utilities::MPI::max(maximum_viscosity_local, this->get_triangulation().get_communicator());
282+
minimum_viscosity = dealii::Utilities::MPI::min(minimum_viscosity_local, this->get_mpi_communicator());
283+
maximum_viscosity = dealii::Utilities::MPI::max(maximum_viscosity_local, this->get_mpi_communicator());
284284

285285
FEValues<dim> fe_values_projection (this->get_mapping(),
286286
fe_projection,
@@ -1566,7 +1566,7 @@ namespace aspect
15661566
}
15671567
}
15681568

1569-
have_periodic_hanging_nodes = (dealii::Utilities::MPI::max(have_periodic_hanging_nodes ? 1 : 0, this->get_triangulation().get_communicator())) == 1;
1569+
have_periodic_hanging_nodes = (dealii::Utilities::MPI::max(have_periodic_hanging_nodes ? 1 : 0, this->get_mpi_communicator())) == 1;
15701570
AssertThrow(have_periodic_hanging_nodes==false, ExcNotImplemented());
15711571
}
15721572

0 commit comments

Comments
 (0)