From: Wolfgang Bangerth Date: Tue, 2 May 2023 23:54:11 +0000 (-0600) Subject: Simplify code somewhat. X-Git-Tag: v9.5.0-rc1~247^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa7ec7993810155d72b83c6a584dd6a9d1a62fee;p=dealii.git Simplify code somewhat. --- diff --git a/source/sundials/kinsol.cc b/source/sundials/kinsol.cc index 13a25fc3bb..dc57fc7a23 100644 --- a/source/sundials/kinsol.cc +++ b/source/sundials/kinsol.cc @@ -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);