copy(*src_ypred, ypred);
copy(*src_fpred, fpred);
- int err = solver.setup_jacobian(convfail,
+ // avoid reinterpret_cast
+ bool jcurPtr_tmp = false;
+ int err = solver.setup_jacobian(convfail,
arkode_mem->ark_tn,
arkode_mem->ark_gamma,
*src_ypred,
*src_fpred,
- (bool &)*jcurPtr);
+ jcurPtr_tmp);
+ *jcurPtr = jcurPtr_tmp ? SUNTRUE : SUNFALSE;
return err;
}
status = ARKodeSetInitStep(arkode_mem, current_time_step);
AssertARKode(status);
- status = ARKodeSetUserData(arkode_mem, (void *)this);
+ status = ARKodeSetUserData(arkode_mem, this);
AssertARKode(status);
status = ARKodeSetStopTime(arkode_mem, data.final_time);
AssertARKode(status);
// Initialize solver
- ARKodeMem ARKode_mem = (ARKodeMem)arkode_mem;
+ auto ARKode_mem = static_cast<ARKodeMem>(arkode_mem);
if (solve_jacobian_system)
{
status = IDASetInitStep(ida_mem, current_time_step);
AssertIDA(status);
- status = IDASetUserData(ida_mem, (void *)this);
+ status = IDASetUserData(ida_mem, this);
AssertIDA(status);
if (data.ic_type == AdditionalData::use_y_diff ||
AssertIDA(status);
// Initialize solver
- IDAMem IDA_mem;
- IDA_mem = (IDAMem)ida_mem;
+ auto IDA_mem = static_cast<IDAMem>(ida_mem);
IDA_mem->ida_lsetup = t_dae_lsetup<VectorType>;
IDA_mem->ida_lsolve = t_dae_solve<VectorType>;
(void)status;
AssertKINSOL(status);
- status = KINSetUserData(kinsol_mem, (void *)this);
+ status = KINSetUserData(kinsol_mem, static_cast<void *>(this));
AssertKINSOL(status);
status = KINSetNumMaxIters(kinsol_mem, data.maximum_non_linear_iterations);
status = KINSetMaxSetupCalls(kinsol_mem, data.maximum_setup_calls);
AssertKINSOL(status);
- status = KINSetNoInitSetup(kinsol_mem, (int)data.no_init_setup);
+ status = KINSetNoInitSetup(kinsol_mem, data.no_init_setup);
AssertKINSOL(status);
status = KINSetMaxNewtonStep(kinsol_mem, data.maximum_newton_step);
if (solve_jacobian_system)
{
- KINMem KIN_mem = (KINMem)kinsol_mem;
+ auto KIN_mem = static_cast<KINMem>(kinsol_mem);
KIN_mem->kin_lsolve = t_kinsol_solve_jacobian<VectorType>;
if (setup_jacobian)
{
Assert(iteration_function, ExcFunctionNotProvided("iteration_function"));
// call to KINSol
- status = KINSol(kinsol_mem, solution, (int)data.strategy, u_scale, f_scale);
+ status = KINSol(kinsol_mem, solution, data.strategy, u_scale, f_scale);
AssertKINSOL(status);
copy(initial_guess_and_solution, solution);
# endif
KINFree(&kinsol_mem);
- return (unsigned int)nniters;
+ return static_cast<unsigned int>(nniters);
}
template <typename VectorType>