Skip to content

Commit

Permalink
Merge branch 'develop' into ci/compiler-warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gardner48 authored May 16, 2024
2 parents 1a251aa + 8bdca73 commit 9165c51
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 24 deletions.
6 changes: 3 additions & 3 deletions src/arkode/arkode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2816,8 +2816,8 @@ int arkPredict_MaximumOrder(ARKodeMem ark_mem, sunrealtype tau, N_Vector yguess)
int arkPredict_VariableOrder(ARKodeMem ark_mem, sunrealtype tau, N_Vector yguess)
{
int ord;
sunrealtype tau_tol = 0.5;
sunrealtype tau_tol2 = 0.75;
sunrealtype tau_tol = HALF;
sunrealtype tau_tol2 = SUN_RCONST(0.75);

/* verify that ark_mem and interpolation structure are provided */
if (ark_mem == NULL)
Expand Down Expand Up @@ -2854,7 +2854,7 @@ int arkPredict_VariableOrder(ARKodeMem ark_mem, sunrealtype tau, N_Vector yguess
int arkPredict_CutoffOrder(ARKodeMem ark_mem, sunrealtype tau, N_Vector yguess)
{
int ord;
sunrealtype tau_tol = 0.5;
sunrealtype tau_tol = HALF;

/* verify that ark_mem and interpolation structure are provided */
if (ark_mem == NULL)
Expand Down
2 changes: 1 addition & 1 deletion src/arkode/arkode_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1588,7 +1588,7 @@ int ARKodeSetErrorBias(void* arkode_mem, sunrealtype bias)
/* set allowed value, otherwise set default */
if (bias < ONE)
{
retval = SUNAdaptController_SetErrorBias(hadapt_mem->hcontroller, -1.0);
retval = SUNAdaptController_SetErrorBias(hadapt_mem->hcontroller, -ONE);
}
else
{
Expand Down
13 changes: 7 additions & 6 deletions src/arkode/arkode_sprk.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ ARKodeSPRKTable ARKodeSymplecticMcLachlan2(void)
if (!sprk_table) { return NULL; }
sprk_table->q = 2;
sprk_table->stages = 2;
sprk_table->a[1] = SUN_RCONST(1.0) -
(SUN_RCONST(1.0) / SUN_RCONST(2.0)) * SUNRsqrt(2.0);
sprk_table->a[1] = SUN_RCONST(1.0) - (SUN_RCONST(1.0) / SUN_RCONST(2.0)) *
SUNRsqrt(SUN_RCONST(2.0));
sprk_table->a[0] = SUN_RCONST(1.0) - sprk_table->a[1];
sprk_table->ahat[1] = SUN_RCONST(1.0) /
(SUN_RCONST(2.0) * (SUN_RCONST(1.0) - sprk_table->a[1]));
Expand All @@ -147,17 +147,18 @@ ARKodeSPRKTable ARKodeSymplecticMcLachlan2(void)

ARKodeSPRKTable ARKodeSymplecticMcLachlan3(void)
{
sunrealtype w = 0.0;
sunrealtype y = 0.0;
sunrealtype z = 0.0;
sunrealtype w = SUN_RCONST(0.0);
sunrealtype y = SUN_RCONST(0.0);
sunrealtype z = SUN_RCONST(0.0);
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(3);
if (!sprk_table) { return NULL; }

sprk_table->q = 3;
sprk_table->stages = 3;

z = -SUNRpowerR((SUN_RCONST(2.0) / SUN_RCONST(27.0)) -
SUN_RCONST(1.0) / (SUN_RCONST(9.0) * SUNRsqrt(3.0)),
SUN_RCONST(1.0) /
(SUN_RCONST(9.0) * SUNRsqrt(SUN_RCONST(3.0))),
SUN_RCONST(1.0) / SUN_RCONST(3.0));
w = -SUN_RCONST(2.0) / SUN_RCONST(3.0) +
SUN_RCONST(1.0) / (SUN_RCONST(9.0) * z) + z;
Expand Down
2 changes: 1 addition & 1 deletion src/cvodes/cvodea.c
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,7 @@ static CVckpntMem CVAckpntInit(CVodeMem cv_mem)
ck_mem->ck_t0 = cv_mem->cv_tn;
ck_mem->ck_nst = 0;
ck_mem->ck_q = 1;
ck_mem->ck_h = 0.0;
ck_mem->ck_h = ZERO;

/* Do we need to carry quadratures */
ck_mem->ck_quadr = cv_mem->cv_quadr && cv_mem->cv_errconQ;
Expand Down
2 changes: 1 addition & 1 deletion src/sundials/sundials_band.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ void SUNDlsMat_bandMatvec(sunrealtype** a, sunrealtype* x, sunrealtype* y,
sunindextype i, j, is, ie;
sunrealtype* col_j;

for (i = 0; i < n; i++) { y[i] = 0.0; }
for (i = 0; i < n; i++) { y[i] = ZERO; }

for (j = 0; j < n; j++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/sundials/sundials_dense.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ void SUNDlsMat_denseMatvec(sunrealtype** a, sunrealtype* x, sunrealtype* y,
sunindextype i, j;
sunrealtype* col_j;

for (i = 0; i < m; i++) { y[i] = 0.0; }
for (i = 0; i < m; i++) { y[i] = ZERO; }

for (j = 0; j < n; j++)
{
Expand Down
12 changes: 7 additions & 5 deletions src/sundials/sundials_hashmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ SUNErrCode SUNHashMap_Destroy(SUNHashMap* map, void (*freevalue)(void* ptr))
* ``<-1`` -- an error occurred
*/
int SUNHashMap_Iterate(SUNHashMap map, int start,
int (*yieldfn)(int, SUNHashMapKeyValue, void*), void* ctx)
int (*yieldfn)(int, SUNHashMapKeyValue, const void*),
const void* ctx)
{
int i;

Expand All @@ -159,7 +160,8 @@ int SUNHashMap_Iterate(SUNHashMap map, int start,
return (map->max_size);
}

static int sunHashMapLinearProbeInsert(int idx, SUNHashMapKeyValue kv, void* ctx)
static int sunHashMapLinearProbeInsert(int idx, SUNHashMapKeyValue kv,
const void* ctx)
{
/* find the next open spot */
if (kv == NULL) { return (idx); /* open spot found at idx */ }
Expand Down Expand Up @@ -216,7 +218,8 @@ int SUNHashMap_Insert(SUNHashMap map, const char* key, void* value)
return (0);
}

static int sunHashMapLinearProbeGet(int idx, SUNHashMapKeyValue kv, void* key)
static int sunHashMapLinearProbeGet(int idx, SUNHashMapKeyValue kv,
const void* key)
{
/* target key cannot be NULL */
if (key == NULL) { return (-2); }
Expand Down Expand Up @@ -260,8 +263,7 @@ int SUNHashMap_GetValue(SUNHashMap map, const char* key, void** value)
if (strcmp(map->buckets[idx]->key, key))
{
/* Keys did not match, so we have a collision and need to probe */
retval = SUNHashMap_Iterate(map, idx + 1, sunHashMapLinearProbeGet,
(void*)key);
retval = SUNHashMap_Iterate(map, idx + 1, sunHashMapLinearProbeGet, key);
if (retval < 0) { return (-1); /* error occurred */ }
if (retval == map->max_size) { return (-2); /* not found */ }
}
Expand Down
3 changes: 2 additions & 1 deletion src/sundials/sundials_hashmap_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ struct SUNHashMap_
SUNErrCode SUNHashMap_New(int max_size, SUNHashMap* map);
SUNErrCode SUNHashMap_Destroy(SUNHashMap* map, void (*freevalue)(void* ptr));
int SUNHashMap_Iterate(SUNHashMap map, int start,
int (*yieldfn)(int, SUNHashMapKeyValue, void*), void* ctx);
int (*yieldfn)(int, SUNHashMapKeyValue, const void*),
const void* ctx);
int SUNHashMap_Insert(SUNHashMap map, const char* key, void* value);
int SUNHashMap_GetValue(SUNHashMap map, const char* key, void** value);
SUNErrCode SUNHashMap_Sort(SUNHashMap map, SUNHashMapKeyValue** sorted,
Expand Down
4 changes: 2 additions & 2 deletions src/sundials/sundials_profiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@ int sunCompareTimes(const void* l, const void* r)
double left_max;
double right_max;

const SUNHashMapKeyValue left = *((SUNHashMapKeyValue*)l);
const SUNHashMapKeyValue right = *((SUNHashMapKeyValue*)r);
const SUNHashMapKeyValue left = *((const SUNHashMapKeyValue*)l);
const SUNHashMapKeyValue right = *((const SUNHashMapKeyValue*)r);

if (left == NULL && right == NULL) { return 0; }
if (left == NULL) { return 1; }
Expand Down
6 changes: 3 additions & 3 deletions src/sunmatrix/sparse/sunmatrix_sparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ SUNErrCode Matvec_SparseCSC(SUNMatrix A, N_Vector x, N_Vector y)
SUNCheckLastErr();

/* initialize result */
for (i = 0; i < SM_ROWS_S(A); i++) { yd[i] = 0.0; }
for (i = 0; i < SM_ROWS_S(A); i++) { yd[i] = ZERO; }

/* iterate through matrix columns */
for (j = 0; j < SM_COLUMNS_S(A); j++)
Expand Down Expand Up @@ -1230,7 +1230,7 @@ SUNErrCode Matvec_SparseCSR(SUNMatrix A, N_Vector x, N_Vector y)
SUNAssert(yd, SUN_ERR_ARG_CORRUPT);
SUNAssert(xd != yd, SUN_ERR_ARG_CORRUPT);
/* initialize result */
for (i = 0; i < SM_ROWS_S(A); i++) { yd[i] = 0.0; }
for (i = 0; i < SM_ROWS_S(A); i++) { yd[i] = ZERO; }

/* iterate through matrix rows */
for (i = 0; i < SM_ROWS_S(A); i++)
Expand Down Expand Up @@ -1298,7 +1298,7 @@ SUNErrCode format_convert(const SUNMatrix A, SUNMatrix B)
sunindextype jj;
for (jj = Ap[row]; jj < Ap[row + 1]; jj++)
{
sunindextype col = Aj[jj];
col = Aj[jj];
sunindextype dest = Bp[col];

Bi[dest] = row;
Expand Down

0 comments on commit 9165c51

Please sign in to comment.