Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command-line control over scalar-valued set routines #662

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
2e4a100
Initial implementation of command-line control over ARKODE inputs
drreynolds Feb 6, 2025
4ee0ced
Added const qualifier
drreynolds Feb 6, 2025
7fe32c7
Apply suggestions from code review
drreynolds Feb 25, 2025
567d885
Additional updates based on PR feedback
drreynolds Feb 25, 2025
834be77
Added const for char* argv[] to subsidiary functions
drreynolds Feb 25, 2025
843b240
Converted separate arrays to arrays of structs
drreynolds Feb 26, 2025
81da918
Removed const decorator from argv inputs to ARKodeSetFromCommandLine,…
drreynolds Feb 26, 2025
ccb3a0d
Updated swig interfaces
drreynolds Feb 26, 2025
3ff1574
Updated handling of errors when setting command-line arguments
drreynolds Feb 26, 2025
5697de0
Updated ARKodeSetFromCommandLine to include an input 'arkid' that sho…
drreynolds Feb 26, 2025
229c013
Updated swig interfaces
drreynolds Feb 26, 2025
6d55e2d
Updated comment
drreynolds Feb 26, 2025
f88f66b
Updated formatting
drreynolds Feb 26, 2025
9a552b9
Updated type for 'offset' to size_t to avoid conversion warnings/errors
drreynolds Feb 26, 2025
62fecac
Apply suggestions from code review to automatically determine the num…
drreynolds Feb 27, 2025
3eece32
Moved command-line input control to a separate file
drreynolds Feb 27, 2025
17000e9
Updated handling of arkid input according to Steven's suggestion
drreynolds Feb 27, 2025
cbdaf2d
Updated includes now that cli interface is separated into a new file
drreynolds Feb 27, 2025
44abb69
Added support for a new writeparameters command-line option, that wil…
drreynolds Feb 27, 2025
d65c219
Added function pointer for stepper-specific setfromcommandline functi…
drreynolds Feb 27, 2025
60e3287
Added placeholder for ARKStep command-line processing (needs to be fi…
drreynolds Feb 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion examples/arkode/C_serial/ark_analytic.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static int check_ans(N_Vector y, sunrealtype t, sunrealtype rtol,
sunrealtype atol);

/* Main Program */
int main(void)
int main(int argc, char* argv[])
{
/* general problem parameters */
sunrealtype T0 = SUN_RCONST(0.0); /* initial time */
Expand Down Expand Up @@ -130,6 +130,10 @@ int main(void)
flag = ARKodeSetLinear(arkode_mem, 0);
if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; }

/* Override any current settings with command-line options */
flag = ARKodeSetFromCommandLine(arkode_mem, "", argc, argv);
if (check_flag(&flag, "ARKodeSetFromCommandLine", 1)) { return 1; }

/* Open output stream for results, output comment line */
UFID = fopen("solution.txt", "w");
fprintf(UFID, "# t u\n");
Expand Down
4 changes: 4 additions & 0 deletions include/arkode/arkode.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ typedef enum
* Shared API routines
* -------------------------- */

/* Command-line control over ARKODE options */
SUNDIALS_EXPORT int ARKodeSetFromCommandLine(void* arkode_mem, const char* arkid,
int argc, char* argv[]);

/* Resize and Reset functions */
SUNDIALS_EXPORT int ARKodeResize(void* arkode_mem, N_Vector ynew,
sunrealtype hscale, sunrealtype t0,
Expand Down
1 change: 1 addition & 0 deletions src/arkode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ set(arkode_SOURCES
arkode_butcher_dirk.c
arkode_butcher_erk.c
arkode_butcher.c
arkode_cli.c
arkode_erkstep_io.c
arkode_erkstep.c
arkode_forcingstep.c
Expand Down
1 change: 1 addition & 0 deletions src/arkode/arkode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1545,6 +1545,7 @@ ARKodeMem arkCreate(SUNContext sunctx)
ark_mem->step_setstagepredictfn = NULL;
ark_mem->step_getnumrhsevals = NULL;
ark_mem->step_setstepdirection = NULL;
ark_mem->step_setfromcommandline = NULL;
ark_mem->step_getnumlinsolvsetups = NULL;
ark_mem->step_setadaptcontroller = NULL;
ark_mem->step_getestlocalerrors = NULL;
Expand Down
13 changes: 13 additions & 0 deletions src/arkode/arkode_arkstep_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,19 @@ int ARKStepGetTimestepperStats(void* arkode_mem, long int* expsteps,
Private functions attached to ARKODE
===============================================================*/

/*---------------------------------------------------------------
arkStep_SetFromCommandLine:

Provides command-line control over ARKStep-specific "set" routines.
---------------------------------------------------------------*/
int arkStep_SetFromCommandLine(ARKodeMem ark_mem, int* i, char* argv[],
const size_t offset, sunbooleantype* arg_used)
{

return (ARK_SUCCESS);
}


/*---------------------------------------------------------------
arkStep_SetRelaxFn:

Expand Down
Loading
Loading