aboutsummaryrefslogtreecommitdiff
path: root/src/Output1D.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Output1D.c')
-rw-r--r--src/Output1D.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/Output1D.c b/src/Output1D.c
index 8bcdd3d..b0e73c5 100644
--- a/src/Output1D.c
+++ b/src/Output1D.c
@@ -14,6 +14,7 @@
#include "cctk.h"
#include "cctk_Parameters.h"
#include "util_String.h"
+#include "CactusBase/IOUtil/src/ioutil_Utils.h"
#include "ioASCIIGH.h"
/* the rcs ID and its dummy function to use it */
@@ -117,7 +118,7 @@ int IOASCII_Output1DVarAs (const cGH *GH, const char *fullname, const char *alia
retval = -1;
vindex = CCTK_VarIndex (fullname);
- if (CheckOutputVar (vindex) == 0)
+ if (CheckOutputVar (vindex))
{
retval = IOASCII_Write1D (GH, vindex, alias);
}
@@ -258,7 +259,7 @@ static void CheckSteerableParameters (asciiioGH *myGH)
if (strcmp (out1D_vars, myGH->out1D_vars) || myGH->out1D_every_default != i)
{
num_vars = CCTK_NumVars ();
- memset (myGH->out1D_every, 0, num_vars * sizeof (int));
+ memset (myGH->out1D_every, 0, num_vars * sizeof (CCTK_INT));
CCTK_TraverseString (out1D_vars, SetOutputFlag, myGH, CCTK_GROUP_OR_VAR);
if (myGH->out1D_every_default == i || ! CCTK_Equals (verbose, "none"))
@@ -305,8 +306,8 @@ static int CheckOutputVar (int vindex)
/* check the variable type */
grouptype = CCTK_GroupTypeFromVarI (vindex);
- retval = grouptype != CCTK_GF && grouptype != CCTK_ARRAY;
- if (retval)
+ retval = grouptype == CCTK_GF || grouptype == CCTK_ARRAY;
+ if (! retval)
{
fullname = CCTK_FullName (vindex);
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
@@ -323,27 +324,18 @@ static int CheckOutputVar (int vindex)
for the given variable */
static void SetOutputFlag (int vindex, const char *optstring, void *arg)
{
- char *endptr;
- asciiioGH *myGH = (asciiioGH *) arg;
+ const asciiioGH *myGH = (const asciiioGH *) arg;
- if (CheckOutputVar (vindex) == 0)
+ if (CheckOutputVar (vindex))
{
myGH->out1D_every[vindex] = myGH->out1D_every_default;
+
if (optstring)
{
- endptr = "error";
- if (strncmp ("out_every=", optstring, 10) == 0)
- {
- myGH->out1D_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->out1D_every[vindex] = 0;
- }
+ IOUtil_ParseOutputFrequency ("1D IOASCII", "IOASCII::out1D_vars",
+ vindex, optstring,
+ &myGH->out1D_every[vindex]);
}
}
}