From 174aa2860dfbbfbfe606e563a17a2288436e4f52 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 25 May 2021 10:43:52 -0600 Subject: [PATCH] Unify internal names of SUNDIALS IDA interfaces. As previously done for the KINSOL interfaces, this patch avoids the t_dae_ prefix and instead uses _callback as suffix. I don't quite know where the t_ prefix comes from, but it sounds like jargon that may be present in the SUNDIALS internal documentation but that a typical reader of our code would not know about. Since these are all internal functions of deal.II, we can rename them freely. In particular, because they are in anonymous namespaces, we can re-use the same names already in use in the KINSOL interfaces. --- source/sundials/ida.cc | 61 +++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/source/sundials/ida.cc b/source/sundials/ida.cc index d03a402876..d78db1dfee 100644 --- a/source/sundials/ida.cc +++ b/source/sundials/ida.cc @@ -60,11 +60,11 @@ namespace SUNDIALS { template int - t_dae_residual(realtype tt, - N_Vector yy, - N_Vector yp, - N_Vector rr, - void * user_data) + residual_callback(realtype tt, + N_Vector yy, + N_Vector yp, + N_Vector rr, + void * user_data) { IDA &solver = *static_cast *>(user_data); @@ -112,12 +112,12 @@ namespace SUNDIALS template int - t_dae_solve(IDAMem IDA_mem, - N_Vector b, - N_Vector weight, - N_Vector yy, - N_Vector yp, - N_Vector resp) + solve_with_jacobian_callback(IDAMem IDA_mem, + N_Vector b, + N_Vector weight, + N_Vector yy, + N_Vector yp, + N_Vector resp) { (void)weight; (void)yy; @@ -143,16 +143,16 @@ namespace SUNDIALS # else template int - t_dae_jacobian_setup(realtype tt, - realtype cj, - N_Vector yy, - N_Vector yp, - N_Vector /* residual */, - SUNMatrix /* ignored */, - void *user_data, - N_Vector /* tmp1 */, - N_Vector /* tmp2 */, - N_Vector /* tmp3 */) + setup_jacobian_callback(realtype tt, + realtype cj, + N_Vector yy, + N_Vector yp, + N_Vector /* residual */, + SUNMatrix /* ignored */, + void *user_data, + N_Vector /* tmp1 */, + N_Vector /* tmp2 */, + N_Vector /* tmp3 */) { Assert(user_data != nullptr, ExcInternalError()); IDA &solver = *static_cast *>(user_data); @@ -169,11 +169,11 @@ namespace SUNDIALS template int - t_dae_solve_jacobian_system(SUNLinearSolver LS, - SUNMatrix /*ignored*/, - N_Vector x, - N_Vector b, - realtype tol) + solve_with_jacobian_callback(SUNLinearSolver LS, + SUNMatrix /*ignored*/, + N_Vector x, + N_Vector b, + realtype tol) { IDA &solver = *static_cast *>(LS->content); @@ -290,7 +290,8 @@ namespace SUNDIALS auto yy = internal::make_nvector_view(solution); auto yp = internal::make_nvector_view(solution_dot); - status = IDAInit(ida_mem, t_dae_residual, current_time, yy, yp); + status = + IDAInit(ida_mem, residual_callback, current_time, yy, yp); AssertIDA(status); if (get_local_tolerances) { @@ -346,7 +347,7 @@ namespace SUNDIALS IDA_mem->ida_lsetup = t_dae_lsetup; if (solve_jacobian_system) - IDA_mem->ida_lsolve = t_dae_solve; + IDA_mem->ida_lsolve = solve_with_jacobian_callback; else AssertThrow(false, ExcFunctionNotProvided("solve_jacobian_system")); # if DEAL_II_SUNDIALS_VERSION_LT(3, 0, 0) @@ -385,7 +386,7 @@ namespace SUNDIALS AssertThrow(solve_jacobian_system || solve_with_jacobian, ExcFunctionNotProvided( "solve_jacobian_system or solve_with_jacobian")); - LS->ops->solve = t_dae_solve_jacobian_system; + LS->ops->solve = solve_with_jacobian_callback; // When we set an iterative solver IDA requires that resid is provided. From // SUNDIALS docs If an iterative method computes the preconditioned initial @@ -436,7 +437,7 @@ namespace SUNDIALS // Finally tell IDA about // it as well. The manual says that this must happen *after* // calling IDASetLinearSolver - status = IDASetJacFn(ida_mem, &t_dae_jacobian_setup); + status = IDASetJacFn(ida_mem, &setup_jacobian_callback); AssertIDA(status); # endif status = IDASetMaxOrd(ida_mem, data.maximum_order); -- 2.39.5