From 8d76dad2505a6bb1d17a46fe69b9d6d34275c4f3 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Fri, 17 Jan 2025 14:52:56 -0600 Subject: [PATCH 1/9] Reorganized organization of checkNvector routines --- src/arkode/arkode.c | 80 ++++++++++++++++++++++++------- src/arkode/arkode_arkstep.c | 26 ---------- src/arkode/arkode_arkstep_impl.h | 1 - src/arkode/arkode_bbdpre.c | 3 +- src/arkode/arkode_erkstep.c | 26 ---------- src/arkode/arkode_erkstep_impl.h | 1 - src/arkode/arkode_forcingstep.c | 17 ------- src/arkode/arkode_impl.h | 1 + src/arkode/arkode_io.c | 4 +- src/arkode/arkode_ls.c | 3 +- src/arkode/arkode_lsrkstep.c | 27 ----------- src/arkode/arkode_lsrkstep_impl.h | 1 - src/arkode/arkode_mristep.c | 26 ---------- src/arkode/arkode_mristep_impl.h | 1 - src/arkode/arkode_relaxation.c | 8 ++++ src/arkode/arkode_splittingstep.c | 17 ------- src/arkode/arkode_sprkstep.c | 26 ---------- src/arkode/arkode_sprkstep_impl.h | 1 - 18 files changed, 79 insertions(+), 190 deletions(-) diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index c03d7cd2e3..8b518f8d68 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -272,6 +272,15 @@ int ARKodeSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol) return (ARK_ILL_INPUT); } + /* Ensure that vector supports N_VAddConst */ + if (!ark_mem->tempv1->ops->nvaddconst) + { + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "N_VAddConst unimplemented (required for scalar abstol)"); + return (SUNFALSE); + } + + /* Set flag indicating whether abstol == 0 */ ark_mem->atolmin0 = (abstol == ZERO); @@ -1851,23 +1860,69 @@ sunbooleantype arkCheckTimestepper(ARKodeMem ark_mem) /*--------------------------------------------------------------- arkCheckNvector: - This routine checks if all required vector operations are - present. If any of them is missing it returns SUNFALSE. + This routine checks if all absolutely-required vector + operations are present. If any of them is missing it returns + SUNFALSE. ---------------------------------------------------------------*/ -sunbooleantype arkCheckNvector(N_Vector tmpl) /* to be updated?? */ +sunbooleantype arkCheckNvector(N_Vector tmpl) { if ((tmpl->ops->nvclone == NULL) || (tmpl->ops->nvdestroy == NULL) || (tmpl->ops->nvlinearsum == NULL) || (tmpl->ops->nvconst == NULL) || (tmpl->ops->nvdiv == NULL) || (tmpl->ops->nvscale == NULL) || (tmpl->ops->nvabs == NULL) || (tmpl->ops->nvinv == NULL) || - (tmpl->ops->nvaddconst == NULL) || (tmpl->ops->nvmaxnorm == NULL) || - (tmpl->ops->nvwrmsnorm == NULL)) + (tmpl->ops->nvmaxnorm == NULL) || (tmpl->ops->nvwrmsnorm == NULL)) { return (SUNFALSE); } else { return (SUNTRUE); } } +/*--------------------------------------------------------------- + arkCheckNvector2: + + This routine perform conditional checks on required vector + operations are present (i.e., if the current ARKODE + configuration requires additional N_Vector routines). If any + of them is missing it returns SUNFALSE. + ---------------------------------------------------------------*/ +sunbooleantype arkCheckNvector2(ARKodeMem ark_mem) +{ + + /* If using a built-in routine for error/residual weights with abstol==0, + ensure that N_VMin is available */ + if ((!ark_mem->user_efun) && (ark_mem->atolmin0) && (!ark_mem->tempv1->ops->nvmin)) + { + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "N_VMin unimplemented (required by error-weight function)"); + return (SUNFALSE); + } + if ((!ark_mem->user_rfun) && (!ark_mem->rwt_is_ewt) && (ark_mem->Ratolmin0) && + (!ark_mem->tempv1->ops->nvmin)) + { + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "N_VMin unimplemented (required by residual-weight function)"); + return (SUNFALSE); + } + + /* If the user has not specified a step size (and it will be estimated + internally), ensure that N_VDiv and N_VMaxNorm are available */ + if ((ark_mem->h0u == ZERO) && (ark_mem->hin == ZERO) && (!ark_mem->tempv1->ops->nvdiv)) + { + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "N_VDiv unimplemented (required for initial step estimation)"); + return (SUNFALSE); + } + if ((ark_mem->h0u == ZERO) && (ark_mem->hin == ZERO) && (!ark_mem->tempv1->ops->nvmaxnorm)) + { + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "N_VMaxNorm unimplemented (required for initial step estimation)"); + return (SUNFALSE); + } + + /* If we made it here, then the vector is sufficient */ + return (SUNTRUE); +} + /*--------------------------------------------------------------- arkInitialSetup @@ -1896,19 +1951,12 @@ int arkInitialSetup(ARKodeMem ark_mem, sunrealtype tout) return (ARK_ILL_INPUT); } - /* If using a built-in routine for error/residual weights with abstol==0, - ensure that N_VMin is available */ - if ((!ark_mem->user_efun) && (ark_mem->atolmin0) && (!ark_mem->yn->ops->nvmin)) + /* Perform additional N_Vector checks here, now that ARKODE has been + fully configured by the user */ + if (!arkCheckNvector2(ark_mem)) { 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, __LINE__, __func__, - __FILE__, "N_VMin unimplemented (required by residual-weight function)"); + MSG_ARK_BAD_NVECTOR); return (ARK_ILL_INPUT); } diff --git a/src/arkode/arkode_arkstep.c b/src/arkode/arkode_arkstep.c index 5ede13165c..ff8625b9ef 100644 --- a/src/arkode/arkode_arkstep.c +++ b/src/arkode/arkode_arkstep.c @@ -66,15 +66,6 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, return (NULL); } - /* Test if all required vector operations are implemented */ - nvectorOK = arkStep_CheckNVector(y0); - if (!nvectorOK) - { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - MSG_ARK_BAD_NVECTOR); - return (NULL); - } - /* Create ark_mem structure and set default values */ ark_mem = arkCreate(sunctx); if (ark_mem == NULL) @@ -2170,23 +2161,6 @@ int arkStep_AccessStepMem(ARKodeMem ark_mem, const char* fname, return (ARK_SUCCESS); } -/*--------------------------------------------------------------- - arkStep_CheckNVector: - - This routine checks if all required vector operations are - present. If any of them is missing it returns SUNFALSE. - ---------------------------------------------------------------*/ -sunbooleantype arkStep_CheckNVector(N_Vector tmpl) -{ - if ((tmpl->ops->nvclone == NULL) || (tmpl->ops->nvdestroy == NULL) || - (tmpl->ops->nvlinearsum == NULL) || (tmpl->ops->nvconst == NULL) || - (tmpl->ops->nvscale == NULL) || (tmpl->ops->nvwrmsnorm == NULL)) - { - return (SUNFALSE); - } - return (SUNTRUE); -} - /*--------------------------------------------------------------- arkStep_SetButcherTables diff --git a/src/arkode/arkode_arkstep_impl.h b/src/arkode/arkode_arkstep_impl.h index 1d5c15e4a3..fa0349017b 100644 --- a/src/arkode/arkode_arkstep_impl.h +++ b/src/arkode/arkode_arkstep_impl.h @@ -236,7 +236,6 @@ int arkStep_AccessARKODEStepMem(void* arkode_mem, const char* fname, ARKodeMem* ark_mem, ARKodeARKStepMem* step_mem); int arkStep_AccessStepMem(ARKodeMem ark_mem, const char* fname, ARKodeARKStepMem* step_mem); -sunbooleantype arkStep_CheckNVector(N_Vector tmpl); int arkStep_SetButcherTables(ARKodeMem ark_mem); int arkStep_CheckButcherTables(ARKodeMem ark_mem); int arkStep_Predict(ARKodeMem ark_mem, int istage, N_Vector yguess); diff --git a/src/arkode/arkode_bbdpre.c b/src/arkode/arkode_bbdpre.c index f6445c8ede..7b7c6b8ee5 100644 --- a/src/arkode/arkode_bbdpre.c +++ b/src/arkode/arkode_bbdpre.c @@ -65,7 +65,8 @@ int ARKBBDPrecInit(void* arkode_mem, sunindextype Nlocal, sunindextype mudq, if (retval != ARK_SUCCESS) { return (retval); } /* Test compatibility of NVECTOR package with the BBD preconditioner */ - if (ark_mem->tempv1->ops->nvgetarraypointer == NULL) + if ((ark_mem->tempv1->ops->nvgetarraypointer == NULL) || + (ark_mem->tempv1->ops->nvsetarraypointer == NULL)) { arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_BBD_BAD_NVECTOR); diff --git a/src/arkode/arkode_erkstep.c b/src/arkode/arkode_erkstep.c index 7947e3d6fd..278f775524 100644 --- a/src/arkode/arkode_erkstep.c +++ b/src/arkode/arkode_erkstep.c @@ -60,15 +60,6 @@ void* ERKStepCreate(ARKRhsFn f, sunrealtype t0, N_Vector y0, SUNContext sunctx) return (NULL); } - /* Test if all required vector operations are implemented */ - nvectorOK = erkStep_CheckNVector(y0); - if (!nvectorOK) - { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - MSG_ARK_BAD_NVECTOR); - return (NULL); - } - /* Create ark_mem structure and set default values */ ark_mem = arkCreate(sunctx); if (ark_mem == NULL) @@ -913,23 +904,6 @@ int erkStep_AccessStepMem(ARKodeMem ark_mem, const char* fname, return (ARK_SUCCESS); } -/*--------------------------------------------------------------- - erkStep_CheckNVector: - - This routine checks if all required vector operations are - present. If any of them is missing it returns SUNFALSE. - ---------------------------------------------------------------*/ -sunbooleantype erkStep_CheckNVector(N_Vector tmpl) -{ - if ((tmpl->ops->nvclone == NULL) || (tmpl->ops->nvdestroy == NULL) || - (tmpl->ops->nvlinearsum == NULL) || (tmpl->ops->nvconst == NULL) || - (tmpl->ops->nvscale == NULL) || (tmpl->ops->nvwrmsnorm == NULL)) - { - return (SUNFALSE); - } - return (SUNTRUE); -} - /*--------------------------------------------------------------- erkStep_SetButcherTable diff --git a/src/arkode/arkode_erkstep_impl.h b/src/arkode/arkode_erkstep_impl.h index 11f5158f0b..91719d9927 100644 --- a/src/arkode/arkode_erkstep_impl.h +++ b/src/arkode/arkode_erkstep_impl.h @@ -101,7 +101,6 @@ int erkStep_AccessARKODEStepMem(void* arkode_mem, const char* fname, ARKodeMem* ark_mem, ARKodeERKStepMem* step_mem); int erkStep_AccessStepMem(ARKodeMem ark_mem, const char* fname, ARKodeERKStepMem* step_mem); -sunbooleantype erkStep_CheckNVector(N_Vector tmpl); int erkStep_SetButcherTable(ARKodeMem ark_mem); int erkStep_CheckButcherTable(ARKodeMem ark_mem); int erkStep_ComputeSolutions(ARKodeMem ark_mem, sunrealtype* dsm); diff --git a/src/arkode/arkode_forcingstep.c b/src/arkode/arkode_forcingstep.c index b257f79798..79d4f7dcdc 100644 --- a/src/arkode/arkode_forcingstep.c +++ b/src/arkode/arkode_forcingstep.c @@ -362,15 +362,6 @@ static void forcingStep_PrintMem(ARKodeMem ark_mem, FILE* outfile) } } -/*------------------------------------------------------------------------------ - This routine checks if all required vector operations are present. If any of - them are missing it returns SUNFALSE. - ----------------------------------------------------------------------------*/ -static sunbooleantype forcingStep_CheckNVector(N_Vector y) -{ - return y->ops->nvlinearsum != NULL; -} - /*------------------------------------------------------------------------------ This routine checks if all required SUNStepper operations are present. If any of them are missing it return SUNFALSE. @@ -423,14 +414,6 @@ static int forcingStep_CheckArgs(ARKodeMem ark_mem, SUNStepper stepper1, return ARK_ILL_INPUT; } - /* Test if all required vector operations are implemented */ - if (!forcingStep_CheckNVector(y0)) - { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - MSG_ARK_BAD_NVECTOR); - return ARK_ILL_INPUT; - } - return ARK_SUCCESS; } diff --git a/src/arkode/arkode_impl.h b/src/arkode/arkode_impl.h index bb9f9623e9..294073b4ed 100644 --- a/src/arkode/arkode_impl.h +++ b/src/arkode/arkode_impl.h @@ -621,6 +621,7 @@ void arkFreeVecArray(int count, N_Vector** v, sunindextype lrw1, long int* lrw, void arkFreeVectors(ARKodeMem ark_mem); sunbooleantype arkCheckTimestepper(ARKodeMem ark_mem); sunbooleantype arkCheckNvector(N_Vector tmpl); +sunbooleantype arkCheckNvector2(ARKodeMem ark_mem); int arkInitialSetup(ARKodeMem ark_mem, sunrealtype tout); int arkStopTests(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, diff --git a/src/arkode/arkode_io.c b/src/arkode/arkode_io.c index 2230f5b289..9f3e2dad19 100644 --- a/src/arkode/arkode_io.c +++ b/src/arkode/arkode_io.c @@ -1252,7 +1252,7 @@ int ARKodeSetFixedStep(void* arkode_mem, sunrealtype hfixed) based on the sign of stepdir. If 0, the direction will remain unchanged. Note that if a fixed step size was previously set, this function can change the sign of that. - + This should only be called after ARKodeReset, or between creating a stepper and ARKodeEvolve. ---------------------------------------------------------------*/ @@ -1499,7 +1499,7 @@ int ARKodeSetConstraints(void* arkode_mem, N_Vector constraints) /* Test if required vector ops. are defined */ if (constraints->ops->nvdiv == NULL || constraints->ops->nvmaxnorm == NULL || - constraints->ops->nvcompare == NULL || + constraints->ops->nvcompare == NULL || constraints->ops->nvprod == NULL || constraints->ops->nvconstrmask == NULL || constraints->ops->nvminquotient == NULL) { diff --git a/src/arkode/arkode_ls.c b/src/arkode/arkode_ls.c index e3ae45c59c..fb4ac6dd7d 100644 --- a/src/arkode/arkode_ls.c +++ b/src/arkode/arkode_ls.c @@ -114,7 +114,8 @@ int ARKodeSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) /* Check for compatible LS type, matrix and "atimes" support */ if (iterative) { - if (ark_mem->tempv1->ops->nvgetlength == NULL) + if ((ark_mem->tempv1->ops->nvgetlength == NULL) || + (ark_mem->tempv1->ops->nvdotprod == NULL)) { arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_LS_BAD_NVECTOR); diff --git a/src/arkode/arkode_lsrkstep.c b/src/arkode/arkode_lsrkstep.c index ffbd5b21e6..65ad07ff28 100644 --- a/src/arkode/arkode_lsrkstep.c +++ b/src/arkode/arkode_lsrkstep.c @@ -147,15 +147,6 @@ void* lsrkStep_Create_Commons(ARKRhsFn rhs, sunrealtype t0, N_Vector y0, return NULL; } - /* Test if all required vector operations are implemented */ - nvectorOK = lsrkStep_CheckNVector(y0); - if (!nvectorOK) - { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - MSG_ARK_BAD_NVECTOR); - return NULL; - } - /* Create ark_mem structure and set default values */ ark_mem = arkCreate(sunctx); if (ark_mem == NULL) @@ -2168,24 +2159,6 @@ int lsrkStep_AccessStepMem(ARKodeMem ark_mem, const char* fname, return ARK_SUCCESS; } -/*--------------------------------------------------------------- - lsrkStep_CheckNVector: - - This routine checks if all required vector operations are - present. If any of them is missing it returns SUNFALSE. - ---------------------------------------------------------------*/ -sunbooleantype lsrkStep_CheckNVector(N_Vector tmpl) -{ - if ((tmpl->ops->nvclone == NULL) || (tmpl->ops->nvdestroy == NULL) || - (tmpl->ops->nvlinearsum == NULL) || (tmpl->ops->nvconst == NULL) || - (tmpl->ops->nvscale == NULL) || (tmpl->ops->nvwrmsnorm == NULL) || - (tmpl->ops->nvspace == NULL)) - { - return SUNFALSE; - } - return SUNTRUE; -} - /*--------------------------------------------------------------- lsrkStep_DomEigUpdateLogic: diff --git a/src/arkode/arkode_lsrkstep_impl.h b/src/arkode/arkode_lsrkstep_impl.h index 9b51b92963..05066acbb0 100644 --- a/src/arkode/arkode_lsrkstep_impl.h +++ b/src/arkode/arkode_lsrkstep_impl.h @@ -200,7 +200,6 @@ int lsrkStep_AccessARKODEStepMem(void* arkode_mem, const char* fname, ARKodeMem* ark_mem, ARKodeLSRKStepMem* step_mem); int lsrkStep_AccessStepMem(ARKodeMem ark_mem, const char* fname, ARKodeLSRKStepMem* step_mem); -sunbooleantype lsrkStep_CheckNVector(N_Vector tmpl); void lsrkStep_DomEigUpdateLogic(ARKodeMem ark_mem, ARKodeLSRKStepMem step_mem, sunrealtype dsm); int lsrkStep_ComputeNewDomEig(ARKodeMem ark_mem, ARKodeLSRKStepMem step_mem); diff --git a/src/arkode/arkode_mristep.c b/src/arkode/arkode_mristep.c index fdf708a173..7f5e852b66 100644 --- a/src/arkode/arkode_mristep.c +++ b/src/arkode/arkode_mristep.c @@ -74,15 +74,6 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, return (NULL); } - /* Test if all required vector operations are implemented */ - nvectorOK = mriStep_CheckNVector(y0); - if (!nvectorOK) - { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - MSG_ARK_BAD_NVECTOR); - return (NULL); - } - /* Create ark_mem structure and set default values */ ark_mem = arkCreate(sunctx); if (ark_mem == NULL) @@ -3102,23 +3093,6 @@ int mriStep_AccessStepMem(ARKodeMem ark_mem, const char* fname, return (ARK_SUCCESS); } -/*--------------------------------------------------------------- - mriStep_CheckNVector: - - This routine checks if all required vector operations are - present. If any of them is missing it returns SUNFALSE. - ---------------------------------------------------------------*/ -sunbooleantype mriStep_CheckNVector(N_Vector tmpl) -{ - if ((tmpl->ops->nvclone == NULL) || (tmpl->ops->nvdestroy == NULL) || - (tmpl->ops->nvlinearsum == NULL) || (tmpl->ops->nvconst == NULL) || - (tmpl->ops->nvscale == NULL) || (tmpl->ops->nvwrmsnorm == NULL)) - { - return (SUNFALSE); - } - return (SUNTRUE); -} - /*--------------------------------------------------------------- mriStep_SetCoupling diff --git a/src/arkode/arkode_mristep_impl.h b/src/arkode/arkode_mristep_impl.h index 367d82c9c6..1a4eabb7b9 100644 --- a/src/arkode/arkode_mristep_impl.h +++ b/src/arkode/arkode_mristep_impl.h @@ -276,7 +276,6 @@ int mriStep_AccessARKODEStepMem(void* arkode_mem, const char* fname, ARKodeMem* ark_mem, ARKodeMRIStepMem* step_mem); int mriStep_AccessStepMem(ARKodeMem ark_mem, const char* fname, ARKodeMRIStepMem* step_mem); -sunbooleantype mriStep_CheckNVector(N_Vector tmpl); int mriStep_SetCoupling(ARKodeMem ark_mem); int mriStep_CheckCoupling(ARKodeMem ark_mem); int mriStep_StageERKFast(ARKodeMem ark_mem, ARKodeMRIStepMem step_mem, diff --git a/src/arkode/arkode_relaxation.c b/src/arkode/arkode_relaxation.c index 0d94b343d2..b0b8583a36 100644 --- a/src/arkode/arkode_relaxation.c +++ b/src/arkode/arkode_relaxation.c @@ -417,6 +417,14 @@ int ARKodeSetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac) } ark_mem = (ARKodeMem)arkode_mem; + /* Ensure that the current N_Vector supports N_VDotProd */ + if (ark_mem->tempv1->ops->nvdotprod == NULL) + { + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "N_VDotProd unimplemented (required for relaxation)"); + return (ARK_ILL_INPUT); + } + /* Call stepper-specific routine (if it exists) */ if (ark_mem->step_setrelaxfn) { diff --git a/src/arkode/arkode_splittingstep.c b/src/arkode/arkode_splittingstep.c index 049ad2836d..455ac8bc1f 100644 --- a/src/arkode/arkode_splittingstep.c +++ b/src/arkode/arkode_splittingstep.c @@ -462,15 +462,6 @@ static int splittingStep_SetDefaults(ARKodeMem ark_mem) return splittingStep_SetOrder(ark_mem, 0); } -/*------------------------------------------------------------------------------ - This routine checks if all required vector operations are present. If any of - them is missing it returns SUNFALSE. - ----------------------------------------------------------------------------*/ -static sunbooleantype splittingStep_CheckNVector(N_Vector y) -{ - return y->ops->nvlinearsum != NULL && y->ops->nvscale != NULL; -} - /*------------------------------------------------------------------------------ This routine checks if all required SUNStepper operations are present. If any of them are missing it return SUNFALSE. @@ -528,14 +519,6 @@ static int splittingStep_CheckArgs(ARKodeMem ark_mem, SUNStepper* steppers, return ARK_ILL_INPUT; } - /* Test if all required vector operations are implemented */ - if (!splittingStep_CheckNVector(y0)) - { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - MSG_ARK_BAD_NVECTOR); - return ARK_ILL_INPUT; - } - return ARK_SUCCESS; } diff --git a/src/arkode/arkode_sprkstep.c b/src/arkode/arkode_sprkstep.c index ae544d9c7b..e72ef17750 100644 --- a/src/arkode/arkode_sprkstep.c +++ b/src/arkode/arkode_sprkstep.c @@ -71,15 +71,6 @@ void* SPRKStepCreate(ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, N_Vector y0, return (NULL); } - /* Test if all required vector operations are implemented */ - nvectorOK = sprkStep_CheckNVector(y0); - if (!nvectorOK) - { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - MSG_ARK_BAD_NVECTOR); - return (NULL); - } - /* Create ark_mem structure and set default values */ ark_mem = arkCreate(sunctx); if (ark_mem == NULL) @@ -826,23 +817,6 @@ int sprkStep_AccessStepMem(ARKodeMem ark_mem, const char* fname, return (ARK_SUCCESS); } -/*--------------------------------------------------------------- - sprkStep_CheckNVector: - - This routine checks if all required vector operations are - present. If any of them is missing it returns SUNFALSE. - ---------------------------------------------------------------*/ -sunbooleantype sprkStep_CheckNVector(N_Vector tmpl) -{ - if ((tmpl->ops->nvclone == NULL) || (tmpl->ops->nvdestroy == NULL) || - (tmpl->ops->nvlinearsum == NULL) || (tmpl->ops->nvconst == NULL) || - (tmpl->ops->nvscale == NULL) || (tmpl->ops->nvwrmsnorm == NULL)) - { - return (SUNFALSE); - } - return (SUNTRUE); -} - /*=============================================================== EOF ===============================================================*/ diff --git a/src/arkode/arkode_sprkstep_impl.h b/src/arkode/arkode_sprkstep_impl.h index 543adc5ef5..130f4e86c2 100644 --- a/src/arkode/arkode_sprkstep_impl.h +++ b/src/arkode/arkode_sprkstep_impl.h @@ -91,7 +91,6 @@ int sprkStep_AccessARKODEStepMem(void* arkode_mem, const char* fname, ARKodeMem* ark_mem, ARKodeSPRKStepMem* step_mem); int sprkStep_AccessStepMem(ARKodeMem ark_mem, const char* fname, ARKodeSPRKStepMem* step_mem); -sunbooleantype sprkStep_CheckNVector(N_Vector tmpl); /* f1 = p' (Force evaluation) */ int sprkStep_f1(ARKodeSPRKStepMem step_mem, sunrealtype tcur, N_Vector ycur, From b7e15afa6fbc05788860b4f95e74d9ea4ba1db56 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Fri, 17 Jan 2025 15:03:24 -0600 Subject: [PATCH 2/9] Removed unused variable --- src/arkode/arkode_arkstep.c | 1 - src/arkode/arkode_erkstep.c | 1 - src/arkode/arkode_lsrkstep.c | 1 - src/arkode/arkode_mristep.c | 1 - src/arkode/arkode_sprkstep.c | 1 - 5 files changed, 5 deletions(-) diff --git a/src/arkode/arkode_arkstep.c b/src/arkode/arkode_arkstep.c index ff8625b9ef..01d994177b 100644 --- a/src/arkode/arkode_arkstep.c +++ b/src/arkode/arkode_arkstep.c @@ -40,7 +40,6 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, ARKodeMem ark_mem; ARKodeARKStepMem step_mem; SUNNonlinearSolver NLS; - sunbooleantype nvectorOK; int retval; /* Check that at least one of fe, fi is supplied and is to be used */ diff --git a/src/arkode/arkode_erkstep.c b/src/arkode/arkode_erkstep.c index 278f775524..5a833d6057 100644 --- a/src/arkode/arkode_erkstep.c +++ b/src/arkode/arkode_erkstep.c @@ -34,7 +34,6 @@ void* ERKStepCreate(ARKRhsFn f, sunrealtype t0, N_Vector y0, SUNContext sunctx) { ARKodeMem ark_mem; ARKodeERKStepMem step_mem; - sunbooleantype nvectorOK; int retval; /* Check that f is supplied */ diff --git a/src/arkode/arkode_lsrkstep.c b/src/arkode/arkode_lsrkstep.c index 65ad07ff28..d43b831e70 100644 --- a/src/arkode/arkode_lsrkstep.c +++ b/src/arkode/arkode_lsrkstep.c @@ -121,7 +121,6 @@ void* lsrkStep_Create_Commons(ARKRhsFn rhs, sunrealtype t0, N_Vector y0, { ARKodeMem ark_mem; ARKodeLSRKStepMem step_mem; - sunbooleantype nvectorOK; int retval; /* Check that rhs is supplied */ diff --git a/src/arkode/arkode_mristep.c b/src/arkode/arkode_mristep.c index 7f5e852b66..71d60f80f5 100644 --- a/src/arkode/arkode_mristep.c +++ b/src/arkode/arkode_mristep.c @@ -39,7 +39,6 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, ARKodeMem ark_mem; /* outer ARKODE memory */ ARKodeMRIStepMem step_mem; /* outer stepper memory */ SUNNonlinearSolver NLS; /* default nonlin solver */ - sunbooleantype nvectorOK; int retval; /* Check that at least one of fse, fsi is supplied and is to be used*/ diff --git a/src/arkode/arkode_sprkstep.c b/src/arkode/arkode_sprkstep.c index e72ef17750..a3aabb7465 100644 --- a/src/arkode/arkode_sprkstep.c +++ b/src/arkode/arkode_sprkstep.c @@ -38,7 +38,6 @@ void* SPRKStepCreate(ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, N_Vector y0, { ARKodeMem ark_mem = NULL; ARKodeSPRKStepMem step_mem = NULL; - sunbooleantype nvectorOK = 0; int retval = 0; /* Check that f1 and f2 are supplied */ From 56dd7b1f19f86d68806c4c5a5c75a42bc392f41d Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Fri, 17 Jan 2025 15:08:00 -0600 Subject: [PATCH 3/9] Formatting --- src/arkode/arkode.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index 8b518f8d68..8e0fe86f27 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -280,7 +280,6 @@ int ARKodeSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol) return (SUNFALSE); } - /* Set flag indicating whether abstol == 0 */ ark_mem->atolmin0 = (abstol == ZERO); @@ -1887,10 +1886,10 @@ sunbooleantype arkCheckNvector(N_Vector tmpl) ---------------------------------------------------------------*/ sunbooleantype arkCheckNvector2(ARKodeMem ark_mem) { - /* If using a built-in routine for error/residual weights with abstol==0, ensure that N_VMin is available */ - if ((!ark_mem->user_efun) && (ark_mem->atolmin0) && (!ark_mem->tempv1->ops->nvmin)) + if ((!ark_mem->user_efun) && (ark_mem->atolmin0) && + (!ark_mem->tempv1->ops->nvmin)) { arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "N_VMin unimplemented (required by error-weight function)"); @@ -1906,16 +1905,18 @@ sunbooleantype arkCheckNvector2(ARKodeMem ark_mem) /* If the user has not specified a step size (and it will be estimated internally), ensure that N_VDiv and N_VMaxNorm are available */ - if ((ark_mem->h0u == ZERO) && (ark_mem->hin == ZERO) && (!ark_mem->tempv1->ops->nvdiv)) + if ((ark_mem->h0u == ZERO) && (ark_mem->hin == ZERO) && + (!ark_mem->tempv1->ops->nvdiv)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "N_VDiv unimplemented (required for initial step estimation)"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "N_VDiv unimplemented (required for initial step estimation)"); return (SUNFALSE); } - if ((ark_mem->h0u == ZERO) && (ark_mem->hin == ZERO) && (!ark_mem->tempv1->ops->nvmaxnorm)) + if ((ark_mem->h0u == ZERO) && (ark_mem->hin == ZERO) && + (!ark_mem->tempv1->ops->nvmaxnorm)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "N_VMaxNorm unimplemented (required for initial step estimation)"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "N_VMaxNorm unimplemented (required for initial step estimation)"); return (SUNFALSE); } From 7da77f2a9b08c229c2782f3be64341a1c34c69b0 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Mon, 20 Jan 2025 10:21:52 -0600 Subject: [PATCH 4/9] Revised N_Vector operation checks following PR review comments --- src/arkode/arkode.c | 40 ++++++++++++++++++++++++++++++++-------- src/arkode/arkode_impl.h | 4 ++-- src/arkode/arkode_ls.c | 21 +++++++++++++++++++-- 3 files changed, 53 insertions(+), 12 deletions(-) diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index 8e0fe86f27..9946395877 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -277,7 +277,7 @@ int ARKodeSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol) { arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "N_VAddConst unimplemented (required for scalar abstol)"); - return (SUNFALSE); + return (ARK_ILL_INPUT); } /* Set flag indicating whether abstol == 0 */ @@ -454,6 +454,14 @@ int ARKodeResStolerance(void* arkode_mem, sunrealtype rabstol) return (ARK_ILL_INPUT); } + /* Ensure that vector supports N_VAddConst */ + if (!ark_mem->tempv1->ops->nvaddconst) + { + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "N_VAddConst unimplemented (required for scalar rabstol)"); + return (ARK_ILL_INPUT); + } + /* Set flag indicating whether rabstol == 0 */ ark_mem->Ratolmin0 = (rabstol == ZERO); @@ -1740,7 +1748,7 @@ int arkInit(ARKodeMem ark_mem, sunrealtype t0, N_Vector y0, int init_type) } /* Test if all required vector operations are implemented */ - nvectorOK = arkCheckNvector(y0); + nvectorOK = arkCheckNvectorRequired(y0); if (!nvectorOK) { arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, @@ -1857,19 +1865,19 @@ sunbooleantype arkCheckTimestepper(ARKodeMem ark_mem) } /*--------------------------------------------------------------- - arkCheckNvector: + arkCheckNvectorRequired: This routine checks if all absolutely-required vector operations are present. If any of them is missing it returns SUNFALSE. ---------------------------------------------------------------*/ -sunbooleantype arkCheckNvector(N_Vector tmpl) +sunbooleantype arkCheckNvectorRequired(N_Vector tmpl) { if ((tmpl->ops->nvclone == NULL) || (tmpl->ops->nvdestroy == NULL) || (tmpl->ops->nvlinearsum == NULL) || (tmpl->ops->nvconst == NULL) || (tmpl->ops->nvdiv == NULL) || (tmpl->ops->nvscale == NULL) || (tmpl->ops->nvabs == NULL) || (tmpl->ops->nvinv == NULL) || - (tmpl->ops->nvmaxnorm == NULL) || (tmpl->ops->nvwrmsnorm == NULL)) + (tmpl->ops->nvwrmsnorm == NULL)) { return (SUNFALSE); } @@ -1877,14 +1885,14 @@ sunbooleantype arkCheckNvector(N_Vector tmpl) } /*--------------------------------------------------------------- - arkCheckNvector2: + arkCheckNvectorOptional: This routine perform conditional checks on required vector operations are present (i.e., if the current ARKODE configuration requires additional N_Vector routines). If any of them is missing it returns SUNFALSE. ---------------------------------------------------------------*/ -sunbooleantype arkCheckNvector2(ARKodeMem ark_mem) +sunbooleantype arkCheckNvectorOptional(ARKodeMem ark_mem) { /* If using a built-in routine for error/residual weights with abstol==0, ensure that N_VMin is available */ @@ -1920,6 +1928,22 @@ sunbooleantype arkCheckNvector2(ARKodeMem ark_mem) return (SUNFALSE); } + /* If using a scalar-valued absolute tolerance (for either the state or + residual), then ensure that N_VAddConst is available */ + if ((ark_mem->itol == ARK_SS) && (!ark_mem->tempv1->ops->nvaddconst)) + { + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "N_VAddConst unimplemented (required for scalar abstol)"); + return (SUNFALSE); + } + if ( (!ark_mem->rwt_is_ewt) && (ark_mem->ritol == ARK_SS) && + (!ark_mem->tempv1->ops->nvaddconst)) + { + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "N_VAddConst unimplemented (required for scalar rabstol)"); + return (SUNFALSE); + } + /* If we made it here, then the vector is sufficient */ return (SUNTRUE); } @@ -1954,7 +1978,7 @@ int arkInitialSetup(ARKodeMem ark_mem, sunrealtype tout) /* Perform additional N_Vector checks here, now that ARKODE has been fully configured by the user */ - if (!arkCheckNvector2(ark_mem)) + if (!arkCheckNvectorOptional(ark_mem)) { arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_ARK_BAD_NVECTOR); diff --git a/src/arkode/arkode_impl.h b/src/arkode/arkode_impl.h index 294073b4ed..143bfd7822 100644 --- a/src/arkode/arkode_impl.h +++ b/src/arkode/arkode_impl.h @@ -620,8 +620,8 @@ void arkFreeVecArray(int count, N_Vector** v, sunindextype lrw1, long int* lrw, sunindextype liw1, long int* liw); void arkFreeVectors(ARKodeMem ark_mem); sunbooleantype arkCheckTimestepper(ARKodeMem ark_mem); -sunbooleantype arkCheckNvector(N_Vector tmpl); -sunbooleantype arkCheckNvector2(ARKodeMem ark_mem); +sunbooleantype arkCheckNvectorRequired(N_Vector tmpl); +sunbooleantype arkCheckNvectorOptional(ARKodeMem ark_mem); int arkInitialSetup(ARKodeMem ark_mem, sunrealtype tout); int arkStopTests(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, diff --git a/src/arkode/arkode_ls.c b/src/arkode/arkode_ls.c index fb4ac6dd7d..d456d53423 100644 --- a/src/arkode/arkode_ls.c +++ b/src/arkode/arkode_ls.c @@ -114,8 +114,7 @@ int ARKodeSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) /* Check for compatible LS type, matrix and "atimes" support */ if (iterative) { - if ((ark_mem->tempv1->ops->nvgetlength == NULL) || - (ark_mem->tempv1->ops->nvdotprod == NULL)) + if (ark_mem->tempv1->ops->nvgetlength == NULL) { arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, MSG_LS_BAD_NVECTOR); @@ -725,6 +724,15 @@ int ARKodeSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac) } else if (nrmfac < ZERO) { + + /* Ensure that vector support N_VDotProd */ + if (ark_mem->tempv1->ops->nvdotprod == NULL) + { + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, + "N_VDotProd unimplemented (required for ARKodeSetLSNormFactor)"); + return (ARKLS_ILL_INPUT); + } + /* compute factor for WRMS norm with dot product */ N_VConst(ONE, ark_mem->tempv1); arkls_mem->nrmfac = SUNRsqrt(N_VDotProd(ark_mem->tempv1, ark_mem->tempv1)); @@ -1677,6 +1685,15 @@ int ARKodeSetMassLSNormFactor(void* arkode_mem, sunrealtype nrmfac) } else if (nrmfac < ZERO) { + + /* Ensure that vector support N_VDotProd */ + if (ark_mem->tempv1->ops->nvdotprod == NULL) + { + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, + "N_VDotProd unimplemented (required for ARKodeSetMassLSNormFactor)"); + return (ARKLS_ILL_INPUT); + } + /* compute factor for WRMS norm with dot product */ N_VConst(ONE, ark_mem->tempv1); arkls_mem->nrmfac = SUNRsqrt(N_VDotProd(ark_mem->tempv1, ark_mem->tempv1)); From 433ff9e93835e444c195f409729a38581d5d62e4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Mon, 20 Jan 2025 10:30:34 -0600 Subject: [PATCH 5/9] Formatting --- src/arkode/arkode.c | 12 ++++++------ src/arkode/arkode_ls.c | 10 ++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index 9946395877..ca84b43152 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -1932,15 +1932,15 @@ sunbooleantype arkCheckNvectorOptional(ARKodeMem ark_mem) residual), then ensure that N_VAddConst is available */ if ((ark_mem->itol == ARK_SS) && (!ark_mem->tempv1->ops->nvaddconst)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "N_VAddConst unimplemented (required for scalar abstol)"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "N_VAddConst unimplemented (required for scalar abstol)"); return (SUNFALSE); } - if ( (!ark_mem->rwt_is_ewt) && (ark_mem->ritol == ARK_SS) && - (!ark_mem->tempv1->ops->nvaddconst)) + if ((!ark_mem->rwt_is_ewt) && (ark_mem->ritol == ARK_SS) && + (!ark_mem->tempv1->ops->nvaddconst)) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "N_VAddConst unimplemented (required for scalar rabstol)"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "N_VAddConst unimplemented (required for scalar rabstol)"); return (SUNFALSE); } diff --git a/src/arkode/arkode_ls.c b/src/arkode/arkode_ls.c index d456d53423..0000f5b2e8 100644 --- a/src/arkode/arkode_ls.c +++ b/src/arkode/arkode_ls.c @@ -724,12 +724,11 @@ int ARKodeSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac) } else if (nrmfac < ZERO) { - /* Ensure that vector support N_VDotProd */ if (ark_mem->tempv1->ops->nvdotprod == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, - "N_VDotProd unimplemented (required for ARKodeSetLSNormFactor)"); + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, + __FILE__, "N_VDotProd unimplemented (required for ARKodeSetLSNormFactor)"); return (ARKLS_ILL_INPUT); } @@ -1685,12 +1684,11 @@ int ARKodeSetMassLSNormFactor(void* arkode_mem, sunrealtype nrmfac) } else if (nrmfac < ZERO) { - /* Ensure that vector support N_VDotProd */ if (ark_mem->tempv1->ops->nvdotprod == NULL) { - arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, - "N_VDotProd unimplemented (required for ARKodeSetMassLSNormFactor)"); + arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, + __FILE__, "N_VDotProd unimplemented (required for ARKodeSetMassLSNormFactor)"); return (ARKLS_ILL_INPUT); } From 6b58d3e564fc1bb80054e8a3c5d62f9d448166dc Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Tue, 21 Jan 2025 08:05:33 -0600 Subject: [PATCH 6/9] Added check for nvclone --- src/arkode/arkode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index ca84b43152..e6e5057c4c 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -3397,6 +3397,9 @@ int arkCheckTemporalError(ARKodeMem ark_mem, int* nflagPtr, int* nefPtr, ---------------------------------------------------------------*/ sunbooleantype arkAllocVec(ARKodeMem ark_mem, N_Vector tmpl, N_Vector* v) { + /* return failure if N_VClone is not implemented */ + if (!ark_mem->tempv1->ops->nvclone) { return SUNFALSE; } + /* allocate the new vector if necessary */ if (*v == NULL) { From e89979663ef8b3ba5a0ceac1e6dd17ecfb37f0e5 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Tue, 21 Jan 2025 08:16:35 -0600 Subject: [PATCH 7/9] Fixed check to use tmpl vector --- src/arkode/arkode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index e6e5057c4c..a5fe2c4773 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -3398,7 +3398,7 @@ int arkCheckTemporalError(ARKodeMem ark_mem, int* nflagPtr, int* nefPtr, sunbooleantype arkAllocVec(ARKodeMem ark_mem, N_Vector tmpl, N_Vector* v) { /* return failure if N_VClone is not implemented */ - if (!ark_mem->tempv1->ops->nvclone) { return SUNFALSE; } + if (!tmpl->ops->nvclone) { return SUNFALSE; } /* allocate the new vector if necessary */ if (*v == NULL) From 0f2fda33da3280d9690c0b6c597047c61f4c42f5 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Tue, 21 Jan 2025 16:47:55 -0600 Subject: [PATCH 8/9] Added nvdestroy check --- src/arkode/arkode.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index a5fe2c4773..76066727e1 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -3397,8 +3397,11 @@ int arkCheckTemporalError(ARKodeMem ark_mem, int* nflagPtr, int* nefPtr, ---------------------------------------------------------------*/ sunbooleantype arkAllocVec(ARKodeMem ark_mem, N_Vector tmpl, N_Vector* v) { - /* return failure if N_VClone is not implemented */ - if (!tmpl->ops->nvclone) { return SUNFALSE; } + /* return failure if N_VClone or N_VDestroy is not implemented */ + if ((!tmpl->ops->nvclone) || (!tmpl->ops->nvdestroy)) + { + return SUNFALSE; + } /* allocate the new vector if necessary */ if (*v == NULL) From ca91c62802e4e6db264e36b624097a81ded74ef3 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Tue, 21 Jan 2025 16:55:25 -0600 Subject: [PATCH 9/9] Formatting --- src/arkode/arkode.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index 76066727e1..9c47423c57 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -3398,10 +3398,7 @@ int arkCheckTemporalError(ARKodeMem ark_mem, int* nflagPtr, int* nefPtr, sunbooleantype arkAllocVec(ARKodeMem ark_mem, N_Vector tmpl, N_Vector* v) { /* return failure if N_VClone or N_VDestroy is not implemented */ - if ((!tmpl->ops->nvclone) || (!tmpl->ops->nvdestroy)) - { - return SUNFALSE; - } + if ((!tmpl->ops->nvclone) || (!tmpl->ops->nvdestroy)) { return SUNFALSE; } /* allocate the new vector if necessary */ if (*v == NULL)