From efe83d062c4ca1f426711e481b3efad45f86e852 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 16 Nov 2022 14:58:27 -0700 Subject: [PATCH] Simplify code. --- tests/slepc/step-36_parallel.cc | 8 ++------ tests/slepc/step-36_parallel_02.cc | 8 ++------ tests/slepc/step-36_parallel_03.cc | 8 ++------ 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/tests/slepc/step-36_parallel.cc b/tests/slepc/step-36_parallel.cc index 0b3bb37dd8..61cac41df3 100644 --- a/tests/slepc/step-36_parallel.cc +++ b/tests/slepc/step-36_parallel.cc @@ -217,7 +217,7 @@ test(std::string solver_name, std::string preconditioner_name) // test SLEPc by { - PETScWrappers::PreconditionBase *preconditioner; + PETScWrappers::PreconditionBase *preconditioner = nullptr; dealii::deallog << preconditioner_name << std::endl; if (preconditioner_name == "Jacobi") @@ -240,11 +240,7 @@ test(std::string solver_name, std::string preconditioner_name) } else { - AssertThrow(false, ExcMessage("not supported preconditioner")); - - // make compiler happy - preconditioner = - new PETScWrappers::PreconditionJacobi(mpi_communicator); + AssertThrow(false, ExcMessage("Unsupported preconditioner")); } dealii::SolverControl linear_solver_control(dof_handler.n_dofs(), diff --git a/tests/slepc/step-36_parallel_02.cc b/tests/slepc/step-36_parallel_02.cc index 759eb7eb91..676c5144fe 100644 --- a/tests/slepc/step-36_parallel_02.cc +++ b/tests/slepc/step-36_parallel_02.cc @@ -217,7 +217,7 @@ test(std::string solver_name, std::string preconditioner_name) // test SLEPc by { - PETScWrappers::PreconditionBase *preconditioner; + PETScWrappers::PreconditionBase *preconditioner = nullptr; dealii::deallog << preconditioner_name << std::endl; if (preconditioner_name == "Jacobi") @@ -240,11 +240,7 @@ test(std::string solver_name, std::string preconditioner_name) } else { - AssertThrow(false, ExcMessage("not supported preconditioner")); - - // make compiler happy - preconditioner = - new PETScWrappers::PreconditionJacobi(mpi_communicator); + AssertThrow(false, ExcMessage("Unsupported preconditioner")); } dealii::SolverControl linear_solver_control(dof_handler.n_dofs(), diff --git a/tests/slepc/step-36_parallel_03.cc b/tests/slepc/step-36_parallel_03.cc index 88465c9e58..20cde958a2 100644 --- a/tests/slepc/step-36_parallel_03.cc +++ b/tests/slepc/step-36_parallel_03.cc @@ -217,7 +217,7 @@ test(std::string solver_name, std::string preconditioner_name) // test SLEPc by { - PETScWrappers::PreconditionBase *preconditioner; + PETScWrappers::PreconditionBase *preconditioner = nullptr; dealii::deallog << preconditioner_name << std::endl; if (preconditioner_name == "Jacobi") @@ -240,11 +240,7 @@ test(std::string solver_name, std::string preconditioner_name) } else { - AssertThrow(false, ExcMessage("not supported preconditioner")); - - // make compiler happy - preconditioner = - new PETScWrappers::PreconditionJacobi(mpi_communicator); + AssertThrow(false, ExcMessage("Unsupported preconditioner")); } dealii::SolverControl linear_solver_control(dof_handler.n_dofs(), -- 2.39.5