Skip to content

Commit

Permalink
Fixing some mistakes from rebasing
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterMeisrimelModelon committed Apr 19, 2024
1 parent 9f3b611 commit 7cf32c1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
20 changes: 10 additions & 10 deletions src/lib/sundials_callbacks_ida_cvode.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <ProblemData>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 = <ProblemData>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:
Expand All @@ -784,11 +784,11 @@ IF SUNDIALS_VERSION >= (7,0,0):
cdef ProblemData pData = <ProblemData>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:
"""
Expand All @@ -797,11 +797,11 @@ ELSE:
cdef ProblemData pData = <ProblemData>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:
Expand Down
16 changes: 8 additions & 8 deletions src/lib/sundials_callbacks_kinsol.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ IF SUNDIALS_VERSION >= (7,0,0):
else:
category = 0

print "Error occured in <function: %s>."%function
print "<message: %s>"%msg
#print "<functionNorm: %g, scaledStepLength: %g, tolerance: %g>"%(fnorm, snorm, pData.TOL)
print("Error occured in <function: %s>."%function)
print("<message: %s>"%msg)
#print("<functionNorm: %g, scaledStepLength: %g, tolerance: %g>"%(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 = <ProblemDataEquationSolver>eh_data
Expand All @@ -251,9 +251,9 @@ ELSE:
else:
category = 0

print "Error occured in <function: %s>."%function
print "<message: %s>"%msg
#print "<functionNorm: %g, scaledStepLength: %g, tolerance: %g>"%(fnorm, snorm, pData.TOL)
print("Error occured in <function: %s>."%function)
print("<message: %s>"%msg)
#print("<functionNorm: %g, scaledStepLength: %g, tolerance: %g>"%(fnorm, snorm, pData.TOL))


cdef void kin_info(const char *module, const char *function, char *msg, void *eh_data) noexcept:
Expand Down Expand Up @@ -287,9 +287,9 @@ cdef void kin_info(const char *module, const char *function, char *msg, void *eh
print("<iteration_index:%d>"%nniters)
print("ivs", N_VGetArrayPointer(kin_mem->kin_uu), block->n))
print("<scaled_residual_norm:%E>", 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:
Expand Down
6 changes: 3 additions & 3 deletions src/lib/sundials_includes.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 7cf32c1

Please sign in to comment.