Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error handling in ida #385

Merged
merged 27 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5dbe6e2
error handling in ida
balos1 Dec 6, 2023
3de7634
Merge branch 'feature/error-handling-just-the-core-formatted' into fe…
balos1 Dec 6, 2023
dda59c0
Merge branch 'feature/error-handling-just-the-core-formatted' into fe…
balos1 Dec 7, 2023
04b178d
Merge branch 'feature/error-handling-just-the-core-formatted' into fe…
balos1 Dec 7, 2023
8f7ce21
Merge branch 'feature/error-handling-just-the-core-formatted' into fe…
balos1 Dec 7, 2023
d80c54c
Merge branch 'feature/error-handling-just-the-core-formatted' into fe…
balos1 Dec 7, 2023
4d30945
Merge branch 'feature/error-handling-just-the-core-formatted' into fe…
balos1 Dec 7, 2023
032efe0
Merge branch 'feature/error-handling-staging' into feature/error-hand…
balos1 Dec 7, 2023
ded0740
Merge branch 'feature/error-handling-staging' into feature/error-hand…
balos1 Dec 7, 2023
46d0e9f
Merge branch 'feature/error-handling-staging' into feature/error-hand…
balos1 Dec 8, 2023
0dd5c9d
Merge branch 'feature/error-handling-staging' into feature/error-hand…
balos1 Dec 8, 2023
66582d6
reapply refactor tool
balos1 Dec 8, 2023
44dfaea
remove ida error handler function
balos1 Dec 8, 2023
a00dd89
Merge branch 'feature/error-handling-staging' into feature/error-hand…
balos1 Dec 8, 2023
d3148d8
Merge branch 'feature/error-handling-staging' into feature/error-hand…
balos1 Dec 8, 2023
dc97664
formatting after merge
balos1 Dec 8, 2023
5466f54
Update src/ida/ida.c
balos1 Dec 8, 2023
a92b7b2
remove errfp reference that was missed
balos1 Dec 8, 2023
99b089e
Merge branch 'feature/error-handling-staging' into feature/error-hand…
balos1 Dec 8, 2023
a5bcd4c
Merge branch 'feature/error-handling-staging' into feature/error-hand…
balos1 Dec 11, 2023
5c5ab0b
Merge branch 'feature/error-handling-staging' into feature/error-hand…
balos1 Dec 11, 2023
370ca62
Merge branch 'feature/error-handling-staging' into feature/error-hand…
balos1 Dec 11, 2023
7bd9e7f
Merge branch 'feature/error-handling-staging' into feature/error-hand…
balos1 Dec 12, 2023
49f22f0
address comments
balos1 Dec 12, 2023
940f62c
call GetLastError in ProcessError
balos1 Dec 12, 2023
0fbffe6
Merge branch 'feature/error-handling-staging' into feature/error-hand…
balos1 Dec 12, 2023
da712dd
Update src/ida/ida.c
balos1 Dec 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/ida/guide/source/Introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ Users now need to link to ``sundials_core`` in addition to the libraries already
This will be picked up automatically in projects that use the SUNDIALS CMake target. The library ``sundials_generic`` has been superceded by ``sundials_core`` and is no longer available.
This fixes some duplicate symbol errors on Windows when linking to multiple SUNDIALS libraries.

**Breaking change**
The functions ``IDASetErrFile`` and ``IDASetHandlerErrFn`` have been removed.
Users of these functions should use the :c:type:`SUNLogger` API instead.
balos1 marked this conversation as resolved.
Show resolved Hide resolved

Changes in v6.6.2
-----------------

Expand Down
47 changes: 0 additions & 47 deletions doc/ida/guide/source/Usage/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -942,53 +942,6 @@ Main solver optional input functions
+--------------------------------------------------------------------+---------------------------------+----------------+


.. c:function:: int IDASetErrFile(void * ida_mem, FILE * errfp)
balos1 marked this conversation as resolved.
Show resolved Hide resolved

The function ``IDASetErrFile`` specifies the file pointer where all IDA
messages should be directed when using the default IDA error handler
function.

**Arguments:**
* ``ida_mem`` -- pointer to the IDA solver object.
* ``errfp`` -- pointer to output file.

**Return value:**
* ``IDA_SUCCESS`` -- The optional value has been successfully set.
* ``IDA_MEM_NULL`` -- The ``ida_mem`` pointer is ``NULL``.

**Notes:**
The default value for ``errfp`` is ``stderr``. Passing a value ``NULL``
disables all future error message output (except for the case in which the
IDA memory pointer is ``NULL``). This use of :c:func:`IDASetErrFile` is
strongly discouraged.

.. warning::

If :c:func:`IDASetErrFile` is to be called, it should be called before any
other optional input functions, in order to take effect for any later
error message.

.. c:function:: int IDASetErrHandlerFn(void * ida_mem, IDAErrHandlerFn ehfun, void * eh_data)

The function ``IDASetErrHandlerFn`` specifies the optional user-defined
function to be used in handling error messages.

**Arguments:**
* ``ida_mem`` -- pointer to the IDA solver object.
* ``ehfun`` -- is the user's error handler function. See
:c:type:`IDAErrHandlerFn` for more details.
* ``eh_data`` -- pointer to user data passed to ``ehfun`` every time it is
called.

**Return value:**
* ``IDA_SUCCESS`` -- The function ``ehfun`` and data pointer ``eh_data`` have
been successfully set.
* ``IDA_MEM_NULL`` -- The ``ida_mem`` pointer is ``NULL``.

