From 9d37c0d61f0b08101de7603998c75d8bdb5911f3 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 24 May 2023 10:18:30 -0600 Subject: [PATCH] Adjust tests. --- tests/quick_tests/sundials-ida.cc | 16 ++++++---------- tests/sundials/ida_01.cc | 24 ++++++++---------------- tests/sundials/ida_02.cc | 25 +++++++++---------------- 3 files changed, 23 insertions(+), 42 deletions(-) diff --git a/tests/quick_tests/sundials-ida.cc b/tests/quick_tests/sundials-ida.cc index 6cd984410e..e726923417 100644 --- a/tests/quick_tests/sundials-ida.cc +++ b/tests/quick_tests/sundials-ida.cc @@ -76,16 +76,15 @@ public: time_stepper.residual = [&](const double /*t*/, const VectorType &y, const VectorType &y_dot, - VectorType & res) -> int { + VectorType & res) { res = y_dot; A.vmult_add(res, y); - return 0; }; time_stepper.setup_jacobian = [&](const double, const VectorType &, const VectorType &, - const double alpha) -> int { + const double alpha) { A(0, 1) = -1.0; A(1, 0) = kappa * kappa; @@ -95,21 +94,18 @@ public: J(1, 1) = alpha; Jinv.invert(J); - return 0; }; time_stepper.solve_with_jacobian = - [&](const VectorType &rhs, VectorType &dst, const double /*tol*/) -> int { - Jinv.vmult(dst, rhs); - return 0; - }; + [&](const VectorType &rhs, VectorType &dst, const double /*tol*/) { + Jinv.vmult(dst, rhs); + }; time_stepper.output_step = [&](const double /*t*/, const VectorType & /*sol*/, const VectorType & /*sol_dot*/, - const unsigned int /*step_number*/) -> int { + const unsigned int /*step_number*/) { // In this test, don't output anything. - return 0; }; time_stepper.solver_should_restart = diff --git a/tests/sundials/ida_01.cc b/tests/sundials/ida_01.cc index d83ae344e9..6d071ab0de 100644 --- a/tests/sundials/ida_01.cc +++ b/tests/sundials/ida_01.cc @@ -76,16 +76,15 @@ public: time_stepper.residual = [&](const double t, const VectorType &y, const VectorType &y_dot, - VectorType & res) -> int { + VectorType & res) { res = y_dot; A.vmult_add(res, y); - return 0; }; time_stepper.setup_jacobian = [&](const double, const VectorType &, const VectorType &, - const double alpha) -> int { + const double alpha) { A(0, 1) = -1.0; A(1, 0) = kappa * kappa; @@ -95,30 +94,24 @@ public: J(1, 1) = alpha; Jinv.invert(J); - return 0; }; // Used only in ver < 4.0.0 - time_stepper.solve_jacobian_system = [&](const VectorType &src, - VectorType & dst) -> int { - Jinv.vmult(dst, src); - return 0; - }; + time_stepper.solve_jacobian_system = + [&](const VectorType &src, VectorType &dst) { Jinv.vmult(dst, src); }; // Used in ver >= 4.0.0 time_stepper.solve_with_jacobian = - [&](const VectorType &src, VectorType &dst, const double) -> int { - Jinv.vmult(dst, src); - return 0; - }; + [&](const VectorType &src, VectorType &dst, const double) { + Jinv.vmult(dst, src); + }; time_stepper.output_step = [&](const double t, const VectorType & sol, const VectorType & sol_dot, - const unsigned int step_number) -> int { + const unsigned int step_number) { deallog << t << ' ' << sol[0] << ' ' << sol[1] << ' ' << sol_dot[0] << ' ' << sol_dot[1] << std::endl; - return 0; }; } @@ -161,5 +154,4 @@ main() HarmonicOscillator ode(1.0, data); ode.run(); - return 0; } diff --git a/tests/sundials/ida_02.cc b/tests/sundials/ida_02.cc index e6c8359670..8277677886 100644 --- a/tests/sundials/ida_02.cc +++ b/tests/sundials/ida_02.cc @@ -79,16 +79,15 @@ public: time_stepper.residual = [&](const double t, const VectorType &y, const VectorType &y_dot, - VectorType & res) -> int { + VectorType & res) { res = y_dot; A.vmult_add(res, y); - return 0; }; time_stepper.setup_jacobian = [&](const double, const VectorType &, const VectorType &, - const double alpha) -> int { + const double alpha) { A(0, 1) = -1.0; A(1, 0) = kappa * kappa; @@ -96,26 +95,21 @@ public: J(0, 0) = alpha; J(1, 1) = alpha; - - return 0; }; - time_stepper.solve_with_jacobian = [&](const VectorType &src, - VectorType & dst, - const double tolerance) -> int { - SolverControl solver_control(1000, tolerance, false, false); - SolverGMRES> solver(solver_control); - solver.solve(J, dst, src, PreconditionIdentity()); - return 0; - }; + time_stepper.solve_with_jacobian = + [&](const VectorType &src, VectorType &dst, const double tolerance) { + SolverControl solver_control(1000, tolerance, false, false); + SolverGMRES> solver(solver_control); + solver.solve(J, dst, src, PreconditionIdentity()); + }; time_stepper.output_step = [&](const double t, const VectorType & sol, const VectorType & sol_dot, - const unsigned int step_number) -> int { + const unsigned int step_number) { deallog << t << ' ' << sol[0] << ' ' << sol[1] << ' ' << sol_dot[0] << ' ' << sol_dot[1] << std::endl; - return 0; }; } @@ -158,5 +152,4 @@ main() HarmonicOscillator ode(1.0, data); ode.run(); - return 0; } -- 2.39.5