From 74bdccc8201dc76f816861233322169f04908e4b Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Fri, 12 Apr 2024 12:40:53 +0200 Subject: [PATCH] Use alias for sundials booleantype. --- include/deal.II/sundials/sundials_types.h | 4 +++- source/sundials/arkode.cc | 27 ++++++++--------------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/include/deal.II/sundials/sundials_types.h b/include/deal.II/sundials/sundials_types.h index ce4b8c1ea5..a2e9b5cf5d 100644 --- a/include/deal.II/sundials/sundials_types.h +++ b/include/deal.II/sundials/sundials_types.h @@ -25,11 +25,13 @@ DEAL_II_NAMESPACE_OPEN namespace SUNDIALS { /** - * Alias for the real type used by SUNDIALS. + * Alias for the bool and real types used by SUNDIALS. */ # if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0) + using booltype = sunbooleantype; using realtype = ::sunrealtype; # else + using booltype = booleantype; using realtype = ::realtype; # endif } // namespace SUNDIALS diff --git a/source/sundials/arkode.cc b/source/sundials/arkode.cc index a1a9092901..bae405956b 100644 --- a/source/sundials/arkode.cc +++ b/source/sundials/arkode.cc @@ -520,18 +520,14 @@ namespace SUNDIALS lr); }; - auto jacobian_solver_setup_callback = [](SUNDIALS::realtype t, - N_Vector y, - N_Vector fy, -# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0) - sunbooleantype jok, - sunbooleantype *jcurPtr, -# else - booleantype jok, - booleantype *jcurPtr, -# endif - SUNDIALS::realtype gamma, - void *user_data) -> int { + auto jacobian_solver_setup_callback = + [](SUNDIALS::realtype t, + N_Vector y, + N_Vector fy, + SUNDIALS::booltype jok, + SUNDIALS::booltype *jcurPtr, + SUNDIALS::realtype gamma, + void *user_data) -> int { Assert(user_data != nullptr, ExcInternalError()); ARKode &solver = *static_cast *>(user_data); @@ -641,13 +637,8 @@ namespace SUNDIALS # endif } -# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0) - sunbooleantype mass_time_dependent = + SUNDIALS::booltype mass_time_dependent = data.mass_is_time_independent ? SUNFALSE : SUNTRUE; -# else - booleantype mass_time_dependent = - data.mass_is_time_independent ? SUNFALSE : SUNTRUE; -# endif status = ARKStepSetMassLinearSolver(arkode_mem, sun_mass_linear_solver, -- 2.39.5