**Notes:**
Error messages indicating that the IDA solver memory is ``NULL`` will always
be directed to ``stderr``.

.. c:function:: int IDASetUserData(void * ida_mem, void * user_data)

The function ``IDASetUserData`` attaches a user-defined data pointer to the
Expand Down
3 changes: 0 additions & 3 deletions include/ida/ida.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,6 @@ SUNDIALS_EXPORT int IDASetMaxBacksIC(void* ida_mem, int maxbacks);

/* Optional input functions */
SUNDIALS_EXPORT int IDASetDeltaCjLSetup(void* ida_max, sunrealtype dcj);
SUNDIALS_EXPORT int IDASetErrHandlerFn(void* ida_mem, IDAErrHandlerFn ehfun,
balos1 marked this conversation as resolved.
Show resolved Hide resolved
void* eh_data);
SUNDIALS_EXPORT int IDASetErrFile(void* ida_mem, FILE* errfp);
SUNDIALS_EXPORT int IDASetUserData(void* ida_mem, void* user_data);
SUNDIALS_EXPORT int IDASetMaxOrd(void* ida_mem, int maxord);
SUNDIALS_EXPORT int IDASetMaxNumSteps(void* ida_mem, long int mxsteps);
Expand Down
30 changes: 0 additions & 30 deletions src/ida/fmod/fida_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,36 +459,6 @@ SWIGEXPORT int _wrap_FIDASetDeltaCjLSetup(void *farg1, double const *farg2) {
}


SWIGEXPORT int _wrap_FIDASetErrHandlerFn(void *farg1, IDAErrHandlerFn farg2, void *farg3) {
int fresult ;
void *arg1 = (void *) 0 ;
IDAErrHandlerFn arg2 = (IDAErrHandlerFn) 0 ;
void *arg3 = (void *) 0 ;
int result;

arg1 = (void *)(farg1);
arg2 = (IDAErrHandlerFn)(farg2);
arg3 = (void *)(farg3);
result = (int)IDASetErrHandlerFn(arg1,arg2,arg3);
fresult = (int)(result);
return fresult;
}


SWIGEXPORT int _wrap_FIDASetErrFile(void *farg1, void *farg2) {
int fresult ;
void *arg1 = (void *) 0 ;
FILE *arg2 = (FILE *) 0 ;
int result;

arg1 = (void *)(farg1);
arg2 = (FILE *)(farg2);
result = (int)IDASetErrFile(arg1,arg2);
fresult = (int)(result);
return fresult;
}


SWIGEXPORT int _wrap_FIDASetUserData(void *farg1, void *farg2) {
int fresult ;
void *arg1 = (void *) 0 ;
Expand Down
56 changes: 0 additions & 56 deletions src/ida/fmod/fida_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ module fida_mod
public :: FIDASetStepToleranceIC
public :: FIDASetMaxBacksIC
public :: FIDASetDeltaCjLSetup
public :: FIDASetErrHandlerFn
public :: FIDASetErrFile
public :: FIDASetUserData
public :: FIDASetMaxOrd
public :: FIDASetMaxNumSteps
Expand Down Expand Up @@ -340,25 +338,6 @@ function swigc_FIDASetDeltaCjLSetup(farg1, farg2) &
integer(C_INT) :: fresult
end function

function swigc_FIDASetErrHandlerFn(farg1, farg2, farg3) &
bind(C, name="_wrap_FIDASetErrHandlerFn") &
result(fresult)
use, intrinsic :: ISO_C_BINDING
type(C_PTR), value :: farg1
type(C_FUNPTR), value :: farg2
type(C_PTR), value :: farg3
integer(C_INT) :: fresult
end function

function swigc_FIDASetErrFile(farg1, farg2) &
bind(C, name="_wrap_FIDASetErrFile") &
result(fresult)
use, intrinsic :: ISO_C_BINDING
type(C_PTR), value :: farg1
type(C_PTR), value :: farg2
integer(C_INT) :: fresult
end function

function swigc_FIDASetUserData(farg1, farg2) &
bind(C, name="_wrap_FIDASetUserData") &
result(fresult)
Expand Down Expand Up @@ -1470,41 +1449,6 @@ function FIDASetDeltaCjLSetup(ida_max, dcj) &
swig_result = fresult
end function

function FIDASetErrHandlerFn(ida_mem, ehfun, eh_data) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
integer(C_INT) :: swig_result
type(C_PTR) :: ida_mem
type(C_FUNPTR), intent(in), value :: ehfun
type(C_PTR) :: eh_data
integer(C_INT) :: fresult
type(C_PTR) :: farg1
type(C_FUNPTR) :: farg2
type(C_PTR) :: farg3

farg1 = ida_mem
farg2 = ehfun
farg3 = eh_data
fresult = swigc_FIDASetErrHandlerFn(farg1, farg2, farg3)
swig_result = fresult
end function

function FIDASetErrFile(ida_mem, errfp) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
integer(C_INT) :: swig_result
type(C_PTR) :: ida_mem
type(C_PTR) :: errfp
integer(C_INT) :: fresult
type(C_PTR) :: farg1
type(C_PTR) :: farg2

farg1 = ida_mem
farg2 = errfp
fresult = swigc_FIDASetErrFile(farg1, farg2)
swig_result = fresult
end function

function FIDASetUserData(ida_mem, user_data) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
Expand Down
Loading