]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Convert NOX tests to not return zero to indicate success.
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 9 May 2023 16:22:11 +0000 (10:22 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 9 May 2023 18:31:36 +0000 (12:31 -0600)
tests/trilinos/nox_solver_01.cc
tests/trilinos/nox_solver_02.cc
tests/trilinos/nox_solver_03.cc
tests/trilinos/step-77-with-nox.cc

index ab26231f83964616d12f0b78076f69fc590d7168..df27d3d13e58567505ca459c16f78fda3dbac4ba 100644 (file)
@@ -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
index c8365508aedf398dd5eae7b5dfa6f05b3722b1cd..07f850876eaa40f85af261bd8ffd775fcb130600 100644 (file)
@@ -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
index a9b381ec17b12343c774f84d0151ca44aa9c881a..23b51285414839125f60a994775caf8999acfede 100644 (file)
@@ -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<double> J(2, 2);
   FullMatrix<double> 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
index cfc82d543667224e037e5e429adbb508b4056832..e73063743152dba39c18f9ade4b5cf5854de7a55 100644 (file)
@@ -430,23 +430,17 @@ namespace Step77
             [&](const Vector<double> &evaluation_point,
                 Vector<double> &      residual) {
               compute_residual(evaluation_point, residual);
-
-              return 0;
             };
 
           nonlinear_solver.setup_jacobian =
             [&](const Vector<double> &current_u) {
               compute_and_factorize_jacobian(current_u);
-
-              return 0;
             };
 
           nonlinear_solver.solve_with_jacobian = [&](const Vector<double> &rhs,
                                                      Vector<double> &      dst,
                                                      const double tolerance) {
             this->solve(rhs, dst, tolerance);
-
-            return 0;
           };
 
           nonlinear_solver.solve(current_solution);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.