From 5b6d8cf993194ae084690976a4d569a930c69318 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 9 May 2023 10:22:11 -0600 Subject: [PATCH] Convert NOX tests to not return zero to indicate success. --- tests/trilinos/nox_solver_01.cc | 4 ---- tests/trilinos/nox_solver_02.cc | 4 ---- tests/trilinos/nox_solver_03.cc | 12 +++--------- tests/trilinos/step-77-with-nox.cc | 6 ------ 4 files changed, 3 insertions(+), 23 deletions(-) diff --git a/tests/trilinos/nox_solver_01.cc b/tests/trilinos/nox_solver_01.cc index ab26231f83..df27d3d13e 100644 --- a/tests/trilinos/nox_solver_01.cc +++ b/tests/trilinos/nox_solver_01.cc @@ -94,25 +94,21 @@ main(int argc, char **argv) solver.residual = [](const auto &src, auto &dst) { // compute residual dst[0] = src[0] * src[0]; - return 0; }; solver.setup_jacobian = [&](const auto &src) { // compute Jacobian J = 2.0 * src[0]; - return 0; }; solver.apply_jacobian = [&](const auto &src, auto &dst) { // solve with Jacobian dst[0] = src[0] * J; - return 0; }; solver.solve_with_jacobian = [&](const auto &src, auto &dst, const auto) { // solve with Jacobian dst[0] = src[0] / J; - return 0; }; // initial guess diff --git a/tests/trilinos/nox_solver_02.cc b/tests/trilinos/nox_solver_02.cc index c8365508ae..07f850876e 100644 --- a/tests/trilinos/nox_solver_02.cc +++ b/tests/trilinos/nox_solver_02.cc @@ -77,26 +77,22 @@ main(int argc, char **argv) // compute residual deallog << "Evaluating residual at u=" << src[0] << std::endl; dst[0] = std::atan(src[0]) - 0.5; - return 0; }; solver.setup_jacobian = [&](const auto &src) { // compute Jacobian deallog << "Setting up Jacobian at u=" << src[0] << std::endl; J = 1. / (1 + src[0] * src[0]); - return 0; }; solver.apply_jacobian = [&](const auto &src, auto &dst) { // solve with Jacobian dst[0] = src[0] * J; - return 0; }; solver.solve_with_jacobian = [&](const auto &src, auto &dst, const auto) { // solve with Jacobian dst[0] = src[0] / J; - return 0; }; // initial guess diff --git a/tests/trilinos/nox_solver_03.cc b/tests/trilinos/nox_solver_03.cc index a9b381ec17..23b5128541 100644 --- a/tests/trilinos/nox_solver_03.cc +++ b/tests/trilinos/nox_solver_03.cc @@ -87,19 +87,18 @@ main(int argc, char **argv) non_linear_parameters); // ... helper functions - solver.residual = [](const VectorType &u, VectorType &F) -> int { + solver.residual = [](const VectorType &u, VectorType &F) { deallog << "Evaluating the solution at u=(" << u[0] << ',' << u[1] << ')' << std::endl; F(0) = std::cos(u[0] + u[1]) - 1 + 2 * u[0]; F(1) = std::sin(u[0] - u[1]) + 2 * u[1]; - return 0; }; FullMatrix J(2, 2); FullMatrix J_inverse(2, 2); - solver.setup_jacobian = [&J, &J_inverse](const VectorType &u) -> int { + solver.setup_jacobian = [&J, &J_inverse](const VectorType &u) { // We don't do any kind of set-up in this program, but we can at least // say that we're here deallog << "Setting up Jacobian system at u=(" << u[0] << ',' << u[1] << ')' @@ -111,24 +110,19 @@ main(int argc, char **argv) J(1, 1) = -std::cos(u[0] - u[1]) + 2; J_inverse.invert(J); - - return 0; }; solver.apply_jacobian = [&](const VectorType &src, VectorType &dst) { J.vmult(dst, src); - return -0; }; solver.solve_with_jacobian = [&J_inverse](const VectorType &rhs, VectorType & dst, - const double /*tolerance*/) -> int { + const double /*tolerance*/) { deallog << "Solving Jacobian system with rhs=(" << rhs[0] << ',' << rhs[1] << ')' << std::endl; J_inverse.vmult(dst, rhs); - - return 0; }; // initial guess diff --git a/tests/trilinos/step-77-with-nox.cc b/tests/trilinos/step-77-with-nox.cc index cfc82d5436..e730637431 100644 --- a/tests/trilinos/step-77-with-nox.cc +++ b/tests/trilinos/step-77-with-nox.cc @@ -430,23 +430,17 @@ namespace Step77 [&](const Vector &evaluation_point, Vector & residual) { compute_residual(evaluation_point, residual); - - return 0; }; nonlinear_solver.setup_jacobian = [&](const Vector ¤t_u) { compute_and_factorize_jacobian(current_u); - - return 0; }; nonlinear_solver.solve_with_jacobian = [&](const Vector &rhs, Vector & dst, const double tolerance) { this->solve(rhs, dst, tolerance); - - return 0; }; nonlinear_solver.solve(current_solution); -- 2.39.5