From 3f378ae415bbeca9118911dad9fa45fdd7c41fce Mon Sep 17 00:00:00 2001 From: Nicolas Barnafi Date: Fri, 9 Sep 2022 16:31:23 +0200 Subject: [PATCH] Added check for corner selection in BDDC, as it it a more recent feature --- source/lac/petsc_precondition.cc | 6 ++++++ tests/petsc/bddc.cc | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/source/lac/petsc_precondition.cc b/source/lac/petsc_precondition.cc index 8c72ccd42e..1b6108dd92 100644 --- a/source/lac/petsc_precondition.cc +++ b/source/lac/petsc_precondition.cc @@ -926,6 +926,7 @@ namespace PETScWrappers else set_option_value("-pc_bddc_symmetric", "false"); if (additional_data.coords.size() > 0) +# if DEAL_II_PETSC_VERSION_GTE(3, 9, 0) { set_option_value("-pc_bddc_corner_selection", "true"); // Convert coords vector to PETSc data array @@ -949,6 +950,11 @@ namespace PETScWrappers ierr = PCSetCoordinates(pc, 0, 0, NULL); AssertThrow(ierr == 0, ExcPETScError(ierr)); } +# else + { + AssertThrow(false, ExcMessage("Corner selection in BDDC is only available with PETSc 3.9.0 or newer"); + } +# endif ierr = PCSetFromOptions(pc); diff --git a/tests/petsc/bddc.cc b/tests/petsc/bddc.cc index 1dfc9fb76e..a627dc1daa 100644 --- a/tests/petsc/bddc.cc +++ b/tests/petsc/bddc.cc @@ -160,7 +160,8 @@ main(int argc, char *argv[]) PETScWrappers::PreconditionBDDC<2> preconditioner; PETScWrappers::PreconditionBDDC<2>::AdditionalData data; - // Now we setup the dof coordinates +// Now we setup the dof coordinates if a sufficiently new PETSc is used +#if DEAL_II_PETSC_VERSION_GTE(3, 9, 0) std::map> dof_2_point; DoFTools::map_dofs_to_support_points(MappingQ1<2>(), dof_handler, @@ -170,6 +171,9 @@ main(int argc, char *argv[]) { coords[d2p.first] = d2p.second; } + data.coords = coords; +#endif + data.use_vertices = true; preconditioner.initialize(system_matrix, data); check_solver_within_range(solver.solve(system_matrix, -- 2.39.5