diff --git a/CHANGELOG.md b/CHANGELOG.md index ec7da53047..dc3696389c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -138,6 +138,14 @@ This will be picked up automatically in projects that use the SUNDIALS CMake tar 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 `*SetErrHandlerFn` and `*SetErrFile` functions in CVODE(S), IDA(S), ARKODE and KINSOL have been +removed. Users of these functions can use the functions `SUNContext_PushErrHandler`, and +`SUNLogger_SetErrorFilename` instead. For further details see the [Error +Checking](https://sundials.readthedocs.io/en/latest/sundials/Errors_link.html) and +[Logging](https://sundials.readthedocs.io/en/latest/sundials/Logging_link.html) sections in the +documentation. + ## Changes to SUNDIALS in release 6.6.2 diff --git a/doc/arkode/guide/source/Introduction.rst b/doc/arkode/guide/source/Introduction.rst index 419bed4835..edd7ad01a6 100644 --- a/doc/arkode/guide/source/Introduction.rst +++ b/doc/arkode/guide/source/Introduction.rst @@ -265,6 +265,23 @@ 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 following functions have been removed + +.. code-block:: + + ARKStepSetErrHandlerFn + ARKStepSetErrFile + ERKStepSetErrHandlerFn + ERKStepSetErrFile + MRIStepSetErrHandlerFn + MRIStepSetErrFile + SPRKStepSetErrHandlerFn + SPRKStepSetErrFile + +Users of these functions can use the functions :c:func:`SUNContext_PushErrHandler`, +and :c:func:`SUNLogger_SetErrorFilename` instead. For further details see +Sections :numref:`SUNDIALS.Errors` and :numref:`SUNDIALS.Logging`. Changes in v5.6.2 ----------------- diff --git a/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst index 0425ab5bec..28532987af 100644 --- a/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst @@ -864,8 +864,6 @@ Return ARKStep parameters to their defaults :c:func:`ARKStepSetDefaults` Set dense output interpolation type :c:func:`ARKStepSetInterpolantType` ``ARK_INTERP_HERMITE`` Set dense output polynomial degree :c:func:`ARKStepSetInterpolantDegree` 5 Supply a pointer to a diagnostics output file :c:func:`ARKStepSetDiagnostics` ``NULL`` -Supply a pointer to an error output file :c:func:`ARKStepSetErrFile` ``stderr`` -Supply a custom error handler function :c:func:`ARKStepSetErrHandlerFn` internal fn Disable time step adaptivity (fixed-step mode) :c:func:`ARKStepSetFixedStep` disabled Supply an initial step size to attempt :c:func:`ARKStepSetInitStep` estimated Maximum no. of warnings for :math:`t_n+h = t_n` :c:func:`ARKStepSetMaxHnilWarns` 10 @@ -1020,57 +1018,6 @@ Set max number of constraint failures :c:func:`ARKStepSetMaxNumConst Use :c:func:`SUNLogger_SetInfoFilename` instead. -.. c:function:: int ARKStepSetErrFile(void* arkode_mem, FILE* errfp) - - Specifies a pointer to the file where all ARKStep warning and error - messages will be written if the default internal error handling - function is used. - - **Arguments:** - * *arkode_mem* -- pointer to the ARKStep memory block. - * *errfp* -- pointer to the output file. - - **Return value:** - * *ARK_SUCCESS* if successful - * *ARK_MEM_NULL* if the ARKStep memory is ``NULL`` - * *ARK_ILL_INPUT* if an argument has an illegal value - - **Notes:** - The default value for *errfp* is ``stderr``. - - Passing a ``NULL`` value disables all future error message output - (except for the case wherein the ARKStep memory pointer is - ``NULL``). This use of the function is strongly discouraged. - - If used, this routine should be called before any other - optional input functions, in order to take effect for subsequent - error messages. - - - -.. c:function:: int ARKStepSetErrHandlerFn(void* arkode_mem, ARKErrHandlerFn ehfun, void* eh_data) - - Specifies the optional user-defined function to be used - in handling error messages. - - **Arguments:** - * *arkode_mem* -- pointer to the ARKStep memory block. - * *ehfun* -- name of user-supplied error handler function. - * *eh_data* -- pointer to user data passed to *ehfun* every time - it is called. - - **Return value:** - * *ARK_SUCCESS* if successful - * *ARK_MEM_NULL* if the ARKStep memory is ``NULL`` - * *ARK_ILL_INPUT* if an argument has an illegal value - - **Notes:** - Error messages indicating that the ARKStep solver memory is - ``NULL`` will always be directed to ``stderr``. - - - - .. c:function:: int ARKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed) Disables time step adaptivity within ARKStep, and specifies the diff --git a/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst index c48b8c5190..a394993069 100644 --- a/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst @@ -477,10 +477,6 @@ Optional inputs for ERKStep +----------------------------------------------------+-------------------------------------------+------------------------+ | Supply a pointer to a diagnostics output file | :c:func:`ERKStepSetDiagnostics()` | ``NULL`` | +----------------------------------------------------+-------------------------------------------+------------------------+ - | Supply a pointer to an error output file | :c:func:`ERKStepSetErrFile()` | ``stderr`` | - +----------------------------------------------------+-------------------------------------------+------------------------+ - | Supply a custom error handler function | :c:func:`ERKStepSetErrHandlerFn()` | internal fn | - +----------------------------------------------------+-------------------------------------------+------------------------+ | Disable time step adaptivity (fixed-step mode) | :c:func:`ERKStepSetFixedStep()` | disabled | +----------------------------------------------------+-------------------------------------------+------------------------+ | Supply an initial step size to attempt | :c:func:`ERKStepSetInitStep()` | estimated | @@ -645,57 +641,6 @@ Optional inputs for ERKStep Use :c:func:`SUNLogger_SetInfoFilename` instead. -.. c:function:: int ERKStepSetErrFile(void* arkode_mem, FILE* errfp) - - Specifies a pointer to the file where all ERKStep warning and error - messages will be written if the default internal error handling - function is used. - - **Arguments:** - * *arkode_mem* -- pointer to the ERKStep memory block. - * *errfp* -- pointer to the output file. - - **Return value:** - * *ARK_SUCCESS* if successful - * *ARK_MEM_NULL* if the ERKStep memory is ``NULL`` - * *ARK_ILL_INPUT* if an argument has an illegal value - - **Notes:** - The default value for *errfp* is ``stderr``. - - Passing a ``NULL`` value disables all future error message output - (except for the case wherein the ERKStep memory pointer is - ``NULL``). This use of the function is strongly discouraged. - - If used, this routine should be called before any other - optional input functions, in order to take effect for subsequent - error messages. - - - -.. c:function:: int ERKStepSetErrHandlerFn(void* arkode_mem, ARKErrHandlerFn ehfun, void* eh_data) - - Specifies the optional user-defined function to be used - in handling error messages. - - **Arguments:** - * *arkode_mem* -- pointer to the ERKStep memory block. - * *ehfun* -- name of user-supplied error handler function. - * *eh_data* -- pointer to user data passed to *ehfun* every time - it is called. - - **Return value:** - * *ARK_SUCCESS* if successful - * *ARK_MEM_NULL* if the ERKStep memory is ``NULL`` - * *ARK_ILL_INPUT* if an argument has an illegal value - - **Notes:** - Error messages indicating that the ERKStep solver memory is - ``NULL`` will always be directed to ``stderr``. - - - - .. c:function:: int ERKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed) Disabled time step adaptivity within ERKStep, and specifies the diff --git a/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst index c4d478c9cd..90f88299a1 100644 --- a/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst @@ -680,10 +680,6 @@ Optional inputs for MRIStep +---------------------------------------------------------------+-------------------------------------------+------------------------+ | Supply a pointer to a diagnostics output file | :c:func:`MRIStepSetDiagnostics()` | ``NULL`` | +---------------------------------------------------------------+-------------------------------------------+------------------------+ - | Supply a pointer to an error output file | :c:func:`MRIStepSetErrFile()` | ``stderr`` | - +---------------------------------------------------------------+-------------------------------------------+------------------------+ - | Supply a custom error handler function | :c:func:`MRIStepSetErrHandlerFn()` | internal fn | - +---------------------------------------------------------------+-------------------------------------------+------------------------+ | Run with fixed-step sizes | :c:func:`MRIStepSetFixedStep()` | required | +---------------------------------------------------------------+-------------------------------------------+------------------------+ | Maximum no. of warnings for :math:`t_n+h = t_n` | :c:func:`MRIStepSetMaxHnilWarns()` | 10 | @@ -857,65 +853,6 @@ Optional inputs for MRIStep Use :c:func:`SUNLogger_SetInfoFilename` instead. -.. c:function:: int MRIStepSetErrFile(void* arkode_mem, FILE* errfp) - - Specifies a pointer to the file where all MRIStep warning and error - messages will be written if the default internal error handling - function is used. - - **Arguments:** - - * *arkode_mem* -- pointer to the MRIStep memory block. - - * *errfp* -- pointer to the output file. - - **Return value:** - - * *ARK_SUCCESS* if successful - - * *ARK_MEM_NULL* if the MRIStep memory is ``NULL`` - - * *ARK_ILL_INPUT* if an argument has an illegal value - - **Notes:** The default value for *errfp* is ``stderr``. - - Passing a ``NULL`` value disables all future error message output - (except for the case wherein the MRIStep memory pointer is - ``NULL``). This use of the function is strongly discouraged. - - If used, this routine should be called before any other - optional input functions, in order to take effect for subsequent - error messages. - - - -.. c:function:: int MRIStepSetErrHandlerFn(void* arkode_mem, ARKErrHandlerFn ehfun, void* eh_data) - - Specifies the optional user-defined function to be used - in handling error messages. - - **Arguments:** - - * *arkode_mem* -- pointer to the MRIStep memory block. - - * *ehfun* -- name of user-supplied error handler function. - - * *eh_data* -- pointer to user data passed to *ehfun* every time - it is called. - - **Return value:** - - * *ARK_SUCCESS* if successful - - * *ARK_MEM_NULL* if the MRIStep memory is ``NULL`` - - * *ARK_ILL_INPUT* if an argument has an illegal value - - **Notes:** Error messages indicating that the MRIStep solver memory is - ``NULL`` will always be directed to ``stderr``. - - - .. c:function:: int MRIStepSetFixedStep(void* arkode_mem, sunrealtype hs) diff --git a/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst index 7e1065977a..41be870730 100644 --- a/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst @@ -271,10 +271,6 @@ Optional inputs for SPRKStep +-----------------------------------------------------+------------------------------------------+------------------------+ | Supply a pointer to a diagnostics output file | :c:func:`SPRKStepSetDiagnostics()` | ``NULL`` | +-----------------------------------------------------+------------------------------------------+------------------------+ - | Supply a pointer to an error output file | :c:func:`SPRKStepSetErrFile()` | ``stderr`` | - +-----------------------------------------------------+------------------------------------------+------------------------+ - | Supply a custom error handler function | :c:func:`SPRKStepSetErrHandlerFn()` | internal fn | - +-----------------------------------------------------+------------------------------------------+------------------------+ | Set fixed step size (required user input) | :c:func:`SPRKStepSetFixedStep()` | user defined | +-----------------------------------------------------+------------------------------------------+------------------------+ | Maximum no. of internal steps before *tout* | :c:func:`SPRKStepSetMaxNumSteps()` | 500 | @@ -379,51 +375,6 @@ Optional inputs for SPRKStep obtained by the integrator are returned at the ends of the time interval. -.. c:function:: int SPRKStepSetErrFile(void* arkode_mem, FILE* errfp) - - Specifies a pointer to the file where all SPRKStep warning and error - messages will be written if the default internal error handling - function is used. - - The default value for *errfp* is ``stderr``. - - Passing a ``NULL`` value disables all future error message output - (except for the case wherein the SPRKStep memory pointer is - ``NULL``). This use of the function is strongly discouraged. - - :param arkode_mem: pointer to the SPRKStep memory block. - :param errfp: pointer to the output file. - - :retval ARK_SUCCESS: if successful - :retval ARK_MEM_NULL: if the SPRKStep memory is ``NULL`` - :retval ARK_ILL_INPUT: if an argument has an illegal value - - .. note:: - - If used, this routine should be called before any other - optional input functions, in order to take effect for subsequent - error messages. - - -.. c:function:: int SPRKStepSetErrHandlerFn(void* arkode_mem, ARKErrHandlerFn ehfun, void* eh_data) - - Specifies the optional user-defined function to be used - in handling error messages. - - :param arkode_mem: pointer to the SPRKStep memory block. - :param ehfun: name of user-supplied error handler function. - :param eh_data: pointer to user data passed to *ehfun* every time it is called. - - :retval ARK_SUCCESS: if successful - :retval ARK_MEM_NULL: if the SPRKStep memory is ``NULL`` - :retval ARK_ILL_INPUT: if an argument has an illegal value - - .. note:: - - Error messages indicating that the SPRKStep solver memory is - ``NULL`` will always be directed to ``stderr``. - - .. c:function:: int SPRKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed) Sets the time step size used within SPRKStep. diff --git a/doc/arkode/guide/source/Usage/User_supplied.rst b/doc/arkode/guide/source/Usage/User_supplied.rst index 3dacbd8a88..9838497c3f 100644 --- a/doc/arkode/guide/source/Usage/User_supplied.rst +++ b/doc/arkode/guide/source/Usage/User_supplied.rst @@ -125,46 +125,6 @@ ODE system to MRIStep: - -.. _ARKODE.Usage.ErrorHandler: - -Error message handler function --------------------------------------- - -As an alternative to the default behavior of directing error and -warning messages to the file pointed to by `errfp` (see -:c:func:`ARKStepSetErrFile`, :c:func:`ERKStepSetErrFile`, and -:c:func:`MRIStepSetErrFile`), the user may provide a function of type -:c:type:`ARKErrHandlerFn` to process any such messages. - - - -.. c:type:: void (*ARKErrHandlerFn)(int error_code, const char* module, const char* function, char* msg, void* user_data) - - This function processes error and warning messages from - ARKODE and its sub-modules. - - **Arguments:** - * *error_code* -- the error code. - * *module* -- the name of the ARKODE module reporting the error. - * *function* -- the name of the function in which the error occurred. - * *msg* -- the error message. - * *user_data* -- a pointer to user data, the same as the - *eh_data* parameter that was passed to :c:func:`ARKStepSetErrHandlerFn`, - :c:func:`ERKStepSetErrHandlerFn`, or :c:func:`MRIStepSetErrHandlerFn`. - - **Return value:** - An *ARKErrHandlerFn* function has no return value. - - **Notes:** - *error_code* is negative for errors and positive - (*ARK_WARNING*) for warnings. If a function that returns a - pointer to memory encounters an error, it sets *error_code* to - 0. - - - - .. _ARKODE.Usage.ErrorWeight: Error weight function diff --git a/include/arkode/arkode.h b/include/arkode/arkode.h index c7b4371505..8cd0a1548d 100644 --- a/include/arkode/arkode.h +++ b/include/arkode/arkode.h @@ -153,9 +153,6 @@ typedef int (*ARKEwtFn)(N_Vector y, N_Vector ewt, void* user_data); typedef int (*ARKRwtFn)(N_Vector y, N_Vector rwt, void* user_data); -typedef void (*ARKErrHandlerFn)(int error_code, const char* module, - const char* function, char* msg, void* user_data); - typedef int (*ARKAdaptFn)(N_Vector y, sunrealtype t, sunrealtype h1, sunrealtype h2, sunrealtype h3, sunrealtype e1, sunrealtype e2, sunrealtype e3, int q, int p, diff --git a/include/arkode/arkode_arkstep.h b/include/arkode/arkode_arkstep.h index 299b69fb85..346d522947 100644 --- a/include/arkode/arkode_arkstep.h +++ b/include/arkode/arkode_arkstep.h @@ -174,9 +174,6 @@ SUNDIALS_EXPORT int ARKStepSetMaxNumConstrFails(void* arkode_mem, int maxfails); SUNDIALS_EXPORT int ARKStepSetRootDirection(void* arkode_mem, int* rootdir); SUNDIALS_EXPORT int ARKStepSetNoInactiveRootWarn(void* arkode_mem); -SUNDIALS_EXPORT int ARKStepSetErrHandlerFn(void* arkode_mem, - ARKErrHandlerFn ehfun, void* eh_data); -SUNDIALS_EXPORT int ARKStepSetErrFile(void* arkode_mem, FILE* errfp); SUNDIALS_EXPORT int ARKStepSetUserData(void* arkode_mem, void* user_data); SUNDIALS_EXPORT int ARKStepSetPostprocessStepFn(void* arkode_mem, diff --git a/include/arkode/arkode_erkstep.h b/include/arkode/arkode_erkstep.h index 1dbd1f37a9..62189c9e6b 100644 --- a/include/arkode/arkode_erkstep.h +++ b/include/arkode/arkode_erkstep.h @@ -118,9 +118,6 @@ SUNDIALS_EXPORT int ERKStepSetMaxNumConstrFails(void* arkode_mem, int maxfails); SUNDIALS_EXPORT int ERKStepSetRootDirection(void* arkode_mem, int* rootdir); SUNDIALS_EXPORT int ERKStepSetNoInactiveRootWarn(void* arkode_mem); -SUNDIALS_EXPORT int ERKStepSetErrHandlerFn(void* arkode_mem, - ARKErrHandlerFn ehfun, void* eh_data); -SUNDIALS_EXPORT int ERKStepSetErrFile(void* arkode_mem, FILE* errfp); SUNDIALS_EXPORT int ERKStepSetUserData(void* arkode_mem, void* user_data); SUNDIALS_EXPORT int ERKStepSetPostprocessStepFn(void* arkode_mem, diff --git a/include/arkode/arkode_mristep.h b/include/arkode/arkode_mristep.h index 27f21b2280..7bf96809f6 100644 --- a/include/arkode/arkode_mristep.h +++ b/include/arkode/arkode_mristep.h @@ -186,9 +186,6 @@ SUNDIALS_EXPORT int MRIStepClearStopTime(void* arkode_mem); SUNDIALS_EXPORT int MRIStepSetFixedStep(void* arkode_mem, sunrealtype hsfixed); SUNDIALS_EXPORT int MRIStepSetRootDirection(void* arkode_mem, int* rootdir); SUNDIALS_EXPORT int MRIStepSetNoInactiveRootWarn(void* arkode_mem); -SUNDIALS_EXPORT int MRIStepSetErrHandlerFn(void* arkode_mem, - ARKErrHandlerFn ehfun, void* eh_data); -SUNDIALS_EXPORT int MRIStepSetErrFile(void* arkode_mem, FILE* errfp); SUNDIALS_EXPORT int MRIStepSetUserData(void* arkode_mem, void* user_data); SUNDIALS_EXPORT int MRIStepSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep); diff --git a/include/arkode/arkode_sprkstep.h b/include/arkode/arkode_sprkstep.h index c489aa82db..12b1b0d1b9 100644 --- a/include/arkode/arkode_sprkstep.h +++ b/include/arkode/arkode_sprkstep.h @@ -68,9 +68,6 @@ SUNDIALS_EXPORT int SPRKStepSetInterpolantDegree(void* arkode_mem, int degree); SUNDIALS_EXPORT int SPRKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps); SUNDIALS_EXPORT int SPRKStepSetStopTime(void* arkode_mem, sunrealtype tstop); SUNDIALS_EXPORT int SPRKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed); -SUNDIALS_EXPORT int SPRKStepSetErrHandlerFn(void* arkode_mem, - ARKErrHandlerFn ehfun, void* eh_data); -SUNDIALS_EXPORT int SPRKStepSetErrFile(void* arkode_mem, FILE* errfp); SUNDIALS_EXPORT int SPRKStepSetUserData(void* arkode_mem, void* user_data); SUNDIALS_EXPORT int SPRKStepSetPostprocessStepFn(void* arkode_mem, diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index dd28e2703d..b4c3bd9608 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -20,6 +20,8 @@ /*=============================================================== Import Header Files ===============================================================*/ +#include "arkode/arkode.h" + #include #include #include @@ -31,6 +33,8 @@ #include "arkode_impl.h" #include "arkode_interp_impl.h" +#include "sundials/priv/sundials_errors_impl.h" +#include "sundials/sundials_logger.h" #include "sundials_utils.h" /*=============================================================== @@ -54,7 +58,7 @@ ARKodeMem arkCreate(SUNContext sunctx) if (!sunctx) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE", "arkCreate", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_SUNCTX); return (NULL); } @@ -63,7 +67,7 @@ ARKodeMem arkCreate(SUNContext sunctx) ark_mem = (ARKodeMem)malloc(sizeof(struct ARKodeMemRec)); if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_FAIL, "ARKODE", "arkCreate", + arkProcessError(NULL, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_ARKMEM_FAIL); return (NULL); } @@ -126,7 +130,7 @@ ARKodeMem arkCreate(SUNContext sunctx) ark_mem->hadapt_mem = arkAdaptInit(); if (ark_mem->hadapt_mem == NULL) { - arkProcessError(NULL, ARK_MEM_FAIL, "ARKODE", "arkCreate", + arkProcessError(NULL, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Allocation of step adaptivity structure failed"); return (NULL); } @@ -137,7 +141,7 @@ ARKodeMem arkCreate(SUNContext sunctx) ark_mem->hadapt_mem->hcontroller = SUNAdaptController_PID(sunctx); if (ark_mem->hadapt_mem->hcontroller == NULL) { - arkProcessError(NULL, ARK_MEM_FAIL, "ARKODE", "arkCreate", + arkProcessError(NULL, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Allocation of step controller object failed"); return (NULL); } @@ -173,7 +177,7 @@ ARKodeMem arkCreate(SUNContext sunctx) iret = arkSetDefaults(ark_mem); if (iret != ARK_SUCCESS) { - arkProcessError(NULL, 0, "ARKODE", "arkCreate", + arkProcessError(NULL, 0, __LINE__, __func__, __FILE__, "Error setting default solver options"); return (NULL); } @@ -229,14 +233,15 @@ int arkResize(ARKodeMem ark_mem, N_Vector y0, sunrealtype hscale, /* Check ark_mem */ if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkResize", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } /* Check if ark_mem was allocated */ if (ark_mem->MallocDone == SUNFALSE) { - arkProcessError(ark_mem, ARK_NO_MALLOC, "ARKODE", "arkResize", + arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, MSG_ARK_NO_MALLOC); return (ARK_NO_MALLOC); } @@ -244,7 +249,7 @@ int arkResize(ARKodeMem ark_mem, N_Vector y0, sunrealtype hscale, /* Check for legal input parameters */ if (y0 == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkResize", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_Y0); return (ARK_ILL_INPUT); } @@ -288,7 +293,7 @@ int arkResize(ARKodeMem ark_mem, N_Vector y0, sunrealtype hscale, y0); if (!resizeOK) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkResize", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Unable to resize vector"); return (ARK_MEM_FAIL); } @@ -300,7 +305,7 @@ int arkResize(ARKodeMem ark_mem, N_Vector y0, sunrealtype hscale, lrw_diff, liw_diff, y0); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE", "arkResize", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Interpolation module resize failure"); return (retval); } @@ -345,25 +350,25 @@ int arkSStolerances(ARKodeMem ark_mem, sunrealtype reltol, sunrealtype abstol) /* Check inputs */ if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSStolerances", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } if (ark_mem->MallocDone == SUNFALSE) { - arkProcessError(ark_mem, ARK_NO_MALLOC, "ARKODE", "arkSStolerances", + arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, MSG_ARK_NO_MALLOC); return (ARK_NO_MALLOC); } if (reltol < ZERO) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkSStolerances", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_RELTOL); return (ARK_ILL_INPUT); } if (abstol < ZERO) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkSStolerances", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_ABSTOL); return (ARK_ILL_INPUT); } @@ -392,38 +397,38 @@ int arkSVtolerances(ARKodeMem ark_mem, sunrealtype reltol, N_Vector abstol) /* Check inputs */ if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSVtolerances", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } if (ark_mem->MallocDone == SUNFALSE) { - arkProcessError(ark_mem, ARK_NO_MALLOC, "ARKODE", "arkSVtolerances", + arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, MSG_ARK_NO_MALLOC); return (ARK_NO_MALLOC); } if (reltol < ZERO) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkSVtolerances", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_RELTOL); return (ARK_ILL_INPUT); } if (abstol == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkSVtolerances", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_ABSTOL); return (ARK_ILL_INPUT); } if (abstol->ops->nvmin == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkSVtolerances", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Missing N_VMin routine from N_Vector"); return (ARK_ILL_INPUT); } abstolmin = N_VMin(abstol); if (abstolmin < ZERO) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkSVtolerances", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_ABSTOL); return (ARK_ILL_INPUT); } @@ -436,7 +441,7 @@ int arkSVtolerances(ARKodeMem ark_mem, sunrealtype reltol, N_Vector abstol) { if (!arkAllocVec(ark_mem, ark_mem->ewt, &(ark_mem->Vabstol))) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkSVtolerances", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_ARKMEM_FAIL); return (ARK_ILL_INPUT); } @@ -458,13 +463,13 @@ int arkWFtolerances(ARKodeMem ark_mem, ARKEwtFn efun) { if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkWFtolerances", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } if (ark_mem->MallocDone == SUNFALSE) { - arkProcessError(ark_mem, ARK_NO_MALLOC, "ARKODE", "arkWFtolerances", + arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, MSG_ARK_NO_MALLOC); return (ARK_NO_MALLOC); } @@ -505,19 +510,19 @@ int arkResStolerance(ARKodeMem ark_mem, sunrealtype rabstol) /* Check inputs */ if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkResStolerances", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } if (ark_mem->MallocDone == SUNFALSE) { - arkProcessError(ark_mem, ARK_NO_MALLOC, "ARKODE", "arkResStolerances", + arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, MSG_ARK_NO_MALLOC); return (ARK_NO_MALLOC); } if (rabstol < ZERO) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkResStolerances", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_RABSTOL); return (ARK_ILL_INPUT); } @@ -531,7 +536,7 @@ int arkResStolerance(ARKodeMem ark_mem, sunrealtype rabstol) ark_mem->rwt = NULL; if (!arkAllocVec(ark_mem, ark_mem->ewt, &(ark_mem->rwt))) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkResStolerances", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_ARKMEM_FAIL); return (ARK_ILL_INPUT); } @@ -558,32 +563,32 @@ int arkResVtolerance(ARKodeMem ark_mem, N_Vector rabstol) /* Check inputs */ if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkResVtolerance", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } if (ark_mem->MallocDone == SUNFALSE) { - arkProcessError(ark_mem, ARK_NO_MALLOC, "ARKODE", "arkResVtolerance", + arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, MSG_ARK_NO_MALLOC); return (ARK_NO_MALLOC); } if (rabstol == NULL) { - arkProcessError(ark_mem, ARK_NO_MALLOC, "ARKODE", "arkResVtolerance", + arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, MSG_ARK_NULL_RABSTOL); return (ARK_NO_MALLOC); } if (rabstol->ops->nvmin == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkResVtolerance", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Missing N_VMin routine from N_Vector"); return (ARK_ILL_INPUT); } rabstolmin = N_VMin(rabstol); if (rabstolmin < ZERO) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkResVtolerance", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_RABSTOL); return (ARK_ILL_INPUT); } @@ -597,7 +602,7 @@ int arkResVtolerance(ARKodeMem ark_mem, N_Vector rabstol) ark_mem->rwt = NULL; if (!arkAllocVec(ark_mem, ark_mem->ewt, &(ark_mem->rwt))) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkResVtolerances", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_ARKMEM_FAIL); return (ARK_ILL_INPUT); } @@ -609,7 +614,7 @@ int arkResVtolerance(ARKodeMem ark_mem, N_Vector rabstol) { if (!arkAllocVec(ark_mem, ark_mem->rwt, &(ark_mem->VRabstol))) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkResStolerances", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_ARKMEM_FAIL); return (ARK_ILL_INPUT); } @@ -630,13 +635,13 @@ int arkResFtolerance(ARKodeMem ark_mem, ARKRwtFn rfun) { if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkResFtolerances", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } if (ark_mem->MallocDone == SUNFALSE) { - arkProcessError(ark_mem, ARK_NO_MALLOC, "ARKODE", "arkResFtolerances", + arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, MSG_ARK_NO_MALLOC); return (ARK_NO_MALLOC); } @@ -647,7 +652,7 @@ int arkResFtolerance(ARKodeMem ark_mem, ARKRwtFn rfun) ark_mem->rwt = NULL; if (!arkAllocVec(ark_mem, ark_mem->ewt, &(ark_mem->rwt))) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkResFtolerances", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_ARKMEM_FAIL); return (ARK_ILL_INPUT); } @@ -702,14 +707,15 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, /* Check if ark_mem exists */ if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkEvolve", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } /* Check if ark_mem was allocated */ if (ark_mem->MallocDone == SUNFALSE) { - arkProcessError(ark_mem, ARK_NO_MALLOC, "ARKODE", "arkEvolve", + arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, MSG_ARK_NO_MALLOC); return (ARK_NO_MALLOC); } @@ -717,7 +723,7 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, /* Check for yout != NULL */ if ((ark_mem->ycur = yout) == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkEvolve", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_YOUT_NULL); return (ARK_ILL_INPUT); } @@ -725,7 +731,7 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, /* Check for tret != NULL */ if (tret == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkEvolve", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_TRET_NULL); return (ARK_ILL_INPUT); } @@ -733,7 +739,7 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, /* Check for valid itask */ if ((itask != ARK_NORMAL) && (itask != ARK_ONE_STEP)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkEvolve", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_ITASK); return (ARK_ILL_INPUT); } @@ -797,12 +803,12 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, { if (ark_mem->itol == ARK_WF) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkEvolve", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_EWT_NOW_FAIL, ark_mem->tcur); } else { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkEvolve", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_EWT_NOW_BAD, ark_mem->tcur); } @@ -819,13 +825,13 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, { if (ark_mem->itol == ARK_WF) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkEvolve", - MSG_ARK_RWT_NOW_FAIL, ark_mem->tcur); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, MSG_ARK_RWT_NOW_FAIL, ark_mem->tcur); } else { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkEvolve", - MSG_ARK_RWT_NOW_BAD, ark_mem->tcur); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, MSG_ARK_RWT_NOW_BAD, ark_mem->tcur); } istate = ARK_ILL_INPUT; @@ -839,7 +845,7 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, /* Check for too many steps */ if ((ark_mem->mxstep > 0) && (nstloc >= ark_mem->mxstep)) { - arkProcessError(ark_mem, ARK_TOO_MUCH_WORK, "ARKODE", "arkEvolve", + arkProcessError(ark_mem, ARK_TOO_MUCH_WORK, __LINE__, __func__, __FILE__, MSG_ARK_MAX_STEPS, ark_mem->tcur); istate = ARK_TOO_MUCH_WORK; ark_mem->tretlast = *tret = ark_mem->tcur; @@ -852,7 +858,7 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, ark_mem->tolsf = ark_mem->uround * nrm; if (ark_mem->tolsf > ONE) { - arkProcessError(ark_mem, ARK_TOO_MUCH_ACC, "ARKODE", "arkEvolve", + arkProcessError(ark_mem, ARK_TOO_MUCH_ACC, __LINE__, __func__, __FILE__, MSG_ARK_TOO_MUCH_ACC, ark_mem->tcur); istate = ARK_TOO_MUCH_ACC; ark_mem->tretlast = *tret = ark_mem->tcur; @@ -868,12 +874,12 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, ark_mem->nhnil++; if (ark_mem->nhnil <= ark_mem->mxhnil) { - arkProcessError(ark_mem, ARK_WARNING, "ARKODE", "arkEvolve", + arkProcessError(ark_mem, ARK_WARNING, __LINE__, __func__, __FILE__, MSG_ARK_HNIL, ark_mem->tcur, ark_mem->h); } if (ark_mem->nhnil == ark_mem->mxhnil) { - arkProcessError(ark_mem, ARK_WARNING, "ARKODE", "arkEvolve", + arkProcessError(ark_mem, ARK_WARNING, __LINE__, __func__, __FILE__, MSG_ARK_HNIL_DONE); } } @@ -1018,7 +1024,7 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, } else if (retval == ARK_RTFUNC_FAIL) { /* g failed */ - arkProcessError(ark_mem, ARK_RTFUNC_FAIL, "ARKODE", "arkEvolve", + arkProcessError(ark_mem, ARK_RTFUNC_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_RTFUNC_FAILED, ark_mem->root_mem->tlo); istate = ARK_RTFUNC_FAIL; break; @@ -1041,7 +1047,7 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, } if ((ark_mem->root_mem->mxgnull > 0) && inactive_roots) { - arkProcessError(ark_mem, ARK_WARNING, "ARKODE", "arkEvolve", + arkProcessError(ark_mem, ARK_WARNING, __LINE__, __func__, __FILE__, MSG_ARK_INACTIVE_ROOTS); } } @@ -1065,7 +1071,7 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, retval = arkGetDky(ark_mem, ark_mem->tstop, 0, yout); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE", "arkEvolve", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, MSG_ARK_INTERPOLATION_FAIL, ark_mem->tstop); istate = retval; break; @@ -1094,7 +1100,7 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, retval = arkGetDky(ark_mem, tout, 0, yout); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE", "arkEvolve", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, MSG_ARK_INTERPOLATION_FAIL, tout); istate = retval; break; @@ -1148,18 +1154,19 @@ int arkGetDky(ARKodeMem ark_mem, sunrealtype t, int k, N_Vector dky) /* Check all inputs for legality */ if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetDky", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } if (dky == NULL) { - arkProcessError(ark_mem, ARK_BAD_DKY, "ARKODE", "arkGetDky", + arkProcessError(ark_mem, ARK_BAD_DKY, __LINE__, __func__, __FILE__, MSG_ARK_NULL_DKY); return (ARK_BAD_DKY); } if (ark_mem->interp == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE", "arkGetDky", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "Missing interpolation structure"); return (ARK_MEM_NULL); } @@ -1172,8 +1179,9 @@ int arkGetDky(ARKodeMem ark_mem, sunrealtype t, int k, N_Vector dky) tn1 = ark_mem->tcur + tfuzz; if ((t - tp) * (t - tn1) > ZERO) { - arkProcessError(ark_mem, ARK_BAD_T, "ARKODE", "arkGetDky", MSG_ARK_BAD_T, t, - ark_mem->tcur - ark_mem->hold, ark_mem->tcur); + arkProcessError(ark_mem, ARK_BAD_T, __LINE__, __func__, __FILE__, + MSG_ARK_BAD_T, t, ark_mem->tcur - ark_mem->hold, + ark_mem->tcur); return (ARK_BAD_T); } @@ -1183,7 +1191,7 @@ int arkGetDky(ARKodeMem ark_mem, sunrealtype t, int k, N_Vector dky) ARK_INTERP_MAX_DEGREE, dky); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE", "arkGetDky", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Error calling arkInterpEvaluate"); return (retval); } @@ -1300,33 +1308,6 @@ int arkRwtSet(N_Vector y, N_Vector weight, void* data) return (flag); } -/*--------------------------------------------------------------- - arkErrHandler is the default error handling function. - It sends the error message to the stream pointed to by ark_errfp - ---------------------------------------------------------------*/ -void arkErrHandler(int error_code, const char* module, const char* function, - char* msg, void* data) -{ - ARKodeMem ark_mem; - char err_type[10]; - - /* data points to ark_mem here */ - ark_mem = (ARKodeMem)data; - - if (error_code == ARK_WARNING) { sprintf(err_type, "WARNING"); } - else { sprintf(err_type, "ERROR"); } - -#ifndef NO_FPRINTF_OUTPUT - if (ark_mem->errfp != NULL) - { - fprintf(ark_mem->errfp, "\n[%s %s] %s\n", module, err_type, function); - fprintf(ark_mem->errfp, " %s\n\n", msg); - } -#endif - - return; -} - /*=============================================================== Private Helper Functions ===============================================================*/ @@ -1336,8 +1317,7 @@ void arkErrHandler(int error_code, const char* module, const char* function, arkInit allocates and initializes memory for a problem. All inputs are checked for errors. If any error occurs during - initialization, it is reported to the file whose file pointer - is errfp and an error flag is returned. Otherwise, it returns + initialization, an error flag is returned. Otherwise, it returns ARK_SUCCESS. This routine should be called by an ARKODE timestepper module (not by the user). This routine must be called prior to calling arkEvolve to evolve the problem. The @@ -1353,14 +1333,16 @@ int arkInit(ARKodeMem ark_mem, sunrealtype t0, N_Vector y0, int init_type) /* Check ark_mem */ if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkInit", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } /* Check for legal input parameters */ if (y0 == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkInit", MSG_ARK_NULL_Y0); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + MSG_ARK_NULL_Y0); return (ARK_ILL_INPUT); } @@ -1377,7 +1359,7 @@ int arkInit(ARKodeMem ark_mem, sunrealtype t0, N_Vector y0, int init_type) stepperOK = arkCheckTimestepper(ark_mem); if (!stepperOK) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkInit", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Time stepper module is missing required functionality"); return (ARK_ILL_INPUT); } @@ -1386,7 +1368,7 @@ int arkInit(ARKodeMem ark_mem, sunrealtype t0, N_Vector y0, int init_type) nvectorOK = arkCheckNvector(y0); if (!nvectorOK) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkInit", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_NVECTOR); return (ARK_ILL_INPUT); } @@ -1405,7 +1387,7 @@ int arkInit(ARKodeMem ark_mem, sunrealtype t0, N_Vector y0, int init_type) allocOK = arkAllocVectors(ark_mem, y0); if (!allocOK) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkInit", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_MEM_FAIL); return (ARK_MEM_FAIL); } @@ -1416,7 +1398,7 @@ int arkInit(ARKodeMem ark_mem, sunrealtype t0, N_Vector y0, int init_type) ark_mem->interp = arkInterpCreate_Hermite(ark_mem, ARK_INTERP_MAX_DEGREE); if (ark_mem->interp == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkInit", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Unable to allocate interpolation module"); return (ARK_MEM_FAIL); } @@ -1463,7 +1445,7 @@ int arkInit(ARKodeMem ark_mem, sunrealtype t0, N_Vector y0, int init_type) retval = SUNAdaptController_Reset(ark_mem->hadapt_mem->hcontroller); if (retval != SUNADAPTCONTROLLER_SUCCESS) { - arkProcessError(ark_mem, ARK_CONTROLLER_ERR, "ARKODE", "arkInit", + arkProcessError(ark_mem, ARK_CONTROLLER_ERR, __LINE__, __func__, __FILE__, "Unable to reset error controller object"); return (ARK_CONTROLLER_ERR); } @@ -1739,7 +1721,7 @@ sunbooleantype arkResizeVec(ARKodeMem ark_mem, ARKVecResizeFn resize, *v = N_VClone(tmpl); if (*v == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkResizeVec", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Unable to clone vector"); return (SUNFALSE); } @@ -1748,7 +1730,7 @@ sunbooleantype arkResizeVec(ARKodeMem ark_mem, ARKVecResizeFn resize, { if (resize(*v, tmpl, resize_data)) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkResizeVec", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_RESIZE_FAIL); return (SUNFALSE); } @@ -1972,14 +1954,14 @@ int arkInitialSetup(ARKodeMem ark_mem, sunrealtype tout) /* Set up the time stepper module */ if (ark_mem->step_init == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkInitialSetup", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Time stepper module is missing"); return (ARK_ILL_INPUT); } retval = ark_mem->step_init(ark_mem, ark_mem->init_type); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE", "arkInitialSetup", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Error in initialization of time stepper module"); return (retval); } @@ -1987,7 +1969,7 @@ int arkInitialSetup(ARKodeMem ark_mem, sunrealtype tout) /* Check that user has supplied an initial step size if fixedstep mode is on */ if ((ark_mem->fixedstep) && (ark_mem->hin == ZERO)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkInitialSetup", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Fixed step mode enabled, but no step size set"); return (ARK_ILL_INPUT); } @@ -1996,15 +1978,15 @@ int arkInitialSetup(ARKodeMem ark_mem, sunrealtype tout) ensure that N_VMin is available */ if ((!ark_mem->user_efun) && (ark_mem->atolmin0) && (!ark_mem->yn->ops->nvmin)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkInitialSetup", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "N_VMin unimplemented (required by error-weight function)"); return (ARK_ILL_INPUT); } if ((!ark_mem->user_rfun) && (!ark_mem->rwt_is_ewt) && (ark_mem->Ratolmin0) && (!ark_mem->yn->ops->nvmin)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", - "arkInitialSetup", "N_VMin unimplemented (required by residual-weight function)"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "N_VMin unimplemented (required by residual-weight function)"); return (ARK_ILL_INPUT); } @@ -2014,7 +1996,7 @@ int arkInitialSetup(ARKodeMem ark_mem, sunrealtype tout) htmp = (ark_mem->h == ZERO) ? tout - ark_mem->tcur : ark_mem->h; if ((ark_mem->tstop - ark_mem->tcur) * htmp <= ZERO) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkInitialSetup", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_TSTOP, ark_mem->tstop, ark_mem->tcur); return (ARK_ILL_INPUT); } @@ -2026,7 +2008,7 @@ int arkInitialSetup(ARKodeMem ark_mem, sunrealtype tout) conOK = N_VConstrMask(ark_mem->constraints, ark_mem->yn, ark_mem->tempv1); if (!conOK) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkInitialSetup", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_Y0_FAIL_CONSTR); return (ARK_ILL_INPUT); } @@ -2038,12 +2020,12 @@ int arkInitialSetup(ARKodeMem ark_mem, sunrealtype tout) { if (ark_mem->itol == ARK_WF) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkInitialSetup", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_EWT_FAIL); } else { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkInitialSetup", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_EWT); } return (ARK_ILL_INPUT); @@ -2061,12 +2043,12 @@ int arkInitialSetup(ARKodeMem ark_mem, sunrealtype tout) { if (ark_mem->itol == ARK_WF) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkInitialSetup", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_RWT_FAIL); } else { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkInitialSetup", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_RWT); } return (ARK_ILL_INPUT); @@ -2088,14 +2070,14 @@ int arkInitialSetup(ARKodeMem ark_mem, sunrealtype tout) { if (!ark_mem->step_fullrhs) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkInitialSetup", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_MISSING_FULLRHS); return ARK_ILL_INPUT; } if (!arkAllocVec(ark_mem, ark_mem->yn, &ark_mem->fn)) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkInitialSetup", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_MEM_FAIL); return (ARK_MEM_FAIL); } @@ -2111,7 +2093,7 @@ int arkInitialSetup(ARKodeMem ark_mem, sunrealtype tout) ark_mem->h = ark_mem->hin; if ((ark_mem->h != ZERO) && ((tout - ark_mem->tcur) * ark_mem->h < ZERO)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkInitialSetup", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_H0); return (ARK_ILL_INPUT); } @@ -2195,7 +2177,7 @@ int arkInitialSetup(ARKodeMem ark_mem, sunrealtype tout) if (retval == ARK_RTFUNC_FAIL) { - arkProcessError(ark_mem, ARK_RTFUNC_FAIL, "ARKODE", "arkRootCheck1", + arkProcessError(ark_mem, ARK_RTFUNC_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_RTFUNC_FAILED, ark_mem->tcur); return (ARK_RTFUNC_FAIL); } @@ -2247,8 +2229,8 @@ int arkStopTests(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, ark_mem->fn, ARK_FULLRHS_END); if (retval != 0) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE", "arkStopTests", - MSG_ARK_RHSFUNC_FAILED); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, + __FILE__, MSG_ARK_RHSFUNC_FAILED); *ier = ARK_RHSFUNC_FAIL; return (1); } @@ -2259,14 +2241,14 @@ int arkStopTests(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, if (retval == CLOSERT) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkStopTests", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_CLOSE_ROOTS, ark_mem->root_mem->tlo); *ier = ARK_ILL_INPUT; return (1); } else if (retval == ARK_RTFUNC_FAIL) { - arkProcessError(ark_mem, ARK_RTFUNC_FAIL, "ARKODE", "arkStopTests", + arkProcessError(ark_mem, ARK_RTFUNC_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_RTFUNC_FAILED, ark_mem->root_mem->tlo); *ier = ARK_RTFUNC_FAIL; return (1); @@ -2304,7 +2286,7 @@ int arkStopTests(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, } else if (retval == ARK_RTFUNC_FAIL) { /* g failed */ - arkProcessError(ark_mem, ARK_RTFUNC_FAIL, "ARKODE", "arkStopTests", + arkProcessError(ark_mem, ARK_RTFUNC_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_RTFUNC_FAILED, ark_mem->root_mem->tlo); *ier = ARK_RTFUNC_FAIL; return (1); @@ -2328,7 +2310,7 @@ int arkStopTests(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, *ier = arkGetDky(ark_mem, ark_mem->tstop, 0, yout); if (*ier != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkStopTests", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_TSTOP, ark_mem->tstop, ark_mem->tcur); *ier = ARK_ILL_INPUT; return (1); @@ -2358,7 +2340,7 @@ int arkStopTests(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, *ier = arkGetDky(ark_mem, tout, 0, yout); if (*ier != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkStopTests", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_TOUT, tout); *ier = ARK_ILL_INPUT; return (1); @@ -2584,7 +2566,7 @@ int arkYddNorm(ARKodeMem ark_mem, sunrealtype hg, sunrealtype* yddnrm) if (ark_mem->interp == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE", "arkYddNorm", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "Missing interpolation structure"); return (ARK_MEM_NULL); } @@ -2683,7 +2665,7 @@ int arkCompleteStep(ARKodeMem ark_mem, sunrealtype dsm) ark_mem->h, dsm); if (retval != SUNADAPTCONTROLLER_SUCCESS) { - arkProcessError(ark_mem, ARK_CONTROLLER_ERR, "ARKODE", "arkCompleteStep", + arkProcessError(ark_mem, ARK_CONTROLLER_ERR, __LINE__, __func__, __FILE__, "Failure updating controller object"); return (ARK_CONTROLLER_ERR); } @@ -2717,107 +2699,107 @@ int arkHandleFailure(ARKodeMem ark_mem, int flag) switch (flag) { case ARK_ERR_FAILURE: - arkProcessError(ark_mem, ARK_ERR_FAILURE, "ARKODE", "ARKODE", + arkProcessError(ark_mem, ARK_ERR_FAILURE, __LINE__, __func__, __FILE__, MSG_ARK_ERR_FAILS, ark_mem->tcur, ark_mem->h); break; case ARK_CONV_FAILURE: - arkProcessError(ark_mem, ARK_CONV_FAILURE, "ARKODE", "ARKODE", + arkProcessError(ark_mem, ARK_CONV_FAILURE, __LINE__, __func__, __FILE__, MSG_ARK_CONV_FAILS, ark_mem->tcur, ark_mem->h); break; case ARK_LSETUP_FAIL: - arkProcessError(ark_mem, ARK_LSETUP_FAIL, "ARKODE", "ARKODE", + arkProcessError(ark_mem, ARK_LSETUP_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_SETUP_FAILED, ark_mem->tcur); break; case ARK_LSOLVE_FAIL: - arkProcessError(ark_mem, ARK_LSOLVE_FAIL, "ARKODE", "ARKODE", + arkProcessError(ark_mem, ARK_LSOLVE_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_SOLVE_FAILED, ark_mem->tcur); break; case ARK_RHSFUNC_FAIL: - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE", "ARKODE", + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_RHSFUNC_FAILED, ark_mem->tcur); break; case ARK_UNREC_RHSFUNC_ERR: - arkProcessError(ark_mem, ARK_UNREC_RHSFUNC_ERR, "ARKODE", "ARKODE", - MSG_ARK_RHSFUNC_UNREC, ark_mem->tcur); + arkProcessError(ark_mem, ARK_UNREC_RHSFUNC_ERR, __LINE__, __func__, + __FILE__, MSG_ARK_RHSFUNC_UNREC, ark_mem->tcur); break; case ARK_REPTD_RHSFUNC_ERR: - arkProcessError(ark_mem, ARK_REPTD_RHSFUNC_ERR, "ARKODE", "ARKODE", - MSG_ARK_RHSFUNC_REPTD, ark_mem->tcur); + arkProcessError(ark_mem, ARK_REPTD_RHSFUNC_ERR, __LINE__, __func__, + __FILE__, MSG_ARK_RHSFUNC_REPTD, ark_mem->tcur); break; case ARK_RTFUNC_FAIL: - arkProcessError(ark_mem, ARK_RTFUNC_FAIL, "ARKODE", "ARKODE", + arkProcessError(ark_mem, ARK_RTFUNC_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_RTFUNC_FAILED, ark_mem->tcur); break; case ARK_TOO_CLOSE: - arkProcessError(ark_mem, ARK_TOO_CLOSE, "ARKODE", "ARKODE", + arkProcessError(ark_mem, ARK_TOO_CLOSE, __LINE__, __func__, __FILE__, MSG_ARK_TOO_CLOSE); break; case ARK_CONSTR_FAIL: - arkProcessError(ark_mem, ARK_CONSTR_FAIL, "ARKODE", "ARKODE", + arkProcessError(ark_mem, ARK_CONSTR_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_FAILED_CONSTR, ark_mem->tcur); break; case ARK_MASSSOLVE_FAIL: - arkProcessError(ark_mem, ARK_MASSSOLVE_FAIL, "ARKODE", "ARKODE", + arkProcessError(ark_mem, ARK_MASSSOLVE_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_MASSSOLVE_FAIL); break; case ARK_NLS_SETUP_FAIL: - arkProcessError(ark_mem, ARK_NLS_SETUP_FAIL, "ARKODE", - "ARKODE", "At t = %Lg the nonlinear solver setup failed unrecoverably", + arkProcessError(ark_mem, ARK_NLS_SETUP_FAIL, __LINE__, __func__, + __FILE__, "At t = %Lg the nonlinear solver setup failed unrecoverably", (long double)ark_mem->tcur); break; case ARK_VECTOROP_ERR: - arkProcessError(ark_mem, ARK_VECTOROP_ERR, "ARKODE", "ARKODE", + arkProcessError(ark_mem, ARK_VECTOROP_ERR, __LINE__, __func__, __FILE__, MSG_ARK_VECTOROP_ERR, ark_mem->tcur); break; case ARK_INNERSTEP_FAIL: - arkProcessError(ark_mem, ARK_INNERSTEP_FAIL, "ARKODE", "ARKODE", + arkProcessError(ark_mem, ARK_INNERSTEP_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_INNERSTEP_FAILED, ark_mem->tcur); break; case ARK_NLS_OP_ERR: - arkProcessError(ark_mem, ARK_NLS_OP_ERR, "ARKODE", "ARKODE", + arkProcessError(ark_mem, ARK_NLS_OP_ERR, __LINE__, __func__, __FILE__, MSG_ARK_NLS_FAIL, ark_mem->tcur); break; case ARK_USER_PREDICT_FAIL: - arkProcessError(ark_mem, ARK_USER_PREDICT_FAIL, "ARKODE", "ARKODE", - MSG_ARK_USER_PREDICT_FAIL, ark_mem->tcur); + arkProcessError(ark_mem, ARK_USER_PREDICT_FAIL, __LINE__, __func__, + __FILE__, MSG_ARK_USER_PREDICT_FAIL, ark_mem->tcur); break; case ARK_POSTPROCESS_STEP_FAIL: - arkProcessError(ark_mem, ARK_POSTPROCESS_STEP_FAIL, "ARKODE", "ARKODE", - MSG_ARK_POSTPROCESS_STEP_FAIL, ark_mem->tcur); + arkProcessError(ark_mem, ARK_POSTPROCESS_STEP_FAIL, __LINE__, __func__, + __FILE__, MSG_ARK_POSTPROCESS_STEP_FAIL, ark_mem->tcur); break; case ARK_POSTPROCESS_STAGE_FAIL: - arkProcessError(ark_mem, ARK_POSTPROCESS_STAGE_FAIL, "ARKODE", "ARKODE", - MSG_ARK_POSTPROCESS_STAGE_FAIL, ark_mem->tcur); + arkProcessError(ark_mem, ARK_POSTPROCESS_STAGE_FAIL, __LINE__, __func__, + __FILE__, MSG_ARK_POSTPROCESS_STAGE_FAIL, ark_mem->tcur); break; case ARK_INTERP_FAIL: - arkProcessError(ark_mem, ARK_INTERP_FAIL, "ARKODE", "ARKODE", + arkProcessError(ark_mem, ARK_INTERP_FAIL, __LINE__, __func__, __FILE__, "At t = %Lg the interpolation module failed unrecoverably", (long double)ark_mem->tcur); break; case ARK_INVALID_TABLE: - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE", "ARKODE", + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, "ARKODE was provided an invalid method table"); break; case ARK_RELAX_FAIL: - arkProcessError(ark_mem, ARK_RELAX_FAIL, "ARKODE", "ARKODE", + arkProcessError(ark_mem, ARK_RELAX_FAIL, __LINE__, __func__, __FILE__, "At t = %Lg the relaxation module failed", (long double)ark_mem->tcur); break; case ARK_RELAX_MEM_NULL: - arkProcessError(ark_mem, ARK_RELAX_MEM_NULL, "ARKODE", "ARKODE", + arkProcessError(ark_mem, ARK_RELAX_MEM_NULL, __LINE__, __func__, __FILE__, "The ARKODE relaxation module memory is NULL"); break; case ARK_RELAX_FUNC_FAIL: - arkProcessError(ark_mem, ARK_RELAX_FUNC_FAIL, "ARKODE", "ARKODE", + arkProcessError(ark_mem, ARK_RELAX_FUNC_FAIL, __LINE__, __func__, __FILE__, "The relaxation function failed unrecoverably"); break; case ARK_RELAX_JAC_FAIL: - arkProcessError(ark_mem, ARK_RELAX_JAC_FAIL, "ARKODE", "ARKODE", + arkProcessError(ark_mem, ARK_RELAX_JAC_FAIL, __LINE__, __func__, __FILE__, "The relaxation Jacobian failed unrecoverably"); break; default: /* This return should never happen */ - arkProcessError(ark_mem, ARK_UNRECOGNIZED_ERROR, "ARKODE", "ARKODE", + arkProcessError(ark_mem, ARK_UNRECOGNIZED_ERROR, __LINE__, __func__, __FILE__, "ARKODE encountered an unrecognized error. Please report " "this to the Sundials developers at " "sundials-users@llnl.gov"); @@ -2968,13 +2950,13 @@ int arkPredict_MaximumOrder(ARKodeMem ark_mem, sunrealtype tau, N_Vector yguess) /* verify that ark_mem and interpolation structure are provided */ if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkPredict_MaximumOrder", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "ARKodeMem structure is NULL"); return (ARK_MEM_NULL); } if (ark_mem->interp == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE", "arkPredict_MaximumOrder", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "ARKodeInterpMem structure is NULL"); return (ARK_MEM_NULL); } @@ -3001,13 +2983,13 @@ int arkPredict_VariableOrder(ARKodeMem ark_mem, sunrealtype tau, N_Vector yguess /* verify that ark_mem and interpolation structure are provided */ if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkPredict_VariableOrder", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "ARKodeMem structure is NULL"); return (ARK_MEM_NULL); } if (ark_mem->interp == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE", "arkPredict_VariableOrder", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "ARKodeInterpMem structure is NULL"); return (ARK_MEM_NULL); } @@ -3038,13 +3020,13 @@ int arkPredict_CutoffOrder(ARKodeMem ark_mem, sunrealtype tau, N_Vector yguess) /* verify that ark_mem and interpolation structure are provided */ if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkPredict_CutoffOrder", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "ARKodeMem structure is NULL"); return (ARK_MEM_NULL); } if (ark_mem->interp == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE", "arkPredict_CutoffOrder", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "ARKodeInterpMem structure is NULL"); return (ARK_MEM_NULL); } @@ -3079,13 +3061,13 @@ int arkPredict_Bootstrap(ARKodeMem ark_mem, sunrealtype hj, sunrealtype tau, /* verify that ark_mem and interpolation structure are provided */ if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkPredict_Bootstrap", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "ARKodeMem structure is NULL"); return (ARK_MEM_NULL); } if (ark_mem->interp == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE", "arkPredict_Bootstrap", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "ARKodeInterpMem structure is NULL"); return (ARK_MEM_NULL); } @@ -3138,7 +3120,7 @@ int arkCheckConvergence(ARKodeMem ark_mem, int* nflagPtr, int* ncfPtr) /* Otherwise, access adaptivity structure */ if (ark_mem->hadapt_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE", "arkCheckConvergence", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARKADAPT_NO_MEM); return (ARK_MEM_NULL); } @@ -3254,7 +3236,7 @@ int arkCheckTemporalError(ARKodeMem ark_mem, int* nflagPtr, int* nefPtr, /* Access hadapt_mem structure */ if (ark_mem->hadapt_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE", "arkCheckTemporalError", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARKADAPT_NO_MEM); return (ARK_MEM_NULL); } @@ -3317,13 +3299,15 @@ int arkAccessHAdaptMem(void* arkode_mem, const char* fname, ARKodeMem* ark_mem, /* access ARKodeMem structure */ if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", fname, MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, fname, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } *ark_mem = (ARKodeMem)arkode_mem; if ((*ark_mem)->hadapt_mem == NULL) { - arkProcessError(*ark_mem, ARK_MEM_NULL, "ARKODE", fname, MSG_ARKADAPT_NO_MEM); + arkProcessError(*ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARKADAPT_NO_MEM); return (ARK_MEM_NULL); } *hadapt_mem = (ARKodeHAdaptMem)(*ark_mem)->hadapt_mem; @@ -3331,39 +3315,48 @@ int arkAccessHAdaptMem(void* arkode_mem, const char* fname, ARKodeMem* ark_mem, } /*--------------------------------------------------------------- - arkProcessError is a high level error handling function - - if ark_mem==NULL it prints the error message to stderr - - otherwise, it sets-up and calls the error handling function - pointed to by ark_ehfun + arkProcessError is a high level error handling function that + calls the appropriate SUNDIALS error handler ---------------------------------------------------------------*/ -void arkProcessError(ARKodeMem ark_mem, int error_code, const char* module, - const char* fname, const char* msgfmt, ...) +void arkProcessError(ARKodeMem ark_mem, int error_code, int line, + const char* func, const char* file, const char* msgfmt, ...) { - va_list ap; - char msg[256]; - /* Initialize the argument pointer variable (msgfmt is the last required argument to arkProcessError) */ + va_list ap; va_start(ap, msgfmt); /* Compose the message */ - vsprintf(msg, msgfmt, ap); + size_t msglen = vsnprintf(NULL, 0, msgfmt, ap) + 1; + char* msg = (char*)malloc(msglen); + vsnprintf(msg, msglen, msgfmt, ap); - if (ark_mem == NULL) - { /* We write to stderr */ + do { + if (ark_mem == NULL) + { + SUNGlobalFallbackErrHandler(line, func, file, msg, error_code); + break; + } -#ifndef NO_FPRINTF_OUTPUT - fprintf(stderr, "\n[%s ERROR] %s\n ", module, fname); - fprintf(stderr, "%s\n\n", msg); + if (error_code == ARK_WARNING) + { +#if SUNDIALS_LOGGING_LEVEL >= 1 + char* file_and_line = sunCombineFileAndLine(line, file); + SUNLogger_QueueMsg(ARK_LOGGER, SUN_LOGLEVEL_WARNING, file_and_line, func, + msg); + free(file_and_line); #endif + break; + } + + /* Call the SUNDIALS main error handler */ + SUNHandleErrWithMsg(line, func, file, msg, error_code, ark_mem->sunctx); } - else - { /* We can call ehfun */ - ark_mem->ehfun(error_code, module, fname, msg, ark_mem->eh_data); - } + while (0); /* Finalize argument processing */ va_end(ap); + free(msg); return; } diff --git a/src/arkode/arkode_adapt.c b/src/arkode/arkode_adapt.c index 6189365dea..814c441b18 100644 --- a/src/arkode/arkode_adapt.c +++ b/src/arkode/arkode_adapt.c @@ -19,8 +19,6 @@ #include #include #include -#include -#include #include "arkode_impl.h" @@ -102,7 +100,8 @@ int arkAdapt(void* arkode_mem, ARKodeHAdaptMem hadapt_mem, N_Vector ycur, int controller_order; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkAdapt", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; @@ -124,7 +123,7 @@ int arkAdapt(void* arkode_mem, ARKodeHAdaptMem hadapt_mem, N_Vector ycur, controller_order, dsm, &h_acc); if (retval != SUNADAPTCONTROLLER_SUCCESS) { - arkProcessError(ark_mem, ARK_CONTROLLER_ERR, "ARKODE", "arkAdapt", + arkProcessError(ark_mem, ARK_CONTROLLER_ERR, __LINE__, __func__, __FILE__, "SUNAdaptController_EstimateStep failure."); return (ARK_CONTROLLER_ERR); } @@ -136,7 +135,7 @@ int arkAdapt(void* arkode_mem, ARKodeHAdaptMem hadapt_mem, N_Vector ycur, retval = hadapt_mem->expstab(ycur, tcur, &h_cfl, hadapt_mem->estab_data); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkAdapt", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Error in explicit stability function."); return (ARK_ILL_INPUT); } diff --git a/src/arkode/arkode_arkstep.c b/src/arkode/arkode_arkstep.c index 9277d3bf1f..41a3f4a254 100644 --- a/src/arkode/arkode_arkstep.c +++ b/src/arkode/arkode_arkstep.c @@ -44,7 +44,7 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, /* Check that at least one of fe, fi is supplied and is to be used */ if (fe == NULL && fi == NULL) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::ARKStep", "ARKStepCreate", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_F); return (NULL); } @@ -52,14 +52,14 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, /* Check for legal input parameters */ if (y0 == NULL) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::ARKStep", "ARKStepCreate", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_Y0); return (NULL); } if (!sunctx) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::ARKStep", "ARKStepCreate", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_SUNCTX); return (NULL); } @@ -68,7 +68,7 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, nvectorOK = arkStep_CheckNVector(y0); if (!nvectorOK) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::ARKStep", "ARKStepCreate", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_NVECTOR); return (NULL); } @@ -77,7 +77,7 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, ark_mem = arkCreate(sunctx); if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ARKStep", "ARKStepCreate", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (NULL); } @@ -87,7 +87,7 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, step_mem = (ARKodeARKStepMem)malloc(sizeof(struct ARKodeARKStepMemRec)); if (step_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ARKStep", "ARKStepCreate", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_ARKMEM_FAIL); return (NULL); } @@ -112,7 +112,7 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, retval = ARKStepSetDefaults((void*)ark_mem); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE::ARKStep", "ARKStepCreate", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Error setting default solver options"); ARKStepFree((void**)&ark_mem); return (NULL); @@ -158,7 +158,7 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, NLS = SUNNonlinSol_Newton(y0, ark_mem->sunctx); if (NLS == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ARKStep", "ARKStepCreate", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Error creating default Newton solver"); ARKStepFree((void**)&ark_mem); return (NULL); @@ -166,7 +166,7 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, retval = ARKStepSetNonlinearSolver(ark_mem, NLS); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ARKStep", "ARKStepCreate", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Error attaching default Newton solver"); ARKStepFree((void**)&ark_mem); return (NULL); @@ -218,7 +218,7 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, retval = arkInit(ark_mem, t0, y0, FIRST_INIT); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE::ARKStep", "ARKStepCreate", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Unable to initialize main ARKODE infrastructure"); ARKStepFree((void**)&ark_mem); return (NULL); @@ -244,8 +244,7 @@ int ARKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, int i, retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepResize", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Determing change in vector sizes */ @@ -260,7 +259,7 @@ int ARKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, retval = arkResize(ark_mem, y0, hscale, t0, resize, resize_data); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE::ARKStep", "ARKStepResize", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Unable to resize main ARKODE infrastructure"); return (retval); } @@ -269,7 +268,7 @@ int ARKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, if (!arkResizeVec(ark_mem, resize, resize_data, lrw_diff, liw_diff, y0, &step_mem->sdata)) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ARKStep", "ARKStepResize", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Unable to resize vector"); return (ARK_MEM_FAIL); } @@ -277,7 +276,7 @@ int ARKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, if (!arkResizeVec(ark_mem, resize, resize_data, lrw_diff, liw_diff, y0, &step_mem->zpred)) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ARKStep", "ARKStepResize", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Unable to resize vector"); return (ARK_MEM_FAIL); } @@ -285,7 +284,7 @@ int ARKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, if (!arkResizeVec(ark_mem, resize, resize_data, lrw_diff, liw_diff, y0, &step_mem->zcor)) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ARKStep", "ARKStepResize", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Unable to resize vector"); return (ARK_MEM_FAIL); } @@ -299,8 +298,8 @@ int ARKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, if (!arkResizeVec(ark_mem, resize, resize_data, lrw_diff, liw_diff, y0, &step_mem->Fe[i])) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ARKStep", - "ARKStepResize", "Unable to resize vector"); + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, + "Unable to resize vector"); return (ARK_MEM_FAIL); } } @@ -313,8 +312,8 @@ int ARKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, if (!arkResizeVec(ark_mem, resize, resize_data, lrw_diff, liw_diff, y0, &step_mem->Fi[i])) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ARKStep", - "ARKStepResize", "Unable to resize vector"); + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, + "Unable to resize vector"); return (ARK_MEM_FAIL); } } @@ -334,7 +333,7 @@ int ARKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, NLS = SUNNonlinSol_Newton(y0, ark_mem->sunctx); if (NLS == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ARKStep", "ARKStepResize", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Error creating default Newton solver"); return (ARK_MEM_FAIL); } @@ -343,7 +342,7 @@ int ARKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, retval = ARKStepSetNonlinearSolver(ark_mem, NLS); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ARKStep", "ARKStepResize", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Error attaching default Newton solver"); return (ARK_MEM_FAIL); } @@ -375,14 +374,13 @@ int ARKStepReInit(void* arkode_mem, ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepReInit", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Check if ark_mem was allocated */ if (ark_mem->MallocDone == SUNFALSE) { - arkProcessError(ark_mem, ARK_NO_MALLOC, "ARKODE::ARKStep", "ARKStepReInit", + arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, MSG_ARK_NO_MALLOC); return (ARK_NO_MALLOC); } @@ -390,7 +388,7 @@ int ARKStepReInit(void* arkode_mem, ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, /* Check that at least one of fe, fi is supplied and is to be used */ if (fe == NULL && fi == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", "ARKStepReInit", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_F); return (ARK_ILL_INPUT); } @@ -398,7 +396,7 @@ int ARKStepReInit(void* arkode_mem, ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, /* Check that y0 is supplied */ if (y0 == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", "ARKStepReInit", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_Y0); return (ARK_ILL_INPUT); } @@ -418,7 +416,7 @@ int ARKStepReInit(void* arkode_mem, ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, retval = arkInit(ark_mem, t0, y0, FIRST_INIT); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE::ARKStep", "ARKStepReInit", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Unable to reinitialize main ARKODE infrastructure"); return (retval); } @@ -446,7 +444,7 @@ int ARKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepReset", &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Initialize main ARKODE infrastructure */ @@ -454,7 +452,7 @@ int ARKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE::ARKStep", "ARKStepReset", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Unable to initialize main ARKODE infrastructure"); return (retval); } @@ -475,8 +473,8 @@ int ARKStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepSStolerances", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; @@ -489,8 +487,8 @@ int ARKStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepSVtolerances", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; @@ -503,8 +501,8 @@ int ARKStepWFtolerances(void* arkode_mem, ARKEwtFn efun) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepWFtolerances", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; @@ -517,8 +515,8 @@ int ARKStepResStolerance(void* arkode_mem, sunrealtype rabstol) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepResStolerance", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; @@ -531,8 +529,8 @@ int ARKStepResVtolerance(void* arkode_mem, N_Vector rabstol) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepResVtolerance", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; @@ -545,8 +543,8 @@ int ARKStepResFtolerance(void* arkode_mem, ARKRwtFn rfun) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepResFtolerance", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; @@ -565,7 +563,7 @@ int ARKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ARKStep", "ARKStepRootInit", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -587,7 +585,7 @@ int ARKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ARKStep", "ARKStepEvolve", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -612,7 +610,7 @@ int ARKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ARKStep", "ARKStepGetDky", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -635,8 +633,7 @@ int ARKStepComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) ARKodeARKStepMem step_mem; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepComputeState", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } N_VLinearSum(ONE, step_mem->zpred, ONE, zcor, z); @@ -812,8 +809,7 @@ void ARKStepPrintMem(void* arkode_mem, FILE* outfile) #endif /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepPrintMem", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return; } /* if outfile==NULL, set it to stdout */ @@ -917,8 +913,7 @@ int arkStep_AttachLinsol(void* arkode_mem, ARKLinsolInitFn linit, int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "arkStep_AttachLinsol", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* free any existing system solver */ @@ -957,8 +952,7 @@ int arkStep_AttachMasssol(void* arkode_mem, ARKMassInitFn minit, int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "arkStep_AttachMasssol", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* free any existing mass matrix solver */ @@ -1035,8 +1029,7 @@ void* arkStep_GetLmem(void* arkode_mem) int retval; /* access ARKodeARKStepMem structure, and return lmem */ - retval = arkStep_AccessStepMem(arkode_mem, "arkStep_GetLmem", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (NULL); } return (step_mem->lmem); } @@ -1054,8 +1047,7 @@ void* arkStep_GetMassMem(void* arkode_mem) int retval; /* access ARKodeARKStepMem structure, and return mass_mem */ - retval = arkStep_AccessStepMem(arkode_mem, "arkStep_GetMassMem", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (NULL); } return (step_mem->mass_mem); } @@ -1072,8 +1064,7 @@ ARKRhsFn arkStep_GetImplicitRHS(void* arkode_mem) int retval; /* access ARKodeARKStepMem structure, and return fi */ - retval = arkStep_AccessStepMem(arkode_mem, "arkStep_GetImplicitRHS", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (NULL); } return (step_mem->fi); } @@ -1092,8 +1083,7 @@ int arkStep_GetGammas(void* arkode_mem, sunrealtype* gamma, sunrealtype* gamrat, int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "arkStep_GetGammas", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set outputs */ @@ -1148,7 +1138,7 @@ int arkStep_Init(void* arkode_mem, int init_type) sunbooleantype reset_efun; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "arkStep_Init", &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* immediately return if reset */ @@ -1185,7 +1175,7 @@ int arkStep_Init(void* arkode_mem, int init_type) retval = arkStep_SetButcherTables(ark_mem); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", "arkStep_Init", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Could not create Butcher table(s)"); return (ARK_ILL_INPUT); } @@ -1194,7 +1184,7 @@ int arkStep_Init(void* arkode_mem, int init_type) retval = arkStep_CheckButcherTables(ark_mem); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", "arkStep_Init", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Error in Butcher table(s)"); return (ARK_ILL_INPUT); } @@ -1214,16 +1204,16 @@ int arkStep_Init(void* arkode_mem, int init_type) /* Ensure that if adaptivity is enabled, then method includes embedding coefficients */ if (!ark_mem->fixedstep && (step_mem->p == 0)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "arkStep_Init", "Adaptive timestepping cannot be performed without embedding coefficients"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "Adaptive timestepping cannot be performed without embedding coefficients"); return (ARK_ILL_INPUT); } /* Relaxation is incompatible with implicit RHS deduction */ if (ark_mem->relax_enabled && step_mem->implicit && step_mem->deduce_rhs) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "arkStep_Init", "Relaxation cannot be performed when deducing implicit RHS values"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "Relaxation cannot be performed when deducing implicit RHS values"); return ARK_ILL_INPUT; } @@ -1337,7 +1327,7 @@ int arkStep_Init(void* arkode_mem, int init_type) if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", "arkStep_Init", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Unable to update interpolation polynomial degree"); return (ARK_ILL_INPUT); } @@ -1354,7 +1344,7 @@ int arkStep_Init(void* arkode_mem, int init_type) { if (step_mem->lsolve_type != step_mem->msolve_type) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", "arkStep_Init", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Incompatible linear and mass matrix solvers"); return (ARK_ILL_INPUT); } @@ -1369,8 +1359,8 @@ int arkStep_Init(void* arkode_mem, int init_type) retval = step_mem->minit((void*)ark_mem); if (retval != 0) { - arkProcessError(ark_mem, ARK_MASSINIT_FAIL, "ARKODE::ARKStep", - "arkStep_Init", MSG_ARK_MASSINIT_FAIL); + arkProcessError(ark_mem, ARK_MASSINIT_FAIL, __LINE__, __func__, + __FILE__, MSG_ARK_MASSINIT_FAIL); return (ARK_MASSINIT_FAIL); } } @@ -1382,8 +1372,8 @@ int arkStep_Init(void* arkode_mem, int init_type) ark_mem->tempv2, ark_mem->tempv3); if (retval != 0) { - arkProcessError(ark_mem, ARK_MASSSETUP_FAIL, "ARKODE::ARKStep", - "arkStep_Init", MSG_ARK_MASSSETUP_FAIL); + arkProcessError(ark_mem, ARK_MASSSETUP_FAIL, __LINE__, __func__, + __FILE__, MSG_ARK_MASSSETUP_FAIL); return (ARK_MASSSETUP_FAIL); } } @@ -1395,8 +1385,8 @@ int arkStep_Init(void* arkode_mem, int init_type) retval = step_mem->linit(ark_mem); if (retval != 0) { - arkProcessError(ark_mem, ARK_LINIT_FAIL, "ARKODE::ARKStep", - "arkStep_Init", MSG_ARK_LINIT_FAIL); + arkProcessError(ark_mem, ARK_LINIT_FAIL, __LINE__, __func__, __FILE__, + MSG_ARK_LINIT_FAIL); return (ARK_LINIT_FAIL); } } @@ -1407,8 +1397,7 @@ int arkStep_Init(void* arkode_mem, int init_type) retval = arkStep_NlsInit(ark_mem); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_NLS_INIT_FAIL, "ARKODE::ARKStep", - "arkStep_Init", + arkProcessError(ark_mem, ARK_NLS_INIT_FAIL, __LINE__, __func__, __FILE__, "Unable to initialize SUNNonlinearSolver object"); return (ARK_NLS_INIT_FAIL); } @@ -1467,8 +1456,7 @@ int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, sunrealtype stage_coefs = ONE; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "arkStep_FullRHS", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* local shortcuts for use with fused vector operations */ @@ -1498,8 +1486,8 @@ int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nfe++; if (retval != 0) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::ARKStep", - "arkStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, + __FILE__, MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } @@ -1510,8 +1498,8 @@ int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nlscoef / ark_mem->h); if (retval) { - arkProcessError(ark_mem, ARK_MASSSOLVE_FAIL, "ARKODE::ARKStep", - "arkStep_FullRHS", "Mass matrix solver failure"); + arkProcessError(ark_mem, ARK_MASSSOLVE_FAIL, __LINE__, __func__, + __FILE__, "Mass matrix solver failure"); return ARK_MASSSOLVE_FAIL; } } @@ -1524,8 +1512,8 @@ int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nfi++; if (retval != 0) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::ARKStep", - "arkStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, + __FILE__, MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } @@ -1536,8 +1524,8 @@ int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nlscoef / ark_mem->h); if (retval) { - arkProcessError(ark_mem, ARK_MASSSOLVE_FAIL, "ARKODE::ARKStep", - "arkStep_FullRHS", "Mass matrix solver failure"); + arkProcessError(ark_mem, ARK_MASSSOLVE_FAIL, __LINE__, __func__, + __FILE__, "Mass matrix solver failure"); return ARK_MASSSOLVE_FAIL; } } @@ -1568,8 +1556,8 @@ int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nlscoef / ark_mem->h); if (retval) { - arkProcessError(ark_mem, ARK_MASSSOLVE_FAIL, "ARKODE::ARKStep", - "arkStep_FullRHS", "Mass matrix solver failure"); + arkProcessError(ark_mem, ARK_MASSSOLVE_FAIL, __LINE__, __func__, + __FILE__, "Mass matrix solver failure"); return ARK_MASSSOLVE_FAIL; } } @@ -1623,8 +1611,8 @@ int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nfe++; if (retval != 0) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::ARKStep", - "arkStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, + __FILE__, MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } @@ -1635,8 +1623,8 @@ int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nlscoef / ark_mem->h); if (retval) { - arkProcessError(ark_mem, ARK_MASSSOLVE_FAIL, "ARKODE::ARKStep", - "arkStep_FullRHS", "Mass matrix solver failure"); + arkProcessError(ark_mem, ARK_MASSSOLVE_FAIL, __LINE__, __func__, + __FILE__, "Mass matrix solver failure"); return ARK_MASSSOLVE_FAIL; } } @@ -1649,8 +1637,8 @@ int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nfi++; if (retval != 0) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::ARKStep", - "arkStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, + __FILE__, MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } @@ -1661,8 +1649,8 @@ int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nlscoef / ark_mem->h); if (retval) { - arkProcessError(ark_mem, ARK_MASSSOLVE_FAIL, "ARKODE::ARKStep", - "arkStep_FullRHS", "Mass matrix solver failure"); + arkProcessError(ark_mem, ARK_MASSSOLVE_FAIL, __LINE__, __func__, + __FILE__, "Mass matrix solver failure"); return ARK_MASSSOLVE_FAIL; } } @@ -1705,8 +1693,8 @@ int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nlscoef / ark_mem->h); if (retval) { - arkProcessError(ark_mem, ARK_MASSSOLVE_FAIL, "ARKODE::ARKStep", - "arkStep_FullRHS", "Mass matrix solver failure"); + arkProcessError(ark_mem, ARK_MASSSOLVE_FAIL, __LINE__, __func__, + __FILE__, "Mass matrix solver failure"); return ARK_MASSSOLVE_FAIL; } } @@ -1732,8 +1720,8 @@ int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nfe++; if (retval != 0) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::ARKStep", - "arkStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, __FILE__, + MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } } @@ -1745,8 +1733,8 @@ int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nfi++; if (retval != 0) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::ARKStep", - "arkStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, __FILE__, + MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } } @@ -1772,8 +1760,8 @@ int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nlscoef / ark_mem->h); if (retval) { - arkProcessError(ark_mem, ARK_MASSSOLVE_FAIL, "ARKODE::ARKStep", - "arkStep_FullRHS", "Mass matrix solver failure"); + arkProcessError(ark_mem, ARK_MASSSOLVE_FAIL, __LINE__, __func__, + __FILE__, "Mass matrix solver failure"); return ARK_MASSSOLVE_FAIL; } } @@ -1792,8 +1780,8 @@ int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, default: /* return with RHS failure if unknown mode is passed */ - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::ARKStep", - "arkStep_FullRHS", "Unknown full RHS mode"); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, __FILE__, + "Unknown full RHS mode"); return (ARK_RHSFUNC_FAIL); } @@ -1838,8 +1826,7 @@ int arkStep_TakeStep_Z(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr) N_Vector zcor0; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "arkStep_TakeStep_Z", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if problem will involve no algebraic solvers, initialize nflagPtr to success */ @@ -2213,13 +2200,14 @@ int arkStep_AccessStepMem(void* arkode_mem, const char* fname, /* access ARKodeMem structure */ if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ARKStep", fname, MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, fname, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } *ark_mem = (ARKodeMem)arkode_mem; if ((*ark_mem)->step_mem == NULL) { - arkProcessError(*ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", fname, + arkProcessError(*ark_mem, ARK_MEM_NULL, __LINE__, fname, __FILE__, MSG_ARKSTEP_NO_MEM); return (ARK_MEM_NULL); } @@ -2260,8 +2248,8 @@ int arkStep_SetButcherTables(ARKodeMem ark_mem) /* access ARKodeARKStepMem structure */ if (ark_mem->step_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ARKStep", - "arkStep_SetButcherTables", MSG_ARKSTEP_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARKSTEP_NO_MEM); return (ARK_MEM_NULL); } step_mem = (ARKodeARKStepMem)ark_mem->step_mem; @@ -2297,8 +2285,7 @@ int arkStep_SetButcherTables(ARKodeMem ark_mem) itable = ARKSTEP_DEFAULT_ARK_ITABLE_5; break; default: /* no available method, set default */ - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "arkStep_SetButcherTables", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "No ImEx method at requested order, using q=5."); etable = ARKSTEP_DEFAULT_ARK_ETABLE_5; itable = ARKSTEP_DEFAULT_ARK_ITABLE_5; @@ -2316,8 +2303,7 @@ int arkStep_SetButcherTables(ARKodeMem ark_mem) case (4): itable = ARKSTEP_DEFAULT_DIRK_4; break; case (5): itable = ARKSTEP_DEFAULT_DIRK_5; break; default: /* no available method, set default */ - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "arkStep_SetButcherTables", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "No implicit method at requested order, using q=5."); itable = ARKSTEP_DEFAULT_DIRK_5; break; @@ -2338,8 +2324,7 @@ int arkStep_SetButcherTables(ARKodeMem ark_mem) case (8): etable = ARKSTEP_DEFAULT_ERK_8; break; case (9): etable = ARKSTEP_DEFAULT_ERK_9; break; default: /* no available method, set default */ - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "arkStep_SetButcherTables", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "No explicit method at requested order, using q=9."); etable = ARKSTEP_DEFAULT_ERK_9; break; @@ -2399,8 +2384,8 @@ int arkStep_CheckButcherTables(ARKodeMem ark_mem) /* access ARKodeARKStepMem structure */ if (ark_mem->step_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ARKStep", - "arkStep_CheckButcherTables", MSG_ARKSTEP_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARKSTEP_NO_MEM); return (ARK_MEM_NULL); } step_mem = (ARKodeARKStepMem)ark_mem->step_mem; @@ -2408,39 +2393,39 @@ int arkStep_CheckButcherTables(ARKodeMem ark_mem) /* check that the expected tables are set */ if (step_mem->explicit && step_mem->Be == NULL) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ARKStep", - "arkStep_CheckButcherTables", "explicit table is NULL!"); + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, + "explicit table is NULL!"); return (ARK_INVALID_TABLE); } if (step_mem->implicit && step_mem->Bi == NULL) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ARKStep", - "arkStep_CheckButcherTables", "implicit table is NULL!"); + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, + "implicit table is NULL!"); return (ARK_INVALID_TABLE); } /* check that stages > 0 */ if (step_mem->stages < 1) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ARKStep", - "arkStep_CheckButcherTables", "stages < 1!"); + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, + "stages < 1!"); return (ARK_INVALID_TABLE); } /* check that method order q > 0 */ if (step_mem->q < 1) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ARKStep", - "arkStep_CheckButcherTables", "method order < 1!"); + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, + "method order < 1!"); return (ARK_INVALID_TABLE); } /* check that embedding order p > 0 */ if ((step_mem->p < 1) && (!ark_mem->fixedstep)) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ARKStep", - "arkStep_CheckButcherTables", "embedding order < 1!"); + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, + "embedding order < 1!"); return (ARK_INVALID_TABLE); } @@ -2451,8 +2436,8 @@ int arkStep_CheckButcherTables(ARKodeMem ark_mem) { if (step_mem->Bi->d == NULL) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ARKStep", - "arkStep_CheckButcherTables", "no implicit embedding!"); + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, + __FILE__, "no implicit embedding!"); return (ARK_INVALID_TABLE); } } @@ -2460,8 +2445,8 @@ int arkStep_CheckButcherTables(ARKodeMem ark_mem) { if (step_mem->Be->d == NULL) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ARKStep", - "arkStep_CheckButcherTables", "no explicit embedding!"); + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, + __FILE__, "no explicit embedding!"); return (ARK_INVALID_TABLE); } } @@ -2480,8 +2465,7 @@ int arkStep_CheckButcherTables(ARKodeMem ark_mem) } if (!okay) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ARKStep", - "arkStep_CheckButcherTables", + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, "Ae Butcher table is implicit!"); return (ARK_INVALID_TABLE); } @@ -2497,8 +2481,7 @@ int arkStep_CheckButcherTables(ARKodeMem ark_mem) } if (!okay) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ARKStep", - "arkStep_CheckButcherTables", + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, "Ai Butcher table is explicit!"); return (ARK_INVALID_TABLE); } @@ -2513,8 +2496,7 @@ int arkStep_CheckButcherTables(ARKodeMem ark_mem) } if (!okay) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ARKStep", - "arkStep_CheckButcherTables", + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, "Ai Butcher table has entries above diagonal!"); return (ARK_INVALID_TABLE); } @@ -2525,8 +2507,7 @@ int arkStep_CheckButcherTables(ARKodeMem ark_mem) { if (step_mem->q < 2) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ARKStep", - "arkStep_CheckButcherTables", + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, "The Butcher table(s) must be at least second order!"); return ARK_INVALID_TABLE; } @@ -2538,8 +2519,8 @@ int arkStep_CheckButcherTables(ARKodeMem ark_mem) { if (step_mem->Be->b[i] < ZERO) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ARKStep", - "arkStep_CheckButcherTables", + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, + __FILE__, "The explicit Butcher table has a negative b value!"); return ARK_INVALID_TABLE; } @@ -2553,8 +2534,8 @@ int arkStep_CheckButcherTables(ARKodeMem ark_mem) { if (step_mem->Bi->b[i] < ZERO) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ARKStep", - "arkStep_CheckButcherTables", + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, + __FILE__, "The implicit Butcher table has a negative b value!"); return ARK_INVALID_TABLE; } @@ -2587,7 +2568,7 @@ int arkStep_Predict(ARKodeMem ark_mem, int istage, N_Vector yguess) /* access ARKodeARKStepMem structure */ if (ark_mem->step_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ARKStep", "arkStep_Predict", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARKSTEP_NO_MEM); return (ARK_MEM_NULL); } @@ -2597,7 +2578,7 @@ int arkStep_Predict(ARKodeMem ark_mem, int istage, N_Vector yguess) if ((ark_mem->interp == NULL) && (step_mem->predictor > 0) && (step_mem->predictor < 4)) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", "arkStep_Predict", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "Interpolation structure is NULL"); return (ARK_MEM_NULL); } @@ -2819,7 +2800,7 @@ int arkStep_StageSetup(ARKodeMem ark_mem, sunbooleantype implicit) /* access ARKodeARKStepMem structure */ if (ark_mem->step_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ARKStep", "arkStep_StageSetup", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARKSTEP_NO_MEM); return (ARK_MEM_NULL); } @@ -2946,8 +2927,8 @@ int arkStep_ComputeSolutions(ARKodeMem ark_mem, sunrealtype* dsmPtr) /* access ARKodeARKStepMem structure */ if (ark_mem->step_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ARKStep", - "arkStep_ComputeSolutions", MSG_ARKSTEP_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARKSTEP_NO_MEM); return (ARK_MEM_NULL); } step_mem = (ARKodeARKStepMem)ark_mem->step_mem; @@ -3120,8 +3101,8 @@ int arkStep_ComputeSolutions_MassFixed(ARKodeMem ark_mem, sunrealtype* dsmPtr) /* access ARKodeARKStepMem structure */ if (ark_mem->step_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ARKStep", - "arkStep_ComputeSolutions_MassFixed", MSG_ARKSTEP_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARKSTEP_NO_MEM); return (ARK_MEM_NULL); } step_mem = (ARKodeARKStepMem)ark_mem->step_mem; @@ -3259,8 +3240,7 @@ int ARKStepCreateMRIStepInnerStepper(void* inner_arkode_mem, &step_mem); if (retval) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::ARKStep", - "ARKStepCreateMRIStepInnerStepper", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "The ARKStep memory pointer is NULL"); return ARK_ILL_INPUT; } @@ -3453,8 +3433,7 @@ int arkStep_SetInnerForcing(void* arkode_mem, sunrealtype tshift, int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "arkStep_SetInnerForcing", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } if (nvecs > 0) @@ -3562,8 +3541,8 @@ int arkStep_RelaxDeltaE(ARKodeMem ark_mem, ARKRelaxJacFn relax_jac_fn, /* Access the stepper memory structure */ if (!(ark_mem->step_mem)) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", - "arkStep_RelaxDeltaE", MSG_ARKSTEP_NO_MEM); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARKSTEP_NO_MEM); return ARK_MEM_NULL; } step_mem = (ARKodeARKStepMem)(ark_mem->step_mem); diff --git a/src/arkode/arkode_arkstep_impl.h b/src/arkode/arkode_arkstep_impl.h index 551125cfb8..c2bf35a7bc 100644 --- a/src/arkode/arkode_arkstep_impl.h +++ b/src/arkode/arkode_arkstep_impl.h @@ -19,13 +19,12 @@ #define _ARKODE_ARKSTEP_IMPL_H #include +/* access to MRIStepInnerStepper_Create */ +#include #include "arkode_impl.h" #include "arkode_ls_impl.h" -/* access to MRIStepInnerStepper_Create */ -#include "arkode/arkode_mristep.h" - #ifdef __cplusplus /* wrapper to enable C++ usage */ extern "C" { #endif diff --git a/src/arkode/arkode_arkstep_io.c b/src/arkode/arkode_arkstep_io.c index 4ea7a7e9e3..b2ef652c80 100644 --- a/src/arkode/arkode_arkstep_io.c +++ b/src/arkode/arkode_arkstep_io.c @@ -24,9 +24,7 @@ #include #include -#include "arkode/arkode_arkstep.h" #include "arkode_arkstep_impl.h" -#include "arkode_ls_impl.h" /*=============================================================== ARKStep Optional input functions (wrappers for generic ARKODE @@ -48,16 +46,6 @@ int ARKStepSetInterpolantType(void* arkode_mem, int itype) return (arkSetInterpolantType(arkode_mem, itype)); } -int ARKStepSetErrHandlerFn(void* arkode_mem, ARKErrHandlerFn ehfun, void* eh_data) -{ - return (arkSetErrHandlerFn(arkode_mem, ehfun, eh_data)); -} - -int ARKStepSetErrFile(void* arkode_mem, FILE* errfp) -{ - return (arkSetErrFile(arkode_mem, errfp)); -} - int ARKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps) { return (arkSetMaxNumSteps(arkode_mem, mxsteps)); @@ -666,8 +654,7 @@ int ARKStepSetUserData(void* arkode_mem, void* user_data) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetUserData", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set user_data in ARKODE mem */ @@ -707,15 +694,14 @@ int ARKStepSetDefaults(void* arkode_mem) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetDefaults", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Set default ARKODE infrastructure parameters */ retval = arkSetDefaults(ark_mem); if (retval != ARK_SUCCESS) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ARKStep", "ARKStepSetDefaults", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "Error setting ARKODE infrastructure defaults"); return (retval); } @@ -765,15 +751,14 @@ int ARKStepSetOptimalParams(void* arkode_mem) long int lenrw, leniw; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetOptimalParams", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* access ARKodeHAdaptMem structure */ if (ark_mem->hadapt_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepSetOptimalParams", MSG_ARKADAPT_NO_MEM); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARKADAPT_NO_MEM); return (ARK_MEM_NULL); } hadapt_mem = ark_mem->hadapt_mem; @@ -791,7 +776,7 @@ int ARKStepSetOptimalParams(void* arkode_mem) ark_mem->hadapt_mem->owncontroller = SUNFALSE; if (retval != SUNADAPTCONTROLLER_SUCCESS) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "ARKStepSetOptimalParams", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_Destroy failure"); return (ARK_MEM_FAIL); } @@ -806,8 +791,7 @@ int ARKStepSetOptimalParams(void* arkode_mem) hadapt_mem->hcontroller = SUNAdaptController_PI(ark_mem->sunctx); if (hadapt_mem->hcontroller == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ARKStep", - "ARKStepSetOptimalParams", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_PI allocation failure"); return (ARK_MEM_FAIL); } @@ -830,8 +814,7 @@ int ARKStepSetOptimalParams(void* arkode_mem) hadapt_mem->hcontroller = SUNAdaptController_PID(ark_mem->sunctx); if (hadapt_mem->hcontroller == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ARKStep", - "ARKStepSetOptimalParams", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_PID allocation failure"); return (ARK_MEM_FAIL); } @@ -852,8 +835,7 @@ int ARKStepSetOptimalParams(void* arkode_mem) hadapt_mem->hcontroller = SUNAdaptController_I(ark_mem->sunctx); if (hadapt_mem->hcontroller == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ARKStep", - "ARKStepSetOptimalParams", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_I allocation failure"); return (ARK_MEM_FAIL); } @@ -875,8 +857,7 @@ int ARKStepSetOptimalParams(void* arkode_mem) hadapt_mem->hcontroller = SUNAdaptController_PID(ark_mem->sunctx); if (hadapt_mem->hcontroller == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ARKStep", - "ARKStepSetOptimalParams", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_PID allocation failure"); return (ARK_MEM_FAIL); } @@ -902,8 +883,7 @@ int ARKStepSetOptimalParams(void* arkode_mem) hadapt_mem->hcontroller = SUNAdaptController_PID(ark_mem->sunctx); if (hadapt_mem->hcontroller == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ARKStep", - "ARKStepSetOptimalParams", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_PID allocation failure"); return (ARK_MEM_FAIL); } @@ -936,8 +916,7 @@ int ARKStepSetOptimalParams(void* arkode_mem) hadapt_mem->hcontroller = SUNAdaptController_PID(ark_mem->sunctx); if (hadapt_mem->hcontroller == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ARKStep", - "ARKStepSetOptimalParams", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_PID allocation failure"); return (ARK_MEM_FAIL); } @@ -958,8 +937,7 @@ int ARKStepSetOptimalParams(void* arkode_mem) hadapt_mem->hcontroller = SUNAdaptController_PID(ark_mem->sunctx); if (hadapt_mem->hcontroller == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ARKStep", - "ARKStepSetOptimalParams", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_PID allocation failure"); return (ARK_MEM_FAIL); } @@ -984,8 +962,7 @@ int ARKStepSetOptimalParams(void* arkode_mem) hadapt_mem->hcontroller = SUNAdaptController_PID(ark_mem->sunctx); if (hadapt_mem->hcontroller == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ARKStep", - "ARKStepSetOptimalParams", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_PID allocation failure"); return (ARK_MEM_FAIL); } @@ -1011,8 +988,7 @@ int ARKStepSetOptimalParams(void* arkode_mem) hadapt_mem->hcontroller = SUNAdaptController_PI(ark_mem->sunctx); if (hadapt_mem->hcontroller == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ARKStep", - "ARKStepSetOptimalParams", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_PI allocation failure"); return (ARK_MEM_FAIL); } @@ -1064,8 +1040,7 @@ int ARKStepSetOrder(void* arkode_mem, int ord) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetOrder", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set user-provided value, or default, depending on argument */ @@ -1115,8 +1090,7 @@ int ARKStepSetLinear(void* arkode_mem, int timedepend) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetLinear", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set parameters */ @@ -1141,8 +1115,7 @@ int ARKStepSetNonlinear(void* arkode_mem) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetNonlinear", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set parameters */ @@ -1166,15 +1139,14 @@ int ARKStepSetExplicit(void* arkode_mem) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetExplicit", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* ensure that fe is defined */ if (step_mem->fe == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "ARKStepSetExplicit", MSG_ARK_MISSING_FE); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + MSG_ARK_MISSING_FE); return (ARK_ILL_INPUT); } @@ -1198,15 +1170,14 @@ int ARKStepSetImplicit(void* arkode_mem) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetImplicit", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* ensure that fi is defined */ if (step_mem->fi == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "ARKStepSetImplicit", MSG_ARK_MISSING_FI); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + MSG_ARK_MISSING_FI); return (ARK_ILL_INPUT); } @@ -1244,20 +1215,19 @@ int ARKStepSetImEx(void* arkode_mem) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetImEx", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* ensure that fe and fi are defined */ if (step_mem->fe == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", "ARKStepSetImEx", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_MISSING_FE); return (ARK_ILL_INPUT); } if (step_mem->fi == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", "ARKStepSetImEx", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_MISSING_FI); return (ARK_ILL_INPUT); } @@ -1303,14 +1273,13 @@ int ARKStepSetTables(void* arkode_mem, int q, int p, ARKodeButcherTable Bi, sunindextype Blrw, Bliw; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetTables", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* check for illegal inputs */ if ((Bi == NULL) && (Be == NULL)) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", "ARKStepSetTables", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "At least one complete table must be supplied"); return (ARK_ILL_INPUT); } @@ -1320,8 +1289,7 @@ int ARKStepSetTables(void* arkode_mem, int q, int p, ARKodeButcherTable Bi, { if (Bi->stages != Be->stages) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepSetTables", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "Both tables must have the same number of stages"); return (ARK_ILL_INPUT); } @@ -1360,8 +1328,8 @@ int ARKStepSetTables(void* arkode_mem, int q, int p, ARKodeButcherTable Bi, step_mem->Be = ARKodeButcherTable_Copy(Be); if (step_mem->Be == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepSetTables", MSG_ARK_NO_MEM); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1369,8 +1337,8 @@ int ARKStepSetTables(void* arkode_mem, int q, int p, ARKodeButcherTable Bi, retval = ARKStepSetExplicit(arkode_mem); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "ARKStepSetTables", "Error in ARKStepSetExplicit"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "Error in ARKStepSetExplicit"); return (retval); } @@ -1387,8 +1355,8 @@ int ARKStepSetTables(void* arkode_mem, int q, int p, ARKodeButcherTable Bi, step_mem->Bi = ARKodeButcherTable_Copy(Bi); if (step_mem->Bi == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepSetTables", MSG_ARK_NO_MEM); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1396,8 +1364,8 @@ int ARKStepSetTables(void* arkode_mem, int q, int p, ARKodeButcherTable Bi, retval = ARKStepSetImplicit(arkode_mem); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "ARKStepSetTables", "Error in ARKStepSetImplicit"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "Error in ARKStepSetImplicit"); return (ARK_ILL_INPUT); } @@ -1414,8 +1382,8 @@ int ARKStepSetTables(void* arkode_mem, int q, int p, ARKodeButcherTable Bi, step_mem->Be = ARKodeButcherTable_Copy(Be); if (step_mem->Be == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepSetTables", MSG_ARK_NO_MEM); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1423,8 +1391,8 @@ int ARKStepSetTables(void* arkode_mem, int q, int p, ARKodeButcherTable Bi, step_mem->Bi = ARKodeButcherTable_Copy(Bi); if (step_mem->Bi == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepSetTables", MSG_ARK_NO_MEM); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1432,8 +1400,8 @@ int ARKStepSetTables(void* arkode_mem, int q, int p, ARKodeButcherTable Bi, retval = ARKStepSetImEx(arkode_mem); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "ARKStepSetTables", "Error in ARKStepSetImEx"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "Error in ARKStepSetImEx"); return (ARK_ILL_INPUT); } } @@ -1471,8 +1439,7 @@ int ARKStepSetTableNum(void* arkode_mem, ARKODE_DIRKTableID itable, sunindextype Blrw, Bliw; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetTableNum", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* clear any existing parameters and Butcher tables */ @@ -1498,8 +1465,7 @@ int ARKStepSetTableNum(void* arkode_mem, ARKODE_DIRKTableID itable, /* illegal inputs */ if ((itable < 0) && (etable < 0)) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepSetTableNum", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "At least one valid table number must be supplied"); return (ARK_ILL_INPUT); @@ -1510,8 +1476,8 @@ int ARKStepSetTableNum(void* arkode_mem, ARKODE_DIRKTableID itable, /* check that argument specifies an explicit table */ if (etable < ARKODE_MIN_ERK_NUM || etable > ARKODE_MAX_ERK_NUM) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepSetTableNum", "Illegal ERK table number"); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + "Illegal ERK table number"); return (ARK_ILL_INPUT); } @@ -1519,8 +1485,7 @@ int ARKStepSetTableNum(void* arkode_mem, ARKODE_DIRKTableID itable, step_mem->Be = ARKodeButcherTable_LoadERK(etable); if (step_mem->Be == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepSetTableNum", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "Error setting explicit table with that index"); return (ARK_ILL_INPUT); } @@ -1532,8 +1497,8 @@ int ARKStepSetTableNum(void* arkode_mem, ARKODE_DIRKTableID itable, flag = ARKStepSetExplicit(arkode_mem); if (flag != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "ARKStepSetTableNum", "Error in ARKStepSetExplicit"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "Error in ARKStepSetExplicit"); return (flag); } @@ -1544,8 +1509,8 @@ int ARKStepSetTableNum(void* arkode_mem, ARKODE_DIRKTableID itable, /* check that argument specifies an implicit table */ if (itable < ARKODE_MIN_DIRK_NUM || itable > ARKODE_MAX_DIRK_NUM) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepSetTableNum", "Illegal IRK table number"); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + "Illegal IRK table number"); return (ARK_ILL_INPUT); } @@ -1553,8 +1518,7 @@ int ARKStepSetTableNum(void* arkode_mem, ARKODE_DIRKTableID itable, step_mem->Bi = ARKodeButcherTable_LoadDIRK(itable); if (step_mem->Bi == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepSetTableNum", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "Error setting table with that index"); return (ARK_ILL_INPUT); } @@ -1566,8 +1530,8 @@ int ARKStepSetTableNum(void* arkode_mem, ARKODE_DIRKTableID itable, flag = ARKStepSetImplicit(arkode_mem); if (flag != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "ARKStepSetTableNum", "Error in ARKStepSetImplicit"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "Error in ARKStepSetImplicit"); return (flag); } @@ -1588,8 +1552,7 @@ int ARKStepSetTableNum(void* arkode_mem, ARKODE_DIRKTableID itable, (itable == ARKODE_ARK548L2SAb_DIRK_8_4_5)) && !((etable == ARKODE_ARK2_ERK_3_1_2) && (itable == ARKODE_ARK2_DIRK_3_1_2))) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "ARKStepSetTableNum", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Incompatible Butcher tables for ARK method"); return (ARK_ILL_INPUT); } @@ -1599,14 +1562,14 @@ int ARKStepSetTableNum(void* arkode_mem, ARKODE_DIRKTableID itable, step_mem->Be = ARKodeButcherTable_LoadERK(etable); if (step_mem->Bi == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepSetTableNum", "Illegal IRK table number"); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + "Illegal IRK table number"); return (ARK_ILL_INPUT); } if (step_mem->Be == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepSetTableNum", "Illegal ERK table number"); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + "Illegal ERK table number"); return (ARK_ILL_INPUT); } step_mem->stages = step_mem->Bi->stages; @@ -1616,8 +1579,8 @@ int ARKStepSetTableNum(void* arkode_mem, ARKODE_DIRKTableID itable, /* set method as ImEx */ if (ARKStepSetImEx(arkode_mem) != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "ARKStepSetTableNum", MSG_ARK_MISSING_F); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + MSG_ARK_MISSING_F); return (ARK_ILL_INPUT); } } @@ -1658,8 +1621,7 @@ int ARKStepSetNonlinCRDown(void* arkode_mem, sunrealtype crdown) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetNonlinCRDown", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -1683,8 +1645,7 @@ int ARKStepSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetNonlinRDiv", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -1708,8 +1669,7 @@ int ARKStepSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetDeltaGammaMax", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -1734,8 +1694,7 @@ int ARKStepSetLSetupFrequency(void* arkode_mem, int msbp) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetLSetupFrequency", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -1759,21 +1718,9 @@ int ARKStepSetPredictorMethod(void* arkode_mem, int pred_method) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetPredictorMethod", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - /* return error if pred_method==5 and a non-NULL stage predictor function - has been supplied */ - if ((pred_method == 5) && (step_mem->stage_predict != NULL)) - { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "ARKStepSetPredictorMethod", - "predictor 5 cannot be combined with user-supplied stage " - "predictor"); - return (ARK_ILL_INPUT); - } - /* set parameter */ step_mem->predictor = pred_method; @@ -1794,15 +1741,15 @@ int ARKStepSetMaxNonlinIters(void* arkode_mem, int maxcor) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetMaxNonlinIters", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } + SUNFunctionBegin(ark_mem->sunctx); + /* Return error message if no NLS module is present */ if (step_mem->NLS == NULL) { - arkProcessError(ark_mem, ARK_NLS_OP_ERR, "ARKODE::ARKStep", - "ARKStepSetMaxNonlinIters", + arkProcessError(ark_mem, ARK_NLS_OP_ERR, __LINE__, __func__, __FILE__, "No SUNNonlinearSolver object is present"); return (ARK_ILL_INPUT); } @@ -1813,10 +1760,9 @@ int ARKStepSetMaxNonlinIters(void* arkode_mem, int maxcor) /* send argument to NLS structure */ retval = SUNNonlinSolSetMaxIters(step_mem->NLS, step_mem->maxcor); - if (retval != SUN_NLS_SUCCESS) + if (retval != SUN_SUCCESS) { - arkProcessError(ark_mem, ARK_NLS_OP_ERR, "ARKODE::ARKStep", - "ARKStepSetMaxNonlinIters", + arkProcessError(ark_mem, ARK_NLS_OP_ERR, __LINE__, __func__, __FILE__, "Error setting maxcor in SUNNonlinearSolver object"); return (ARK_NLS_OP_ERR); } @@ -1837,8 +1783,7 @@ int ARKStepSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetNonlinConvCoef", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* argument <= 0 sets default, otherwise set input */ @@ -1860,8 +1805,7 @@ int ARKStepSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) int retval; /* access ARKodeARKStepMem structure and set function pointer */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetStagePredictFn", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } step_mem->stage_predict = PredictStage; @@ -1887,8 +1831,7 @@ int ARKStepSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce) int retval; /* access ARKodeARKStepMem structure and set function pointer */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetDeduceImplicitRhs", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } step_mem->deduce_rhs = deduce; @@ -1907,7 +1850,7 @@ int ARKStepGetCurrentGamma(void* arkode_mem, sunrealtype* gamma) int retval; ARKodeMem ark_mem; ARKodeARKStepMem step_mem; - retval = arkStep_AccessStepMem(arkode_mem, NULL, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *gamma = step_mem->gamma; return (retval); @@ -1925,8 +1868,7 @@ int ARKStepGetNumRhsEvals(void* arkode_mem, long int* fe_evals, long int* fi_eva int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepGetNumRhsEvals", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get values from step_mem */ @@ -1948,8 +1890,7 @@ int ARKStepGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepGetNumLinSolvSetups", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get value from step_mem */ @@ -1972,8 +1913,7 @@ int ARKStepGetCurrentButcherTables(void* arkode_mem, ARKodeButcherTable* Bi, int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepGetCurrentButcherTables", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get tables from step_mem */ @@ -1996,10 +1936,11 @@ int ARKStepGetEstLocalErrors(void* arkode_mem, N_Vector ele) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepGetEstLocalErrors", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } + SUNFunctionBegin(ark_mem->sunctx); + /* copy vector to output */ N_VScale(ONE, ark_mem->tempv1, ele); @@ -2021,8 +1962,7 @@ int ARKStepGetTimestepperStats(void* arkode_mem, long int* expsteps, int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepGetTimestepperStats", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set expsteps and accsteps from adaptivity structure */ @@ -2051,8 +1991,7 @@ int ARKStepGetNumNonlinSolvIters(void* arkode_mem, long int* nniters) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepGetNumNonlinSolvIters", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *nniters = step_mem->nls_iters; @@ -2072,8 +2011,7 @@ int ARKStepGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepGetNumNonlinSolvConvFails", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set output from step_mem */ @@ -2095,8 +2033,7 @@ int ARKStepGetNonlinSolvStats(void* arkode_mem, long int* nniters, int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepGetNonlinSolvStats", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *nniters = step_mem->nls_iters; @@ -2119,8 +2056,7 @@ int ARKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepPrintAllStats", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* step and rootfinding stats */ @@ -2250,7 +2186,7 @@ int ARKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) break; default: - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "ARKStepPrintAllStats", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Invalid formatting option."); return (ARK_ILL_INPUT); } @@ -2274,16 +2210,14 @@ int ARKStepWriteParameters(void* arkode_mem, FILE* fp) int flag, retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepWriteParameters", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* output ARKODE infrastructure parameters first */ flag = arkWriteParameters(ark_mem, fp); if (flag != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepWriteParameters", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "Error writing ARKODE infrastructure parameters"); return (flag); } @@ -2337,15 +2271,14 @@ int ARKStepWriteButcher(void* arkode_mem, FILE* fp) ARKodeARKStepMem step_mem; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepWriteButcher", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* check that Butcher table is non-NULL (otherwise report error) */ if ((step_mem->Be == NULL) && (step_mem->Bi == NULL)) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", - "ARKStepWriteButcher", "Butcher table memory is NULL"); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + "Butcher table memory is NULL"); return (ARK_MEM_NULL); } diff --git a/src/arkode/arkode_arkstep_nls.c b/src/arkode/arkode_arkstep_nls.c index 0bc12e5ada..dfaaabbbfe 100644 --- a/src/arkode/arkode_arkstep_nls.c +++ b/src/arkode/arkode_arkstep_nls.c @@ -40,15 +40,13 @@ int ARKStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetNonlinearSolver", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Return immediately if NLS input is NULL */ if (NLS == NULL) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::ARKStep", - "ARKStepSetNonlinearSolver", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "The NLS input must be non-NULL"); return (ARK_ILL_INPUT); } @@ -57,7 +55,7 @@ int ARKStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) if ((NLS->ops->gettype == NULL) || (NLS->ops->solve == NULL) || (NLS->ops->setsysfn == NULL)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "ARKStepSetNonlinearSolver", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "NLS does not support required operations"); return (ARK_ILL_INPUT); } @@ -77,8 +75,7 @@ int ARKStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) (void*)ark_mem); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "ARKStepSetNonlinearSolver", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Setting convergence test function failed"); return (ARK_ILL_INPUT); } @@ -87,8 +84,7 @@ int ARKStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) retval = SUNNonlinSolSetMaxIters(step_mem->NLS, step_mem->maxcor); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "ARKStepSetNonlinearSolver", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Setting maximum number of nonlinear iterations failed"); return (ARK_ILL_INPUT); } @@ -96,8 +92,7 @@ int ARKStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) /* set the nonlinear system RHS function */ if (!(step_mem->fi)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "ARKStepSetNonlinearSolver", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "The implicit ODE RHS function is NULL"); return (ARK_ILL_INPUT); } @@ -120,8 +115,7 @@ int ARKStepSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepSetNlsRhsFn", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } if (nls_fi) { step_mem->nls_fi = nls_fi; } @@ -146,8 +140,7 @@ int ARKStepGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "ARKStepGetNonlinearSystemData", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *tcur = ark_mem->tcur; @@ -182,7 +175,7 @@ int arkStep_NlsInit(ARKodeMem ark_mem) /* access ARKodeARKStepMem structure */ if (ark_mem->step_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", "arkStep_NlsInit", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARKSTEP_NO_MEM); return (ARK_MEM_NULL); } @@ -200,7 +193,7 @@ int arkStep_NlsInit(ARKodeMem ark_mem) else { retval = SUNNonlinSolSetLSetupFn(step_mem->NLS, NULL); } if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", "arkStep_NlsInit", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Setting the linear solver setup function failed"); return (ARK_NLS_INIT_FAIL); } @@ -213,7 +206,7 @@ int arkStep_NlsInit(ARKodeMem ark_mem) else { retval = SUNNonlinSolSetLSolveFn(step_mem->NLS, NULL); } if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", "arkStep_NlsInit", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Setting linear solver solve function failed"); return (ARK_NLS_INIT_FAIL); } @@ -235,8 +228,8 @@ int arkStep_NlsInit(ARKodeMem ark_mem) } else { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "arkStep_NlsInit", "Invalid mass matrix type"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "Invalid mass matrix type"); return (ARK_ILL_INPUT); } } @@ -259,20 +252,20 @@ int arkStep_NlsInit(ARKodeMem ark_mem) } else { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "arkStep_NlsInit", "Invalid mass matrix type"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "Invalid mass matrix type"); return (ARK_ILL_INPUT); } } else { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "arkStep_NlsInit", "Invalid nonlinear solver type"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "Invalid nonlinear solver type"); return (ARK_ILL_INPUT); } if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", "arkStep_NlsInit", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Setting nonlinear system function failed"); return (ARK_ILL_INPUT); } @@ -281,8 +274,8 @@ int arkStep_NlsInit(ARKodeMem ark_mem) retval = SUNNonlinSolInitialize(step_mem->NLS); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ARKStep", - "arkStep_NlsInit", MSG_NLS_INIT_FAIL); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + MSG_NLS_INIT_FAIL); return (ARK_NLS_INIT_FAIL); } @@ -314,7 +307,7 @@ int arkStep_Nls(ARKodeMem ark_mem, int nflag) /* access ARKodeARKStepMem structure */ if (ark_mem->step_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ARKStep", "arkStep_Nls", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARKSTEP_NO_MEM); return (ARK_MEM_NULL); } @@ -412,8 +405,7 @@ int arkStep_NlsLSetup(sunbooleantype jbad, sunbooleantype* jcur, void* arkode_me int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "arkStep_NlsLSetup", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update convfail based on jbad flag */ @@ -455,8 +447,7 @@ int arkStep_NlsLSolve(N_Vector b, void* arkode_mem) int retval, nonlin_iter; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "arkStep_NlsLSolve", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* retrieve nonlinear solver iteration from module */ @@ -511,8 +502,7 @@ int arkStep_NlsResidual_MassIdent(N_Vector zcor, N_Vector r, void* arkode_mem) N_Vector X[3]; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "arkStep_NlsResidual_MassIdent", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update 'ycur' value as stored predictor + current corrector */ @@ -574,8 +564,7 @@ int arkStep_NlsResidual_MassFixed(N_Vector zcor, N_Vector r, void* arkode_mem) N_Vector X[3]; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "arkStep_NlsResidual_MassFixed", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update 'ycur' value as stored predictor + current corrector */ @@ -643,8 +632,7 @@ int arkStep_NlsResidual_MassTDep(N_Vector zcor, N_Vector r, void* arkode_mem) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "arkStep_NlsResidual_MassTDep", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update 'ycur' value as stored predictor + current corrector */ @@ -709,8 +697,7 @@ int arkStep_NlsFPFunction_MassIdent(N_Vector zcor, N_Vector g, void* arkode_mem) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "arkStep_NlsFPFunction_MassIdent", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update 'ycur' value as stored predictor + current corrector */ @@ -773,8 +760,7 @@ int arkStep_NlsFPFunction_MassFixed(N_Vector zcor, N_Vector g, void* arkode_mem) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "arkStep_NlsFPFunction_MassFixed", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update 'ycur' value as stored predictor + current corrector */ @@ -843,8 +829,7 @@ int arkStep_NlsFPFunction_MassTDep(N_Vector zcor, N_Vector g, void* arkode_mem) int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "arkStep_NlsFPFunction_MassTDep", - &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update 'ycur' value as stored predictor + current corrector */ @@ -900,8 +885,7 @@ int arkStep_NlsConvTest(SUNNonlinearSolver NLS, N_Vector y, N_Vector del, int m, retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, "arkStep_NlsConvTest", &ark_mem, - &step_mem); + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if the problem is linearly implicit, just return success */ diff --git a/src/arkode/arkode_bandpre.c b/src/arkode/arkode_bandpre.c index 9a6e529a8d..e64034b7c8 100644 --- a/src/arkode/arkode_bandpre.c +++ b/src/arkode/arkode_bandpre.c @@ -69,7 +69,7 @@ int ARKBandPrecInit(void* arkode_mem, sunindextype N, sunindextype mu, /* Test compatibility of NVECTOR package with the BAND preconditioner */ if (ark_mem->tempv1->ops->nvgetarraypointer == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKBANDPRE", "ARKBandPrecInit", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_BP_BAD_NVECTOR); return (ARKLS_ILL_INPUT); } @@ -79,7 +79,7 @@ int ARKBandPrecInit(void* arkode_mem, sunindextype N, sunindextype mu, pdata = (ARKBandPrecData)malloc(sizeof *pdata); if (pdata == NULL) { - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKBANDPRE", "ARKBandPrecInit", + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_BP_MEM_FAIL); return (ARKLS_MEM_FAIL); } @@ -100,7 +100,7 @@ int ARKBandPrecInit(void* arkode_mem, sunindextype N, sunindextype mu, { free(pdata); pdata = NULL; - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKBANDPRE", "ARKBandPrecInit", + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_BP_MEM_FAIL); return (ARKLS_MEM_FAIL); } @@ -114,7 +114,7 @@ int ARKBandPrecInit(void* arkode_mem, sunindextype N, sunindextype mu, SUNMatDestroy(pdata->savedJ); free(pdata); pdata = NULL; - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKBANDPRE", "ARKBandPrecInit", + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_BP_MEM_FAIL); return (ARKLS_MEM_FAIL); } @@ -128,7 +128,7 @@ int ARKBandPrecInit(void* arkode_mem, sunindextype N, sunindextype mu, SUNMatDestroy(pdata->savedJ); free(pdata); pdata = NULL; - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKBANDPRE", "ARKBandPrecInit", + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_BP_MEM_FAIL); return (ARKLS_MEM_FAIL); } @@ -142,7 +142,7 @@ int ARKBandPrecInit(void* arkode_mem, sunindextype N, sunindextype mu, SUNMatDestroy(pdata->savedJ); free(pdata); pdata = NULL; - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKBANDPRE", "ARKBandPrecInit", + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_BP_MEM_FAIL); return (ARKLS_MEM_FAIL); } @@ -156,7 +156,7 @@ int ARKBandPrecInit(void* arkode_mem, sunindextype N, sunindextype mu, arkFreeVec(ark_mem, &(pdata->tmp1)); free(pdata); pdata = NULL; - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKBANDPRE", "ARKBandPrecInit", + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_BP_MEM_FAIL); return (ARKLS_MEM_FAIL); } @@ -172,7 +172,7 @@ int ARKBandPrecInit(void* arkode_mem, sunindextype N, sunindextype mu, arkFreeVec(ark_mem, &(pdata->tmp2)); free(pdata); pdata = NULL; - arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, "ARKBANDPRE", "ARKBandPrecInit", + arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, __LINE__, __func__, __FILE__, MSG_BP_SUNLS_FAIL); return (ARKLS_SUNLS_FAIL); } @@ -208,8 +208,8 @@ int ARKBandPrecGetWorkSpace(void* arkode_mem, long int* lenrwBP, long int* leniw /* Return immediately if ARKBandPrecData is NULL */ if (arkls_mem->P_data == NULL) { - arkProcessError(ark_mem, ARKLS_PMEM_NULL, "ARKBANDPRE", - "ARKBandPrecGetWorkSpace", MSG_BP_PMEM_NULL); + arkProcessError(ark_mem, ARKLS_PMEM_NULL, __LINE__, __func__, __FILE__, + MSG_BP_PMEM_NULL); return (ARKLS_PMEM_NULL); } pdata = (ARKBandPrecData)arkls_mem->P_data; @@ -269,8 +269,8 @@ int ARKBandPrecGetNumRhsEvals(void* arkode_mem, long int* nfevalsBP) /* Return immediately if ARKBandPrecData is NULL */ if (arkls_mem->P_data == NULL) { - arkProcessError(ark_mem, ARKLS_PMEM_NULL, "ARKBANDPRE", - "ARKBandPrecGetNumRhsEvals", MSG_BP_PMEM_NULL); + arkProcessError(ark_mem, ARKLS_PMEM_NULL, __LINE__, __func__, __FILE__, + MSG_BP_PMEM_NULL); return (ARKLS_PMEM_NULL); } pdata = (ARKBandPrecData)arkls_mem->P_data; @@ -342,7 +342,7 @@ static int ARKBandPrecSetup(sunrealtype t, N_Vector y, N_Vector fy, retval = SUNMatCopy(pdata->savedJ, pdata->savedP); if (retval < 0) { - arkProcessError(ark_mem, -1, "ARKBANDPRE", "ARKBandPrecSetup", + arkProcessError(ark_mem, -1, __LINE__, __func__, __FILE__, MSG_BP_SUNMAT_FAIL); return (-1); } @@ -355,7 +355,7 @@ static int ARKBandPrecSetup(sunrealtype t, N_Vector y, N_Vector fy, retval = SUNMatZero(pdata->savedJ); if (retval < 0) { - arkProcessError(ark_mem, -1, "ARKBANDPRE", "ARKBandPrecSetup", + arkProcessError(ark_mem, -1, __LINE__, __func__, __FILE__, MSG_BP_SUNMAT_FAIL); return (-1); } @@ -364,7 +364,7 @@ static int ARKBandPrecSetup(sunrealtype t, N_Vector y, N_Vector fy, retval = ARKBandPDQJac(pdata, t, y, fy, pdata->tmp1, pdata->tmp2); if (retval < 0) { - arkProcessError(ark_mem, -1, "ARKBANDPRE", "ARKBandPrecSetup", + arkProcessError(ark_mem, -1, __LINE__, __func__, __FILE__, MSG_BP_RHSFUNC_FAILED); return (-1); } @@ -373,7 +373,7 @@ static int ARKBandPrecSetup(sunrealtype t, N_Vector y, N_Vector fy, retval = SUNMatCopy(pdata->savedJ, pdata->savedP); if (retval < 0) { - arkProcessError(ark_mem, -1, "ARKBANDPRE", "ARKBandPrecSetup", + arkProcessError(ark_mem, -1, __LINE__, __func__, __FILE__, MSG_BP_SUNMAT_FAIL); return (-1); } @@ -384,7 +384,7 @@ static int ARKBandPrecSetup(sunrealtype t, N_Vector y, N_Vector fy, retval = SUNMatScaleAddI(-gamma, pdata->savedP); if (retval) { - arkProcessError(ark_mem, -1, "ARKBANDPRE", "ARKBandPrecSetup", + arkProcessError(ark_mem, -1, __LINE__, __func__, __FILE__, MSG_BP_SUNMAT_FAIL); return (-1); } diff --git a/src/arkode/arkode_bbdpre.c b/src/arkode/arkode_bbdpre.c index f1fa46d68f..e9d16c6de5 100644 --- a/src/arkode/arkode_bbdpre.c +++ b/src/arkode/arkode_bbdpre.c @@ -67,7 +67,7 @@ int ARKBBDPrecInit(void* arkode_mem, sunindextype Nlocal, sunindextype mudq, /* Test compatibility of NVECTOR package with the BBD preconditioner */ if (ark_mem->tempv1->ops->nvgetarraypointer == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKBBDPRE", "ARKBBDPrecInit", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_BBD_BAD_NVECTOR); return (ARKLS_ILL_INPUT); } @@ -77,7 +77,7 @@ int ARKBBDPrecInit(void* arkode_mem, sunindextype Nlocal, sunindextype mudq, pdata = (ARKBBDPrecData)malloc(sizeof *pdata); if (pdata == NULL) { - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKBBDPRE", "ARKBBDPrecInit", + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_BBD_MEM_FAIL); return (ARKLS_MEM_FAIL); } @@ -99,7 +99,7 @@ int ARKBBDPrecInit(void* arkode_mem, sunindextype Nlocal, sunindextype mudq, { free(pdata); pdata = NULL; - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKBBDPRE", "ARKBBDPrecInit", + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_BBD_MEM_FAIL); return (ARKLS_MEM_FAIL); } @@ -114,7 +114,7 @@ int ARKBBDPrecInit(void* arkode_mem, sunindextype Nlocal, sunindextype mudq, SUNMatDestroy(pdata->savedJ); free(pdata); pdata = NULL; - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKBBDPRE", "ARKBBDPrecInit", + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_BBD_MEM_FAIL); return (ARKLS_MEM_FAIL); } @@ -129,7 +129,7 @@ int ARKBBDPrecInit(void* arkode_mem, sunindextype Nlocal, sunindextype mudq, SUNMatDestroy(pdata->savedJ); free(pdata); pdata = NULL; - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKBBDPRE", "ARKBBDPrecInit", + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_BBD_MEM_FAIL); return (ARKLS_MEM_FAIL); } @@ -143,7 +143,7 @@ int ARKBBDPrecInit(void* arkode_mem, sunindextype Nlocal, sunindextype mudq, SUNMatDestroy(pdata->savedJ); free(pdata); pdata = NULL; - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKBBDPRE", "ARKBBDPrecInit", + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_BBD_MEM_FAIL); return (ARKLS_MEM_FAIL); } @@ -157,7 +157,7 @@ int ARKBBDPrecInit(void* arkode_mem, sunindextype Nlocal, sunindextype mudq, SUNMatDestroy(pdata->savedJ); free(pdata); pdata = NULL; - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKBBDPRE", "ARKBBDPrecInit", + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_BBD_MEM_FAIL); return (ARKLS_MEM_FAIL); } @@ -172,7 +172,7 @@ int ARKBBDPrecInit(void* arkode_mem, sunindextype Nlocal, sunindextype mudq, SUNMatDestroy(pdata->savedJ); free(pdata); pdata = NULL; - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKBBDPRE", "ARKBBDPrecInit", + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_BBD_MEM_FAIL); return (ARKLS_MEM_FAIL); } @@ -188,7 +188,7 @@ int ARKBBDPrecInit(void* arkode_mem, sunindextype Nlocal, sunindextype mudq, SUNMatDestroy(pdata->savedJ); free(pdata); pdata = NULL; - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKBBDPRE", "ARKBBDPrecInit", + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_BBD_MEM_FAIL); return (ARKLS_MEM_FAIL); } @@ -207,7 +207,7 @@ int ARKBBDPrecInit(void* arkode_mem, sunindextype Nlocal, sunindextype mudq, SUNMatDestroy(pdata->savedJ); free(pdata); pdata = NULL; - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKBBDPRE", "ARKBBDPrecInit", + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_BBD_MEM_FAIL); return (ARKLS_MEM_FAIL); } @@ -226,7 +226,7 @@ int ARKBBDPrecInit(void* arkode_mem, sunindextype Nlocal, sunindextype mudq, SUNLinSolFree(pdata->LS); free(pdata); pdata = NULL; - arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, "ARKBBDPRE", "ARKBBDPrecInit", + arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, __LINE__, __func__, __FILE__, MSG_BBD_SUNLS_FAIL); return (ARKLS_SUNLS_FAIL); } @@ -304,7 +304,7 @@ int ARKBBDPrecReInit(void* arkode_mem, sunindextype mudq, sunindextype mldq, /* Return immediately ARKBBDPrecData is NULL */ if (arkls_mem->P_data == NULL) { - arkProcessError(ark_mem, ARKLS_PMEM_NULL, "ARKBBDPRE", "ARKBBDPrecReInit", + arkProcessError(ark_mem, ARKLS_PMEM_NULL, __LINE__, __func__, __FILE__, MSG_BBD_PMEM_NULL); return (ARKLS_PMEM_NULL); } @@ -341,8 +341,8 @@ int ARKBBDPrecGetWorkSpace(void* arkode_mem, long int* lenrwBBDP, /* Return immediately ARKBBDPrecData is NULL */ if (arkls_mem->P_data == NULL) { - arkProcessError(ark_mem, ARKLS_PMEM_NULL, "ARKBBDPRE", - "ARKBBDPrecGetWorkSpace", MSG_BBD_PMEM_NULL); + arkProcessError(ark_mem, ARKLS_PMEM_NULL, __LINE__, __func__, __FILE__, + MSG_BBD_PMEM_NULL); return (ARKLS_PMEM_NULL); } pdata = (ARKBBDPrecData)arkls_mem->P_data; @@ -370,8 +370,8 @@ int ARKBBDPrecGetNumGfnEvals(void* arkode_mem, long int* ngevalsBBDP) /* Return immediately if ARKBBDPrecData is NULL */ if (arkls_mem->P_data == NULL) { - arkProcessError(ark_mem, ARKLS_PMEM_NULL, "ARKBBDPRE", - "ARKBBDPrecGetNumGfnEvals", MSG_BBD_PMEM_NULL); + arkProcessError(ark_mem, ARKLS_PMEM_NULL, __LINE__, __func__, __FILE__, + MSG_BBD_PMEM_NULL); return (ARKLS_PMEM_NULL); } pdata = (ARKBBDPrecData)arkls_mem->P_data; @@ -447,7 +447,7 @@ static int ARKBBDPrecSetup(sunrealtype t, N_Vector y, N_Vector fy, retval = SUNMatCopy(pdata->savedJ, pdata->savedP); if (retval < 0) { - arkProcessError(ark_mem, -1, "ARKBBDPRE", "ARKBBDPrecSetup", + arkProcessError(ark_mem, -1, __LINE__, __func__, __FILE__, MSG_BBD_SUNMAT_FAIL); return (-1); } @@ -461,7 +461,7 @@ static int ARKBBDPrecSetup(sunrealtype t, N_Vector y, N_Vector fy, retval = SUNMatZero(pdata->savedJ); if (retval < 0) { - arkProcessError(ark_mem, -1, "ARKBBDPRE", "ARKBBDPrecSetup", + arkProcessError(ark_mem, -1, __LINE__, __func__, __FILE__, MSG_BBD_SUNMAT_FAIL); return (-1); } @@ -470,7 +470,7 @@ static int ARKBBDPrecSetup(sunrealtype t, N_Vector y, N_Vector fy, retval = ARKBBDDQJac(pdata, t, y, pdata->tmp1, pdata->tmp2, pdata->tmp3); if (retval < 0) { - arkProcessError(ark_mem, -1, "ARKBBDPRE", "ARKBBDPrecSetup", + arkProcessError(ark_mem, -1, __LINE__, __func__, __FILE__, MSG_BBD_FUNC_FAILED); return (-1); } @@ -479,7 +479,7 @@ static int ARKBBDPrecSetup(sunrealtype t, N_Vector y, N_Vector fy, retval = SUNMatCopy(pdata->savedJ, pdata->savedP); if (retval < 0) { - arkProcessError(ark_mem, -1, "ARKBBDPRE", "ARKBBDPrecSetup", + arkProcessError(ark_mem, -1, __LINE__, __func__, __FILE__, MSG_BBD_SUNMAT_FAIL); return (-1); } @@ -490,7 +490,7 @@ static int ARKBBDPrecSetup(sunrealtype t, N_Vector y, N_Vector fy, retval = SUNMatScaleAddI(-gamma, pdata->savedP); if (retval) { - arkProcessError(ark_mem, -1, "ARKBBDPRE", "ARKBBDPrecSetup", + arkProcessError(ark_mem, -1, __LINE__, __func__, __FILE__, MSG_BBD_SUNMAT_FAIL); return (-1); } diff --git a/src/arkode/arkode_butcher_dirk.c b/src/arkode/arkode_butcher_dirk.c index 3fb1c6a2bf..f7fc66afbd 100644 --- a/src/arkode/arkode_butcher_dirk.c +++ b/src/arkode/arkode_butcher_dirk.c @@ -38,8 +38,8 @@ ARKodeButcherTable ARKodeButcherTable_LoadDIRK(ARKODE_DIRKTableID imethod) #undef ARK_BUTCHER_TABLE default: - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE", - "ARKodeButcherTable_LoadDIRK", "Unknown Butcher table"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "Unknown Butcher table"); return NULL; } } @@ -67,7 +67,7 @@ ARKODE_DIRKTableID arkButcherTableDIRKNameToID(const char* imethod) #include "arkode_butcher_dirk.def" #undef ARK_BUTCHER_TABLE - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE", "arkButcherTableDIRKNameToID", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Unknown Butcher table"); return ARKODE_DIRK_NONE; diff --git a/src/arkode/arkode_butcher_erk.c b/src/arkode/arkode_butcher_erk.c index 6cd1099417..d807000cea 100644 --- a/src/arkode/arkode_butcher_erk.c +++ b/src/arkode/arkode_butcher_erk.c @@ -38,7 +38,7 @@ ARKodeButcherTable ARKodeButcherTable_LoadERK(ARKODE_ERKTableID emethod) #undef ARK_BUTCHER_TABLE default: - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE", "ARKodeButcherTable_LoadERK", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Unknown Butcher table"); return NULL; } @@ -67,7 +67,7 @@ ARKODE_ERKTableID arkButcherTableERKNameToID(const char* emethod) #include "arkode_butcher_erk.def" #undef ARK_BUTCHER_TABLE - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE", "arkButcherTableERKNameToID", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Unknown Butcher table"); return ARKODE_ERK_NONE; diff --git a/src/arkode/arkode_erkstep.c b/src/arkode/arkode_erkstep.c index 6c383127fd..3ec6a6e719 100644 --- a/src/arkode/arkode_erkstep.c +++ b/src/arkode/arkode_erkstep.c @@ -40,7 +40,7 @@ void* ERKStepCreate(ARKRhsFn f, sunrealtype t0, N_Vector y0, SUNContext sunctx) /* Check that f is supplied */ if (f == NULL) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::ERKStep", "ERKStepCreate", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_F); return (NULL); } @@ -48,14 +48,14 @@ void* ERKStepCreate(ARKRhsFn f, sunrealtype t0, N_Vector y0, SUNContext sunctx) /* Check for legal input parameters */ if (y0 == NULL) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::ERKStep", "ERKStepCreate", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_Y0); return (NULL); } if (!sunctx) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::ERKStep", "ERKStepCreate", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_SUNCTX); return (NULL); } @@ -64,7 +64,7 @@ void* ERKStepCreate(ARKRhsFn f, sunrealtype t0, N_Vector y0, SUNContext sunctx) nvectorOK = erkStep_CheckNVector(y0); if (!nvectorOK) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::ERKStep", "ERKStepCreate", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_NVECTOR); return (NULL); } @@ -73,7 +73,7 @@ void* ERKStepCreate(ARKRhsFn f, sunrealtype t0, N_Vector y0, SUNContext sunctx) ark_mem = arkCreate(sunctx); if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ERKStep", "ERKStepCreate", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (NULL); } @@ -83,7 +83,7 @@ void* ERKStepCreate(ARKRhsFn f, sunrealtype t0, N_Vector y0, SUNContext sunctx) step_mem = (ARKodeERKStepMem)malloc(sizeof(struct ARKodeERKStepMemRec)); if (step_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ERKStep", "ERKStepCreate", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_ARKMEM_FAIL); return (NULL); } @@ -99,7 +99,7 @@ void* ERKStepCreate(ARKRhsFn f, sunrealtype t0, N_Vector y0, SUNContext sunctx) retval = ERKStepSetDefaults((void*)ark_mem); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE::ERKStep", "ERKStepCreate", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Error setting default solver options"); return (NULL); } @@ -122,7 +122,7 @@ void* ERKStepCreate(ARKRhsFn f, sunrealtype t0, N_Vector y0, SUNContext sunctx) retval = arkInit(ark_mem, t0, y0, FIRST_INIT); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE::ERKStep", "ERKStepCreate", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Unable to initialize main ARKODE infrastructure"); return (NULL); } @@ -146,8 +146,7 @@ int ERKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, int i, retval; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, "ERKStepReSize", &ark_mem, - &step_mem); + retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Determing change in vector sizes */ @@ -162,7 +161,7 @@ int ERKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, retval = arkResize(ark_mem, y0, hscale, t0, resize, resize_data); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE::ERKStep", "ERKStepResize", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Unable to resize main ARKODE infrastructure"); return (retval); } @@ -173,7 +172,7 @@ int ERKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, if (!arkResizeVec(ark_mem, resize, resize_data, lrw_diff, liw_diff, y0, &step_mem->F[i])) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ERKStep", "ERKStepResize", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Unable to resize vector"); return (ARK_MEM_FAIL); } @@ -200,14 +199,13 @@ int ERKStepReInit(void* arkode_mem, ARKRhsFn f, sunrealtype t0, N_Vector y0) int retval; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, "ERKStepReInit", &ark_mem, - &step_mem); + retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Check if ark_mem was allocated */ if (ark_mem->MallocDone == SUNFALSE) { - arkProcessError(ark_mem, ARK_NO_MALLOC, "ARKODE::ERKStep", "ERKStepReInit", + arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, MSG_ARK_NO_MALLOC); return (ARK_NO_MALLOC); } @@ -215,7 +213,7 @@ int ERKStepReInit(void* arkode_mem, ARKRhsFn f, sunrealtype t0, N_Vector y0) /* Check that f is supplied */ if (f == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ERKStep", "ERKStepReInit", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_F); return (ARK_ILL_INPUT); } @@ -223,7 +221,7 @@ int ERKStepReInit(void* arkode_mem, ARKRhsFn f, sunrealtype t0, N_Vector y0) /* Check for legal input parameters */ if (y0 == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ERKStep", "ERKStepReInit", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_Y0); return (ARK_ILL_INPUT); } @@ -235,7 +233,7 @@ int ERKStepReInit(void* arkode_mem, ARKRhsFn f, sunrealtype t0, N_Vector y0) retval = arkInit(arkode_mem, t0, y0, FIRST_INIT); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE::ERKStep", "ERKStepReInit", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Unable to initialize main ARKODE infrastructure"); return (retval); } @@ -260,7 +258,7 @@ int ERKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) int retval; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, "ERKStepReset", &ark_mem, &step_mem); + retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Initialize main ARKODE infrastructure */ @@ -268,7 +266,7 @@ int ERKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE::ERKStep", "ERKStepReset", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Unable to initialize main ARKODE infrastructure"); return (retval); } @@ -288,8 +286,8 @@ int ERKStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ERKStep", - "ERKStepSStolerances", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; @@ -302,8 +300,8 @@ int ERKStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ERKStep", - "ERKStepSVtolerances", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; @@ -316,8 +314,8 @@ int ERKStepWFtolerances(void* arkode_mem, ARKEwtFn efun) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ERKStep", - "ERKStepWFtolerances", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; @@ -330,7 +328,7 @@ int ERKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ERKStep", "ERKStepRootInit", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -346,7 +344,7 @@ int ERKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ERKStep", "ERKStepEvolve", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -364,7 +362,7 @@ int ERKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ERKStep", "ERKStepGetDky", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -458,8 +456,7 @@ void ERKStepPrintMem(void* arkode_mem, FILE* outfile) #endif /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, "ERKStepPrintMem", &ark_mem, - &step_mem); + retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return; } /* output data from main ARKODE infrastructure */ @@ -517,7 +514,7 @@ int erkStep_Init(void* arkode_mem, int init_type) int retval, j; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, "erkStep_Init", &ark_mem, &step_mem); + retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* immediately return if resize or reset */ @@ -539,7 +536,7 @@ int erkStep_Init(void* arkode_mem, int init_type) retval = erkStep_SetButcherTable(ark_mem); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ERKStep", "erkStep_Init", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Could not create Butcher table"); return (ARK_ILL_INPUT); } @@ -548,7 +545,7 @@ int erkStep_Init(void* arkode_mem, int init_type) retval = erkStep_CheckButcherTable(ark_mem); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ERKStep", "erkStep_Init", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Error in Butcher table"); return (ARK_ILL_INPUT); } @@ -560,8 +557,8 @@ int erkStep_Init(void* arkode_mem, int init_type) /* Ensure that if adaptivity is enabled, then method includes embedding coefficients */ if (!ark_mem->fixedstep && (step_mem->p == 0)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ERKStep", - "erkStep_Init", "Adaptive timestepping cannot be performed without embedding coefficients"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "Adaptive timestepping cannot be performed without embedding coefficients"); return (ARK_ILL_INPUT); } @@ -613,7 +610,7 @@ int erkStep_Init(void* arkode_mem, int init_type) if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ERKStep", "erkStep_Init", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Unable to update interpolation polynomial degree"); return (ARK_ILL_INPUT); } @@ -663,8 +660,7 @@ int erkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, sunbooleantype recomputeRHS; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, "erkStep_FullRHS", &ark_mem, - &step_mem); + retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* perform RHS functions contingent on 'mode' argument */ @@ -679,8 +675,8 @@ int erkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nfe++; if (retval != 0) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::ERKStep", - "erkStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, __FILE__, + MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } } @@ -708,8 +704,8 @@ int erkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nfe++; if (retval != 0) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::ERKStep", - "erkStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, + __FILE__, MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } } @@ -728,8 +724,8 @@ int erkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nfe++; if (retval != 0) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::ERKStep", - "erkStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, __FILE__, + MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } @@ -737,8 +733,8 @@ int erkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, default: /* return with RHS failure if unknown mode is passed */ - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::ERKStep", - "erkStep_FullRHS", "Unknown full RHS mode"); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, __FILE__, + "Unknown full RHS mode"); return (ARK_RHSFUNC_FAIL); } @@ -777,8 +773,7 @@ int erkStep_TakeStep(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr) *nflagPtr = ARK_SUCCESS; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, "erkStep_TakeStep", &ark_mem, - &step_mem); + retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* local shortcuts for fused vector operations */ @@ -904,13 +899,14 @@ int erkStep_AccessStepMem(void* arkode_mem, const char* fname, /* access ARKodeMem structure */ if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ERKStep", fname, MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, fname, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } *ark_mem = (ARKodeMem)arkode_mem; if ((*ark_mem)->step_mem == NULL) { - arkProcessError(*ark_mem, ARK_MEM_NULL, "ARKODE::ERKStep", fname, + arkProcessError(*ark_mem, ARK_MEM_NULL, __LINE__, fname, __FILE__, MSG_ERKSTEP_NO_MEM); return (ARK_MEM_NULL); } @@ -950,8 +946,8 @@ int erkStep_SetButcherTable(ARKodeMem ark_mem) /* access ARKodeERKStepMem structure */ if (ark_mem->step_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ERKStep", - "erkStep_SetButcherTable", MSG_ERKSTEP_NO_MEM); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ERKSTEP_NO_MEM); return (ARK_MEM_NULL); } step_mem = (ARKodeERKStepMem)ark_mem->step_mem; @@ -974,8 +970,7 @@ int erkStep_SetButcherTable(ARKodeMem ark_mem) case (8): etable = ERKSTEP_DEFAULT_8; break; case (9): etable = ERKSTEP_DEFAULT_9; break; default: /* no available method, set default */ - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::ERKStep", - "erkStep_SetButcherTable", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "No explicit method at requested order, using q=9."); etable = ERKSTEP_DEFAULT_9; break; @@ -1021,8 +1016,8 @@ int erkStep_CheckButcherTable(ARKodeMem ark_mem) /* access ARKodeERKStepMem structure */ if (ark_mem->step_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ERKStep", - "erkStep_CheckButcherTable", MSG_ERKSTEP_NO_MEM); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ERKSTEP_NO_MEM); return (ARK_MEM_NULL); } step_mem = (ARKodeERKStepMem)ark_mem->step_mem; @@ -1030,24 +1025,24 @@ int erkStep_CheckButcherTable(ARKodeMem ark_mem) /* check that stages > 0 */ if (step_mem->stages < 1) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ERKStep", - "erkStep_CheckButcherTable", "stages < 1!"); + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, + "stages < 1!"); return (ARK_INVALID_TABLE); } /* check that method order q > 0 */ if (step_mem->q < 1) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ERKStep", - "erkStep_CheckButcherTable", "method order < 1!"); + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, + "method order < 1!"); return (ARK_INVALID_TABLE); } /* check that embedding order p > 0 */ if ((step_mem->p < 1) && (!ark_mem->fixedstep)) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ERKStep", - "erkStep_CheckButcherTable", "embedding order < 1!"); + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, + "embedding order < 1!"); return (ARK_INVALID_TABLE); } @@ -1056,8 +1051,8 @@ int erkStep_CheckButcherTable(ARKodeMem ark_mem) { if (step_mem->B->d == NULL) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ERKStep", - "erkStep_CheckButcherTable", "no embedding!"); + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, + "no embedding!"); return (ARK_INVALID_TABLE); } } @@ -1073,8 +1068,8 @@ int erkStep_CheckButcherTable(ARKodeMem ark_mem) } if (!okay) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ERKStep", - "erkStep_CheckButcherTable", "Ae Butcher table is implicit!"); + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, + "Ae Butcher table is implicit!"); return (ARK_INVALID_TABLE); } @@ -1083,8 +1078,7 @@ int erkStep_CheckButcherTable(ARKodeMem ark_mem) { if (step_mem->q < 2) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ERKStep", - "erkStep_CheckButcherTables", + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, "The Butcher table must be at least second order!"); return ARK_INVALID_TABLE; } @@ -1093,9 +1087,8 @@ int erkStep_CheckButcherTable(ARKodeMem ark_mem) { if (step_mem->B->b[i] < ZERO) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::ERKStep", - "erkStep_CheckButcherTable", - "The Butcher table has a negative b value!"); + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, + __FILE__, "The Butcher table has a negative b value!"); return ARK_INVALID_TABLE; } } @@ -1130,8 +1123,8 @@ int erkStep_ComputeSolutions(ARKodeMem ark_mem, sunrealtype* dsmPtr) /* access ARKodeERKStepMem structure */ if (ark_mem->step_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ERKStep", - "erkStep_ComputeSolutions", MSG_ERKSTEP_NO_MEM); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ERKSTEP_NO_MEM); return (ARK_MEM_NULL); } step_mem = (ARKodeERKStepMem)ark_mem->step_mem; @@ -1207,8 +1200,8 @@ int erkStep_RelaxDeltaE(ARKodeMem ark_mem, ARKRelaxJacFn relax_jac_fn, /* Access the stepper memory structure */ if (!(ark_mem->step_mem)) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ERKStep", - "erkStep_RelaxDeltaE", MSG_ERKSTEP_NO_MEM); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ERKSTEP_NO_MEM); return ARK_MEM_NULL; } step_mem = (ARKodeERKStepMem)(ark_mem->step_mem); diff --git a/src/arkode/arkode_erkstep_io.c b/src/arkode/arkode_erkstep_io.c index 5cf192ce89..90c397c562 100644 --- a/src/arkode/arkode_erkstep_io.c +++ b/src/arkode/arkode_erkstep_io.c @@ -46,16 +46,6 @@ int ERKStepSetInterpolantType(void* arkode_mem, int itype) return (arkSetInterpolantType(arkode_mem, itype)); } -int ERKStepSetErrHandlerFn(void* arkode_mem, ARKErrHandlerFn ehfun, void* eh_data) -{ - return (arkSetErrHandlerFn(arkode_mem, ehfun, eh_data)); -} - -int ERKStepSetErrFile(void* arkode_mem, FILE* errfp) -{ - return (arkSetErrFile(arkode_mem, errfp)); -} - int ERKStepSetUserData(void* arkode_mem, void* user_data) { return (arkSetUserData(arkode_mem, user_data)); @@ -423,15 +413,14 @@ int ERKStepSetDefaults(void* arkode_mem) long int lenrw, leniw; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, "ERKStepSetDefaults", &ark_mem, - &step_mem); + retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Set default ARKODE infrastructure parameters */ retval = arkSetDefaults(arkode_mem); if (retval != ARK_SUCCESS) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::ERKStep", "ERKStepSetDefaults", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "Error setting ARKODE infrastructure defaults"); return (retval); } @@ -450,7 +439,7 @@ int ERKStepSetDefaults(void* arkode_mem) ark_mem->hadapt_mem->owncontroller = SUNFALSE; if (retval != SUNADAPTCONTROLLER_SUCCESS) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "ERKStepSetDefaults", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_Destroy failure"); return (ARK_MEM_FAIL); } @@ -459,8 +448,7 @@ int ERKStepSetDefaults(void* arkode_mem) ark_mem->hadapt_mem->hcontroller = SUNAdaptController_PI(ark_mem->sunctx); if (ark_mem->hadapt_mem->hcontroller == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::ERKStep", - "ERKStepSetDefaults", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptControllerPI allocation failure"); return (ARK_MEM_FAIL); } @@ -502,8 +490,7 @@ int ERKStepSetOrder(void* arkode_mem, int ord) int retval; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, "ERKStepSetOrder", &ark_mem, - &step_mem); + retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set user-provided value, or default, depending on argument */ @@ -543,14 +530,13 @@ int ERKStepSetTable(void* arkode_mem, ARKodeButcherTable B) int retval; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, "ERKStepSetTable", &ark_mem, - &step_mem); + retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* check for legal inputs */ if (B == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ERKStep", "ERKStepSetTable", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -575,7 +561,7 @@ int ERKStepSetTable(void* arkode_mem, ARKodeButcherTable B) step_mem->B = ARKodeButcherTable_Copy(B); if (step_mem->B == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ERKStep", "ERKStepSetTable", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -602,15 +588,14 @@ int ERKStepSetTableNum(void* arkode_mem, ARKODE_ERKTableID etable) int retval; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, "ERKStepSetTableNum", &ark_mem, - &step_mem); + retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* check that argument specifies an explicit table */ if (etable < ARKODE_MIN_ERK_NUM || etable > ARKODE_MAX_ERK_NUM) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ERKStep", - "ERKStepSetTableNum", "Illegal ERK table number"); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + "Illegal ERK table number"); return (ARK_ILL_INPUT); } @@ -629,8 +614,8 @@ int ERKStepSetTableNum(void* arkode_mem, ARKODE_ERKTableID etable) step_mem->B = ARKodeButcherTable_LoadERK(etable); if (step_mem->B == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ERKStep", - "ERKStepSetTableNum", "Error setting table with that index"); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + "Error setting table with that index"); return (ARK_ILL_INPUT); } step_mem->stages = step_mem->B->stages; @@ -672,8 +657,7 @@ int ERKStepGetNumRhsEvals(void* arkode_mem, long int* fevals) int retval; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, "ERKStepGetNumRhsEvals", &ark_mem, - &step_mem); + retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get values from step_mem */ @@ -694,8 +678,7 @@ int ERKStepGetCurrentButcherTable(void* arkode_mem, ARKodeButcherTable* B) int retval; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, "ERKStepGetCurrentButcherTable", - &ark_mem, &step_mem); + retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get tables from step_mem */ @@ -717,8 +700,7 @@ int ERKStepGetEstLocalErrors(void* arkode_mem, N_Vector ele) int retval; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, "ERKStepGetEstLocalErrors", - &ark_mem, &step_mem); + retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* copy vector to output */ @@ -741,8 +723,7 @@ int ERKStepGetTimestepperStats(void* arkode_mem, long int* expsteps, int retval; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, "ERKStepGetTimestepperStats", - &ark_mem, &step_mem); + retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set expsteps and accsteps from adaptivity structure */ @@ -769,8 +750,7 @@ int ERKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) int retval; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, "ERKStepPrintAllStats", &ark_mem, - &step_mem); + retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } retval = arkPrintAllStats(arkode_mem, outfile, fmt); @@ -786,7 +766,7 @@ int ERKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) fprintf(outfile, "\n"); break; default: - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "ERKStepPrintAllStats", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Invalid formatting option."); return (ARK_ILL_INPUT); } @@ -810,16 +790,14 @@ int ERKStepWriteParameters(void* arkode_mem, FILE* fp) int retval; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, "ERKStepWriteParameters", &ark_mem, - &step_mem); + retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* output ARKODE infrastructure parameters first */ retval = arkWriteParameters(arkode_mem, fp); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ERKStep", - "ERKStepWriteParameters", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "Error writing ARKODE infrastructure parameters"); return (retval); } @@ -844,15 +822,14 @@ int ERKStepWriteButcher(void* arkode_mem, FILE* fp) ARKodeERKStepMem step_mem; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, "ERKStepWriteButcher", &ark_mem, - &step_mem); + retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* check that Butcher table is non-NULL (otherwise report error) */ if (step_mem->B == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::ERKStep", - "ERKStepWriteButcher", "Butcher table memory is NULL"); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + "Butcher table memory is NULL"); return (ARK_MEM_NULL); } diff --git a/src/arkode/arkode_impl.h b/src/arkode/arkode_impl.h index 7a2999ed7b..e3a32ea1f6 100644 --- a/src/arkode/arkode_impl.h +++ b/src/arkode/arkode_impl.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -389,11 +390,6 @@ struct ARKodeMemRec sunbooleantype initialized; /* denotes arkInitialSetup has been done */ sunbooleantype call_fullrhs; /* denotes the full RHS fn will be called */ - /* Error handler function and error ouput file */ - ARKErrHandlerFn ehfun; /* error messages are handled by ehfun */ - void* eh_data; /* data pointer passed to ehfun */ - FILE* errfp; /* ARKODE error messages are sent to errfp */ - /* Rootfinding Data */ ARKodeRootMem root_mem; /* root-finding structure */ @@ -857,10 +853,6 @@ struct ARKodeMemRec /* Prototype of internal rwtSet function */ int arkRwtSet(N_Vector ycur, N_Vector weight, void* data); -/* Prototype of internal errHandler function */ -void arkErrHandler(int error_code, const char* module, const char* function, - char* msg, void* data); - /* Prototype of internal explicit stability estimation function */ int arkExpStab(N_Vector y, sunrealtype t, sunrealtype* hstab, void* user_data); @@ -868,8 +860,8 @@ int arkExpStab(N_Vector y, sunrealtype t, sunrealtype* hstab, void* user_data); HIGH LEVEL ERROR HANDLER, USED THROUGHOUT ARKODE ===============================================================*/ -void arkProcessError(ARKodeMem ark_mem, int error_code, const char* module, - const char* fname, const char* msgfmt, ...); +void arkProcessError(ARKodeMem ark_mem, int error_code, int line, + const char* func, const char* file, const char* msgfmt, ...); /*=============================================================== ARKODE PRIVATE FUNCTION PROTOTYPES @@ -954,8 +946,6 @@ int arkSetDefaults(void* arkode_mem); int arkSetDenseOrder(void* arkode_mem, int dord); int arkSetInterpolantType(void* arkode_mem, int itype); int arkSetInterpolantDegree(void* arkode_mem, int degree); -int arkSetErrHandlerFn(void* arkode_mem, ARKErrHandlerFn ehfun, void* eh_data); -int arkSetErrFile(void* arkode_mem, FILE* errfp); int arkSetUserData(void* arkode_mem, void* user_data); int arkSetMaxNumSteps(void* arkode_mem, long int mxsteps); int arkSetMaxHnilWarns(void* arkode_mem, int mxhnil); diff --git a/src/arkode/arkode_interp.c b/src/arkode/arkode_interp.c index 60bd8a7589..749e00b2bc 100644 --- a/src/arkode/arkode_interp.c +++ b/src/arkode/arkode_interp.c @@ -343,8 +343,8 @@ int arkInterpSetDegree_Hermite(void* arkode_mem, ARKInterp interp, int degree) { if (degree > ARK_INTERP_MAX_DEGREE) { - arkProcessError(ark_mem, ARK_INTERP_FAIL, "ARKODE", - "arkInterpSetDegree_Hermite", "Illegal degree specified."); + arkProcessError(ark_mem, ARK_INTERP_FAIL, __LINE__, __func__, __FILE__, + "Illegal degree specified."); return (ARK_ILL_INPUT); } @@ -541,8 +541,8 @@ int arkInterpEvaluate_Hermite(void* arkode_mem, ARKInterp interp, /* error on illegal d */ if (d < 0) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", - "arkInterpEvaluate_Hermite", "Requested illegal derivative."); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "Requested illegal derivative."); return (ARK_ILL_INPUT); } @@ -836,8 +836,8 @@ int arkInterpEvaluate_Hermite(void* arkode_mem, ARKInterp interp, break; default: - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", - "arkInterpEvaluate_Hermite", "Illegal polynomial order"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "Illegal polynomial order"); return (ARK_ILL_INPUT); } @@ -1105,8 +1105,8 @@ int arkInterpSetDegree_Lagrange(void* arkode_mem, ARKInterp I, int degree) { if (degree > ARK_INTERP_MAX_DEGREE) { - arkProcessError(ark_mem, ARK_INTERP_FAIL, "ARKODE", - "arkInterpSetDegree_Lagrange", "Illegal degree specified."); + arkProcessError(ark_mem, ARK_INTERP_FAIL, __LINE__, __func__, __FILE__, + "Illegal degree specified."); return (ARK_ILL_INPUT); } @@ -1333,8 +1333,7 @@ int arkInterpEvaluate_Lagrange(void* arkode_mem, ARKInterp I, sunrealtype tau, /* error on illegal deriv */ if ((deriv < 0) || (deriv > 3)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", - "arkInterpEvaluate_Lagrange", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Requested illegal derivative."); return (ARK_ILL_INPUT); } diff --git a/src/arkode/arkode_io.c b/src/arkode/arkode_io.c index dcc3ffd527..f035f85a65 100644 --- a/src/arkode/arkode_io.c +++ b/src/arkode/arkode_io.c @@ -47,7 +47,7 @@ int arkSetDefaults(void* arkode_mem) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetDefaults", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -64,21 +64,15 @@ int arkSetDefaults(void* arkode_mem) ark_mem->SRabstol = SUN_RCONST(1.e-9); /* residual absolute tolerance */ ark_mem->Ratolmin0 = SUNFALSE; /* min(Rabstol) > 0 */ ark_mem->user_efun = SUNFALSE; /* no user-supplied ewt function */ - ark_mem->efun = arkEwtSetSS; /* built-in scalar-scalar ewt function */ - ark_mem->e_data = ark_mem; /* ewt function data */ - ark_mem->user_rfun = SUNFALSE; /* no user-supplied rwt function */ - ark_mem->rfun = arkRwtSet; /* built-in rwt function */ - ark_mem->r_data = ark_mem; /* rwt function data */ - ark_mem->ehfun = arkErrHandler; /* default error handler fn */ - ark_mem->eh_data = ark_mem; /* error handler data */ - ark_mem->errfp = stderr; /* output stream for errors */ -#if SUNDIALS_LOGGING_LEVEL > 0 - ark_mem->errfp = (ARK_LOGGER->error_fp) ? ARK_LOGGER->error_fp : stderr; -#endif - ark_mem->mxstep = MXSTEP_DEFAULT; /* max number of steps */ - ark_mem->mxhnil = MXHNIL; /* max warns of t+h==t */ - ark_mem->maxnef = MAXNEF; /* max error test fails */ - ark_mem->maxncf = MAXNCF; /* max convergence fails */ + ark_mem->efun = arkEwtSetSS; /* built-in scalar-scalar ewt function */ + ark_mem->e_data = ark_mem; /* ewt function data */ + ark_mem->user_rfun = SUNFALSE; /* no user-supplied rwt function */ + ark_mem->rfun = arkRwtSet; /* built-in rwt function */ + ark_mem->r_data = ark_mem; /* rwt function data */ + ark_mem->mxstep = MXSTEP_DEFAULT; /* max number of steps */ + ark_mem->mxhnil = MXHNIL; /* max warns of t+h==t */ + ark_mem->maxnef = MAXNEF; /* max error test fails */ + ark_mem->maxncf = MAXNCF; /* max convergence fails */ ark_mem->maxconstrfails = MAXCONSTRFAILS; /* max number of constraint fails */ ark_mem->hin = ZERO; /* determine initial step on-the-fly */ ark_mem->hmin = ZERO; /* no minimum step size */ @@ -126,7 +120,7 @@ int arkSetInterpolantType(void* arkode_mem, int itype) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetInterpolantType", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -135,7 +129,7 @@ int arkSetInterpolantType(void* arkode_mem, int itype) /* check for legal itype input */ if ((itype != ARK_INTERP_HERMITE) && (itype != ARK_INTERP_LAGRANGE)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkSetInterpolantType", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Illegal interpolation type input."); return (ARK_ILL_INPUT); } @@ -143,7 +137,7 @@ int arkSetInterpolantType(void* arkode_mem, int itype) /* do not change type once the module has been initialized */ if (ark_mem->initialized) { - arkProcessError(ark_mem, ARK_INTERP_FAIL, "ARKODE", "arkSetInterpolantType", + arkProcessError(ark_mem, ARK_INTERP_FAIL, __LINE__, __func__, __FILE__, "Type cannot be specified after module initialization."); return (ARK_ILL_INPUT); } @@ -174,7 +168,7 @@ int arkSetInterpolantType(void* arkode_mem, int itype) } if (ark_mem->interp == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkSetInterpolantType", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Unable to allocate interpolation structure"); return (ARK_MEM_FAIL); } @@ -201,7 +195,7 @@ int arkSetInterpolantDegree(void* arkode_mem, int degree) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetInterpolantDegree", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -209,7 +203,7 @@ int arkSetInterpolantDegree(void* arkode_mem, int degree) if (ark_mem->interp == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE", "arkSetInterpolantDegree", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "Interpolation module is not yet allocated"); return (ARK_MEM_NULL); } @@ -217,7 +211,7 @@ int arkSetInterpolantDegree(void* arkode_mem, int degree) /* do not change degree once the module has been initialized */ if (ark_mem->initialized) { - arkProcessError(ark_mem, ARK_INTERP_FAIL, "ARKODE", "arkSetInterpolantType", + arkProcessError(ark_mem, ARK_INTERP_FAIL, __LINE__, __func__, __FILE__, "Degree cannot be specified after module initialization."); return (ARK_ILL_INPUT); } @@ -226,56 +220,6 @@ int arkSetInterpolantDegree(void* arkode_mem, int degree) return (arkInterpSetDegree(ark_mem, ark_mem->interp, degree)); } -/*--------------------------------------------------------------- - arkSetErrHandlerFn: - - Specifies the error handler function - ---------------------------------------------------------------*/ -int arkSetErrHandlerFn(void* arkode_mem, ARKErrHandlerFn ehfun, void* eh_data) -{ - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetErrHandlerFn", - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - - /* set user-provided values, or defaults, depending on argument */ - if (ehfun == NULL) - { - ark_mem->ehfun = arkErrHandler; - ark_mem->eh_data = ark_mem; - } - else - { - ark_mem->ehfun = ehfun; - ark_mem->eh_data = eh_data; - } - - return (ARK_SUCCESS); -} - -/*--------------------------------------------------------------- - arkSetErrFile: - - Specifies the FILE pointer for output (NULL means no messages) - ---------------------------------------------------------------*/ -int arkSetErrFile(void* arkode_mem, FILE* errfp) -{ - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetErrFile", - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - ark_mem->errfp = errfp; - return (ARK_SUCCESS); -} - /*--------------------------------------------------------------- arkSetUserData: @@ -286,7 +230,7 @@ int arkSetUserData(void* arkode_mem, void* user_data) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetUserData", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -322,7 +266,7 @@ int arkSetAdaptController(void* arkode_mem, SUNAdaptController C) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetAdaptController", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -343,7 +287,7 @@ int arkSetAdaptController(void* arkode_mem, SUNAdaptController C) ark_mem->hadapt_mem->owncontroller = SUNFALSE; if (retval != SUNADAPTCONTROLLER_SUCCESS) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkSetAdaptController", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_Destroy failure"); return (ARK_MEM_FAIL); } @@ -356,7 +300,7 @@ int arkSetAdaptController(void* arkode_mem, SUNAdaptController C) C = SUNAdaptController_PID(ark_mem->sunctx); if (C == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkSetAdaptController", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptControllerPID allocation failure"); return (ARK_MEM_FAIL); } @@ -386,7 +330,7 @@ int arkSetMaxNumSteps(void* arkode_mem, long int mxsteps) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetMaxNumSteps", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -409,7 +353,7 @@ int arkSetMaxHnilWarns(void* arkode_mem, int mxhnil) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetMaxHnilWarns", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -433,7 +377,7 @@ int arkSetInitStep(void* arkode_mem, sunrealtype hin) int retval; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetInitStep", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -463,7 +407,7 @@ int arkSetMinStep(void* arkode_mem, sunrealtype hmin) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetMinStep", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -479,7 +423,7 @@ int arkSetMinStep(void* arkode_mem, sunrealtype hmin) /* check that hmin and hmax are agreeable */ if (hmin * ark_mem->hmax_inv > ONE) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkSetMinStep", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_HMIN_HMAX); return (ARK_ILL_INPUT); } @@ -501,7 +445,7 @@ int arkSetMaxStep(void* arkode_mem, sunrealtype hmax) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetMaxStep", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -518,7 +462,7 @@ int arkSetMaxStep(void* arkode_mem, sunrealtype hmax) hmax_inv = ONE / hmax; if (hmax_inv * ark_mem->hmin > ONE) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkSetMaxStep", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_HMIN_HMAX); return (ARK_ILL_INPUT); } @@ -539,7 +483,7 @@ int arkSetStopTime(void* arkode_mem, sunrealtype tstop) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetStopTime", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -553,7 +497,7 @@ int arkSetStopTime(void* arkode_mem, sunrealtype tstop) { if ((tstop - ark_mem->tcur) * ark_mem->h < ZERO) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkSetStopTime", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_TSTOP, tstop, ark_mem->tcur); return (ARK_ILL_INPUT); } @@ -576,7 +520,7 @@ int arkSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetInterpolateStopTime", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -595,7 +539,7 @@ int arkClearStopTime(void* arkode_mem) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkClearStopTime", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -626,7 +570,7 @@ int arkSetFixedStep(void* arkode_mem, sunrealtype hfixed) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetFixedStep", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -674,14 +618,14 @@ int arkSetRootDirection(void* arkode_mem, int* rootdir) if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetRootDirection", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; if (ark_mem->root_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE", "arkSetRootDirection", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -689,7 +633,7 @@ int arkSetRootDirection(void* arkode_mem, int* rootdir) if (ark_root_mem->nrtfn == 0) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkSetRootDirection", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NO_ROOT); return (ARK_ILL_INPUT); } @@ -712,14 +656,14 @@ int arkSetNoInactiveRootWarn(void* arkode_mem) ARKodeRootMem ark_root_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetNoInactiveRootWarn", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; if (ark_mem->root_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE", "arkSetNoInactiveRootWarn", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -744,7 +688,7 @@ int arkSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetPostprocessStepFn", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -780,7 +724,7 @@ int arkSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetPostprocessStageFn", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -803,7 +747,7 @@ int arkSetConstraints(void* arkode_mem, N_Vector constraints) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetConstraints", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -823,7 +767,7 @@ int arkSetConstraints(void* arkode_mem, N_Vector constraints) constraints->ops->nvconstrmask == NULL || constraints->ops->nvminquotient == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkSetConstraints", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_NVECTOR); return (ARK_ILL_INPUT); } @@ -832,7 +776,7 @@ int arkSetConstraints(void* arkode_mem, N_Vector constraints) temptest = N_VMaxNorm(constraints); if ((temptest > SUN_RCONST(2.5)) || (temptest < HALF)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkSetConstraints", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_CONSTR); return (ARK_ILL_INPUT); } @@ -861,7 +805,7 @@ int arkSetMaxNumConstrFails(void* arkode_mem, int maxfails) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetMaxNumConstrFails", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -895,7 +839,7 @@ int arkSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, SUNAdaptController C; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetController", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -904,7 +848,7 @@ int arkSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, /* Check for illegal inputs */ if ((idefault != 1) && (adapt_params == NULL)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkSetAdaptivityMethod", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "NULL-valued adapt_params provided"); return (ARK_ILL_INPUT); } @@ -924,7 +868,7 @@ int arkSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, ark_mem->hadapt_mem->owncontroller = SUNFALSE; if (retval != SUNADAPTCONTROLLER_SUCCESS) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkSetAdaptivityMethod", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_Destroy failure"); return (ARK_MEM_FAIL); } @@ -950,7 +894,7 @@ int arkSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, C = SUNAdaptController_PID(ark_mem->sunctx); if (C == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkSetAdaptivityMethod", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_PID allocation failure"); return (ARK_MEM_FAIL); } @@ -960,9 +904,8 @@ int arkSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, if (retval != SUNADAPTCONTROLLER_SUCCESS) { (void)SUNAdaptController_Destroy(C); - arkProcessError(ark_mem, ARK_CONTROLLER_ERR, "ARKODE", - "arkSetAdaptivityMethod", - "SUNAdaptController_SetParams_PID failure"); + arkProcessError(ark_mem, ARK_CONTROLLER_ERR, __LINE__, __func__, + __FILE__, "SUNAdaptController_SetParams_PID failure"); return (ARK_CONTROLLER_ERR); } } @@ -971,7 +914,7 @@ int arkSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, C = SUNAdaptController_PI(ark_mem->sunctx); if (C == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkSetAdaptivityMethod", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_PI allocation failure"); return (ARK_MEM_FAIL); } @@ -981,9 +924,8 @@ int arkSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, if (retval != SUNADAPTCONTROLLER_SUCCESS) { (void)SUNAdaptController_Destroy(C); - arkProcessError(ark_mem, ARK_CONTROLLER_ERR, "ARKODE", - "arkSetAdaptivityMethod", - "SUNAdaptController_SetParams_PI failure"); + arkProcessError(ark_mem, ARK_CONTROLLER_ERR, __LINE__, __func__, + __FILE__, "SUNAdaptController_SetParams_PI failure"); return (ARK_CONTROLLER_ERR); } } @@ -992,7 +934,7 @@ int arkSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, C = SUNAdaptController_I(ark_mem->sunctx); if (C == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkSetAdaptivityMethod", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_I allocation failure"); return (ARK_MEM_FAIL); } @@ -1002,9 +944,8 @@ int arkSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, if (retval != SUNADAPTCONTROLLER_SUCCESS) { (void)SUNAdaptController_Destroy(C); - arkProcessError(ark_mem, ARK_CONTROLLER_ERR, "ARKODE", - "arkSetAdaptivityMethod", - "SUNAdaptController_SetParams_I failure"); + arkProcessError(ark_mem, ARK_CONTROLLER_ERR, __LINE__, __func__, + __FILE__, "SUNAdaptController_SetParams_I failure"); return (ARK_CONTROLLER_ERR); } } @@ -1013,7 +954,7 @@ int arkSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, C = SUNAdaptController_ExpGus(ark_mem->sunctx); if (C == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkSetAdaptivityMethod", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_ExpGus allocation failure"); return (ARK_MEM_FAIL); } @@ -1023,9 +964,8 @@ int arkSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, if (retval != SUNADAPTCONTROLLER_SUCCESS) { (void)SUNAdaptController_Destroy(C); - arkProcessError(ark_mem, ARK_CONTROLLER_ERR, "ARKODE", - "arkSetAdaptivityMethod", - "SUNAdaptController_SetParams_ExpGus failure"); + arkProcessError(ark_mem, ARK_CONTROLLER_ERR, __LINE__, __func__, + __FILE__, "SUNAdaptController_SetParams_ExpGus failure"); return (ARK_CONTROLLER_ERR); } } @@ -1034,7 +974,7 @@ int arkSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, C = SUNAdaptController_ImpGus(ark_mem->sunctx); if (C == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkSetAdaptivityMethod", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_ImpGus allocation failure"); return (ARK_MEM_FAIL); } @@ -1044,9 +984,8 @@ int arkSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, if (retval != SUNADAPTCONTROLLER_SUCCESS) { (void)SUNAdaptController_Destroy(C); - arkProcessError(ark_mem, ARK_CONTROLLER_ERR, "ARKODE", - "arkSetAdaptivityMethod", - "SUNAdaptController_SetParams_ImpGus failure"); + arkProcessError(ark_mem, ARK_CONTROLLER_ERR, __LINE__, __func__, + __FILE__, "SUNAdaptController_SetParams_ImpGus failure"); return (ARK_CONTROLLER_ERR); } } @@ -1055,7 +994,7 @@ int arkSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, C = SUNAdaptController_ImExGus(ark_mem->sunctx); if (C == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkSetAdaptivityMethod", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_ImExGus allocation failure"); return (ARK_MEM_FAIL); } @@ -1065,15 +1004,14 @@ int arkSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, if (retval != SUNADAPTCONTROLLER_SUCCESS) { (void)SUNAdaptController_Destroy(C); - arkProcessError(ark_mem, ARK_CONTROLLER_ERR, "ARKODE", - "arkSetAdaptivityMethod", - "SUNAdaptController_SetParams_ImExGus failure"); + arkProcessError(ark_mem, ARK_CONTROLLER_ERR, __LINE__, __func__, + __FILE__, "SUNAdaptController_SetParams_ImExGus failure"); return (ARK_CONTROLLER_ERR); } } break; default: - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkSetAdaptivityMethod", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Illegal imethod"); return (ARK_ILL_INPUT); } @@ -1110,7 +1048,7 @@ int arkSetAdaptivityFn(void* arkode_mem, ARKAdaptFn hfun, void* h_data) SUNAdaptController C; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetAdaptivityFn", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1131,7 +1069,7 @@ int arkSetAdaptivityFn(void* arkode_mem, ARKAdaptFn hfun, void* h_data) ark_mem->hadapt_mem->owncontroller = SUNFALSE; if (retval != SUNADAPTCONTROLLER_SUCCESS) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkSetAdaptivityFn", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_Destroy failure"); return (ARK_MEM_FAIL); } @@ -1145,7 +1083,7 @@ int arkSetAdaptivityFn(void* arkode_mem, ARKAdaptFn hfun, void* h_data) C = SUNAdaptController_PID(ark_mem->sunctx); if (C == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkSetAdaptivityFn", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "SUNAdaptController_PID allocation failure"); return (ARK_MEM_FAIL); } @@ -1155,7 +1093,7 @@ int arkSetAdaptivityFn(void* arkode_mem, ARKAdaptFn hfun, void* h_data) C = ARKUserControl(ark_mem->sunctx, arkode_mem, hfun, h_data); if (C == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkSetAdaptivityFn", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "ARKUserControl allocation failure"); return (ARK_MEM_FAIL); } @@ -1187,14 +1125,13 @@ int arkSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac) int retval; ARKodeHAdaptMem hadapt_mem; ARKodeMem ark_mem; - retval = arkAccessHAdaptMem(arkode_mem, "arkSetCFLFraction", &ark_mem, - &hadapt_mem); + retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } /* check for allowable parameters */ if (cfl_frac >= ONE) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkSetCFLFraction", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Illegal CFL fraction"); return (ARK_ILL_INPUT); } @@ -1220,8 +1157,7 @@ int arkSetAdaptivityAdjustment(void* arkode_mem, int adjust) int retval; ARKodeHAdaptMem hadapt_mem; ARKodeMem ark_mem; - retval = arkAccessHAdaptMem(arkode_mem, "arkSetAdaptivityAdjustment", - &ark_mem, &hadapt_mem); + retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } /* store requested adjustment */ @@ -1242,14 +1178,13 @@ int arkSetSafetyFactor(void* arkode_mem, sunrealtype safety) int retval; ARKodeHAdaptMem hadapt_mem; ARKodeMem ark_mem; - retval = arkAccessHAdaptMem(arkode_mem, "arkSetSafetyFactor", &ark_mem, - &hadapt_mem); + retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } /* check for allowable parameters */ if (safety >= ONE) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkSetSafetyFactor", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Illegal safety factor"); return (ARK_ILL_INPUT); } @@ -1273,8 +1208,7 @@ int arkSetErrorBias(void* arkode_mem, sunrealtype bias) int retval; ARKodeHAdaptMem hadapt_mem; ARKodeMem ark_mem; - retval = arkAccessHAdaptMem(arkode_mem, "arkSetErrorBias", &ark_mem, - &hadapt_mem); + retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set allowed value, otherwise set default */ @@ -1288,7 +1222,7 @@ int arkSetErrorBias(void* arkode_mem, sunrealtype bias) } if (retval != SUNADAPTCONTROLLER_SUCCESS) { - arkProcessError(ark_mem, ARK_CONTROLLER_ERR, "ARKODE", "arkSetErrorBias", + arkProcessError(ark_mem, ARK_CONTROLLER_ERR, __LINE__, __func__, __FILE__, "SUNAdaptController_SetErrorBias failure"); return (ARK_CONTROLLER_ERR); } @@ -1308,8 +1242,7 @@ int arkSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth) int retval; ARKodeHAdaptMem hadapt_mem; ARKodeMem ark_mem; - retval = arkAccessHAdaptMem(arkode_mem, "arkSetMaxGrowth", &ark_mem, - &hadapt_mem); + retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set allowed value, otherwise set default */ @@ -1332,8 +1265,7 @@ int arkSetMinReduction(void* arkode_mem, sunrealtype eta_min) int retval; ARKodeHAdaptMem hadapt_mem; ARKodeMem ark_mem; - retval = arkAccessHAdaptMem(arkode_mem, "arkSetMinReduction", &ark_mem, - &hadapt_mem); + retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set allowed value, otherwise set default */ @@ -1355,8 +1287,7 @@ int arkSetFixedStepBounds(void* arkode_mem, sunrealtype lb, sunrealtype ub) int retval; ARKodeHAdaptMem hadapt_mem; ARKodeMem ark_mem; - retval = arkAccessHAdaptMem(arkode_mem, "arkSetFixedStepBounds", &ark_mem, - &hadapt_mem); + retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set allowable interval, otherwise set defaults */ @@ -1386,8 +1317,7 @@ int arkSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1) int retval; ARKodeHAdaptMem hadapt_mem; ARKodeMem ark_mem; - retval = arkAccessHAdaptMem(arkode_mem, "arkSetMaxFirstGrowth", &ark_mem, - &hadapt_mem); + retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -1409,8 +1339,7 @@ int arkSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf) int retval; ARKodeHAdaptMem hadapt_mem; ARKodeMem ark_mem; - retval = arkAccessHAdaptMem(arkode_mem, "arkSetMaxEFailGrowth", &ark_mem, - &hadapt_mem); + retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -1432,8 +1361,7 @@ int arkSetSmallNumEFails(void* arkode_mem, int small_nef) int retval; ARKodeHAdaptMem hadapt_mem; ARKodeMem ark_mem; - retval = arkAccessHAdaptMem(arkode_mem, "arkSetSmallNumEFails", &ark_mem, - &hadapt_mem); + retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -1455,8 +1383,7 @@ int arkSetMaxCFailGrowth(void* arkode_mem, sunrealtype etacf) int retval; ARKodeHAdaptMem hadapt_mem; ARKodeMem ark_mem; - retval = arkAccessHAdaptMem(arkode_mem, "arkSetMaxCFailGrowth", &ark_mem, - &hadapt_mem); + retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -1478,8 +1405,7 @@ int arkSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data) int retval; ARKodeHAdaptMem hadapt_mem; ARKodeMem ark_mem; - retval = arkAccessHAdaptMem(arkode_mem, "arkSetStabilityFn", &ark_mem, - &hadapt_mem); + retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } /* NULL argument sets default, otherwise set inputs */ @@ -1509,7 +1435,7 @@ int arkSetMaxErrTestFails(void* arkode_mem, int maxnef) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetMaxErrTestFails", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1533,7 +1459,7 @@ int arkSetMaxConvFails(void* arkode_mem, int maxncf) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetMaxConvFails", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1556,7 +1482,7 @@ int arkSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetUseCompensatedSums", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1582,7 +1508,7 @@ int arkGetNumStepAttempts(void* arkode_mem, long int* nstep_attempts) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetNumStepAttempts", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1602,7 +1528,7 @@ int arkGetNumSteps(void* arkode_mem, long int* nsteps) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetNumSteps", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1622,7 +1548,7 @@ int arkGetActualInitStep(void* arkode_mem, sunrealtype* hinused) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetActualInitStep", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1642,7 +1568,7 @@ int arkGetLastStep(void* arkode_mem, sunrealtype* hlast) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetLastStep", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1662,7 +1588,7 @@ int arkGetCurrentStep(void* arkode_mem, sunrealtype* hcur) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetCurrentStep", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1683,7 +1609,7 @@ int arkGetCurrentState(void* arkode_mem, N_Vector* state) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetCurrentState", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1703,7 +1629,7 @@ int arkGetCurrentTime(void* arkode_mem, sunrealtype* tcur) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetCurrentTime", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1723,7 +1649,7 @@ int arkGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfact) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetTolScaleFactor", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1743,7 +1669,7 @@ int arkGetErrWeights(void* arkode_mem, N_Vector eweight) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetErrWeights", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1763,7 +1689,7 @@ int arkGetResWeights(void* arkode_mem, N_Vector rweight) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetResWeights", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1783,7 +1709,7 @@ int arkGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetWorkSpace", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1805,14 +1731,14 @@ int arkGetNumGEvals(void* arkode_mem, long int* ngevals) ARKodeRootMem ark_root_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetNumGEvals", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; if (ark_mem->root_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE", "arkGetNumGEvals", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1833,14 +1759,14 @@ int arkGetRootInfo(void* arkode_mem, int* rootsfound) ARKodeRootMem ark_root_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetRootInfo", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; if (ark_mem->root_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE", "arkGetRootInfo", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1863,7 +1789,7 @@ int arkGetStepStats(void* arkode_mem, long int* nsteps, sunrealtype* hinused, ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetStepStats", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1887,7 +1813,7 @@ int arkGetNumConstrFails(void* arkode_mem, long int* nconstrfails) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetNumConstrFails", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1907,7 +1833,7 @@ int arkGetNumExpSteps(void* arkode_mem, long int* nsteps) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetNumExpSteps", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1927,7 +1853,7 @@ int arkGetNumAccSteps(void* arkode_mem, long int* nsteps) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetNumAccSteps", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1947,7 +1873,7 @@ int arkGetNumErrTestFails(void* arkode_mem, long int* netfails) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetNumErrTestFails", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1968,7 +1894,7 @@ int arkGetNumStepSolveFails(void* arkode_mem, long int* nncfails) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetNumStepSolveFails", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -1988,7 +1914,7 @@ int arkGetUserData(void* arkode_mem, void** user_data) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetUserData", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -2013,7 +1939,7 @@ int arkPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkPrintAllStats", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -2064,7 +1990,7 @@ int arkPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) } break; default: - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkPrintAllStats", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Invalid formatting option."); return (ARK_ILL_INPUT); } @@ -2161,7 +2087,7 @@ int arkWriteParameters(ARKodeMem ark_mem, FILE* fp) { if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkWriteParameters", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -2257,7 +2183,7 @@ int arkSetForcePass(void* arkode_mem, sunbooleantype force_pass) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkSetForcePass", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -2278,7 +2204,7 @@ int arkGetLastKFlag(void* arkode_mem, int* last_kflag) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkGetLastKFlag", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } diff --git a/src/arkode/arkode_ls.c b/src/arkode/arkode_ls.c index 710e5430d7..e0ef55bec6 100644 --- a/src/arkode/arkode_ls.c +++ b/src/arkode/arkode_ls.c @@ -57,7 +57,7 @@ int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) /* Return immediately if either arkode_mem or LS inputs are NULL */ if (arkode_mem == NULL) { - arkProcessError(NULL, ARKLS_MEM_NULL, "ARKLS", "arkLSSetLinearSolver", + arkProcessError(NULL, ARKLS_MEM_NULL, __LINE__, __func__, __FILE__, MSG_LS_ARKMEM_NULL); return (ARKLS_MEM_NULL); } @@ -65,7 +65,7 @@ int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) if (LS == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLSSetLinearSolver", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "LS must be non-NULL"); return (ARKLS_ILL_INPUT); } @@ -73,7 +73,7 @@ int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) /* Test if solver is compatible with LS interface */ if ((LS->ops->gettype == NULL) || (LS->ops->solve == NULL)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLSSetLinearSolver", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "LS object is missing a required operation"); return (ARKLS_ILL_INPUT); } @@ -90,7 +90,7 @@ int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) if ((ark_mem->tempv1->ops->nvconst == NULL) || (ark_mem->tempv1->ops->nvwrmsnorm == NULL)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLSSetLinearSolver", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_LS_BAD_NVECTOR); return (ARKLS_ILL_INPUT); } @@ -98,8 +98,8 @@ int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) /* Ensure that A is NULL when LS is matrix-embedded */ if ((LSType == SUNLINEARSOLVER_MATRIX_EMBEDDED) && (A != NULL)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", - "arkLSSetLinearSolver", "Incompatible inputs: matrix-embedded LS requires NULL matrix"); + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, + __FILE__, "Incompatible inputs: matrix-embedded LS requires NULL matrix"); return (ARKLS_ILL_INPUT); } @@ -108,7 +108,7 @@ int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) { if (ark_mem->tempv1->ops->nvgetlength == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLSSetLinearSolver", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_LS_BAD_NVECTOR); return (ARKLS_ILL_INPUT); } @@ -116,14 +116,14 @@ int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) if (!matrixbased && (LSType != SUNLINEARSOLVER_MATRIX_EMBEDDED) && (LS->ops->setatimes == NULL)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", - "arkLSSetLinearSolver", "Incompatible inputs: iterative LS must support ATimes routine"); + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, + __FILE__, "Incompatible inputs: iterative LS must support ATimes routine"); return (ARKLS_ILL_INPUT); } if (matrixbased && (A == NULL)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLSSetLinearSolver", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "Incompatible inputs: matrix-iterative LS requires " "non-NULL matrix"); return (ARKLS_ILL_INPUT); @@ -131,7 +131,7 @@ int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) } else if (A == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLSSetLinearSolver", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "Incompatible inputs: direct LS requires non-NULL matrix"); return (ARKLS_ILL_INPUT); } @@ -140,7 +140,7 @@ int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) if ((ark_mem->step_attachlinsol == NULL) || (ark_mem->step_getlinmem == NULL) || (ark_mem->step_getimplicitrhs == NULL) || (ark_mem->step_getgammas == NULL)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLSSetLinearSolver", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "Missing time step module or associated routines"); return (ARKLS_ILL_INPUT); } @@ -150,7 +150,7 @@ int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) arkls_mem = (ARKLsMem)malloc(sizeof(struct ARKLsMemRec)); if (arkls_mem == NULL) { - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKLS", "arkLSSetLinearSolver", + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_LS_MEM_FAIL); return (ARKLS_MEM_FAIL); } @@ -185,7 +185,7 @@ int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) if (arkls_mem->Jt_f == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLSSetLinearSolver", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "Time step module is missing implicit RHS fcn"); free(arkls_mem); arkls_mem = NULL; @@ -217,7 +217,7 @@ int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) retval = SUNLinSolSetATimes(LS, ark_mem, arkLsATimes); if (retval != SUNLS_SUCCESS) { - arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, "ARKLS", "arkLSSetLinearSolver", + arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, __LINE__, __func__, __FILE__, "Error in calling SUNLinSolSetATimes"); free(arkls_mem); arkls_mem = NULL; @@ -231,7 +231,7 @@ int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) retval = SUNLinSolSetPreconditioner(LS, ark_mem, NULL, NULL); if (retval != SUNLS_SUCCESS) { - arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, "ARKLS", "arkLSSetLinearSolver", + arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, __LINE__, __func__, __FILE__, "Error in calling SUNLinSolSetPreconditioner"); free(arkls_mem); arkls_mem = NULL; @@ -249,7 +249,7 @@ int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) /* Allocate memory for ytemp and x */ if (!arkAllocVec(ark_mem, ark_mem->tempv1, &(arkls_mem->ytemp))) { - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKLS", "arkLSSetLinearSolver", + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_LS_MEM_FAIL); free(arkls_mem); arkls_mem = NULL; @@ -258,7 +258,7 @@ int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) if (!arkAllocVec(ark_mem, ark_mem->tempv1, &(arkls_mem->x))) { - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKLS", "arkLSSetLinearSolver", + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_LS_MEM_FAIL); arkFreeVec(ark_mem, &(arkls_mem->ytemp)); free(arkls_mem); @@ -281,7 +281,7 @@ int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) arkLsSolve, arkLsFree, LSType, arkls_mem); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKLS", "arkLSSetLinearSolver", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Failed to attach to time stepper module"); N_VDestroy(arkls_mem->x); N_VDestroy(arkls_mem->ytemp); @@ -311,7 +311,7 @@ int arkLSSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, /* Return immediately if either arkode_mem or LS inputs are NULL */ if (arkode_mem == NULL) { - arkProcessError(NULL, ARKLS_MEM_NULL, "ARKLS", "arkLSSetMassLinearSolver", + arkProcessError(NULL, ARKLS_MEM_NULL, __LINE__, __func__, __FILE__, MSG_LS_ARKMEM_NULL); return (ARKLS_MEM_NULL); } @@ -319,15 +319,15 @@ int arkLSSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, if (LS == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", - "arkLSSetMassLinearSolver", "LS must be non-NULL"); + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, + "LS must be non-NULL"); return (ARKLS_ILL_INPUT); } /* Test if solver is compatible with LS interface */ if ((LS->ops->gettype == NULL) || (LS->ops->solve == NULL)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLSSetMassLinearSolver", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "LS object is missing a required operation"); return (ARKLS_ILL_INPUT); } @@ -344,16 +344,16 @@ int arkLSSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, if ((ark_mem->tempv1->ops->nvconst == NULL) || (ark_mem->tempv1->ops->nvwrmsnorm == NULL)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", - "arkLSSetMassLinearSolver", MSG_LS_BAD_NVECTOR); + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, + MSG_LS_BAD_NVECTOR); return (ARKLS_ILL_INPUT); } /* Ensure that M is NULL when LS is matrix-embedded */ if ((LSType == SUNLINEARSOLVER_MATRIX_EMBEDDED) && (M != NULL)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", - "arkLSSetMassLinearSolver", "Incompatible inputs: matrix-embedded LS requires NULL matrix"); + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, + __FILE__, "Incompatible inputs: matrix-embedded LS requires NULL matrix"); return (ARKLS_ILL_INPUT); } @@ -362,7 +362,7 @@ int arkLSSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, { if (ark_mem->tempv1->ops->nvgetlength == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLSSetLinearSolver", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_LS_BAD_NVECTOR); return (ARKLS_ILL_INPUT); } @@ -370,15 +370,14 @@ int arkLSSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, if (!matrixbased && (LSType != SUNLINEARSOLVER_MATRIX_EMBEDDED) && (LS->ops->setatimes == NULL)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", - "arkLSSetMassLinearSolver", "Incompatible inputs: iterative LS must support ATimes routine"); + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, + __FILE__, "Incompatible inputs: iterative LS must support ATimes routine"); return (ARKLS_ILL_INPUT); } if (matrixbased && (M == NULL)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", - "arkLSSetMassLinearSolver", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "Incompatible inputs: matrix-iterative LS requires " "non-NULL matrix"); return (ARKLS_ILL_INPUT); @@ -386,7 +385,7 @@ int arkLSSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, } else if (M == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLSSetMassLinearSolver", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "Incompatible inputs: direct LS requires non-NULL matrix"); return (ARKLS_ILL_INPUT); } @@ -394,7 +393,7 @@ int arkLSSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, /* Test whether time stepper module is supplied, with required routines */ if ((ark_mem->step_attachmasssol == NULL) || (ark_mem->step_getmassmem == NULL)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLSSetMassLinearSolver", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "Missing time step module or associated routines"); return (ARKLS_ILL_INPUT); } @@ -404,8 +403,8 @@ int arkLSSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, arkls_mem = (ARKLsMassMem)malloc(sizeof(struct ARKLsMassMemRec)); if (arkls_mem == NULL) { - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKLS", - "arkLSSetMassLinearSolver", MSG_LS_MEM_FAIL); + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, + MSG_LS_MEM_FAIL); return (ARKLS_MEM_FAIL); } memset(arkls_mem, 0, sizeof(struct ARKLsMassMemRec)); @@ -446,8 +445,7 @@ int arkLSSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, retval = SUNLinSolSetATimes(LS, ark_mem, NULL); if (retval != SUNLS_SUCCESS) { - arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, "ARKLS", - "arkLSSetMassLinearSolver", + arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, __LINE__, __func__, __FILE__, "Error in calling SUNLinSolSetATimes"); free(arkls_mem); arkls_mem = NULL; @@ -461,8 +459,7 @@ int arkLSSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, retval = SUNLinSolSetPreconditioner(LS, ark_mem, NULL, NULL); if (retval != SUNLS_SUCCESS) { - arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, "ARKLS", - "arkLSSetMassLinearSolver", + arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, __LINE__, __func__, __FILE__, "Error in calling SUNLinSolSetPreconditioner"); free(arkls_mem); arkls_mem = NULL; @@ -480,8 +477,8 @@ int arkLSSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, arkls_mem->M_lu = SUNMatClone(M); if (arkls_mem->M_lu == NULL) { - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKLS", - "arkLSSetMassLinearSolver", MSG_LS_MEM_FAIL); + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, + MSG_LS_MEM_FAIL); free(arkls_mem); arkls_mem = NULL; return (ARKLS_MEM_FAIL); @@ -493,8 +490,8 @@ int arkLSSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, /* Allocate memory for x */ if (!arkAllocVec(ark_mem, ark_mem->tempv1, &(arkls_mem->x))) { - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKLS", - "arkLSSetMassLinearSolver", MSG_LS_MEM_FAIL); + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, + MSG_LS_MEM_FAIL); if (!iterative) { SUNMatDestroy(arkls_mem->M_lu); } free(arkls_mem); arkls_mem = NULL; @@ -511,7 +508,7 @@ int arkLSSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, LSType, arkls_mem); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKLS", "arkLSSetMassLinearSolver", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Failed to attach to time stepper module"); N_VDestroy(arkls_mem->x); if (!iterative) { SUNMatDestroy(arkls_mem->M_lu); } @@ -543,7 +540,7 @@ int arkLSSetJacFn(void* arkode_mem, ARKLsJacFn jac) /* return with failure if jac cannot be used */ if ((jac != NULL) && (arkls_mem->A == NULL)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLSSetJacFn", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "Jacobian routine cannot be supplied for NULL SUNMatrix"); return (ARKLS_ILL_INPUT); } @@ -587,14 +584,14 @@ int arkLSSetMassFn(void* arkode_mem, ARKLsMassFn mass) /* return with failure if mass cannot be used */ if (mass == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLSSetMassFn", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "Mass-matrix routine must be non-NULL"); return (ARKLS_ILL_INPUT); } if (arkls_mem->M == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", - "arkLSSetMassFn", "Mass-matrix routine cannot be supplied for NULL SUNMatrix"); + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, + __FILE__, "Mass-matrix routine cannot be supplied for NULL SUNMatrix"); return (ARKLS_ILL_INPUT); } @@ -723,7 +720,7 @@ int arkLSSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, /* issue error if LS object does not allow user-supplied preconditioning */ if (arkls_mem->LS->ops->setpreconditioner == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLSSetPreconditioner", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "SUNLinearSolver object does not support user-supplied " "preconditioning"); return (ARKLS_ILL_INPUT); @@ -740,7 +737,7 @@ int arkLSSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, arkls_psolve); if (retval != SUNLS_SUCCESS) { - arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, "ARKLS", "arkLSSetPreconditioner", + arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, __LINE__, __func__, __FILE__, "Error in calling SUNLinSolSetPreconditioner"); return (ARKLS_SUNLS_FAIL); } @@ -766,8 +763,8 @@ int arkLSSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, /* issue error if LS object does not allow user-supplied ATimes */ if (arkls_mem->LS->ops->setatimes == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", - "arkLSSetJacTimes", "SUNLinearSolver object does not support user-supplied ATimes routine"); + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, + __FILE__, "SUNLinearSolver object does not support user-supplied ATimes routine"); return (ARKLS_ILL_INPUT); } @@ -790,7 +787,7 @@ int arkLSSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, if (arkls_mem->Jt_f == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLSSetJacTimes", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "Time step module is missing implicit RHS fcn"); return (ARKLS_ILL_INPUT); } @@ -818,8 +815,8 @@ int arkLSSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn) /* check if using internal finite difference approximation */ if (!(arkls_mem->jtimesDQ)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", - "arkLSSetJacTimesRhsFn", "Internal finite-difference Jacobian-vector product is disabled."); + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, + __FILE__, "Internal finite-difference Jacobian-vector product is disabled."); return (ARKLS_ILL_INPUT); } @@ -831,7 +828,7 @@ int arkLSSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn) if (arkls_mem->Jt_f == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLSSetJacTimesRhsFn", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "Time step module is missing implicit RHS fcn"); return (ARKLS_ILL_INPUT); } @@ -854,8 +851,8 @@ int arkLSSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys) /* return with failure if linsys cannot be used */ if ((linsys != NULL) && (arkls_mem->A == NULL)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", - "arkLSSetLinSysFn", "Linear system setup routine cannot be supplied for NULL SUNMatrix"); + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, + __FILE__, "Linear system setup routine cannot be supplied for NULL SUNMatrix"); return (ARKLS_ILL_INPUT); } @@ -1287,8 +1284,7 @@ int arkLSSetMassPreconditioner(void* arkode_mem, ARKLsMassPrecSetupFn psetup, /* issue error if LS object does not allow user-supplied preconditioning */ if (arkls_mem->LS->ops->setpreconditioner == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", - "arkLSSetMassPreconditioner", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "SUNLinearSolver object does not support user-supplied " "preconditioning"); return (ARKLS_ILL_INPUT); @@ -1305,8 +1301,7 @@ int arkLSSetMassPreconditioner(void* arkode_mem, ARKLsMassPrecSetupFn psetup, arkls_mpsolve); if (retval != SUNLS_SUCCESS) { - arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, "ARKLS", - "arkLSSetMassPreconditioner", + arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, __LINE__, __func__, __FILE__, "Error in calling SUNLinSolSetPreconditioner"); return (ARKLS_SUNLS_FAIL); } @@ -1333,7 +1328,7 @@ int arkLSSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn mtsetup, /* issue error if mtimes function is unusable */ if (mtimes == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLSSetMassTimes", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "non-NULL mtimes function must be supplied"); return (ARKLS_ILL_INPUT); } @@ -1341,8 +1336,8 @@ int arkLSSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn mtsetup, /* issue error if LS object does not allow user-supplied ATimes */ if (arkls_mem->LS->ops->setatimes == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", - "arkLSSetMassTimes", "SUNLinearSolver object does not support user-supplied ATimes routine"); + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, + __FILE__, "SUNLinearSolver object does not support user-supplied ATimes routine"); return (ARKLS_ILL_INPUT); } @@ -1356,7 +1351,7 @@ int arkLSSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn mtsetup, retval = SUNLinSolSetATimes(arkls_mem->LS, ark_mem, arkLsMTimes); if (retval != SUNLS_SUCCESS) { - arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, "ARKLS", "arkLSSetMassTimes", + arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, __LINE__, __func__, __FILE__, "Error in calling SUNLinSolSetATimes"); return (ARKLS_SUNLS_FAIL); } @@ -1662,7 +1657,7 @@ int arkLsATimes(void* arkode_mem, N_Vector v, N_Vector z) &dgamma_fail); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKLS", "arkLsATimes", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "An error occurred in ark_step_getgammas"); return (retval); } @@ -1714,7 +1709,7 @@ int arkLsPSetup(void* arkode_mem) &dgamma_fail); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKLS", "arkLsPSetup", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "An error occurred in ark_step_getgammas"); return (retval); } @@ -1755,7 +1750,7 @@ int arkLsPSolve(void* arkode_mem, N_Vector r, N_Vector z, sunrealtype tol, int l &dgamma_fail); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKLS", "arkLsPSolve", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "An error occurred in ark_step_getgammas"); return (retval); } @@ -1794,7 +1789,7 @@ int arkLsMTimes(void* arkode_mem, N_Vector v, N_Vector z) if (retval == 0) { arkls_mem->nmtimes++; } else { - arkProcessError(ark_mem, retval, "ARKLS", "arkLsMTimes", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Error in user mass matrix-vector product routine"); } return (retval); @@ -1808,15 +1803,15 @@ int arkLsMTimes(void* arkode_mem, N_Vector v, N_Vector z) if (retval == 0) { arkls_mem->nmtimes++; } else { - arkProcessError(ark_mem, retval, "ARKLS", - "arkLsMTimes", "Error in SUNMatrix mass matrix-vector product routine"); + arkProcessError(ark_mem, retval, __LINE__, __func__, + __FILE__, "Error in SUNMatrix mass matrix-vector product routine"); } return (retval); } } /* if we made it here, then no matrix-vector product is available */ - arkProcessError(ark_mem, retval, "ARKLS", "arkLsMTimes", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Missing mass matrix-vector product routine"); return (-1); } @@ -1900,7 +1895,7 @@ int arkLsDQJac(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix Jac, /* verify that Jac is non-NULL */ if (Jac == NULL) { - arkProcessError(ark_mem, ARKLS_LMEM_NULL, "ARKLS", "arkLsDQJac", + arkProcessError(ark_mem, ARKLS_LMEM_NULL, __LINE__, __func__, __FILE__, "SUNMatrix is NULL"); return (ARKLS_LMEM_NULL); } @@ -1909,7 +1904,7 @@ int arkLsDQJac(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix Jac, fi = ark_mem->step_getimplicitrhs((void*)ark_mem); if (fi == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLsDQJac", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "Time step module is missing implicit RHS fcn"); return (ARKLS_ILL_INPUT); } @@ -1923,7 +1918,7 @@ int arkLsDQJac(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix Jac, ark_mem->tempv1->ops->nvgetarraypointer == NULL || ark_mem->tempv1->ops->nvsetarraypointer == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLsDQJac", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_LS_BAD_NVECTOR); return (ARKLS_ILL_INPUT); } @@ -1939,7 +1934,7 @@ int arkLsDQJac(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix Jac, } else { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLsDQJac", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "arkLsDQJac not implemented for this SUNMatrix type!"); retval = ARKLS_ILL_INPUT; } @@ -2227,7 +2222,7 @@ static int arkLsLinSys(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix A, retval = SUNMatCopy(arkls_mem->savedJ, A); if (retval) { - arkProcessError(ark_mem, ARKLS_SUNMAT_FAIL, "ARKLS", "arkLsSetup", + arkProcessError(ark_mem, ARKLS_SUNMAT_FAIL, __LINE__, __func__, __FILE__, MSG_LS_SUNMAT_FAILED); arkls_mem->last_flag = ARKLS_SUNMAT_FAIL; return (arkls_mem->last_flag); @@ -2244,8 +2239,8 @@ static int arkLsLinSys(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix A, retval = SUNMatZero(A); if (retval) { - arkProcessError(ark_mem, ARKLS_SUNMAT_FAIL, "ARKLS", "arkLsSetup", - MSG_LS_SUNMAT_FAILED); + arkProcessError(ark_mem, ARKLS_SUNMAT_FAIL, __LINE__, __func__, + __FILE__, MSG_LS_SUNMAT_FAILED); arkls_mem->last_flag = ARKLS_SUNMAT_FAIL; return (arkls_mem->last_flag); } @@ -2256,8 +2251,8 @@ static int arkLsLinSys(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix A, vtemp3); if (retval < 0) { - arkProcessError(ark_mem, ARKLS_JACFUNC_UNRECVR, "ARKLS", "arkLsSetup", - MSG_LS_JACFUNC_FAILED); + arkProcessError(ark_mem, ARKLS_JACFUNC_UNRECVR, __LINE__, __func__, + __FILE__, MSG_LS_JACFUNC_FAILED); arkls_mem->last_flag = ARKLS_JACFUNC_UNRECVR; return (-1); } @@ -2271,7 +2266,7 @@ static int arkLsLinSys(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix A, retval = SUNMatCopy(A, arkls_mem->savedJ); if (retval) { - arkProcessError(ark_mem, ARKLS_SUNMAT_FAIL, "ARKLS", "arkLsSetup", + arkProcessError(ark_mem, ARKLS_SUNMAT_FAIL, __LINE__, __func__, __FILE__, MSG_LS_SUNMAT_FAILED); arkls_mem->last_flag = ARKLS_SUNMAT_FAIL; return (arkls_mem->last_flag); @@ -2285,7 +2280,7 @@ static int arkLsLinSys(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix A, /* Check matrix operation return value */ if (retval) { - arkProcessError(ark_mem, ARKLS_SUNMAT_FAIL, "ARKLS", "arkLsSetup", + arkProcessError(ark_mem, ARKLS_SUNMAT_FAIL, __LINE__, __func__, __FILE__, MSG_LS_SUNMAT_FAILED); arkls_mem->last_flag = ARKLS_SUNMAT_FAIL; return (arkls_mem->last_flag); @@ -2351,8 +2346,8 @@ int arkLsInitialize(void* arkode_mem) else { retval++; } if (retval) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", - "arkLsInitialize", "No Jacobian constructor available for SUNMatrix type"); + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, + __FILE__, "No Jacobian constructor available for SUNMatrix type"); arkls_mem->last_flag = ARKLS_ILL_INPUT; return (ARKLS_ILL_INPUT); } @@ -2364,7 +2359,7 @@ int arkLsInitialize(void* arkode_mem) arkls_mem->savedJ = SUNMatClone(arkls_mem->A); if (arkls_mem->savedJ == NULL) { - arkProcessError(ark_mem, ARKLS_MEM_FAIL, "ARKLS", "arkLsInitialize", + arkProcessError(ark_mem, ARKLS_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_LS_MEM_FAIL); arkls_mem->last_flag = ARKLS_MEM_FAIL; return (ARKLS_MEM_FAIL); @@ -2391,8 +2386,8 @@ int arkLsInitialize(void* arkode_mem) /* A and M must both be NULL or non-NULL */ if ((arkls_mem->A == NULL) ^ (arkls_massmem->M == NULL)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", - "arkLsInitialize", "Cannot combine NULL and non-NULL System and mass matrices"); + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, + __FILE__, "Cannot combine NULL and non-NULL System and mass matrices"); arkls_mem->last_flag = ARKLS_ILL_INPUT; return (ARKLS_ILL_INPUT); } @@ -2415,7 +2410,7 @@ int arkLsInitialize(void* arkode_mem) } if (retval) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLsInitialize", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "System and mass matrices have incompatible types"); arkls_mem->last_flag = ARKLS_ILL_INPUT; return (ARKLS_ILL_INPUT); @@ -2426,16 +2421,16 @@ int arkLsInitialize(void* arkode_mem) if ((SUNLinSolGetType(arkls_mem->LS) == SUNLINEARSOLVER_MATRIX_EMBEDDED) && (SUNLinSolGetType(arkls_massmem->LS) != SUNLINEARSOLVER_MATRIX_EMBEDDED)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", - "arkLsInitialize", "mismatched matrix-embedded LS types (system and mass must match)"); + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, + __FILE__, "mismatched matrix-embedded LS types (system and mass must match)"); arkls_mem->last_flag = ARKLS_ILL_INPUT; return (ARKLS_ILL_INPUT); } if ((SUNLinSolGetType(arkls_mem->LS) != SUNLINEARSOLVER_MATRIX_EMBEDDED) && (SUNLinSolGetType(arkls_massmem->LS) == SUNLINEARSOLVER_MATRIX_EMBEDDED)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", - "arkLsInitialize", "mismatched matrix-embedded LS types (system and mass must match)"); + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, + __FILE__, "mismatched matrix-embedded LS types (system and mass must match)"); arkls_mem->last_flag = ARKLS_ILL_INPUT; return (ARKLS_ILL_INPUT); } @@ -2519,7 +2514,7 @@ int arkLsSetup(void* arkode_mem, int convfail, sunrealtype tpred, &jcur, &dgamma_fail); if (arkls_mem->last_flag) { - arkProcessError(ark_mem, arkls_mem->last_flag, "ARKLS", "arkLsSetup", + arkProcessError(ark_mem, arkls_mem->last_flag, __LINE__, __func__, __FILE__, "An error occurred in ark_step_getgammas"); return (arkls_mem->last_flag); } @@ -2549,7 +2544,7 @@ int arkLsSetup(void* arkode_mem, int convfail, sunrealtype tpred, vtemp3); if (arkls_mem->last_flag) { - arkProcessError(ark_mem, ARKLS_SUNMAT_FAIL, "ARKLS", "arkLsSetup", + arkProcessError(ark_mem, ARKLS_SUNMAT_FAIL, __LINE__, __func__, __FILE__, "Error setting up mass-matrix linear solver"); return (arkls_mem->last_flag); } @@ -2578,8 +2573,8 @@ int arkLsSetup(void* arkode_mem, int convfail, sunrealtype tpred, { if (retval < 0) { - arkProcessError(ark_mem, ARKLS_JACFUNC_UNRECVR, "ARKLS", "arkLsSetup", - MSG_LS_JACFUNC_FAILED); + arkProcessError(ark_mem, ARKLS_JACFUNC_UNRECVR, __LINE__, __func__, + __FILE__, MSG_LS_JACFUNC_FAILED); arkls_mem->last_flag = ARKLS_JACFUNC_UNRECVR; return (-1); } @@ -2675,7 +2670,7 @@ int arkLsSolve(void* arkode_mem, N_Vector b, sunrealtype tnow, N_Vector ynow, ark_mem->ewt); if (retval != SUNLS_SUCCESS) { - arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, "ARKLS", "arkLsSolve", + arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, __LINE__, __func__, __FILE__, "Error in call to SUNLinSolSetScalingVectors"); arkls_mem->last_flag = ARKLS_SUNLS_FAIL; return (arkls_mem->last_flag); @@ -2721,8 +2716,8 @@ int arkLsSolve(void* arkode_mem, N_Vector b, sunrealtype tnow, N_Vector ynow, arkls_mem->njtsetup++; if (arkls_mem->last_flag) { - arkProcessError(ark_mem, arkls_mem->last_flag, "ARKLS", "arkLsSolve", - MSG_LS_JTSETUP_FAILED); + arkProcessError(ark_mem, arkls_mem->last_flag, __LINE__, __func__, + __FILE__, MSG_LS_JTSETUP_FAILED); return (arkls_mem->last_flag); } } @@ -2739,8 +2734,8 @@ int arkLsSolve(void* arkode_mem, N_Vector b, sunrealtype tnow, N_Vector ynow, &jcur, &dgamma_fail); if (arkls_mem->last_flag != ARK_SUCCESS) { - arkProcessError(ark_mem, arkls_mem->last_flag, "ARKLS", "arkLsSolve", - "An error occurred in ark_step_getgammas"); + arkProcessError(ark_mem, arkls_mem->last_flag, __LINE__, __func__, + __FILE__, "An error occurred in ark_step_getgammas"); return (arkls_mem->last_flag); } if (gamrat != ONE) { N_VScale(TWO / (ONE + gamrat), b, b); } @@ -2802,18 +2797,18 @@ int arkLsSolve(void* arkode_mem, N_Vector b, sunrealtype tnow, N_Vector ynow, case SUNLS_GS_FAIL: case SUNLS_QRSOL_FAIL: return (-1); break; case SUNLS_PACKAGE_FAIL_UNREC: - arkProcessError(ark_mem, SUNLS_PACKAGE_FAIL_UNREC, "ARKLS", "arkLsSolve", - "Failure in SUNLinSol external package"); + arkProcessError(ark_mem, SUNLS_PACKAGE_FAIL_UNREC, __LINE__, __func__, + __FILE__, "Failure in SUNLinSol external package"); return (-1); break; case SUNLS_ATIMES_FAIL_UNREC: - arkProcessError(ark_mem, SUNLS_ATIMES_FAIL_UNREC, "ARKLS", "arkLsSolve", - MSG_LS_JTIMES_FAILED); + arkProcessError(ark_mem, SUNLS_ATIMES_FAIL_UNREC, __LINE__, __func__, + __FILE__, MSG_LS_JTIMES_FAILED); return (-1); break; case SUNLS_PSOLVE_FAIL_UNREC: - arkProcessError(ark_mem, SUNLS_PSOLVE_FAIL_UNREC, "ARKLS", "arkLsSolve", - MSG_LS_PSOLVE_FAILED); + arkProcessError(ark_mem, SUNLS_PSOLVE_FAIL_UNREC, __LINE__, __func__, + __FILE__, MSG_LS_PSOLVE_FAILED); return (-1); break; } @@ -2897,7 +2892,7 @@ int arkLsMassInitialize(void* arkode_mem) /* check for user-provided mass matrix constructor */ if (arkls_mem->mass == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLsMassInitialize", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "Missing user-provided mass-matrix routine"); arkls_mem->last_flag = ARKLS_ILL_INPUT; return (arkls_mem->last_flag); @@ -2905,7 +2900,7 @@ int arkLsMassInitialize(void* arkode_mem) /* check that someone can perform matrix-vector product */ if ((arkls_mem->mtimes == NULL) && (arkls_mem->M->ops->matvec == NULL)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLsMassInitialize", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "No available mass matrix-vector product routine"); arkls_mem->last_flag = ARKLS_ILL_INPUT; return (arkls_mem->last_flag); @@ -2916,7 +2911,7 @@ int arkLsMassInitialize(void* arkode_mem) if ((arkls_mem->M == NULL) && (arkls_mem->mtimes == NULL) && (SUNLinSolGetType(arkls_mem->LS) != SUNLINEARSOLVER_MATRIX_EMBEDDED)) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLsMassInitialize", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "Missing user-provided mass matrix-vector product routine"); arkls_mem->last_flag = ARKLS_ILL_INPUT; return (arkls_mem->last_flag); @@ -2925,7 +2920,7 @@ int arkLsMassInitialize(void* arkode_mem) /* ensure that a mass matrix solver exists */ if (arkls_mem->LS == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, "ARKLS", "arkLsMassInitialize", + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, "Missing SUNLinearSolver object"); arkls_mem->last_flag = ARKLS_ILL_INPUT; return (arkls_mem->last_flag); @@ -2998,8 +2993,8 @@ int arkLsMassSetup(void* arkode_mem, sunrealtype t, N_Vector vtemp1, arkls_mem->msetuptime = t; if (arkls_mem->last_flag != 0) { - arkProcessError(ark_mem, arkls_mem->last_flag, "ARKLS", "arkLsMassSetup", - MSG_LS_MTSETUP_FAILED); + arkProcessError(ark_mem, arkls_mem->last_flag, __LINE__, __func__, + __FILE__, MSG_LS_MTSETUP_FAILED); return (arkls_mem->last_flag); } } @@ -3030,8 +3025,8 @@ int arkLsMassSetup(void* arkode_mem, sunrealtype t, N_Vector vtemp1, retval = SUNMatZero(arkls_mem->M); if (retval) { - arkProcessError(ark_mem, ARKLS_SUNMAT_FAIL, "ARKLS", "arkLsMassSetup", - MSG_LS_SUNMAT_FAILED); + arkProcessError(ark_mem, ARKLS_SUNMAT_FAIL, __LINE__, __func__, + __FILE__, MSG_LS_SUNMAT_FAILED); arkls_mem->last_flag = ARKLS_SUNMAT_FAIL; return (arkls_mem->last_flag); } @@ -3043,8 +3038,8 @@ int arkLsMassSetup(void* arkode_mem, sunrealtype t, N_Vector vtemp1, arkls_mem->msetuptime = t; if (retval < 0) { - arkProcessError(ark_mem, ARKLS_MASSFUNC_UNRECVR, "ARKLS", - "arkLsMassSetup", MSG_LS_MASSFUNC_FAILED); + arkProcessError(ark_mem, ARKLS_MASSFUNC_UNRECVR, __LINE__, __func__, + __FILE__, MSG_LS_MASSFUNC_FAILED); arkls_mem->last_flag = ARKLS_MASSFUNC_UNRECVR; return (-1); } @@ -3060,8 +3055,8 @@ int arkLsMassSetup(void* arkode_mem, sunrealtype t, N_Vector vtemp1, retval = SUNMatCopy(arkls_mem->M, arkls_mem->M_lu); if (retval) { - arkProcessError(ark_mem, ARKLS_SUNMAT_FAIL, "ARKLS", "arkLsMassSetup", - MSG_LS_SUNMAT_FAILED); + arkProcessError(ark_mem, ARKLS_SUNMAT_FAIL, __LINE__, __func__, + __FILE__, MSG_LS_SUNMAT_FAILED); arkls_mem->last_flag = ARKLS_SUNMAT_FAIL; return (arkls_mem->last_flag); } @@ -3086,7 +3081,7 @@ int arkLsMassSetup(void* arkode_mem, sunrealtype t, N_Vector vtemp1, arkls_mem->nmvsetup++; if (retval) { - arkProcessError(ark_mem, ARKLS_SUNMAT_FAIL, "ARKLS", "arkLsMassSetup", + arkProcessError(ark_mem, ARKLS_SUNMAT_FAIL, __LINE__, __func__, __FILE__, MSG_LS_SUNMAT_FAILED); arkls_mem->last_flag = ARKLS_SUNMAT_FAIL; return (arkls_mem->last_flag); @@ -3139,7 +3134,7 @@ int arkLsMassSolve(void* arkode_mem, N_Vector b, sunrealtype nlscoef) ark_mem->ewt); if (retval != SUNLS_SUCCESS) { - arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, "ARKLS", "arkLsMassSolve", + arkProcessError(ark_mem, ARKLS_SUNLS_FAIL, __LINE__, __func__, __FILE__, "Error in call to SUNLinSolSetScalingVectors"); arkls_mem->last_flag = ARKLS_SUNLS_FAIL; return (arkls_mem->last_flag); @@ -3232,18 +3227,18 @@ int arkLsMassSolve(void* arkode_mem, N_Vector b, sunrealtype nlscoef) case SUNLS_GS_FAIL: case SUNLS_QRSOL_FAIL: return (-1); break; case SUNLS_PACKAGE_FAIL_UNREC: - arkProcessError(ark_mem, SUNLS_PACKAGE_FAIL_UNREC, "ARKLS", - "arkLsMassSolve", "Failure in SUNLinSol external package"); + arkProcessError(ark_mem, SUNLS_PACKAGE_FAIL_UNREC, __LINE__, __func__, + __FILE__, "Failure in SUNLinSol external package"); return (-1); break; case SUNLS_ATIMES_FAIL_UNREC: - arkProcessError(ark_mem, SUNLS_ATIMES_FAIL_UNREC, "ARKLS", "arkLsMassSolve", - MSG_LS_MTIMES_FAILED); + arkProcessError(ark_mem, SUNLS_ATIMES_FAIL_UNREC, __LINE__, __func__, + __FILE__, MSG_LS_MTIMES_FAILED); return (-1); break; case SUNLS_PSOLVE_FAIL_UNREC: - arkProcessError(ark_mem, SUNLS_PSOLVE_FAIL_UNREC, "ARKLS", "arkLsMassSolve", - MSG_LS_PSOLVE_FAILED); + arkProcessError(ark_mem, SUNLS_PSOLVE_FAIL_UNREC, __LINE__, __func__, + __FILE__, MSG_LS_PSOLVE_FAILED); return (-1); break; } @@ -3362,14 +3357,16 @@ int arkLs_AccessLMem(void* arkode_mem, const char* fname, ARKodeMem* ark_mem, void* ark_step_lmem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARKLS_MEM_NULL, "ARKLS", fname, MSG_LS_ARKMEM_NULL); + arkProcessError(NULL, ARKLS_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_LS_ARKMEM_NULL); return (ARKLS_MEM_NULL); } *ark_mem = (ARKodeMem)arkode_mem; ark_step_lmem = (*ark_mem)->step_getlinmem(arkode_mem); if (ark_step_lmem == NULL) { - arkProcessError(*ark_mem, ARKLS_LMEM_NULL, "ARKLS", fname, MSG_LS_LMEM_NULL); + arkProcessError(*ark_mem, ARKLS_LMEM_NULL, __LINE__, __func__, __FILE__, + MSG_LS_LMEM_NULL); return (ARKLS_LMEM_NULL); } *arkls_mem = (ARKLsMem)ark_step_lmem; @@ -3382,14 +3379,15 @@ int arkLs_AccessMassMem(void* arkode_mem, const char* fname, ARKodeMem* ark_mem, void* ark_step_massmem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARKLS_MEM_NULL, "ARKLS", fname, MSG_LS_ARKMEM_NULL); + arkProcessError(NULL, ARKLS_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_LS_ARKMEM_NULL); return (ARKLS_MEM_NULL); } *ark_mem = (ARKodeMem)arkode_mem; ark_step_massmem = (*ark_mem)->step_getmassmem(arkode_mem); if (ark_step_massmem == NULL) { - arkProcessError(*ark_mem, ARKLS_MASSMEM_NULL, "ARKLS", fname, + arkProcessError(*ark_mem, ARKLS_MASSMEM_NULL, __LINE__, __func__, __FILE__, MSG_LS_MASSMEM_NULL); return (ARKLS_MASSMEM_NULL); } diff --git a/src/arkode/arkode_mri_tables.c b/src/arkode/arkode_mri_tables.c index dba8a5ef9d..b6b713a759 100644 --- a/src/arkode/arkode_mri_tables.c +++ b/src/arkode/arkode_mri_tables.c @@ -42,7 +42,7 @@ MRIStepCoupling MRIStepCoupling_LoadTable(ARKODE_MRITableID method) #undef ARK_MRI_TABLE default: - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE", "MRIStepCoupling_LoadTable", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Unknown coupling table"); return NULL; } @@ -60,7 +60,7 @@ MRIStepCoupling MRIStepCoupling_LoadTableByName(const char* method) #include "arkode_mri_tables.def" #undef ARK_MRI_TABLE - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE", "MRIStepCoupling_LoadTable", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Unknown coupling table"); return NULL; diff --git a/src/arkode/arkode_mristep.c b/src/arkode/arkode_mristep.c index dd1a408003..f4b615024d 100644 --- a/src/arkode/arkode_mristep.c +++ b/src/arkode/arkode_mristep.c @@ -45,7 +45,7 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, /* Check that at least one of fse, fsi is supplied and is to be used*/ if (fse == NULL && fsi == NULL) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::MRIStep", "MRIStepCreate", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_F); return (NULL); } @@ -53,7 +53,7 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, /* Check that y0 is supplied */ if (y0 == NULL) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::MRIStep", "MRIStepCreate", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_Y0); return (NULL); } @@ -61,7 +61,7 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, /* Check that stepper is supplied */ if (stepper == NULL) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::MRIStep", "MRIStepCreate", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "The inner stepper memory is NULL"); return (NULL); } @@ -69,7 +69,7 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, /* Check that context is supplied */ if (!sunctx) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::MRIStep", "MRIStepCreate", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_SUNCTX); return (NULL); } @@ -78,7 +78,7 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, nvectorOK = mriStep_CheckNVector(y0); if (!nvectorOK) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::MRIStep", "MRIStepCreate", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_NVECTOR); return (NULL); } @@ -87,7 +87,7 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, ark_mem = arkCreate(sunctx); if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::MRIStep", "MRIStepCreate", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (NULL); } @@ -97,7 +97,7 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, step_mem = (ARKodeMRIStepMem)malloc(sizeof(struct ARKodeMRIStepMemRec)); if (step_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::MRIStep", "MRIStepCreate", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_ARKMEM_FAIL); MRIStepFree((void**)&ark_mem); return (NULL); @@ -119,7 +119,7 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, retval = MRIStepSetDefaults((void*)ark_mem); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE::MRIStep", "MRIStepCreate", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Error setting default solver options"); MRIStepFree((void**)&ark_mem); return (NULL); @@ -151,7 +151,7 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, NLS = SUNNonlinSol_Newton(y0, ark_mem->sunctx); if (!NLS) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::MRIStep", "MRIStepCreate", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Error creating default Newton solver"); MRIStepFree((void**)&ark_mem); return (NULL); @@ -159,7 +159,7 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, retval = MRIStepSetNonlinearSolver(ark_mem, NLS); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::MRIStep", "MRIStepCreate", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Error attaching default Newton solver"); MRIStepFree((void**)&ark_mem); return (NULL); @@ -194,7 +194,7 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, retval = arkInit(ark_mem, t0, y0, FIRST_INIT); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE::MRIStep", "MRIStepCreate", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Unable to initialize main ARKODE infrastructure"); MRIStepFree((void**)&ark_mem); return (NULL); @@ -207,7 +207,7 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, retval = mriStepInnerStepper_HasRequiredOps(step_mem->stepper); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", "MRIStepCreate", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "A required inner stepper function is NULL"); MRIStepFree((void**)&ark_mem); return (NULL); @@ -234,8 +234,7 @@ int MRIStepResize(void* arkode_mem, N_Vector y0, sunrealtype t0, int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepResize", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Determing change in vector sizes */ @@ -250,7 +249,7 @@ int MRIStepResize(void* arkode_mem, N_Vector y0, sunrealtype t0, retval = arkResize(ark_mem, y0, SUN_RCONST(1.0), t0, resize, resize_data); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE::MRIStep", "MRIStepResize", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Unable to resize main ARKODE infrastructure"); return (retval); } @@ -262,7 +261,7 @@ int MRIStepResize(void* arkode_mem, N_Vector y0, sunrealtype t0, &(step_mem->Fse), lrw_diff, &(ark_mem->lrw), liw_diff, &(ark_mem->liw))) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::MRIStep", "MRIStepResize", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Unable to resize vector"); return (ARK_MEM_FAIL); } @@ -275,7 +274,7 @@ int MRIStepResize(void* arkode_mem, N_Vector y0, sunrealtype t0, &(step_mem->Fsi), lrw_diff, &(ark_mem->lrw), liw_diff, &(ark_mem->liw))) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::MRIStep", "MRIStepResize", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Unable to resize vector"); return (ARK_MEM_FAIL); } @@ -287,7 +286,7 @@ int MRIStepResize(void* arkode_mem, N_Vector y0, sunrealtype t0, if (!arkResizeVec(ark_mem, resize, resize_data, lrw_diff, liw_diff, y0, &step_mem->sdata)) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::MRIStep", "MRIStepResize", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Unable to resize vector"); return (ARK_MEM_FAIL); } @@ -297,7 +296,7 @@ int MRIStepResize(void* arkode_mem, N_Vector y0, sunrealtype t0, if (!arkResizeVec(ark_mem, resize, resize_data, lrw_diff, liw_diff, y0, &step_mem->zpred)) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::MRIStep", "MRIStepResize", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Unable to resize vector"); return (ARK_MEM_FAIL); } @@ -307,7 +306,7 @@ int MRIStepResize(void* arkode_mem, N_Vector y0, sunrealtype t0, if (!arkResizeVec(ark_mem, resize, resize_data, lrw_diff, liw_diff, y0, &step_mem->zcor)) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::MRIStep", "MRIStepResize", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Unable to resize vector"); return (ARK_MEM_FAIL); } @@ -327,7 +326,7 @@ int MRIStepResize(void* arkode_mem, N_Vector y0, sunrealtype t0, NLS = SUNNonlinSol_Newton(y0, ark_mem->sunctx); if (NLS == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::MRIStep", "MRIStepResize", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Error creating default Newton solver"); return (ARK_MEM_FAIL); } @@ -336,7 +335,7 @@ int MRIStepResize(void* arkode_mem, N_Vector y0, sunrealtype t0, retval = MRIStepSetNonlinearSolver(ark_mem, NLS); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::MRIStep", "MRIStepResize", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Error attaching default Newton solver"); return (ARK_MEM_FAIL); } @@ -348,7 +347,7 @@ int MRIStepResize(void* arkode_mem, N_Vector y0, sunrealtype t0, lrw_diff, liw_diff, y0); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::MRIStep", "MRIStepResize", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Unable to resize vector"); return (ARK_MEM_FAIL); } @@ -378,14 +377,13 @@ int MRIStepReInit(void* arkode_mem, ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepReInit", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Check if ark_mem was allocated */ if (ark_mem->MallocDone == SUNFALSE) { - arkProcessError(ark_mem, ARK_NO_MALLOC, "ARKODE::MRIStep", "MRIStepReInit", + arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, MSG_ARK_NO_MALLOC); return (ARK_NO_MALLOC); } @@ -393,7 +391,7 @@ int MRIStepReInit(void* arkode_mem, ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, /* Check that at least one of fse, fsi is supplied and is to be used */ if (fse == NULL && fsi == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", "MRIStepReInit", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_F); return (ARK_ILL_INPUT); } @@ -401,7 +399,7 @@ int MRIStepReInit(void* arkode_mem, ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, /* Check that y0 is supplied */ if (y0 == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", "MRIStepReInit", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_Y0); return (ARK_ILL_INPUT); } @@ -417,7 +415,7 @@ int MRIStepReInit(void* arkode_mem, ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, NLS = SUNNonlinSol_Newton(y0, ark_mem->sunctx); if (!NLS) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::MRIStep", "MRIStepReInit", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Error creating default Newton solver"); MRIStepFree((void**)&ark_mem); return (ARK_MEM_FAIL); @@ -425,7 +423,7 @@ int MRIStepReInit(void* arkode_mem, ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, retval = MRIStepSetNonlinearSolver(ark_mem, NLS); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::MRIStep", "MRIStepReInit", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Error attaching default Newton solver"); MRIStepFree((void**)&ark_mem); return (ARK_MEM_FAIL); @@ -437,7 +435,7 @@ int MRIStepReInit(void* arkode_mem, ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, retval = arkInit(arkode_mem, t0, y0, FIRST_INIT); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE::MRIStep", "MRIStepReInit", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Unable to reinitialize main ARKODE infrastructure"); return (retval); } @@ -470,7 +468,7 @@ int MRIStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepReset", &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Initialize main ARKODE infrastructure */ @@ -478,7 +476,7 @@ int MRIStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE::MRIStep", "MRIStepReset", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Unable to initialize main ARKODE infrastructure"); return (retval); } @@ -502,8 +500,8 @@ int MRIStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::MRIStep", - "MRIStepSStolerances", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; @@ -516,8 +514,8 @@ int MRIStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::MRIStep", - "MRIStepSVtolerances", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; @@ -530,8 +528,8 @@ int MRIStepWFtolerances(void* arkode_mem, ARKEwtFn efun) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::MRIStep", - "MRIStepWFtolerances", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; @@ -550,7 +548,7 @@ int MRIStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::MRIStep", "MRIStepRootInit", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -572,7 +570,7 @@ int MRIStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::MRIStep", "MRIStepEvolve", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -597,7 +595,7 @@ int MRIStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::MRIStep", "MRIStepGetDky", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -620,8 +618,7 @@ int MRIStepComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) ARKodeMRIStepMem step_mem; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepComputeState", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } N_VLinearSum(ONE, step_mem->zpred, ONE, zcor, z); @@ -767,8 +764,7 @@ void MRIStepPrintMem(void* arkode_mem, FILE* outfile) int i, retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepPrintMem", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return; } /* if outfile==NULL, set it to stdout */ @@ -890,8 +886,7 @@ int mriStep_AttachLinsol(void* arkode_mem, ARKLinsolInitFn linit, int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "mriStep_AttachLinsol", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* free any existing system solver */ @@ -924,8 +919,7 @@ void mriStep_DisableLSetup(void* arkode_mem) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "mriStep_DisableLSetup", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return; } /* nullify the lsetup function pointer */ @@ -945,8 +939,7 @@ void* mriStep_GetLmem(void* arkode_mem) int retval; /* access ARKodeMRIStepMem structure, and return lmem */ - retval = mriStep_AccessStepMem(arkode_mem, "mriStep_GetLmem", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (NULL); } return (step_mem->lmem); } @@ -963,8 +956,7 @@ ARKRhsFn mriStep_GetImplicitRHS(void* arkode_mem) int retval; /* access ARKodeMRIStepMem structure, and return fi */ - retval = mriStep_AccessStepMem(arkode_mem, "mriStep_GetImplicitRHS", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (NULL); } if (step_mem->implicit_rhs) { return (step_mem->fsi); } else { return (NULL); } @@ -984,8 +976,7 @@ int mriStep_GetGammas(void* arkode_mem, sunrealtype* gamma, sunrealtype* gamrat, int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "mriStep_GetGammas", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set outputs */ @@ -1019,7 +1010,7 @@ int mriStep_Init(void* arkode_mem, int init_type) sunbooleantype reset_efun; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "mriStep_Init", &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* immediately return if reset */ @@ -1043,8 +1034,8 @@ int mriStep_Init(void* arkode_mem, int init_type) /* assume fixed outer step size */ if (!ark_mem->fixedstep) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", - "mriStep_Init", "Adaptive outer time stepping is not currently supported"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "Adaptive outer time stepping is not currently supported"); return (ARK_ILL_INPUT); } @@ -1052,7 +1043,7 @@ int mriStep_Init(void* arkode_mem, int init_type) retval = mriStep_SetCoupling(ark_mem); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", "mriStep_Init", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Could not create coupling table"); return (ARK_ILL_INPUT); } @@ -1061,7 +1052,7 @@ int mriStep_Init(void* arkode_mem, int init_type) retval = mriStep_CheckCoupling(ark_mem); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", "mriStep_Init", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Error in coupling table"); return (ARK_ILL_INPUT); } @@ -1087,7 +1078,7 @@ int mriStep_Init(void* arkode_mem, int init_type) &(step_mem->nstages_active)); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", "mriStep_Init", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Error in coupling table"); return (ARK_ILL_INPUT); } @@ -1225,7 +1216,7 @@ int mriStep_Init(void* arkode_mem, int init_type) step_mem->MRIC->nmat, ark_mem->ewt); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", "mriStep_Init", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Error allocating inner stepper memory"); return (ARK_MEM_FAIL); } @@ -1248,7 +1239,7 @@ int mriStep_Init(void* arkode_mem, int init_type) if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", "mriStep_Init", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Unable to update interpolation polynomial degree"); return (ARK_ILL_INPUT); } @@ -1261,8 +1252,8 @@ int mriStep_Init(void* arkode_mem, int init_type) retval = step_mem->linit(ark_mem); if (retval != 0) { - arkProcessError(ark_mem, ARK_LINIT_FAIL, "ARKODE::MRIStep", - "mriStep_Init", MSG_ARK_LINIT_FAIL); + arkProcessError(ark_mem, ARK_LINIT_FAIL, __LINE__, __func__, __FILE__, + MSG_ARK_LINIT_FAIL); return (ARK_LINIT_FAIL); } } @@ -1273,8 +1264,7 @@ int mriStep_Init(void* arkode_mem, int init_type) retval = mriStep_NlsInit(ark_mem); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_NLS_INIT_FAIL, "ARKODE::MRIStep", - "mriStep_Init", + arkProcessError(ark_mem, ARK_NLS_INIT_FAIL, __LINE__, __func__, __FILE__, "Unable to initialize SUNNonlinearSolver object"); return (ARK_NLS_INIT_FAIL); } @@ -1320,15 +1310,14 @@ int mriStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "mriStep_FullRHS", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* ensure that inner stepper provides fullrhs function */ if (!(step_mem->stepper->ops->fullrhs)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", - "mriStep_FullRHS", MSG_ARK_MISSING_FULLRHS); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + MSG_ARK_MISSING_FULLRHS); return ARK_ILL_INPUT; } @@ -1347,8 +1336,8 @@ int mriStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nfse++; if (retval != 0) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::MRIStep", - "mriStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, + __FILE__, MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } } @@ -1360,8 +1349,8 @@ int mriStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nfsi++; if (retval != 0) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::MRIStep", - "mriStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, + __FILE__, MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } } @@ -1371,8 +1360,8 @@ int mriStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, ARK_FULLRHS_OTHER); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::MRIStep", - "mriStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, __FILE__, + MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } } @@ -1409,8 +1398,8 @@ int mriStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nfse++; if (retval != 0) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::MRIStep", - "mriStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, + __FILE__, MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } } @@ -1422,8 +1411,8 @@ int mriStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nfsi++; if (retval != 0) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::MRIStep", - "mriStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, + __FILE__, MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } } @@ -1433,8 +1422,8 @@ int mriStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, ARK_FULLRHS_OTHER); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::MRIStep", - "mriStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, __FILE__, + MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } } @@ -1468,8 +1457,8 @@ int mriStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nfse++; if (retval != 0) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::MRIStep", - "mriStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, __FILE__, + MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } } @@ -1481,8 +1470,8 @@ int mriStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, step_mem->nfsi++; if (retval != 0) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::MRIStep", - "mriStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, __FILE__, + MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } } @@ -1492,8 +1481,8 @@ int mriStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, ARK_FULLRHS_OTHER); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::MRIStep", - "mriStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, __FILE__, + MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } @@ -1519,8 +1508,8 @@ int mriStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, default: /* return with RHS failure if unknown mode is passed */ - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::MRIStep", - "mriStep_FullRHS", "Unknown full RHS mode"); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, __FILE__, + "Unknown full RHS mode"); return (ARK_RHSFUNC_FAIL); } @@ -1565,8 +1554,7 @@ int mriStep_TakeStep(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr) *dsmPtr = ZERO; /* access the MRIStep mem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "mriStep_TakeStep", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* call nonlinear solver setup if it exists */ @@ -1783,13 +1771,14 @@ int mriStep_AccessStepMem(void* arkode_mem, const char* fname, /* access ARKodeMem structure */ if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::MRIStep", fname, MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, fname, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } *ark_mem = (ARKodeMem)arkode_mem; if ((*ark_mem)->step_mem == NULL) { - arkProcessError(*ark_mem, ARK_MEM_NULL, "ARKODE::MRIStep", fname, + arkProcessError(*ark_mem, ARK_MEM_NULL, __LINE__, fname, __FILE__, MSG_MRISTEP_NO_MEM); return (ARK_MEM_NULL); } @@ -1828,8 +1817,8 @@ int mriStep_SetCoupling(ARKodeMem ark_mem) /* access ARKodeMRIStepMem structure */ if (ark_mem->step_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::MRIStep", - "mriStep_SetCoupling", MSG_MRISTEP_NO_MEM); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_MRISTEP_NO_MEM); return (ARK_MEM_NULL); } step_mem = (ARKodeMRIStepMem)ark_mem->step_mem; @@ -1851,8 +1840,7 @@ int mriStep_SetCoupling(ARKodeMem ark_mem) step_mem->MRIC = MRIStepCoupling_LoadTable(MRISTEP_DEFAULT_IMEX_SD_4); break; default: - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", - "mriStep_SetCoupling", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "No MRI method at requested order, using q=3."); step_mem->MRIC = MRIStepCoupling_LoadTable(MRISTEP_DEFAULT_IMEX_SD_3); break; @@ -1874,8 +1862,7 @@ int mriStep_SetCoupling(ARKodeMem ark_mem) step_mem->MRIC = MRIStepCoupling_LoadTable(MRISTEP_DEFAULT_IMPL_SD_4); break; default: - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", - "mriStep_SetCoupling", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "No MRI method at requested order, using q=3."); step_mem->MRIC = MRIStepCoupling_LoadTable(MRISTEP_DEFAULT_IMPL_SD_3); break; @@ -1894,8 +1881,7 @@ int mriStep_SetCoupling(ARKodeMem ark_mem) step_mem->MRIC = MRIStepCoupling_LoadTable(MRISTEP_DEFAULT_EXPL_4); break; default: - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", - "mriStep_SetCoupling", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "No MRI method at requested order, using q=3."); step_mem->MRIC = MRIStepCoupling_LoadTable(MRISTEP_DEFAULT_EXPL_3); break; @@ -1904,8 +1890,7 @@ int mriStep_SetCoupling(ARKodeMem ark_mem) if (step_mem->MRIC == NULL) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::MRIStep", - "mriStep_SetCoupling", + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, "An error occurred in constructing coupling table."); return (ARK_INVALID_TABLE); } @@ -1948,8 +1933,8 @@ int mriStep_CheckCoupling(ARKodeMem ark_mem) /* access ARKodeMRIStepMem structure */ if (ark_mem->step_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::MRIStep", - "mriStep_CheckCoupling", MSG_MRISTEP_NO_MEM); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_MRISTEP_NO_MEM); return (ARK_MEM_NULL); } step_mem = (ARKodeMRIStepMem)ark_mem->step_mem; @@ -1957,24 +1942,24 @@ int mriStep_CheckCoupling(ARKodeMem ark_mem) /* check that stages > 0 */ if (step_mem->MRIC->stages < 1) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::MRIStep", - "mriStep_CheckCoupling", "stages < 1!"); + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, + "stages < 1!"); return (ARK_INVALID_TABLE); } /* check that method order q > 0 */ if (step_mem->MRIC->q < 1) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::MRIStep", - "mriStep_CheckCoupling", "method order < 1"); + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, + "method order < 1"); return (ARK_INVALID_TABLE); } /* check that embedding order p > 0 (if adaptive) */ if ((step_mem->MRIC->p < 1) && (!ark_mem->fixedstep)) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::MRIStep", - "mriStep_CheckCoupling", "embedding order < 1"); + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, + "embedding order < 1"); return (ARK_INVALID_TABLE); } @@ -1984,8 +1969,7 @@ int mriStep_CheckCoupling(ARKodeMem ark_mem) /* ImEx */ if (!(step_mem->MRIC->W) || !(step_mem->MRIC->G)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", - "mriStep_CheckCoupling", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Invalid coupling table for an IMEX problem!"); return (ARK_ILL_INPUT); } @@ -1995,8 +1979,7 @@ int mriStep_CheckCoupling(ARKodeMem ark_mem) /* Explicit */ if (!(step_mem->MRIC->W) || step_mem->MRIC->G) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", - "mriStep_CheckCoupling", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Invalid coupling table for an explicit problem!"); return (ARK_ILL_INPUT); } @@ -2006,8 +1989,7 @@ int mriStep_CheckCoupling(ARKodeMem ark_mem) /* Implicit */ if (step_mem->MRIC->W || !(step_mem->MRIC->G)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", - "mriStep_CheckCoupling", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Invalid coupling table fro an implicit problem!"); return (ARK_ILL_INPUT); } @@ -2029,8 +2011,7 @@ int mriStep_CheckCoupling(ARKodeMem ark_mem) } if (Wabs > tol) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::MRIStep", - "mriStep_CheckCoupling", + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, "Coupling can be up to ERK (at most)!"); return (ARK_INVALID_TABLE); } @@ -2052,8 +2033,7 @@ int mriStep_CheckCoupling(ARKodeMem ark_mem) } if (Gabs > tol) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::MRIStep", - "mriStep_CheckCoupling", + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, "Coupling can be up to DIRK (at most)!"); return (ARK_INVALID_TABLE); } @@ -2070,8 +2050,7 @@ int mriStep_CheckCoupling(ARKodeMem ark_mem) } if (!okay) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::MRIStep", - "mriStep_CheckCoupling", + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, "solve-coupled DIRK stages not currently supported"); return (ARK_INVALID_TABLE); } @@ -2087,8 +2066,8 @@ int mriStep_CheckCoupling(ARKodeMem ark_mem) } if (!okay) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::MRIStep", - "mriStep_CheckCoupling", "Stage times must be sorted."); + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, + "Stage times must be sorted."); return (ARK_INVALID_TABLE); } @@ -2104,8 +2083,7 @@ int mriStep_CheckCoupling(ARKodeMem ark_mem) } if (Gabs > tol) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::MRIStep", - "mriStep_CheckCoupling", + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, "First stage must equal old solution."); return (ARK_INVALID_TABLE); } @@ -2113,8 +2091,8 @@ int mriStep_CheckCoupling(ARKodeMem ark_mem) /* check that the last stage is at the final time */ if (SUNRabs(ONE - step_mem->MRIC->c[step_mem->MRIC->stages - 1]) > tol) { - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::MRIStep", - "mriStep_CheckCoupling", "Final stage time must be equal 1."); + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, + "Final stage time must be equal 1."); return (ARK_INVALID_TABLE); } @@ -2239,8 +2217,7 @@ int mriStep_StageDIRKFast(ARKodeMem ark_mem, ARKodeMRIStepMem step_mem, int is, #endif /* this is not currently implemented */ - arkProcessError(ark_mem, ARK_INVALID_TABLE, "ARKODE::MRIStep", - "mriStep_StageDIRKFast", + arkProcessError(ark_mem, ARK_INVALID_TABLE, __LINE__, __func__, __FILE__, "This routine is not yet implemented."); return (ARK_INVALID_TABLE); } @@ -2518,7 +2495,7 @@ int mriStep_Predict(ARKodeMem ark_mem, int istage, N_Vector yguess) /* access ARKodeMRIStepMem structure */ if (ark_mem->step_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::MRIStep", "mriStep_Predict", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_MRISTEP_NO_MEM); return (ARK_MEM_NULL); } @@ -2527,7 +2504,7 @@ int mriStep_Predict(ARKodeMem ark_mem, int istage, N_Vector yguess) /* verify that interpolation structure is provided */ if ((ark_mem->interp == NULL) && (step_mem->predictor > 0)) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::MRIStep", "mriStep_Predict", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "Interpolation structure is NULL"); return (ARK_MEM_NULL); } @@ -2656,7 +2633,7 @@ int mriStep_StageSetup(ARKodeMem ark_mem) /* access ARKodeMRIStepMem structure */ if (ark_mem->step_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::MRIStep", "mriStep_StageSetup", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_MRISTEP_NO_MEM); return (ARK_MEM_NULL); } @@ -2721,8 +2698,8 @@ int MRIStepInnerStepper_Create(SUNContext sunctx, MRIStepInnerStepper* stepper) *stepper = (MRIStepInnerStepper)malloc(sizeof(**stepper)); if (*stepper == NULL) { - arkProcessError(NULL, ARK_MEM_FAIL, "ARKODE::MRIStep", - "MRIStepInnerStepper_Create", MSG_ARK_ARKMEM_FAIL); + arkProcessError(NULL, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, + MSG_ARK_ARKMEM_FAIL); return (ARK_MEM_FAIL); } memset(*stepper, 0, sizeof(**stepper)); @@ -2730,8 +2707,8 @@ int MRIStepInnerStepper_Create(SUNContext sunctx, MRIStepInnerStepper* stepper) (*stepper)->ops = (MRIStepInnerStepper_Ops)malloc(sizeof(*((*stepper)->ops))); if ((*stepper)->ops == NULL) { - arkProcessError(NULL, ARK_MEM_FAIL, "ARKODE::MRIStep", - "MRIStepInnerStepper_Create", MSG_ARK_ARKMEM_FAIL); + arkProcessError(NULL, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, + MSG_ARK_ARKMEM_FAIL); free(*stepper); return (ARK_MEM_FAIL); } @@ -2765,8 +2742,7 @@ int MRIStepInnerStepper_SetContent(MRIStepInnerStepper stepper, void* content) { if (stepper == NULL) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::MRIStep", - "MRIStepInnerStepper_SetContent", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Inner stepper memory is NULL"); return ARK_ILL_INPUT; } @@ -2779,8 +2755,7 @@ int MRIStepInnerStepper_GetContent(MRIStepInnerStepper stepper, void** content) { if (stepper == NULL) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::MRIStep", - "MRIStepInnerStepper_GetContent", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Inner stepper memory is NULL"); return ARK_ILL_INPUT; } @@ -2794,16 +2769,14 @@ int MRIStepInnerStepper_SetEvolveFn(MRIStepInnerStepper stepper, { if (stepper == NULL) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::MRIStep", - "MRIStepInnerStepper_SetEvolveFn", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Inner stepper memory is NULL"); return ARK_ILL_INPUT; } if (stepper->ops == NULL) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::MRIStep", - "MRIStepInnerStepper_SetEvolveFn", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Inner stepper operations structure is NULL"); return ARK_ILL_INPUT; } @@ -2818,16 +2791,14 @@ int MRIStepInnerStepper_SetFullRhsFn(MRIStepInnerStepper stepper, { if (stepper == NULL) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::MRIStep", - "MRIStepInnerStepper_SetFullRhsFn", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Inner stepper memory is NULL"); return ARK_ILL_INPUT; } if (stepper->ops == NULL) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::MRIStep", - "MRIStepInnerStepper_SetFullRhsFn", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Inner stepper operations structure is NULL"); return ARK_ILL_INPUT; } @@ -2842,16 +2813,14 @@ int MRIStepInnerStepper_SetResetFn(MRIStepInnerStepper stepper, { if (stepper == NULL) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::MRIStep", - "MRIStepInnerStepper_SetResetFn", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Inner stepper memory is NULL"); return ARK_ILL_INPUT; } if (stepper->ops == NULL) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::MRIStep", - "MRIStepInnerStepper_SetResetFn", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Inner stepper operations structure is NULL"); return ARK_ILL_INPUT; } @@ -2869,8 +2838,7 @@ int MRIStepInnerStepper_AddForcing(MRIStepInnerStepper stepper, sunrealtype t, if (stepper == NULL) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::MRIStep", - "MRIStepInnerStepper_AddForcing", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Inner stepper memory is NULL"); return ARK_ILL_INPUT; } @@ -2901,8 +2869,7 @@ int MRIStepInnerStepper_GetForcingData(MRIStepInnerStepper stepper, { if (stepper == NULL) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::MRIStep", - "MRIStepInnerStepper_GetForcingData", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Inner stepper memory is NULL"); return ARK_ILL_INPUT; } diff --git a/src/arkode/arkode_mristep_io.c b/src/arkode/arkode_mristep_io.c index b599863e73..00caa61326 100644 --- a/src/arkode/arkode_mristep_io.c +++ b/src/arkode/arkode_mristep_io.c @@ -43,16 +43,6 @@ int MRIStepSetInterpolantType(void* arkode_mem, int itype) return (arkSetInterpolantType(arkode_mem, itype)); } -int MRIStepSetErrHandlerFn(void* arkode_mem, ARKErrHandlerFn ehfun, void* eh_data) -{ - return (arkSetErrHandlerFn(arkode_mem, ehfun, eh_data)); -} - -int MRIStepSetErrFile(void* arkode_mem, FILE* errfp) -{ - return (arkSetErrFile(arkode_mem, errfp)); -} - int MRIStepSetMaxNumSteps(void* arkode_mem, long int mxsteps) { return (arkSetMaxNumSteps(arkode_mem, mxsteps)); @@ -304,8 +294,7 @@ int MRIStepSetUserData(void* arkode_mem, void* user_data) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepSetUserData", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set user_data in ARKODE mem */ @@ -336,8 +325,7 @@ int MRIStepSetDefaults(void* arkode_mem) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepSetDefaults", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Set default values for integrator optional inputs */ @@ -386,8 +374,7 @@ int MRIStepSetLinear(void* arkode_mem, int timedepend) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepSetLinear", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set parameters */ @@ -413,8 +400,7 @@ int MRIStepSetNonlinear(void* arkode_mem) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepSetNonlinear", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set parameters */ @@ -441,8 +427,7 @@ int MRIStepSetOrder(void* arkode_mem, int ord) sunindextype Tlrw, Tliw; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepSetOrder", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval) { return (retval); } /* check for illegal inputs */ @@ -476,15 +461,14 @@ int MRIStepSetCoupling(void* arkode_mem, MRIStepCoupling MRIC) sunindextype Tlrw, Tliw; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepSetCoupling", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* check for illegal inputs */ if (MRIC == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::MRIStep", - "MRIStepSetCoupling", MSG_MRISTEP_NO_COUPLING); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_MRISTEP_NO_COUPLING); return (ARK_ILL_INPUT); } @@ -507,8 +491,8 @@ int MRIStepSetCoupling(void* arkode_mem, MRIStepCoupling MRIC) step_mem->MRIC = MRIStepCoupling_Copy(MRIC); if (step_mem->MRIC == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::MRIStep", - "MRIStepSetCoupling", MSG_MRISTEP_NO_COUPLING); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_MRISTEP_NO_COUPLING); return (ARK_MEM_NULL); } MRIStepCoupling_Space(step_mem->MRIC, &Tliw, &Tlrw); @@ -530,8 +514,7 @@ int MRIStepSetPreInnerFn(void* arkode_mem, MRIStepPreInnerFn prefn) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepSetDefaults", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Set pre inner evolve function */ @@ -552,8 +535,7 @@ int MRIStepSetPostInnerFn(void* arkode_mem, MRIStepPostInnerFn postfn) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepSetDefaults", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Set pre inner evolve function */ @@ -573,16 +555,15 @@ int MRIStepSetFixedStep(void* arkode_mem, sunrealtype hsfixed) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::MRIStep", - "MRIStepSetFixedStep", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; if (hsfixed == ZERO) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", - "MRIStepSetFixedStep", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "MRIStep does not support adaptive steps at this time."); return (ARK_ILL_INPUT); } @@ -605,8 +586,7 @@ int MRIStepSetNonlinCRDown(void* arkode_mem, sunrealtype crdown) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepSetNonlinCRDown", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -630,8 +610,7 @@ int MRIStepSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepSetNonlinRDiv", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -655,8 +634,7 @@ int MRIStepSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepSetDeltaGammaMax", - &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -681,8 +659,7 @@ int MRIStepSetLSetupFrequency(void* arkode_mem, int msbp) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepSetLSetupFrequency", - &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -706,8 +683,7 @@ int MRIStepSetPredictorMethod(void* arkode_mem, int pred_method) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepSetPredictorMethod", - &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set parameter */ @@ -730,15 +706,13 @@ int MRIStepSetMaxNonlinIters(void* arkode_mem, int maxcor) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepSetMaxNonlinIters", - &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Return error message if no NLS module is present */ if (step_mem->NLS == NULL) { - arkProcessError(ark_mem, ARK_NLS_OP_ERR, "ARKODE::MRIStep", - "MRIStepSetMaxNonlinIters", + arkProcessError(ark_mem, ARK_NLS_OP_ERR, __LINE__, __func__, __FILE__, "No SUNNonlinearSolver object is present"); return (ARK_ILL_INPUT); } @@ -751,8 +725,7 @@ int MRIStepSetMaxNonlinIters(void* arkode_mem, int maxcor) retval = SUNNonlinSolSetMaxIters(step_mem->NLS, step_mem->maxcor); if (retval != SUN_NLS_SUCCESS) { - arkProcessError(ark_mem, ARK_NLS_OP_ERR, "ARKODE::MRIStep", - "MRIStepSetMaxNonlinIters", + arkProcessError(ark_mem, ARK_NLS_OP_ERR, __LINE__, __func__, __FILE__, "Error setting maxcor in SUNNonlinearSolver object"); return (ARK_NLS_OP_ERR); } @@ -773,8 +746,7 @@ int MRIStepSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepSetNonlinConvCoef", - &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* argument <= 0 sets default, otherwise set input */ @@ -796,8 +768,7 @@ int MRIStepSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) int retval; /* access ARKodeMRIStepMem structure and set function pointer */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepSetStagePredictFn", - &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } step_mem->stage_predict = PredictStage; @@ -823,8 +794,7 @@ int MRIStepSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce) int retval; /* access ARKodeMRIStepMem structure and set function pointer */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepSetDeduceImplicitRhs", - &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } step_mem->deduce_rhs = deduce; @@ -842,8 +812,7 @@ int MRIStepGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepGetLastInnerStepFlag", - &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Get ARKODE workspace */ @@ -869,8 +838,7 @@ int MRIStepGetLastInnerStepFlag(void* arkode_mem, int* flag) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepGetLastInnerStepFlag", - &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get the last return value from the inner stepper */ @@ -887,7 +855,7 @@ int MRIStepGetCurrentGamma(void* arkode_mem, sunrealtype* gamma) int retval; ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; - retval = mriStep_AccessStepMem(arkode_mem, NULL, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *gamma = step_mem->gamma; return (retval); @@ -906,8 +874,7 @@ int MRIStepGetNumRhsEvals(void* arkode_mem, long int* nfse_evals, int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepGetNumRhsEvals", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get number of fse and fsi evals from step_mem */ @@ -929,8 +896,7 @@ int MRIStepGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepGetNumLinSolvSetups", - &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get value from step_mem */ @@ -951,8 +917,7 @@ int MRIStepGetNumNonlinSolvIters(void* arkode_mem, long int* nniters) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepGetNumNonlinSolvIters", - &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *nniters = step_mem->nls_iters; @@ -972,8 +937,7 @@ int MRIStepGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepGetNumNonlinSolvConvFails", - &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set output from step_mem */ @@ -995,8 +959,7 @@ int MRIStepGetNonlinSolvStats(void* arkode_mem, long int* nniters, int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepGetNonlinSolvStats", - &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *nniters = step_mem->nls_iters; @@ -1017,8 +980,7 @@ int MRIStepGetCurrentCoupling(void* arkode_mem, MRIStepCoupling* MRIC) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepGetCurrentCoupling", - &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get coupling structure from step_mem */ @@ -1040,8 +1002,7 @@ int MRIStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) int retval; /* access ARKode MRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepPrintAllStats", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* step and rootfinding stats */ @@ -1139,7 +1100,7 @@ int MRIStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) break; default: - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "MRIStepPrintAllStats", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Invalid formatting option."); return (ARK_ILL_INPUT); } @@ -1163,16 +1124,14 @@ int MRIStepWriteParameters(void* arkode_mem, FILE* fp) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepWriteParameters", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* output ARKODE infrastructure parameters first */ retval = arkWriteParameters(arkode_mem, fp); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::MRIStep", - "MRIStepWriteParameters", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "Error writing ARKODE infrastructure parameters"); return (retval); } @@ -1192,15 +1151,14 @@ int MRIStepWriteCoupling(void* arkode_mem, FILE* fp) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepWriteCoupling", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* check that coupling structure is non-NULL (otherwise report error) */ if (step_mem->MRIC == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::MRIStep", - "MRIStepWriteCoupling", "Coupling structure is NULL"); + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + "Coupling structure is NULL"); return (ARK_MEM_NULL); } diff --git a/src/arkode/arkode_mristep_nls.c b/src/arkode/arkode_mristep_nls.c index 267ea665db..6830aa457a 100644 --- a/src/arkode/arkode_mristep_nls.c +++ b/src/arkode/arkode_mristep_nls.c @@ -40,15 +40,13 @@ int MRIStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepSetNonlinearSolver", - &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Return immediately if NLS input is NULL */ if (NLS == NULL) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::MRIStep", - "MRIStepSetNonlinearSolver", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "The NLS input must be non-NULL"); return (ARK_ILL_INPUT); } @@ -57,7 +55,7 @@ int MRIStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) if ((NLS->ops->gettype == NULL) || (NLS->ops->solve == NULL) || (NLS->ops->setsysfn == NULL)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "MRIStepSetNonlinearSolver", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "NLS does not support required operations"); return (ARK_ILL_INPUT); } @@ -83,14 +81,13 @@ int MRIStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) } else { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", - "MRIStepSetNonlinearSolver", "Invalid nonlinear solver type"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "Invalid nonlinear solver type"); return (ARK_ILL_INPUT); } if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", - "MRIStepSetNonlinearSolver", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Setting nonlinear system function failed"); return (ARK_ILL_INPUT); } @@ -100,8 +97,7 @@ int MRIStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) arkode_mem); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", - "MRIStepSetNonlinearSolver", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Setting convergence test function failed"); return (ARK_ILL_INPUT); } @@ -110,8 +106,7 @@ int MRIStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) retval = SUNNonlinSolSetMaxIters(step_mem->NLS, step_mem->maxcor); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", - "MRIStepSetNonlinearSolver", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Setting maximum number of nonlinear iterations failed"); return (ARK_ILL_INPUT); } @@ -123,8 +118,7 @@ int MRIStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) { if (!(step_mem->fsi)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", - "MRIStepSetNonlinearSolver", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "The implicit slow ODE RHS function is NULL"); return (ARK_ILL_INPUT); } @@ -148,8 +142,7 @@ int MRIStepSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fsi) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepSetNlsRhsFn", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } if (nls_fsi) { step_mem->nls_fsi = nls_fsi; } @@ -174,8 +167,7 @@ int MRIStepGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "MRIStepGetNonlinearSystemData", - &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *tcur = ark_mem->tcur; @@ -210,7 +202,7 @@ int mriStep_NlsInit(ARKodeMem ark_mem) /* access ARKodeMRIStepMem structure */ if (ark_mem->step_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::MRIStep", "mriStep_NlsInit", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_MRISTEP_NO_MEM); return (ARK_MEM_NULL); } @@ -228,7 +220,7 @@ int mriStep_NlsInit(ARKodeMem ark_mem) else { retval = SUNNonlinSolSetLSetupFn(step_mem->NLS, NULL); } if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", "mriStep_NlsInit", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Setting the linear solver setup function failed"); return (ARK_NLS_INIT_FAIL); } @@ -241,7 +233,7 @@ int mriStep_NlsInit(ARKodeMem ark_mem) else { retval = SUNNonlinSolSetLSolveFn(step_mem->NLS, NULL); } if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", "mriStep_NlsInit", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Setting linear solver solve function failed"); return (ARK_NLS_INIT_FAIL); } @@ -250,8 +242,8 @@ int mriStep_NlsInit(ARKodeMem ark_mem) retval = SUNNonlinSolInitialize(step_mem->NLS); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", - "mriStep_NlsInit", MSG_NLS_INIT_FAIL); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + MSG_NLS_INIT_FAIL); return (ARK_NLS_INIT_FAIL); } @@ -283,7 +275,7 @@ int mriStep_Nls(ARKodeMem ark_mem, int nflag) /* access ARKodeMRIStepMem structure */ if (ark_mem->step_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::MRIStep", "mriStep_Nls", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_MRISTEP_NO_MEM); return (ARK_MEM_NULL); } @@ -381,8 +373,7 @@ int mriStep_NlsLSetup(sunbooleantype jbad, sunbooleantype* jcur, void* arkode_me int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "mriStep_NlsLSetup", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update convfail based on jbad flag */ @@ -425,8 +416,7 @@ int mriStep_NlsLSolve(N_Vector b, void* arkode_mem) int retval, nonlin_iter; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "mriStep_NlsLSolve", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* retrieve nonlinear solver iteration from module */ @@ -473,8 +463,7 @@ int mriStep_NlsResidual(N_Vector zcor, N_Vector r, void* arkode_mem) N_Vector X[3]; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "mriStep_NlsResidual", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update 'ycur' value as stored predictor + current corrector */ @@ -529,8 +518,7 @@ int mriStep_NlsFPFunction(N_Vector zcor, N_Vector g, void* arkode_mem) int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "mriStep_NlsFPFunction", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update 'ycur' value as stored predictor + current corrector */ @@ -581,8 +569,7 @@ int mriStep_NlsConvTest(SUNNonlinearSolver NLS, N_Vector y, N_Vector del, int m, retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, "mriStep_NlsConvTest", &ark_mem, - &step_mem); + retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if the problem is linearly implicit, just return success */ diff --git a/src/arkode/arkode_relaxation.c b/src/arkode/arkode_relaxation.c index 5167e6b44d..cf5b309ba8 100644 --- a/src/arkode/arkode_relaxation.c +++ b/src/arkode/arkode_relaxation.c @@ -39,14 +39,15 @@ static int arkRelaxAccessMem(void* arkode_mem, const char* fname, { if (!arkode_mem) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", fname, MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return ARK_MEM_NULL; } *ark_mem = (ARKodeMem)arkode_mem; if (!((*ark_mem)->relax_mem)) { - arkProcessError(*ark_mem, ARK_RELAX_MEM_NULL, "ARKODE", fname, + arkProcessError(*ark_mem, ARK_RELAX_MEM_NULL, __LINE__, __func__, __FILE__, MSG_RELAX_MEM_NULL); return ARK_RELAX_MEM_NULL; } @@ -490,7 +491,7 @@ int arkRelaxSetSolver(void* arkode_mem, ARKRelaxSolver solver) if (solver != ARK_RELAX_BRENT && solver != ARK_RELAX_NEWTON) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkRelaxSetSolver", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "An invalid relaxation solver option was provided."); return ARK_ILL_INPUT; } @@ -679,7 +680,7 @@ int arkRelaxPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) fprintf(outfile, ",Relax NLS fails,%ld", relax_mem->nls_fails); break; default: - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkRelaxPrintAllStats", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Invalid formatting option."); return ARK_ILL_INPUT; } @@ -701,7 +702,7 @@ int arkRelaxCreate(void* arkode_mem, ARKRelaxFn relax_fn, /* Check inputs */ if (!arkode_mem) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkRelaxCreate", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return ARK_MEM_NULL; } @@ -717,14 +718,14 @@ int arkRelaxCreate(void* arkode_mem, ARKRelaxFn relax_fn, /* Ensure both the relaxation function and Jacobian are provided */ if (!relax_fn) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkRelaxCreate", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "The relaxation function is NULL."); return ARK_ILL_INPUT; } if (!relax_jac_fn) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkRelaxCreate", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "The relaxation Jacobian function is NULL."); return ARK_ILL_INPUT; } @@ -732,7 +733,7 @@ int arkRelaxCreate(void* arkode_mem, ARKRelaxFn relax_fn, /* Ensure stepper supplied inputs are provided */ if (!delta_e_fn || !get_order_fn) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkRelaxCreate", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "The Delta y, Delta e, or get order function is NULL."); return ARK_ILL_INPUT; } @@ -797,7 +798,7 @@ int arkRelax(ARKodeMem ark_mem, int* relax_fails, sunrealtype* dsm_inout, /* Get the relaxation memory structure */ if (!relax_mem) { - arkProcessError(ark_mem, ARK_RELAX_MEM_NULL, "ARKODE", "arkRelax", + arkProcessError(ark_mem, ARK_RELAX_MEM_NULL, __LINE__, __func__, __FILE__, MSG_RELAX_MEM_NULL); return ARK_RELAX_MEM_NULL; } diff --git a/src/arkode/arkode_root.c b/src/arkode/arkode_root.c index 853914db8f..43f4d7d9ab 100644 --- a/src/arkode/arkode_root.c +++ b/src/arkode/arkode_root.c @@ -41,7 +41,8 @@ int arkRootInit(ARKodeMem ark_mem, int nrtfn, ARKRootFn g) /* Check ark_mem pointer */ if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkRootInit", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } nrt = (nrtfn < 0) ? 0 : nrtfn; @@ -51,14 +52,14 @@ int arkRootInit(ARKodeMem ark_mem, int nrtfn, ARKRootFn g) { if (!(ark_mem->step_fullrhs)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkRootInit", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_MISSING_FULLRHS); return ARK_ILL_INPUT; } if (!arkAllocVec(ark_mem, ark_mem->yn, &ark_mem->fn)) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkInitialSetup", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_MEM_FAIL); return (ARK_MEM_FAIL); } @@ -70,7 +71,8 @@ int arkRootInit(ARKodeMem ark_mem, int nrtfn, ARKRootFn g) ark_mem->root_mem = (ARKodeRootMem)malloc(sizeof(struct ARKodeRootMemRec)); if (ark_mem->root_mem == NULL) { - arkProcessError(ark_mem, 0, "ARKODE", "arkRootInit", MSG_ARK_ARKMEM_FAIL); + arkProcessError(ark_mem, 0, __LINE__, __func__, __FILE__, + MSG_ARK_ARKMEM_FAIL); return (ARK_MEM_FAIL); } ark_mem->root_mem->glo = NULL; @@ -147,7 +149,7 @@ int arkRootInit(ARKodeMem ark_mem, int nrtfn, ARKRootFn g) ark_mem->lrw -= 3 * nrt; ark_mem->liw -= 3 * nrt; - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkRootInit", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_G); return (ARK_ILL_INPUT); } @@ -164,7 +166,7 @@ int arkRootInit(ARKodeMem ark_mem, int nrtfn, ARKRootFn g) ark_mem->root_mem->nrtfn = nrt; if (g == NULL) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "arkRootInit", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_G); return (ARK_ILL_INPUT); } @@ -175,7 +177,7 @@ int arkRootInit(ARKodeMem ark_mem, int nrtfn, ARKRootFn g) ark_mem->root_mem->glo = (sunrealtype*)malloc(nrt * sizeof(sunrealtype)); if (ark_mem->root_mem->glo == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkRootInit", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_MEM_FAIL); return (ARK_MEM_FAIL); } @@ -185,7 +187,7 @@ int arkRootInit(ARKodeMem ark_mem, int nrtfn, ARKRootFn g) { free(ark_mem->root_mem->glo); ark_mem->root_mem->glo = NULL; - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkRootInit", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_MEM_FAIL); return (ARK_MEM_FAIL); } @@ -197,7 +199,7 @@ int arkRootInit(ARKodeMem ark_mem, int nrtfn, ARKRootFn g) ark_mem->root_mem->glo = NULL; free(ark_mem->root_mem->ghi); ark_mem->root_mem->ghi = NULL; - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkRootInit", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_MEM_FAIL); return (ARK_MEM_FAIL); } @@ -211,7 +213,7 @@ int arkRootInit(ARKodeMem ark_mem, int nrtfn, ARKRootFn g) ark_mem->root_mem->ghi = NULL; free(ark_mem->root_mem->grout); ark_mem->root_mem->grout = NULL; - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkRootInit", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_MEM_FAIL); return (ARK_MEM_FAIL); } @@ -227,7 +229,7 @@ int arkRootInit(ARKodeMem ark_mem, int nrtfn, ARKRootFn g) ark_mem->root_mem->grout = NULL; free(ark_mem->root_mem->iroots); ark_mem->root_mem->iroots = NULL; - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkRootInit", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_MEM_FAIL); return (ARK_MEM_FAIL); } @@ -246,7 +248,7 @@ int arkRootInit(ARKodeMem ark_mem, int nrtfn, ARKRootFn g) ark_mem->root_mem->iroots = NULL; free(ark_mem->root_mem->rootdir); ark_mem->root_mem->rootdir = NULL; - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE", "arkRootInit", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_MEM_FAIL); return (ARK_MEM_FAIL); } @@ -274,7 +276,8 @@ int arkRootFree(void* arkode_mem) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkRootFree", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; @@ -316,7 +319,7 @@ int arkPrintRootMem(void* arkode_mem, FILE* outfile) ARKodeMem ark_mem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkPrintRootMem", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -405,7 +408,7 @@ int arkRootCheck1(void* arkode_mem) ARKodeRootMem rootmem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkRootCheck1", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -485,7 +488,7 @@ int arkRootCheck2(void* arkode_mem) ARKodeRootMem rootmem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkRootCheck2", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -583,7 +586,7 @@ int arkRootCheck3(void* arkode_mem) ARKodeRootMem rootmem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkRootCheck3", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -723,7 +726,8 @@ int arkRootfind(void* arkode_mem) ARKodeRootMem rootmem; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE", "arkRootfind", MSG_ARK_NO_MEM); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; diff --git a/src/arkode/arkode_sprkstep.c b/src/arkode/arkode_sprkstep.c index e2f5514f53..18a93c4a70 100644 --- a/src/arkode/arkode_sprkstep.c +++ b/src/arkode/arkode_sprkstep.c @@ -44,14 +44,14 @@ void* SPRKStepCreate(ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, N_Vector y0, /* Check that f1 and f2 are supplied */ if (!f1) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::SPRKStep", "SPRKStepCreate", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_F); return (NULL); } if (!f2) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::SPRKStep", "SPRKStepCreate", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_F); return (NULL); } @@ -59,14 +59,14 @@ void* SPRKStepCreate(ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, N_Vector y0, /* Check for legal input parameters */ if (!y0) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::SPRKStep", "SPRKStepCreate", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_Y0); return (NULL); } if (!sunctx) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::SPRKStep", "SPRKStepCreate", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_NULL_SUNCTX); return (NULL); } @@ -75,7 +75,7 @@ void* SPRKStepCreate(ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, N_Vector y0, nvectorOK = sprkStep_CheckNVector(y0); if (!nvectorOK) { - arkProcessError(NULL, ARK_ILL_INPUT, "ARKODE::SPRKStep", "SPRKStepCreate", + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_NVECTOR); return (NULL); } @@ -84,7 +84,7 @@ void* SPRKStepCreate(ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, N_Vector y0, ark_mem = arkCreate(sunctx); if (ark_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::SPRKStep", "SPRKStepCreate", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (NULL); } @@ -94,7 +94,7 @@ void* SPRKStepCreate(ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, N_Vector y0, step_mem = (ARKodeSPRKStepMem)malloc(sizeof(struct ARKodeSPRKStepMemRec)); if (step_mem == NULL) { - arkProcessError(ark_mem, ARK_MEM_FAIL, "ARKODE::SPRKStep", "SPRKStepCreate", + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_ARKMEM_FAIL); return (NULL); } @@ -125,7 +125,7 @@ void* SPRKStepCreate(ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, N_Vector y0, retval = SPRKStepSetDefaults((void*)ark_mem); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE::SPRKStep", "SPRKStepCreate", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Error setting default solver options"); SPRKStepFree((void**)&ark_mem); return (NULL); @@ -151,7 +151,7 @@ void* SPRKStepCreate(ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, N_Vector y0, retval = arkInit(ark_mem, t0, y0, FIRST_INIT); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE::SPRKStep", "SPRKStepCreate", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Unable to initialize main ARKODE infrastructure"); SPRKStepFree((void**)&ark_mem); return (NULL); @@ -179,31 +179,30 @@ int SPRKStepReInit(void* arkode_mem, ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, "SPRKStepReInit", &ark_mem, - &step_mem); + retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Check if ark_mem was allocated */ if (ark_mem->MallocDone == SUNFALSE) { - arkProcessError(ark_mem, ARK_NO_MALLOC, "ARKODE::SPRKStep", - "SPRKStepReInit", MSG_ARK_NO_MALLOC); + arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MALLOC); return (ARK_NO_MALLOC); } /* Check that f1 and f2 are supplied */ if (!f1 || !f2) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::SPRKStep", - "SPRKStepReInit", MSG_ARK_NULL_F); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + MSG_ARK_NULL_F); return (ARK_ILL_INPUT); } /* Check that y0 is supplied */ if (!y0) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::SPRKStep", - "SPRKStepReInit", MSG_ARK_NULL_Y0); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + MSG_ARK_NULL_Y0); return (ARK_ILL_INPUT); } @@ -215,7 +214,7 @@ int SPRKStepReInit(void* arkode_mem, ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, retval = arkInit(ark_mem, t0, y0, FIRST_INIT); if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE::SPRKStep", "SPRKStepReInit", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Unable to reinitialize main ARKODE infrastructure"); return (retval); } @@ -245,8 +244,7 @@ int SPRKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, "SPRKStepReset", &ark_mem, - &step_mem); + retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Initialize main ARKODE infrastructure */ @@ -254,7 +252,7 @@ int SPRKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, retval, "ARKODE::SPRKStep", "SPRKStepReset", + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Unable to initialize main ARKODE infrastructure"); return (retval); } @@ -278,7 +276,7 @@ int SPRKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, int retval = 0; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::SPRKStep", "SPRKKStepGetDky", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -303,7 +301,7 @@ int SPRKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) int retval = 0; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::SPRKStep", "SPRKKStepGetDky", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -385,8 +383,7 @@ int sprkStep_Init(void* arkode_mem, int init_type) int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, "sprkStep_Init", &ark_mem, - &step_mem); + retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* immediately return if reset */ @@ -452,7 +449,7 @@ int sprkStep_Init(void* arkode_mem, int init_type) if (retval != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::SPRKStep", "arkStep_Init", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Unable to update interpolation polynomial degree"); return (ARK_ILL_INPUT); } @@ -467,7 +464,7 @@ int SPRKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g) ARKodeMem ark_mem = NULL; if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::SPRKStep", "SPRKStepRootInit", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } @@ -524,8 +521,7 @@ int sprkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, ARKodeSPRKStepMem step_mem = NULL; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, "SPRKStep_FullRHS", &ark_mem, - &step_mem); + retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* perform RHS functions contingent on 'mode' argument */ @@ -541,16 +537,16 @@ int sprkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, retval = sprkStep_f1(step_mem, t, y, f, ark_mem->user_data); if (retval != 0) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::SPRKStep", - "SPRKStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, __FILE__, + MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } retval = sprkStep_f2(step_mem, t, y, f, ark_mem->user_data); if (retval != 0) { - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::SPRKStep", - "SPRKStep_FullRHS", MSG_ARK_RHSFUNC_FAILED, t); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, __FILE__, + MSG_ARK_RHSFUNC_FAILED, t); return (ARK_RHSFUNC_FAIL); } @@ -558,8 +554,8 @@ int sprkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, default: /* return with RHS failure if unknown mode is passed */ - arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, "ARKODE::SPRKStep", - "SPRKStep_FullRHS", "Unknown full RHS mode"); + arkProcessError(ark_mem, ARK_RHSFUNC_FAIL, __LINE__, __func__, __FILE__, + "Unknown full RHS mode"); return (ARK_RHSFUNC_FAIL); } @@ -582,8 +578,7 @@ int sprkStep_TakeStep(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr) int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, "sprkStep_TakeStep", &ark_mem, - &step_mem); + retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } prev_stage = ark_mem->yn; @@ -661,8 +656,7 @@ int sprkStep_TakeStep_Compensated(void* arkode_mem, sunrealtype* dsmPtr, int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, "sprkStep_TakeStep_SPRK", - &ark_mem, &step_mem); + retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Vector shortcuts */ @@ -726,8 +720,8 @@ int sprkStep_TakeStep_Compensated(void* arkode_mem, sunrealtype* dsmPtr, * wont work with the increment form */ if (ark_mem->ProcessStage != NULL) { - arkProcessError(ark_mem, ARK_POSTPROCESS_STAGE_FAIL, "SPRKStep", - "sprkStep_TakeStep_Compensated", + arkProcessError(ark_mem, ARK_POSTPROCESS_STAGE_FAIL, __LINE__, __func__, + __FILE__, "Compensated summation is not compatible with stage " "PostProcessing!\n"); return (ARK_POSTPROCESS_STAGE_FAIL); @@ -765,14 +759,14 @@ int sprkStep_AccessStepMem(void* arkode_mem, const char* fname, /* access ARKodeMem structure */ if (arkode_mem == NULL) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::SPRKStep", fname, + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, fname, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } *ark_mem = (ARKodeMem)arkode_mem; if ((*ark_mem)->step_mem == NULL) { - arkProcessError(*ark_mem, ARK_MEM_NULL, "ARKODE::SPRKStep", fname, + arkProcessError(*ark_mem, ARK_MEM_NULL, __LINE__, fname, __FILE__, MSG_SPRKSTEP_NO_MEM); return (ARK_MEM_NULL); } diff --git a/src/arkode/arkode_sprkstep_io.c b/src/arkode/arkode_sprkstep_io.c index 30c67ba9a6..e8dec2f32d 100644 --- a/src/arkode/arkode_sprkstep_io.c +++ b/src/arkode/arkode_sprkstep_io.c @@ -43,16 +43,6 @@ int SPRKStepSetInterpolantType(void* arkode_mem, int itype) return (arkSetInterpolantType(arkode_mem, itype)); } -int SPRKStepSetErrHandlerFn(void* arkode_mem, ARKErrHandlerFn ehfun, void* eh_data) -{ - return (arkSetErrHandlerFn(arkode_mem, ehfun, eh_data)); -} - -int SPRKStepSetErrFile(void* arkode_mem, FILE* errfp) -{ - return (arkSetErrFile(arkode_mem, errfp)); -} - int SPRKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps) { return (arkSetMaxNumSteps(arkode_mem, mxsteps)); @@ -185,15 +175,14 @@ int SPRKStepSetDefaults(void* arkode_mem) int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, "SPRKStepSetDefaults", &ark_mem, - &step_mem); + retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Set default ARKODE infrastructure parameters */ retval = arkSetDefaults(ark_mem); if (retval != ARK_SUCCESS) { - arkProcessError(NULL, ARK_MEM_NULL, "ARKODE::SPRKStep", "SPRKStepSetDefaults", + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "Error setting ARKODE infrastructure defaults"); return (retval); } @@ -216,8 +205,7 @@ int SPRKStepSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff) int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, "SPRKStepSetUseCompensatedSums", - &ark_mem, &step_mem); + retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } if (onoff) @@ -256,8 +244,7 @@ int SPRKStepSetMethod(void* arkode_mem, ARKodeSPRKTable sprk_storage) int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, "SPRKStepSetMethod", &ark_mem, - &step_mem); + retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } if (step_mem->method) @@ -283,8 +270,7 @@ int SPRKStepSetMethodName(void* arkode_mem, const char* method) int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, "SPRKStepSetMethodName", &ark_mem, - &step_mem); + retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } if (step_mem->method) @@ -313,8 +299,7 @@ int SPRKStepSetOrder(void* arkode_mem, int ord) int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, "SPRKStepSetOrder", &ark_mem, - &step_mem); + retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Invalid orders result in the default order being used. */ @@ -349,8 +334,7 @@ int SPRKStepGetNumRhsEvals(void* arkode_mem, long int* nf1, long int* nf2) int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, "SPRKStepGetNumRhsEvals", - &ark_mem, &step_mem); + retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *nf1 = step_mem->nf1; @@ -371,8 +355,7 @@ int SPRKStepGetCurrentMethod(void* arkode_mem, ARKodeSPRKTable* sprk_storage) int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, "SPRKStepGetNumRhsEvals", - &ark_mem, &step_mem); + retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *sprk_storage = step_mem->method; @@ -392,8 +375,7 @@ int SPRKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, "SPRKStepPrintAllStats", &ark_mem, - &step_mem); + retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* step and rootfinding stats */ @@ -413,7 +395,7 @@ int SPRKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) fprintf(outfile, ",f2 RHS fn evals,%ld", step_mem->nf2); break; default: - arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE", "SPRKStepPrintAllStats", + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "Invalid formatting option."); return (ARK_ILL_INPUT); } @@ -438,16 +420,14 @@ int SPRKStepWriteParameters(void* arkode_mem, FILE* fp) int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, "SPRKStepWriteParameters", - &ark_mem, &step_mem); + retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* output ARKODE infrastructure parameters first */ flag = arkWriteParameters(ark_mem, fp); if (flag != ARK_SUCCESS) { - arkProcessError(ark_mem, ARK_MEM_NULL, "ARKODE::SPRKStep", - "SPRKStepWriteParameters", + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, "Error writing ARKODE infrastructure parameters"); return (flag); } diff --git a/src/arkode/fmod/farkode_arkstep_mod.c b/src/arkode/fmod/farkode_arkstep_mod.c index 29b6b1eb92..7dfb868447 100644 --- a/src/arkode/fmod/farkode_arkstep_mod.c +++ b/src/arkode/fmod/farkode_arkstep_mod.c @@ -1211,36 +1211,6 @@ SWIGEXPORT int _wrap_FARKStepSetNoInactiveRootWarn(void *farg1) { } -SWIGEXPORT int _wrap_FARKStepSetErrHandlerFn(void *farg1, ARKErrHandlerFn farg2, void *farg3) { - int fresult ; - void *arg1 = (void *) 0 ; - ARKErrHandlerFn arg2 = (ARKErrHandlerFn) 0 ; - void *arg3 = (void *) 0 ; - int result; - - arg1 = (void *)(farg1); - arg2 = (ARKErrHandlerFn)(farg2); - arg3 = (void *)(farg3); - result = (int)ARKStepSetErrHandlerFn(arg1,arg2,arg3); - fresult = (int)(result); - return fresult; -} - - -SWIGEXPORT int _wrap_FARKStepSetErrFile(void *farg1, void *farg2) { - int fresult ; - void *arg1 = (void *) 0 ; - FILE *arg2 = (FILE *) 0 ; - int result; - - arg1 = (void *)(farg1); - arg2 = (FILE *)(farg2); - result = (int)ARKStepSetErrFile(arg1,arg2); - fresult = (int)(result); - return fresult; -} - - SWIGEXPORT int _wrap_FARKStepSetUserData(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; diff --git a/src/arkode/fmod/farkode_arkstep_mod.f90 b/src/arkode/fmod/farkode_arkstep_mod.f90 index fc1bbe3c39..1f2b79c764 100644 --- a/src/arkode/fmod/farkode_arkstep_mod.f90 +++ b/src/arkode/fmod/farkode_arkstep_mod.f90 @@ -132,8 +132,6 @@ module farkode_arkstep_mod public :: FARKStepSetMaxNumConstrFails public :: FARKStepSetRootDirection public :: FARKStepSetNoInactiveRootWarn - public :: FARKStepSetErrHandlerFn - public :: FARKStepSetErrFile public :: FARKStepSetUserData public :: FARKStepSetPostprocessStepFn public :: FARKStepSetPostprocessStageFn @@ -860,25 +858,6 @@ function swigc_FARKStepSetNoInactiveRootWarn(farg1) & integer(C_INT) :: fresult end function -function swigc_FARKStepSetErrHandlerFn(farg1, farg2, farg3) & -bind(C, name="_wrap_FARKStepSetErrHandlerFn") & -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_FARKStepSetErrFile(farg1, farg2) & -bind(C, name="_wrap_FARKStepSetErrFile") & -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_FARKStepSetUserData(farg1, farg2) & bind(C, name="_wrap_FARKStepSetUserData") & result(fresult) @@ -2963,41 +2942,6 @@ function FARKStepSetNoInactiveRootWarn(arkode_mem) & swig_result = fresult end function -function FARKStepSetErrHandlerFn(arkode_mem, ehfun, eh_data) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: arkode_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 = arkode_mem -farg2 = ehfun -farg3 = eh_data -fresult = swigc_FARKStepSetErrHandlerFn(farg1, farg2, farg3) -swig_result = fresult -end function - -function FARKStepSetErrFile(arkode_mem, errfp) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: arkode_mem -type(C_PTR) :: errfp -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -type(C_PTR) :: farg2 - -farg1 = arkode_mem -farg2 = errfp -fresult = swigc_FARKStepSetErrFile(farg1, farg2) -swig_result = fresult -end function - function FARKStepSetUserData(arkode_mem, user_data) & result(swig_result) use, intrinsic :: ISO_C_BINDING diff --git a/src/arkode/fmod/farkode_erkstep_mod.c b/src/arkode/fmod/farkode_erkstep_mod.c index 128d8bed34..1f1bcf3db7 100644 --- a/src/arkode/fmod/farkode_erkstep_mod.c +++ b/src/arkode/fmod/farkode_erkstep_mod.c @@ -879,36 +879,6 @@ SWIGEXPORT int _wrap_FERKStepSetNoInactiveRootWarn(void *farg1) { } -SWIGEXPORT int _wrap_FERKStepSetErrHandlerFn(void *farg1, ARKErrHandlerFn farg2, void *farg3) { - int fresult ; - void *arg1 = (void *) 0 ; - ARKErrHandlerFn arg2 = (ARKErrHandlerFn) 0 ; - void *arg3 = (void *) 0 ; - int result; - - arg1 = (void *)(farg1); - arg2 = (ARKErrHandlerFn)(farg2); - arg3 = (void *)(farg3); - result = (int)ERKStepSetErrHandlerFn(arg1,arg2,arg3); - fresult = (int)(result); - return fresult; -} - - -SWIGEXPORT int _wrap_FERKStepSetErrFile(void *farg1, void *farg2) { - int fresult ; - void *arg1 = (void *) 0 ; - FILE *arg2 = (FILE *) 0 ; - int result; - - arg1 = (void *)(farg1); - arg2 = (FILE *)(farg2); - result = (int)ERKStepSetErrFile(arg1,arg2); - fresult = (int)(result); - return fresult; -} - - SWIGEXPORT int _wrap_FERKStepSetUserData(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; diff --git a/src/arkode/fmod/farkode_erkstep_mod.f90 b/src/arkode/fmod/farkode_erkstep_mod.f90 index a5dff94d87..73a3586b2d 100644 --- a/src/arkode/fmod/farkode_erkstep_mod.f90 +++ b/src/arkode/fmod/farkode_erkstep_mod.f90 @@ -97,8 +97,6 @@ module farkode_erkstep_mod public :: FERKStepSetMaxNumConstrFails public :: FERKStepSetRootDirection public :: FERKStepSetNoInactiveRootWarn - public :: FERKStepSetErrHandlerFn - public :: FERKStepSetErrFile public :: FERKStepSetUserData public :: FERKStepSetPostprocessStepFn public :: FERKStepSetPostprocessStageFn @@ -561,25 +559,6 @@ function swigc_FERKStepSetNoInactiveRootWarn(farg1) & integer(C_INT) :: fresult end function -function swigc_FERKStepSetErrHandlerFn(farg1, farg2, farg3) & -bind(C, name="_wrap_FERKStepSetErrHandlerFn") & -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_FERKStepSetErrFile(farg1, farg2) & -bind(C, name="_wrap_FERKStepSetErrFile") & -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_FERKStepSetUserData(farg1, farg2) & bind(C, name="_wrap_FERKStepSetUserData") & result(fresult) @@ -1793,41 +1772,6 @@ function FERKStepSetNoInactiveRootWarn(arkode_mem) & swig_result = fresult end function -function FERKStepSetErrHandlerFn(arkode_mem, ehfun, eh_data) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: arkode_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 = arkode_mem -farg2 = ehfun -farg3 = eh_data -fresult = swigc_FERKStepSetErrHandlerFn(farg1, farg2, farg3) -swig_result = fresult -end function - -function FERKStepSetErrFile(arkode_mem, errfp) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: arkode_mem -type(C_PTR) :: errfp -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -type(C_PTR) :: farg2 - -farg1 = arkode_mem -farg2 = errfp -fresult = swigc_FERKStepSetErrFile(farg1, farg2) -swig_result = fresult -end function - function FERKStepSetUserData(arkode_mem, user_data) & result(swig_result) use, intrinsic :: ISO_C_BINDING diff --git a/src/arkode/fmod/farkode_mristep_mod.c b/src/arkode/fmod/farkode_mristep_mod.c index 63c3adb087..20dae93466 100644 --- a/src/arkode/fmod/farkode_mristep_mod.c +++ b/src/arkode/fmod/farkode_mristep_mod.c @@ -1127,36 +1127,6 @@ SWIGEXPORT int _wrap_FMRIStepSetNoInactiveRootWarn(void *farg1) { } -SWIGEXPORT int _wrap_FMRIStepSetErrHandlerFn(void *farg1, ARKErrHandlerFn farg2, void *farg3) { - int fresult ; - void *arg1 = (void *) 0 ; - ARKErrHandlerFn arg2 = (ARKErrHandlerFn) 0 ; - void *arg3 = (void *) 0 ; - int result; - - arg1 = (void *)(farg1); - arg2 = (ARKErrHandlerFn)(farg2); - arg3 = (void *)(farg3); - result = (int)MRIStepSetErrHandlerFn(arg1,arg2,arg3); - fresult = (int)(result); - return fresult; -} - - -SWIGEXPORT int _wrap_FMRIStepSetErrFile(void *farg1, void *farg2) { - int fresult ; - void *arg1 = (void *) 0 ; - FILE *arg2 = (FILE *) 0 ; - int result; - - arg1 = (void *)(farg1); - arg2 = (FILE *)(farg2); - result = (int)MRIStepSetErrFile(arg1,arg2); - fresult = (int)(result); - return fresult; -} - - SWIGEXPORT int _wrap_FMRIStepSetUserData(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; diff --git a/src/arkode/fmod/farkode_mristep_mod.f90 b/src/arkode/fmod/farkode_mristep_mod.f90 index ba581e4d84..494f3ea0cf 100644 --- a/src/arkode/fmod/farkode_mristep_mod.f90 +++ b/src/arkode/fmod/farkode_mristep_mod.f90 @@ -156,8 +156,6 @@ module farkode_mristep_mod public :: FMRIStepSetFixedStep public :: FMRIStepSetRootDirection public :: FMRIStepSetNoInactiveRootWarn - public :: FMRIStepSetErrHandlerFn - public :: FMRIStepSetErrFile public :: FMRIStepSetUserData public :: FMRIStepSetPostprocessStepFn public :: FMRIStepSetPostprocessStageFn @@ -768,25 +766,6 @@ function swigc_FMRIStepSetNoInactiveRootWarn(farg1) & integer(C_INT) :: fresult end function -function swigc_FMRIStepSetErrHandlerFn(farg1, farg2, farg3) & -bind(C, name="_wrap_FMRIStepSetErrHandlerFn") & -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_FMRIStepSetErrFile(farg1, farg2) & -bind(C, name="_wrap_FMRIStepSetErrFile") & -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_FMRIStepSetUserData(farg1, farg2) & bind(C, name="_wrap_FMRIStepSetUserData") & result(fresult) @@ -2378,41 +2357,6 @@ function FMRIStepSetNoInactiveRootWarn(arkode_mem) & swig_result = fresult end function -function FMRIStepSetErrHandlerFn(arkode_mem, ehfun, eh_data) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: arkode_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 = arkode_mem -farg2 = ehfun -farg3 = eh_data -fresult = swigc_FMRIStepSetErrHandlerFn(farg1, farg2, farg3) -swig_result = fresult -end function - -function FMRIStepSetErrFile(arkode_mem, errfp) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: arkode_mem -type(C_PTR) :: errfp -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -type(C_PTR) :: farg2 - -farg1 = arkode_mem -farg2 = errfp -fresult = swigc_FMRIStepSetErrFile(farg1, farg2) -swig_result = fresult -end function - function FMRIStepSetUserData(arkode_mem, user_data) & result(swig_result) use, intrinsic :: ISO_C_BINDING diff --git a/src/arkode/fmod/farkode_sprkstep_mod.c b/src/arkode/fmod/farkode_sprkstep_mod.c index 4cf502f9fd..1966f018b0 100644 --- a/src/arkode/fmod/farkode_sprkstep_mod.c +++ b/src/arkode/fmod/farkode_sprkstep_mod.c @@ -443,36 +443,6 @@ SWIGEXPORT int _wrap_FSPRKStepSetFixedStep(void *farg1, double const *farg2) { } -SWIGEXPORT int _wrap_FSPRKStepSetErrHandlerFn(void *farg1, ARKErrHandlerFn farg2, void *farg3) { - int fresult ; - void *arg1 = (void *) 0 ; - ARKErrHandlerFn arg2 = (ARKErrHandlerFn) 0 ; - void *arg3 = (void *) 0 ; - int result; - - arg1 = (void *)(farg1); - arg2 = (ARKErrHandlerFn)(farg2); - arg3 = (void *)(farg3); - result = (int)SPRKStepSetErrHandlerFn(arg1,arg2,arg3); - fresult = (int)(result); - return fresult; -} - - -SWIGEXPORT int _wrap_FSPRKStepSetErrFile(void *farg1, void *farg2) { - int fresult ; - void *arg1 = (void *) 0 ; - FILE *arg2 = (FILE *) 0 ; - int result; - - arg1 = (void *)(farg1); - arg2 = (FILE *)(farg2); - result = (int)SPRKStepSetErrFile(arg1,arg2); - fresult = (int)(result); - return fresult; -} - - SWIGEXPORT int _wrap_FSPRKStepSetUserData(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; diff --git a/src/arkode/fmod/farkode_sprkstep_mod.f90 b/src/arkode/fmod/farkode_sprkstep_mod.f90 index 42c43b4be7..ee21f1f689 100644 --- a/src/arkode/fmod/farkode_sprkstep_mod.f90 +++ b/src/arkode/fmod/farkode_sprkstep_mod.f90 @@ -67,8 +67,6 @@ module farkode_sprkstep_mod public :: FSPRKStepSetMaxNumSteps public :: FSPRKStepSetStopTime public :: FSPRKStepSetFixedStep - public :: FSPRKStepSetErrHandlerFn - public :: FSPRKStepSetErrFile public :: FSPRKStepSetUserData public :: FSPRKStepSetPostprocessStepFn public :: FSPRKStepSetPostprocessStageFn @@ -226,25 +224,6 @@ function swigc_FSPRKStepSetFixedStep(farg1, farg2) & integer(C_INT) :: fresult end function -function swigc_FSPRKStepSetErrHandlerFn(farg1, farg2, farg3) & -bind(C, name="_wrap_FSPRKStepSetErrHandlerFn") & -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_FSPRKStepSetErrFile(farg1, farg2) & -bind(C, name="_wrap_FSPRKStepSetErrFile") & -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_FSPRKStepSetUserData(farg1, farg2) & bind(C, name="_wrap_FSPRKStepSetUserData") & result(fresult) @@ -707,41 +686,6 @@ function FSPRKStepSetFixedStep(arkode_mem, hfixed) & swig_result = fresult end function -function FSPRKStepSetErrHandlerFn(arkode_mem, ehfun, eh_data) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: arkode_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 = arkode_mem -farg2 = ehfun -farg3 = eh_data -fresult = swigc_FSPRKStepSetErrHandlerFn(farg1, farg2, farg3) -swig_result = fresult -end function - -function FSPRKStepSetErrFile(arkode_mem, errfp) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: arkode_mem -type(C_PTR) :: errfp -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -type(C_PTR) :: farg2 - -farg1 = arkode_mem -farg2 = errfp -fresult = swigc_FSPRKStepSetErrFile(farg1, farg2) -swig_result = fresult -end function - function FSPRKStepSetUserData(arkode_mem, user_data) & result(swig_result) use, intrinsic :: ISO_C_BINDING diff --git a/test/unit_tests/arkode/CMakeLists.txt b/test/unit_tests/arkode/CMakeLists.txt index 9dd745e188..320bb0e51a 100644 --- a/test/unit_tests/arkode/CMakeLists.txt +++ b/test/unit_tests/arkode/CMakeLists.txt @@ -20,6 +20,9 @@ add_subdirectory(C_serial) # C++ unit tests if(CXX_FOUND) add_subdirectory(CXX_serial) + if(SUNDIALS_TEST_ENABLE_GTEST) + add_subdirectory(gtest) + endif() if(ENABLE_MPI AND MPI_CXX_FOUND) add_subdirectory(CXX_parallel) endif() diff --git a/test/unit_tests/arkode/gtest/CMakeLists.txt b/test/unit_tests/arkode/gtest/CMakeLists.txt new file mode 100644 index 0000000000..117f5c6097 --- /dev/null +++ b/test/unit_tests/arkode/gtest/CMakeLists.txt @@ -0,0 +1,20 @@ +# --------------------------------------------------------------- +# SUNDIALS Copyright Start +# Copyright (c) 2002-2023, Lawrence Livermore National Security +# and Southern Methodist University. +# All rights reserved. +# +# See the top-level LICENSE and NOTICE files for details. +# +# SPDX-License-Identifier: BSD-3-Clause +# SUNDIALS Copyright End +# --------------------------------------------------------------- + +# include location of public and private header files + +add_executable(test_arkode_error_handling test_arkode_error_handling.cpp) +target_include_directories(test_arkode_error_handling PRIVATE + $ ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) +target_link_libraries(test_arkode_error_handling + PRIVATE sundials_arkode sundials_nvecserial sundials_core GTest::gtest_main GTest::gmock) +gtest_discover_tests(test_arkode_error_handling) diff --git a/test/unit_tests/arkode/gtest/test_arkode_error_handling.cpp b/test/unit_tests/arkode/gtest/test_arkode_error_handling.cpp new file mode 100644 index 0000000000..0df9ea251c --- /dev/null +++ b/test/unit_tests/arkode/gtest/test_arkode_error_handling.cpp @@ -0,0 +1,78 @@ +/* ----------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2023, Lawrence Livermore National Security + * and Southern Methodist University. + * All rights reserved. + * + * See the top-level LICENSE and NOTICE files for details. + * + * SPDX-License-Identifier: BSD-3-Clause + * SUNDIALS Copyright End + * -----------------------------------------------------------------*/ + +#include +#include +#include +#include + +#include "../../utilities/dumpstderr.hpp" +#include "arkode/arkode_arkstep.h" +#include "arkode/arkode_impl.h" +#include "nvector/nvector_serial.h" +#include "sundials/sundials_context.hpp" +#include "sundials/sundials_logger.h" +#include "sundials/sundials_nvector.h" + +static const std::string errfile{"test_arkode_error_handling.err"}; + +static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) +{ + return 0; +} + +class ARKodeErrConditionTest : public testing::Test +{ +protected: + ARKodeErrConditionTest() + { + SUNContext_ClearErrHandlers(sunctx); + SUNContext_PushErrHandler(sunctx, SUNLogErrHandlerFn, NULL); + SUNContext_GetLogger(sunctx, &logger); + v = N_VNew_Serial(1, sunctx); + arkode_mem = ARKStepCreate(f, f, sunrealtype{0.0}, v, sunctx); + } + + ~ARKodeErrConditionTest() + { + N_VDestroy(v); + ARKStepFree(&arkode_mem); + } + + void* arkode_mem; + N_Vector v; + SUNLogger logger; + sundials::Context sunctx; +}; + +TEST_F(ARKodeErrConditionTest, WarningIsPrinted) +{ + SUNLogger_SetWarningFilename(logger, errfile.c_str()); + ARKodeMemRec* ark_mem = (ARKodeMemRec*)arkode_mem; + arkProcessError(ark_mem, ARK_WARNING, __LINE__, __func__, __FILE__, "test"); + SUNLogger_Flush(logger, SUN_LOGLEVEL_WARNING); + std::string output = dumpstderr(sunctx, errfile); + EXPECT_THAT(output, testing::AllOf(testing::StartsWith("[WARNING]"), + testing::HasSubstr("[rank 0]"), + testing::HasSubstr("test"))); +} + +TEST_F(ARKodeErrConditionTest, ErrorIsPrinted) +{ + SUNLogger_SetErrorFilename(logger, errfile.c_str()); + // negative reltol is illegal + ARKStepSStolerances(arkode_mem, /* reltol= */ -1e-4, /* abstol= */ 1e-4); + std::string output = dumpstderr(sunctx, errfile); + EXPECT_THAT(output, testing::AllOf(testing::StartsWith("[ERROR]"), + testing::HasSubstr("[rank 0]"), + testing::HasSubstr(MSG_ARK_BAD_RELTOL))); +}