]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify code somewhat.
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 2 May 2023 23:54:11 +0000 (17:54 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 4 May 2023 23:43:06 +0000 (17:43 -0600)
source/sundials/kinsol.cc

index 13a25fc3bb09742309576a78740dd8ca18466b4f..dc57fc7a2321d6ca94ec344a0b6a2ec622fe1363 100644 (file)
@@ -217,14 +217,10 @@ namespace SUNDIALS
 
       internal::copy(*src_yy, yy);
 
-      int err = 0;
-      if (solver.residual)
-        err = call_and_possibly_capture_exception(solver.residual,
-                                                  solver.pending_exception,
-                                                  *src_yy,
-                                                  *dst_FF);
-      else
-        Assert(false, ExcInternalError());
+      Assert(solver.residual, ExcInternalError());
+
+      const int err = call_and_possibly_capture_exception(
+        solver.residual, solver.pending_exception, *src_yy, *dst_FF);
 
       internal::copy(FF, *dst_FF);
 
@@ -249,14 +245,10 @@ namespace SUNDIALS
 
       internal::copy(*src_yy, yy);
 
-      int err = 0;
-      if (solver.iteration_function)
-        err = call_and_possibly_capture_exception(solver.iteration_function,
-                                                  solver.pending_exception,
-                                                  *src_yy,
-                                                  *dst_FF);
-      else
-        Assert(false, ExcInternalError());
+      Assert(solver.iteration_function, ExcInternalError());
+
+      const int err = call_and_possibly_capture_exception(
+        solver.iteration_function, solver.pending_exception, *src_yy, *dst_FF);
 
       internal::copy(FF, *dst_FF);
 

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.