tPass pulse shape value as string - cngf-pf - continuum model for granular flows with pore-pressure dynamics (renamed from 1d_fd_simple_shear)
(HTM) git clone git://src.adamsgaard.dk/cngf-pf
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 934c2a555efeceff702659449db4c68ed2bf9b23
(DIR) parent f2663e1123ac994ca9f60a747addf5559786f887
(HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Wed, 18 Sep 2019 16:54:01 +0200
Pass pulse shape value as string
Diffstat:
M main.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/main.c b/main.c
t@@ -69,7 +69,7 @@ usage(void)
" -u, --fluid-pressure-pulse-time VAL fluid pressure pulse peak time [s]\n"
" (default %g)\n"
" -S, --fluid-pressure-pulse-shape VAL\n"
- " 0: triangular (default), 1: square\n"
+ " where VAL is triangular (default) or square\n"
" -t, --time VAL simulation start time [s] (default %g)\n"
" -T, --time-end VAL simulation end time [s] (default %g)\n"
" -I, --file-interval VAL interval between output files [s] (default %g)\n"
t@@ -283,7 +283,16 @@ main(int argc, char* argv[])
sim.p_f_mod_pulse_time = atof(optarg);
break;
case 'S':
- sim.p_f_mod_pulse_shape = atoi(optarg);
+ if (strcmp(optarg, "triangle") == 0)
+ sim.p_f_mod_pulse_shape = 0;
+ else if (strcmp(optarg, "square") == 0)
+ sim.p_f_mod_pulse_shape = 1;
+ else {
+ fprintf(stderr, "error: invalid pulse shape '%s'\n",
+ optarg);
+ return 1;
+ }
+ printf("pulse shape: %d\n", sim.p_f_mod_pulse_shape);
break;
case 't':
sim.t = atof(optarg);