From aa7ec7993810155d72b83c6a584dd6a9d1a62fee Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 2 May 2023 17:54:11 -0600 Subject: [PATCH] Simplify code somewhat. --- source/sundials/kinsol.cc | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) 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); -- 2.39.5