From 7cf32c11690d921d5d014d7a41c26c36c07613d0 Mon Sep 17 00:00:00 2001 From: PeterMeisrimelModelon <92585725+PeterMeisrimelModelon@users.noreply.github.com> Date: Fri, 19 Apr 2024 09:54:37 +0200 Subject: [PATCH] Fixing some mistakes from rebasing --- src/lib/sundials_callbacks_ida_cvode.pxi | 20 ++++++++++---------- src/lib/sundials_callbacks_kinsol.pxi | 16 ++++++++-------- src/lib/sundials_includes.pxd | 6 +++--- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/lib/sundials_callbacks_ida_cvode.pxi b/src/lib/sundials_callbacks_ida_cvode.pxi index e49f46a1..e35497d2 100644 --- a/src/lib/sundials_callbacks_ida_cvode.pxi +++ b/src/lib/sundials_callbacks_ida_cvode.pxi @@ -750,31 +750,31 @@ IF SUNDIALS_VERSION >= (7,0,0): cdef struct _SUNContext: pass ctypedef int SUNErrCode - cdef void cv_err(int line, const char* func, const char* file, const char* msg, SUNErrCode error_code, void* problem_data, SUNContext sunctx): + cdef void cv_err(int line, const char* func, const char* file, const char* msg, SUNErrCode error_code, void* problem_data, SUNContext sunctx) noexcept: """ This method overrides the default handling of error messages. """ cdef ProblemData pData = problem_data if error_code > 0 and pData.verbose > 0: #Warning - print '[CVode Warning]', msg + print('[CVode Warning]', msg) if pData.verbose > 2: #Verbosity is greater than NORMAL, print warnings and errors if error_code < 0: #Error - print '[CVode Error]', msg + print('[CVode Error]', msg) ELSE: - cdef void cv_err(int error_code, const char *module, const char *function, char *msg, void *problem_data): + cdef void cv_err(int error_code, const char *module, const char *function, char *msg, void *problem_data) noexcept: """ This method overrides the default handling of error messages. """ cdef ProblemData pData = problem_data if error_code > 0 and pData.verbose > 0: #Warning - print '[CVode Warning]', msg + print('[CVode Warning]', msg) if pData.verbose > 2: #Verbosity is greater than NORMAL, print warnings and errors if error_code < 0: #Error - print '[CVode Error]', msg + print('[CVode Error]', msg) IF SUNDIALS_VERSION >= (7,0,0): cdef void ida_err(int line, const char* func, const char* file, const char* msg, SUNErrCode error_code, void* problem_data, SUNContext sunctx) noexcept: @@ -784,11 +784,11 @@ IF SUNDIALS_VERSION >= (7,0,0): cdef ProblemData pData = problem_data if error_code > 0 and pData.verbose > 0: #Warning - print '[IDA Warning]', msg + print('[IDA Warning]', msg) if pData.verbose > 2: #Verbosity is greater than NORMAL, print warnings and errors if error_code < 0: #Error - print '[IDA Error]', msg + print('[IDA Error]', msg) ELSE: cdef void ida_err(int error_code, const char *module, const char *function, char *msg, void *problem_data) noexcept: """ @@ -797,11 +797,11 @@ ELSE: cdef ProblemData pData = problem_data if error_code > 0 and pData.verbose > 0: #Warning - print '[IDA Warning]', msg + print('[IDA Warning]', msg) if pData.verbose > 2: #Verbosity is greater than NORMAL, print warnings and errors if error_code < 0: #Error - print '[IDA Error]', msg + print('[IDA Error]', msg) cdef class ProblemData: diff --git a/src/lib/sundials_callbacks_kinsol.pxi b/src/lib/sundials_callbacks_kinsol.pxi index 51e48691..3e637e98 100644 --- a/src/lib/sundials_callbacks_kinsol.pxi +++ b/src/lib/sundials_callbacks_kinsol.pxi @@ -237,9 +237,9 @@ IF SUNDIALS_VERSION >= (7,0,0): else: category = 0 - print "Error occured in ."%function - print ""%msg - #print ""%(fnorm, snorm, pData.TOL) + print("Error occured in ."%function) + print(""%msg) + #print(""%(fnorm, snorm, pData.TOL)) ELSE: cdef void kin_err(int err_code, const char *module, const char *function, char *msg, void *eh_data) noexcept: cdef ProblemDataEquationSolver pData = eh_data @@ -251,9 +251,9 @@ ELSE: else: category = 0 - print "Error occured in ."%function - print ""%msg - #print ""%(fnorm, snorm, pData.TOL) + print("Error occured in ."%function) + print(""%msg) + #print(""%(fnorm, snorm, pData.TOL)) cdef void kin_info(const char *module, const char *function, char *msg, void *eh_data) noexcept: @@ -287,9 +287,9 @@ cdef void kin_info(const char *module, const char *function, char *msg, void *eh print(""%nniters) print("ivs", N_VGetArrayPointer(kin_mem->kin_uu), block->n)) print("", kin_mem->kin_fnorm)) - print "residuals", + print("residuals", realtype* f = N_VGetArrayPointer(kin_mem->kin_fval); - f[i]*residual_scaling_factors[i] + f[i]*residual_scaling_factors[i]) """ cdef class ProblemDataEquationSolver: diff --git a/src/lib/sundials_includes.pxd b/src/lib/sundials_includes.pxd index e083acf1..110fc1f6 100644 --- a/src/lib/sundials_includes.pxd +++ b/src/lib/sundials_includes.pxd @@ -768,13 +768,13 @@ cdef extern from "kinsol/kinsol.h": # Functions for error handling IF SUNDIALS_VERSION < (7,0,0): cdef extern from "kinsol/kinsol.h": - ctypedef void (*KINErrHandlerFn)(int error_code, char *module, char *function, char *msg, void *user_data) + ctypedef void (*KINErrHandlerFn)(int error_code, char *module, char *function, char *msg, void *user_data) noexcept int KINSetErrHandlerFn(void *kinmem, KINErrHandlerFn ehfun, void *eh_data) noexcept cdef extern from "cvodes/cvodes.h": - ctypedef void (*CVErrHandlerFn)(int error_code, const char *module, const char *function, char *msg, void *eh_data) + ctypedef void (*CVErrHandlerFn)(int error_code, const char *module, const char *function, char *msg, void *eh_data) noexcept int CVodeSetErrHandlerFn(void *cvode_mem, CVErrHandlerFn ehfun, void* eh_data) noexcept cdef extern from "idas/idas.h": - ctypedef void (*IDAErrHandlerFn)(int error_code, const char *module, const char *function, char *msg, void *eh_data) + ctypedef void (*IDAErrHandlerFn)(int error_code, const char *module, const char *function, char *msg, void *eh_data) noexcept int IDASetErrHandlerFn(void *ida_mem,IDAErrHandlerFn ehfun, void* eh_data) noexcept IF SUNDIALS_VERSION >= (6,0,0):