Skip to content

Commit

Permalink
update duplicate error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
balos1 committed Dec 11, 2023
1 parent 9a2f675 commit 2523575
Show file tree
Hide file tree
Showing 113 changed files with 2,354 additions and 2,359 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,22 @@ accordingly.

**Breaking change**
Functions, types and header files that were previously deprecated have been
removed.
removed. In addittion the following names/symbols were replaced by ``SUN_ERR_*``
codes instead:

```
SUNLS_UNRECOV_FAILURE --> no replacement (this value was unused)
SUN_ERR_ARG_CORRUPT --> SUN_ERR_ARG_CORRUPT
SUN_ERR_ARG_INCOMPATIBLE --> SUN_ERR_ARG_INCOMPATIBLE
SUN_ERR_MEM_FAIL --> SUN_ERR_MEM_FAIL
SUNLS_VECTOROP_ERR --> SUN_ERR_OP_FAIL
SUN_NLS_SUCCESS --> SUN_SUCCESS
SUN_NLS_MEM_NULL --> SUN_ERR_ARG_CORRUPT
SUN_NLS_MEM_FAIL --> SUN_ERR_MEM_FAIL
SUN_NLS_ILL_INPUT --> SUN_ERR_ARG_INCOMPATIBLE
SUN_NLS_VECTOROP_ERR --> SUN_ERR_OP_FAIL
SUN_NLS_EXT_FAIL --> SUN_ERR_EXT_FAIL
```

