aboutsummaryrefslogtreecommitdiff
path: root/src/Output3D.c
diff options
context:
space:
mode:
authortradke <tradke@94b1c47f-dcfd-45ef-a468-0854c0e9e350>2002-04-15 13:07:16 +0000
committertradke <tradke@94b1c47f-dcfd-45ef-a468-0854c0e9e350>2002-04-15 13:07:16 +0000
commit8c87ce629147b4040461ed28048fb15ca1f4a2c4 (patch)
treeb51c883c8449c2e60f9ff66f5962ca1400e6fc36 /src/Output3D.c
parent88a045f23bf33bbe1e309f046b81508260ea723a (diff)
Switch to the new Hyperslab API. You need to update CactusPUGH/PUGHSlab if
you haven't done so yet. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOASCII/trunk@105 94b1c47f-dcfd-45ef-a468-0854c0e9e350
Diffstat (limited to 'src/Output3D.c')
-rw-r--r--src/Output3D.c81
1 files changed, 34 insertions, 47 deletions
diff --git a/src/Output3D.c b/src/Output3D.c
index 7bd3b55..78d8354 100644
--- a/src/Output3D.c
+++ b/src/Output3D.c
@@ -67,20 +67,13 @@ int IOASCII_Output3DGH (const cGH *GH)
CheckSteerableParameters (myGH);
- /* Return if no output is required */
- if (myGH->out3D_every <= 0)
- {
- return (0);
- }
-
/* Loop over all variables */
for (vindex = retval = 0; vindex < CCTK_NumVars (); vindex++)
{
-
/* Check if this variable should be output */
if (! IOASCII_TimeFor3D (GH, vindex))
{
- continue;
+ continue;
}
/* Get the variable name for this index (for filename) */
@@ -205,14 +198,9 @@ int IOASCII_TimeFor3D (const cGH *GH, int vindex)
CheckSteerableParameters (myGH);
- /* return if no output requested */
- if (myGH->out3D_every <= 0)
- {
- return (0);
- }
-
/* Check if this variable should be output */
- if (myGH->do_out3D[vindex] && (GH->cctk_iteration % myGH->out3D_every == 0))
+ if (myGH->out3D_every[vindex] > 0 &&
+ GH->cctk_iteration % myGH->out3D_every[vindex] == 0)
{
/* Check if variable wasn't already output this iteration */
if (myGH->out3D_last[vindex] == GH->cctk_iteration)
@@ -294,29 +282,22 @@ int IOASCII_TriggerOutput3D (const cGH *GH, int vindex)
/* check if steerable parameters have changed */
static void CheckSteerableParameters (asciiioGH *myGH)
{
- int i, out_old, times_set, num_vars;
+ int i, num_vars;
char *fullname, *msg;
- static int out3D_vars_lastset = -1;
DECLARE_CCTK_PARAMETERS
- out_old = myGH->out3D_every;
-
/* How often to output */
- myGH->out3D_every = out_every > 0 ? out_every : -1;
- if (out3D_every > 0)
- {
- myGH->out3D_every = out3D_every;
- }
+ i = myGH->out3D_every_default;
+ myGH->out3D_every_default = out3D_every > 0 ? out3D_every : out_every;
/* Report if frequency changed */
-
- if (myGH->out3D_every != out_old && ! CCTK_Equals (newverbose, "none"))
+ if (myGH->out3D_every_default != i && ! CCTK_Equals (newverbose, "none"))
{
- if (myGH->out3D_every > 0)
+ if (myGH->out3D_every_default > 0)
{
CCTK_VInfo (CCTK_THORNSTRING, "IOASCII_3D: Periodic output every %d "
- "iterations", myGH->out3D_every);
+ "iterations", myGH->out3D_every_default);
}
else
{
@@ -325,21 +306,18 @@ static void CheckSteerableParameters (asciiioGH *myGH)
}
/* re-parse the 'out3D_vars' parameter if it was changed */
- times_set = CCTK_ParameterQueryTimesSet ("out3D_vars", CCTK_THORNSTRING);
- if (times_set != out3D_vars_lastset)
+ if (strcmp (out3D_vars, myGH->out3D_vars) || myGH->out3D_every_default != i)
{
num_vars = CCTK_NumVars ();
- memset (myGH->do_out3D, 0, num_vars);
- CCTK_TraverseString (out3D_vars, SetOutputFlag, myGH->do_out3D,
- CCTK_GROUP_OR_VAR);
+ memset (myGH->out3D_every, 0, num_vars * sizeof (int));
+ CCTK_TraverseString (out3D_vars, SetOutputFlag, myGH, CCTK_GROUP_OR_VAR);
- if (CCTK_Equals (newverbose, "standard") ||
- CCTK_Equals (newverbose, "full"))
+ if (myGH->out3D_every_default == i || ! CCTK_Equals (newverbose, "none"))
{
msg = NULL;
for (i = 0; i < num_vars; i++)
{
- if (myGH->do_out3D[i])
+ if (myGH->out3D_every[i] > 0)
{
fullname = CCTK_FullName (i);
if (! msg)
@@ -362,9 +340,9 @@ static void CheckSteerableParameters (asciiioGH *myGH)
}
/* Save the last setting of 'out3D_vars' parameter */
- out3D_vars_lastset = times_set;
+ free (myGH->out3D_vars);
+ myGH->out3D_vars = strdup (out3D_vars);
}
-
}
@@ -407,18 +385,27 @@ static int CheckOutputVar (int vindex)
for the given variable */
static void SetOutputFlag (int vindex, const char *optstring, void *arg)
{
- char *flags = (char *) arg;
+ char *endptr;
+ asciiioGH *myGH = (asciiioGH *) arg;
- /* Check the variable type */
if (CheckOutputVar (vindex) == 0)
{
- flags[vindex] = 1;
- }
-
- if (optstring)
- {
- CCTK_VWarn (5, __LINE__, __FILE__, CCTK_THORNSTRING,
- "Optional string '%s' in variable name ignored", optstring);
+ myGH->out3D_every[vindex] = myGH->out3D_every_default;
+ if (optstring)
+ {
+ endptr = "error";
+ if (strncmp ("out_every=", optstring, 10) == 0)
+ {
+ myGH->out3D_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->out3D_every[vindex] = 0;
+ }
+ }
}
}