Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven-Roberts committed May 16, 2024
1 parent ba9074c commit d3f5235
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 40 deletions.
4 changes: 4 additions & 0 deletions include/sundials/sundials_adaptcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ struct _generic_SUNAdaptController
SUNDIALS_EXPORT
SUNAdaptController SUNAdaptController_NewEmpty(SUNContext sunctx);

/* Function to free a generic SUNAdaptController (assumes content is already empty) */
SUNDIALS_EXPORT
void SUNAdaptController_DestroyEmpty(SUNAdaptController C);

/* Function to report the type of a SUNAdaptController object. */
SUNDIALS_EXPORT
SUNAdaptController_Type SUNAdaptController_GetType(SUNAdaptController C);
Expand Down
72 changes: 36 additions & 36 deletions src/arkode/arkode_sprk.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "arkode/arkode_butcher.h"
#include "arkode_impl.h"

static ARKodeSPRKTable ARKodeSymplecticEuler(void)
static ARKodeSPRKTable arkodeSymplecticEuler(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(1);
if (!sprk_table) { return NULL; }
Expand All @@ -43,7 +43,7 @@ static ARKodeSPRKTable ARKodeSymplecticEuler(void)
https://doi.org/10.1016/0021-9991(91)90299-Z.
*/

static ARKodeSPRKTable ARKodeSymplecticLeapfrog2(void)
static ARKodeSPRKTable arkodeSymplecticLeapfrog2(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(2);
if (!sprk_table) { return NULL; }
Expand All @@ -56,7 +56,7 @@ static ARKodeSPRKTable ARKodeSymplecticLeapfrog2(void)
return sprk_table;
}

static ARKodeSPRKTable ARKodeSymplecticPseudoLeapfrog2(void)
static ARKodeSPRKTable arkodeSymplecticPseudoLeapfrog2(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(2);
if (!sprk_table) { return NULL; }
Expand All @@ -69,7 +69,7 @@ static ARKodeSPRKTable ARKodeSymplecticPseudoLeapfrog2(void)
return sprk_table;
}

static ARKodeSPRKTable ARKodeSymplecticCandyRozmus4(void)
static ARKodeSPRKTable arkodeSymplecticCandyRozmus4(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(4);
if (!sprk_table) { return NULL; }
Expand Down Expand Up @@ -108,7 +108,7 @@ static ARKodeSPRKTable ARKodeSymplecticCandyRozmus4(void)
https://accelconf.web.cern.ch/p83/PDF/PAC1983_2669.PDF
*/

static ARKodeSPRKTable ARKodeSymplecticRuth3(void)
static ARKodeSPRKTable arkodeSymplecticRuth3(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(3);
if (!sprk_table) { return NULL; }
Expand All @@ -130,7 +130,7 @@ static ARKodeSPRKTable ARKodeSymplecticRuth3(void)
Nonlinearity. 5, 541–562 (1992). https://doi.org/10.1088/0951-7715/5/2/011
*/

static ARKodeSPRKTable ARKodeSymplecticMcLachlan2(void)
static ARKodeSPRKTable arkodeSymplecticMcLachlan2(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(2);
if (!sprk_table) { return NULL; }
Expand All @@ -145,7 +145,7 @@ static ARKodeSPRKTable ARKodeSymplecticMcLachlan2(void)
return sprk_table;
}

static ARKodeSPRKTable ARKodeSymplecticMcLachlan3(void)
static ARKodeSPRKTable arkodeSymplecticMcLachlan3(void)
{
sunrealtype w = 0.0;
sunrealtype y = 0.0;
Expand Down Expand Up @@ -174,7 +174,7 @@ static ARKodeSPRKTable ARKodeSymplecticMcLachlan3(void)
return sprk_table;
}

static ARKodeSPRKTable ARKodeSymplecticMcLachlan4(void)
static ARKodeSPRKTable arkodeSymplecticMcLachlan4(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(4);
if (!sprk_table) { return NULL; }
Expand All @@ -191,7 +191,7 @@ static ARKodeSPRKTable ARKodeSymplecticMcLachlan4(void)
return sprk_table;
}

static ARKodeSPRKTable ARKodeSymplecticMcLachlan5(void)
static ARKodeSPRKTable arkodeSymplecticMcLachlan5(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(6);
if (!sprk_table) { return NULL; }
Expand Down Expand Up @@ -221,7 +221,7 @@ static ARKodeSPRKTable ARKodeSymplecticMcLachlan5(void)
*/

static ARKodeSPRKTable ARKodeSymplecticYoshida6(void)
static ARKodeSPRKTable arkodeSymplecticYoshida6(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(8);
if (!sprk_table) { return NULL; }
Expand Down Expand Up @@ -260,7 +260,7 @@ static ARKodeSPRKTable ARKodeSymplecticYoshida6(void)
*/

static ARKodeSPRKTable ARKodeSymplecticSuzukiUmeno816(void)
static ARKodeSPRKTable arkodeSymplecticSuzukiUmeno816(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(16);
if (!sprk_table) { return NULL; }
Expand Down Expand Up @@ -310,7 +310,7 @@ static ARKodeSPRKTable ARKodeSymplecticSuzukiUmeno816(void)
*/

static ARKodeSPRKTable ARKodeSymplecticSofroniou10(void)
static ARKodeSPRKTable arkodeSymplecticSofroniou10(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(36);
if (!sprk_table) { return NULL; }
Expand Down Expand Up @@ -452,19 +452,19 @@ ARKodeSPRKTable ARKodeSPRKTable_Load(ARKODE_SPRKMethodID id)
{
switch (id)
{
case ARKODE_SPRK_EULER_1_1: return ARKodeSymplecticEuler();
case ARKODE_SPRK_LEAPFROG_2_2: return ARKodeSymplecticLeapfrog2();
case ARKODE_SPRK_EULER_1_1: return arkodeSymplecticEuler();
case ARKODE_SPRK_LEAPFROG_2_2: return arkodeSymplecticLeapfrog2();
case ARKODE_SPRK_PSEUDO_LEAPFROG_2_2:
return ARKodeSymplecticPseudoLeapfrog2();
case ARKODE_SPRK_RUTH_3_3: return ARKodeSymplecticRuth3();
case ARKODE_SPRK_MCLACHLAN_2_2: return ARKodeSymplecticMcLachlan2();
case ARKODE_SPRK_MCLACHLAN_3_3: return ARKodeSymplecticMcLachlan3();
case ARKODE_SPRK_MCLACHLAN_4_4: return ARKodeSymplecticMcLachlan4();
case ARKODE_SPRK_CANDY_ROZMUS_4_4: return ARKodeSymplecticCandyRozmus4();
case ARKODE_SPRK_MCLACHLAN_5_6: return ARKodeSymplecticMcLachlan5();
case ARKODE_SPRK_YOSHIDA_6_8: return ARKodeSymplecticYoshida6();
case ARKODE_SPRK_SUZUKI_UMENO_8_16: return ARKodeSymplecticSuzukiUmeno816();
case ARKODE_SPRK_SOFRONIOU_10_36: return ARKodeSymplecticSofroniou10();
return arkodeSymplecticPseudoLeapfrog2();
case ARKODE_SPRK_RUTH_3_3: return arkodeSymplecticRuth3();
case ARKODE_SPRK_MCLACHLAN_2_2: return arkodeSymplecticMcLachlan2();
case ARKODE_SPRK_MCLACHLAN_3_3: return arkodeSymplecticMcLachlan3();
case ARKODE_SPRK_MCLACHLAN_4_4: return arkodeSymplecticMcLachlan4();
case ARKODE_SPRK_CANDY_ROZMUS_4_4: return arkodeSymplecticCandyRozmus4();
case ARKODE_SPRK_MCLACHLAN_5_6: return arkodeSymplecticMcLachlan5();
case ARKODE_SPRK_YOSHIDA_6_8: return arkodeSymplecticYoshida6();
case ARKODE_SPRK_SUZUKI_UMENO_8_16: return arkodeSymplecticSuzukiUmeno816();
case ARKODE_SPRK_SOFRONIOU_10_36: return arkodeSymplecticSofroniou10();
default: return NULL;
}
}
Expand All @@ -473,51 +473,51 @@ ARKodeSPRKTable ARKodeSPRKTable_LoadByName(const char* method)
{
if (!strcmp(method, "ARKODE_SPRK_EULER_1_1"))
{
return ARKodeSymplecticEuler();
return arkodeSymplecticEuler();
}
if (!strcmp(method, "ARKODE_SPRK_LEAPFROG_2_2"))
{
return ARKodeSymplecticLeapfrog2();
return arkodeSymplecticLeapfrog2();
}
if (!strcmp(method, "ARKODE_SPRK_PSEUDO_LEAPFROG_2_2"))
{
return ARKodeSymplecticPseudoLeapfrog2();
return arkodeSymplecticPseudoLeapfrog2();
}
if (!strcmp(method, "ARKODE_SPRK_RUTH_3_3"))
{
return ARKodeSymplecticRuth3();
return arkodeSymplecticRuth3();
}
if (!strcmp(method, "ARKODE_SPRK_MCLACHLAN_2_2"))
{
return ARKodeSymplecticMcLachlan2();
return arkodeSymplecticMcLachlan2();
}
if (!strcmp(method, "ARKODE_SPRK_MCLACHLAN_3_3"))
{
return ARKodeSymplecticMcLachlan3();
return arkodeSymplecticMcLachlan3();
}
if (!strcmp(method, "ARKODE_SPRK_MCLACHLAN_4_4"))
{
return ARKodeSymplecticMcLachlan4();
return arkodeSymplecticMcLachlan4();
}
if (!strcmp(method, "ARKODE_SPRK_CANDY_ROZMUS_4_4"))
{
return ARKodeSymplecticCandyRozmus4();
return arkodeSymplecticCandyRozmus4();
}
if (!strcmp(method, "ARKODE_SPRK_MCLACHLAN_5_6"))
{
return ARKodeSymplecticMcLachlan5();
return arkodeSymplecticMcLachlan5();
}
if (!strcmp(method, "ARKODE_SPRK_YOSHIDA_6_8"))
{
return ARKodeSymplecticYoshida6();
return arkodeSymplecticYoshida6();
}
if (!strcmp(method, "ARKODE_SPRK_SUZUKI_UMENO_8_16"))
{
return ARKodeSymplecticSuzukiUmeno816();
return arkodeSymplecticSuzukiUmeno816();
}
if (!strcmp(method, "ARKODE_SPRK_SOFRONIOU_10_36"))
{
return ARKodeSymplecticSofroniou10();
return arkodeSymplecticSofroniou10();
}
return NULL;
}
Expand Down
4 changes: 0 additions & 4 deletions src/nvector/manyvector/nvector_manyvector.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,10 +595,6 @@ MPI_Comm N_VGetCommunicator_MPIManyVector(N_Vector v)
{
return (MANYVECTOR_COMM(v));
}
#else
/* This function retrieves the MPI Communicator from a ManyVector object. */
//TODO: is this needed?
//SUNComm N_VGetCommunicator_ManyVector(N_Vector v) { return SUN_COMM_NULL; }
#endif

/* This function retrieves the global length of a ManyVector object. */
Expand Down
17 changes: 17 additions & 0 deletions src/sundials/sundials_adaptcontroller.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,23 @@ SUNAdaptController SUNAdaptController_NewEmpty(SUNContext sunctx)
return (C);
}

/* -----------------------------------------------------------------
* Free a generic SUNAdaptController (assumes content is already empty)
* ----------------------------------------------------------------- */

void SUNAdaptController_DestroyEmpty(SUNAdaptController C)
{
if (C == NULL) { return; }

/* free non-NULL ops structure */
if (C->ops) { free(C->ops); }
C->ops = NULL;

/* free overall SUNAdaptController object and return */
free(C);
return;
}

/* -----------------------------------------------------------------
* Required functions in the 'ops' structure for non-NULL controller
* ----------------------------------------------------------------- */
Expand Down

0 comments on commit d3f5235

Please sign in to comment.