**Breaking change**
Users now need to link to `sundials_core` in addition to the libraries already linked to.
Expand Down
14 changes: 7 additions & 7 deletions benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ SUNNonlinearSolver_Type TaskLocalNewton_GetType(SUNNonlinearSolver NLS)
int TaskLocalNewton_Initialize(SUNNonlinearSolver NLS)
{
/* check that the nonlinear solver is non-null */
if (NLS == NULL) { return SUN_NLS_MEM_NULL; }
if (NLS == NULL) { return SUN_ERR_ARG_CORRUPT; }

/* override default system and lsolve functions with local versions */
SUNNonlinSolSetSysFn(LOCAL_NLS(NLS), TaskLocalNlsResidual);
Expand All @@ -656,7 +656,7 @@ int TaskLocalNewton_Solve(SUNNonlinearSolver NLS, N_Vector y0, N_Vector ycor,
if ((NLS == NULL) || (y0 == NULL) || (ycor == NULL) || (w == NULL) ||
(mem == NULL))
{
return SUN_NLS_MEM_NULL;
return SUN_ERR_ARG_CORRUPT;
}

/* shortcuts */
Expand All @@ -683,7 +683,7 @@ int TaskLocalNewton_Solve(SUNNonlinearSolver NLS, N_Vector y0, N_Vector ycor,
int TaskLocalNewton_Free(SUNNonlinearSolver NLS)
{
/* return if NLS is already free */
if (NLS == NULL) { return SUN_NLS_SUCCESS; }
if (NLS == NULL) { return SUN_SUCCESS; }

/* free items from contents, then the generic structure */
if (NLS->content)
Expand All @@ -703,13 +703,13 @@ int TaskLocalNewton_Free(SUNNonlinearSolver NLS)
/* free the nonlinear solver */
free(NLS);

return SUN_NLS_SUCCESS;
return SUN_SUCCESS;
}

int TaskLocalNewton_SetSysFn(SUNNonlinearSolver NLS, SUNNonlinSolSysFn SysFn)
{
/* check that the nonlinear solver is non-null */
if (NLS == NULL) { return SUN_NLS_MEM_NULL; }
if (NLS == NULL) { return SUN_ERR_ARG_CORRUPT; }

return (SUNNonlinSolSetSysFn(LOCAL_NLS(NLS), SysFn));
}
Expand All @@ -719,15 +719,15 @@ int TaskLocalNewton_SetConvTestFn(SUNNonlinearSolver NLS,
void* ctest_data)
{
/* check that the nonlinear solver is non-null */
if (NLS == NULL) { return SUN_NLS_MEM_NULL; }
if (NLS == NULL) { return SUN_ERR_ARG_CORRUPT; }

return (SUNNonlinSolSetConvTestFn(LOCAL_NLS(NLS), CTestFn, ctest_data));
}

int TaskLocalNewton_GetNumConvFails(SUNNonlinearSolver NLS, long int* nconvfails)
{
/* check that the nonlinear solver is non-null */
if (NLS == NULL) { return SUN_NLS_MEM_NULL; }
if (NLS == NULL) { return SUN_ERR_ARG_CORRUPT; }

*nconvfails = GET_NLS_CONTENT(NLS)->ncnf;
return (0);
Expand Down
14 changes: 7 additions & 7 deletions benchmarks/advection_reaction_3D/raja/arkode_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ SUNNonlinearSolver_Type TaskLocalNewton_GetType(SUNNonlinearSolver NLS)
int TaskLocalNewton_Initialize(SUNNonlinearSolver NLS)
{
/* check that the nonlinear solver is non-null */
if (NLS == NULL) { return SUN_NLS_MEM_NULL; }
if (NLS == NULL) { return SUN_ERR_ARG_CORRUPT; }

/* override default system and lsolve functions with local versions */
SUNNonlinSolSetSysFn(LOCAL_NLS(NLS), TaskLocalNlsResidual);
Expand All @@ -656,7 +656,7 @@ int TaskLocalNewton_Solve(SUNNonlinearSolver NLS, N_Vector y0, N_Vector ycor,
if ((NLS == NULL) || (y0 == NULL) || (ycor == NULL) || (w == NULL) ||
(mem == NULL))
{
return SUN_NLS_MEM_NULL;
return SUN_ERR_ARG_CORRUPT;
}

/* shortcuts */
Expand All @@ -683,7 +683,7 @@ int TaskLocalNewton_Solve(SUNNonlinearSolver NLS, N_Vector y0, N_Vector ycor,
int TaskLocalNewton_Free(SUNNonlinearSolver NLS)
{
/* return if NLS is already free */
if (NLS == NULL) { return SUN_NLS_SUCCESS; }
if (NLS == NULL) { return SUN_SUCCESS; }

/* free items from contents, then the generic structure */
if (NLS->content)
Expand All @@ -703,13 +703,13 @@ int TaskLocalNewton_Free(SUNNonlinearSolver NLS)
/* free the nonlinear solver */
free(NLS);

return SUN_NLS_SUCCESS;
return SUN_SUCCESS;
}

int TaskLocalNewton_SetSysFn(SUNNonlinearSolver NLS, SUNNonlinSolSysFn SysFn)
{
/* check that the nonlinear solver is non-null */
if (NLS == NULL) { return SUN_NLS_MEM_NULL; }
if (NLS == NULL) { return SUN_ERR_ARG_CORRUPT; }

return (SUNNonlinSolSetSysFn(LOCAL_NLS(NLS), SysFn));
}
Expand All @@ -719,15 +719,15 @@ int TaskLocalNewton_SetConvTestFn(SUNNonlinearSolver NLS,
void* ctest_data)
{
/* check that the nonlinear solver is non-null */
if (NLS == NULL) { return SUN_NLS_MEM_NULL; }
if (NLS == NULL) { return SUN_ERR_ARG_CORRUPT; }

return (SUNNonlinSolSetConvTestFn(LOCAL_NLS(NLS), CTestFn, ctest_data));
}

int TaskLocalNewton_GetNumConvFails(SUNNonlinearSolver NLS, long int* nconvfails)
{
/* check that the nonlinear solver is non-null */
if (NLS == NULL) { return SUN_NLS_MEM_NULL; }
if (NLS == NULL) { return SUN_ERR_ARG_CORRUPT; }

*nconvfails = GET_NLS_CONTENT(NLS)->ncnf;
return (0);
Expand Down
11 changes: 1 addition & 10 deletions doc/shared/sunlinsol/SUNLinSol_API.rst
Original file line number Diff line number Diff line change
Expand Up @@ -523,14 +523,7 @@ provide additional information to the user in case of a linear solver failure.
+------------------------------+-------+---------------------------------------------------+
| Error code | Value | Meaning |
+==============================+=======+===================================================+
| ``SUNLS_SUCCESS`` | 0 | successful call or converged solve |
+------------------------------+-------+---------------------------------------------------+
| ``SUNLS_MEM_NULL`` | -801 | the memory argument to the function is ``NULL`` |
+------------------------------+-------+---------------------------------------------------+
| ``SUNLS_ILL_INPUT`` | -802 | an illegal input has been provided to the |
| | | function |
+------------------------------+-------+---------------------------------------------------+
| ``SUNLS_MEM_FAIL`` | -803 | failed memory access or allocation |
| ``SUN_SUCCESS`` | 0 | successful call or converged solve |
+------------------------------+-------+---------------------------------------------------+
| ``SUNLS_ATIMES_NULL`` | -804 | the ``Atimes`` function is ``NULL`` |
+------------------------------+-------+---------------------------------------------------+
Expand All @@ -554,8 +547,6 @@ provide additional information to the user in case of a linear solver failure.
| ``SUNLS_QRSOL_FAIL`` | -811 | a singular $R$ matrix was encountered in a QR |
| | | factorization (SPGMR/SPFGMR) |
+------------------------------+-------+---------------------------------------------------+
| ``SUNLS_VECTOROP_ERR`` | -812 | a vector operation error occurred |
+------------------------------+-------+---------------------------------------------------+
| ``SUNLS_RES_REDUCED`` | 801 | an iterative solver reduced the residual, but did |
| | | not converge to the desired tolerance |
+------------------------------+-------+---------------------------------------------------+
Expand Down
4 changes: 2 additions & 2 deletions doc/shared/sunlinsol/SUNLinSol_KLU.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ user-callable routines:
constructor routine (or the previous ``SUNKLUReInit`` call).
**Return value:**
* ``SUNLS_SUCCESS`` -- reinitialization successful.
* ``SUN_SUCCESS`` -- reinitialization successful.
* ``SUNLS_MEM_NULL`` -- either ``S`` or ``A`` are ``NULL``.
* ``SUNLS_ILL_INPUT`` -- ``A`` does not have type ``SUNMATRIX_SPARSE`` or
``reinit_type`` is invalid.
Expand Down Expand Up @@ -116,7 +116,7 @@ user-callable routines:
The default is 1 for COLAMD.
**Return value:**
* ``SUNLS_SUCCESS`` -- ordering choice successfully updated.
* ``SUN_SUCCESS`` -- ordering choice successfully updated.
* ``SUNLS_MEM_NULL`` -- ``S`` is ``NULL``.
* ``SUNLS_ILL_INPUT`` -- ``ordering_choice``.
Expand Down
2 changes: 1 addition & 1 deletion doc/shared/sunlinsol/SUNLinSol_MagmaDense.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ In addition, the module provides the following user-callable routines:
* *onoff* -- 0 for synchronous mode or 1 for asynchronous mode (default 1)
**Return value:**
* ``SUNLS_SUCCESS`` if successful
* ``SUN_SUCCESS`` if successful
* ``SUNLS_MEM_NULL`` if *LS* is ``NULL``
Expand Down
8 changes: 4 additions & 4 deletions doc/shared/sunlinsol/SUNLinSol_PCG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ The module SUNLinSol_PCG provides the following user-callable routines:
* ``SUN_PREC_BOTH``
**Return value:**
* ``SUNLS_SUCCESS`` -- successful update.
* ``SUN_SUCCESS`` -- successful update.
* ``SUNLS_ILL_INPUT`` -- illegal ``pretype``
* ``SUNLS_MEM_NULL`` -- ``S`` is ``NULL``
Expand All @@ -170,7 +170,7 @@ The module SUNLinSol_PCG provides the following user-callable routines:
non-positive input will result in the default value (5).
**Return value:**
* ``SUNLS_SUCCESS`` -- successful update.
* ``SUN_SUCCESS`` -- successful update.
* ``SUNLS_MEM_NULL`` -- ``S`` is ``NULL``
Expand All @@ -186,7 +186,7 @@ The module SUNLinSol_PCG provides the following user-callable routines:
a ``NULL`` input will disable output
**Return value:**
* *SUNLS_SUCCESS* if successful
* *SUN_SUCCESS* if successful
* *SUNLS_MEM_NULL* if the SUNLinearSolver memory was ``NULL``
* *SUNLS_ILL_INPUT* if SUNDIALS was not built with monitoring enabled

Expand Down Expand Up @@ -219,7 +219,7 @@ The module SUNLinSol_PCG provides the following user-callable routines:
* 1, for each linear iteration the residual norm is printed
**Return value:**
* *SUNLS_SUCCESS* if successful
* *SUN_SUCCESS* if successful
* *SUNLS_MEM_NULL* if the SUNLinearSolver memory was ``NULL``
* *SUNLS_ILL_INPUT* if SUNDIALS was not built with monitoring enabled, or
if the print level value was invalid
Expand Down
8 changes: 4 additions & 4 deletions doc/shared/sunlinsol/SUNLinSol_SPBCGS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ user-callable routines:
* ``SUN_PREC_BOTH``
**Return value:**
* ``SUNLS_SUCCESS`` -- successful update.
* ``SUN_SUCCESS`` -- successful update.
* ``SUNLS_ILL_INPUT`` -- illegal ``pretype``
* ``SUNLS_MEM_NULL`` -- ``S`` is ``NULL``
Expand All @@ -114,7 +114,7 @@ user-callable routines:
non-positive input will result in the default value (5).
**Return value:**
* ``SUNLS_SUCCESS`` -- successful update.
* ``SUN_SUCCESS`` -- successful update.
* ``SUNLS_MEM_NULL`` -- ``S`` is ``NULL``
Expand All @@ -129,7 +129,7 @@ user-callable routines:
a ``NULL`` input will disable output
**Return value:**
* *SUNLS_SUCCESS* if successful
* *SUN_SUCCESS* if successful
* *SUNLS_MEM_NULL* if the SUNLinearSolver memory was ``NULL``
* *SUNLS_ILL_INPUT* if SUNDIALS was not built with monitoring enabled

Expand Down Expand Up @@ -160,7 +160,7 @@ user-callable routines:
* 1, for each linear iteration the residual norm is printed
**Return value:**
* *SUNLS_SUCCESS* if successful
* *SUN_SUCCESS* if successful
* *SUNLS_MEM_NULL* if the SUNLinearSolver memory was ``NULL``
* *SUNLS_ILL_INPUT* if SUNDIALS was not built with monitoring enabled, or
if the print level value was invalid
Expand Down
10 changes: 5 additions & 5 deletions doc/shared/sunlinsol/SUNLinSol_SPFGMR.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ user-callable routines:
* ``SUN_PREC_BOTH``
**Return value:**
* ``SUNLS_SUCCESS`` -- successful update.
* ``SUN_SUCCESS`` -- successful update.
* ``SUNLS_ILL_INPUT`` -- illegal ``pretype``
* ``SUNLS_MEM_NULL`` -- ``S`` is ``NULL``
Expand All @@ -122,7 +122,7 @@ user-callable routines:
* ``SUN_CLASSICAL_GS``
**Return value:**
* ``SUNLS_SUCCESS`` -- successful update.
* ``SUN_SUCCESS`` -- successful update.
* ``SUNLS_ILL_INPUT`` -- illegal ``gstype``
* ``SUNLS_MEM_NULL`` -- ``S`` is ``NULL``
Expand All @@ -137,7 +137,7 @@ user-callable routines:
result in the default of 0.
**Return value:**
* ``SUNLS_SUCCESS`` -- successful update.
* ``SUN_SUCCESS`` -- successful update.
* ``SUNLS_MEM_NULL`` -- ``S`` is ``NULL``
Expand All @@ -152,7 +152,7 @@ user-callable routines:
a ``NULL`` input will disable output
**Return value:**
* *SUNLS_SUCCESS* if successful
* *SUN_SUCCESS* if successful
* *SUNLS_MEM_NULL* if the SUNLinearSolver memory was ``NULL``
* *SUNLS_ILL_INPUT* if SUNDIALS was not built with monitoring enabled

Expand Down Expand Up @@ -185,7 +185,7 @@ user-callable routines:
* 1, for each linear iteration the residual norm is printed
**Return value:**
* *SUNLS_SUCCESS* if successful
* *SUN_SUCCESS* if successful
* *SUNLS_MEM_NULL* if the SUNLinearSolver memory was ``NULL``
* *SUNLS_ILL_INPUT* if SUNDIALS was not built with monitoring enabled, or
if the print level value was invalid
Expand Down
10 changes: 5 additions & 5 deletions doc/shared/sunlinsol/SUNLinSol_SPGMR.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ user-callable routines:
* ``SUN_PREC_BOTH``
**Return value:**
* ``SUNLS_SUCCESS`` -- successful update.
* ``SUN_SUCCESS`` -- successful update.
* ``SUNLS_ILL_INPUT`` -- illegal ``pretype``
* ``SUNLS_MEM_NULL`` -- ``S`` is ``NULL``
Expand All @@ -109,7 +109,7 @@ user-callable routines:
* ``SUN_CLASSICAL_GS``
**Return value:**
* ``SUNLS_SUCCESS`` -- successful update.
* ``SUN_SUCCESS`` -- successful update.
* ``SUNLS_ILL_INPUT`` -- illegal ``gstype``
* ``SUNLS_MEM_NULL`` -- ``S`` is ``NULL``
Expand All @@ -124,7 +124,7 @@ user-callable routines:
result in the default of 0.
**Return value:**
* ``SUNLS_SUCCESS`` -- successful update.
* ``SUN_SUCCESS`` -- successful update.
* ``SUNLS_MEM_NULL`` -- ``S`` is ``NULL``
Expand All @@ -139,7 +139,7 @@ user-callable routines:
a ``NULL`` input will disable output
**Return value:**
* *SUNLS_SUCCESS* if successful
* *SUN_SUCCESS* if successful
* *SUNLS_MEM_NULL* if the SUNLinearSolver memory was ``NULL``
* *SUNLS_ILL_INPUT* if SUNDIALS was not built with monitoring enabled

Expand Down Expand Up @@ -172,7 +172,7 @@ user-callable routines:
* 1, for each linear iteration the residual norm is printed
**Return value:**
* *SUNLS_SUCCESS* if successful
* *SUN_SUCCESS* if successful
* *SUNLS_MEM_NULL* if the SUNLinearSolver memory was ``NULL``
* *SUNLS_ILL_INPUT* if SUNDIALS was not built with monitoring enabled, or
if the print level value was invalid
Expand Down
8 changes: 4 additions & 4 deletions doc/shared/sunlinsol/SUNLinSol_SPTFQMR.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ The module SUNLinSol_SPTFQMR provides the following user-callable routines:
* ``SUN_PREC_BOTH``
**Return value:**
* ``SUNLS_SUCCESS`` -- successful update.
* ``SUN_SUCCESS`` -- successful update.
* ``SUNLS_ILL_INPUT`` -- illegal ``pretype``
* ``SUNLS_MEM_NULL`` -- ``S`` is ``NULL``
Expand All @@ -114,7 +114,7 @@ The module SUNLinSol_SPTFQMR provides the following user-callable routines:
non-positive input will result in the default value (5).
**Return value:**
* ``SUNLS_SUCCESS`` -- successful update.
* ``SUN_SUCCESS`` -- successful update.
* ``SUNLS_MEM_NULL`` -- ``S`` is ``NULL``
Expand All @@ -129,7 +129,7 @@ The module SUNLinSol_SPTFQMR provides the following user-callable routines:
a ``NULL`` input will disable output
**Return value:**
* *SUNLS_SUCCESS* if successful
* *SUN_SUCCESS* if successful
* *SUNLS_MEM_NULL* if the SUNLinearSolver memory was ``NULL``
* *SUNLS_ILL_INPUT* if SUNDIALS was not built with monitoring enabled

Expand Down Expand Up @@ -162,7 +162,7 @@ The module SUNLinSol_SPTFQMR provides the following user-callable routines:
* 1, for each linear iteration the residual norm is printed
**Return value:**
* *SUNLS_SUCCESS* if successful
* *SUN_SUCCESS* if successful
* *SUNLS_MEM_NULL* if the SUNLinearSolver memory was ``NULL``
* *SUNLS_ILL_INPUT* if SUNDIALS was not built with monitoring enabled, or
if the print level value was invalid
Expand Down
Loading

0 comments on commit 2523575

Please sign in to comment.