diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Output.c | 22 | ||||
-rw-r--r-- | src/Startup.c | 2 | ||||
-rw-r--r-- | src/ioJpegGH.h | 2 |
3 files changed, 9 insertions, 17 deletions
diff --git a/src/Output.c b/src/Output.c index 1f2c8ff..144a74f 100644 --- a/src/Output.c +++ b/src/Output.c @@ -14,6 +14,7 @@ #include "cctk.h" #include "cctk_Parameters.h" #include "util_String.h" +#include "CactusBase/IOUtil/src/ioutil_Utils.h" #include "ioJpegGH.h" /* the rcs ID and its dummy function to use it */ @@ -262,7 +263,7 @@ static void CheckSteerableParameters (ioJpegGH *myGH) if (strcmp (out_vars, myGH->out_vars) || myGH->out_every_default != i) { num_vars = CCTK_NumVars (); - memset (myGH->out_every, 0, num_vars * sizeof (int)); + memset (myGH->out_every, 0, num_vars * sizeof (CCTK_INT)); CCTK_TraverseString (out_vars, SetOutputFlag, myGH, CCTK_GROUP_OR_VAR); if (myGH->out_every_default == i || ! CCTK_Equals (verbose, "none")) @@ -270,7 +271,7 @@ static void CheckSteerableParameters (ioJpegGH *myGH) msg = NULL; for (i = 0; i < num_vars; i++) { - if (myGH->out_every[i]) + if (myGH->out_every[i] > 0) { fullname = CCTK_FullName (i); if (! msg) @@ -342,27 +343,18 @@ static int CheckOutputVar (int vindex) for the given variable */ static void SetOutputFlag (int vindex, const char *optstring, void *arg) { - char *endptr; const ioJpegGH *myGH = (const ioJpegGH *) arg; if (CheckOutputVar (vindex) == 0) { myGH->out_every[vindex] = myGH->out_every_default; + if (optstring) { - endptr = "error"; - if (strncmp ("out_every=", optstring, 10) == 0) - { - myGH->out_every[vindex] = strtol (optstring + 10, &endptr, 10); - } - if (endptr && *endptr) - { - CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "SetOutputFlag: Optional string '%s' could not be parsed", - optstring); - myGH->out_every[vindex] = 0; - } + IOUtil_ParseOutputFrequency (CCTK_THORNSTRING, "IOJpeg::out_vars", + vindex, optstring, + &myGH->out_every[vindex]); } } } diff --git a/src/Startup.c b/src/Startup.c index 10bbe54..58ea1a4 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -123,7 +123,7 @@ static void *SetupGH (tFleshConfig *config, int conv_level, cGH *GH) } numvars = CCTK_NumVars (); - myGH->out_every = (int *) malloc (numvars * sizeof (int)); + myGH->out_every = (CCTK_INT *) malloc (numvars * sizeof (CCTK_INT)); myGH->out_last = (int *) malloc (numvars * sizeof (int)); for (i = 0; i < numvars; i++) diff --git a/src/ioJpegGH.h b/src/ioJpegGH.h index 41ae67d..94c0f66 100644 --- a/src/ioJpegGH.h +++ b/src/ioJpegGH.h @@ -21,7 +21,7 @@ typedef struct IOJpegGH int out_every_default; /* number of times to output every variable */ - int *out_every; + CCTK_INT *out_every; /* the last iteration output for every variable */ int *out_last; |