diff options
author | tradke <tradke@94b1c47f-dcfd-45ef-a468-0854c0e9e350> | 2002-05-06 09:11:42 +0000 |
---|---|---|
committer | tradke <tradke@94b1c47f-dcfd-45ef-a468-0854c0e9e350> | 2002-05-06 09:11:42 +0000 |
commit | 84df6a1831d14dcd7a80b7c65758919a78732df0 (patch) | |
tree | b66b71102d27bfaf0b90d5dd5918292041b092d0 /src | |
parent | 76d4e575a9901080e16d0558e9d65f7a1ec8fe22 (diff) |
Parameter names changes as announced in today's mail to users@cactuscode.org.
You must also update thorn IOUtil now.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOASCII/trunk@113 94b1c47f-dcfd-45ef-a468-0854c0e9e350
Diffstat (limited to 'src')
-rw-r--r-- | src/ChooseOutput.c | 29 | ||||
-rw-r--r-- | src/Output1D.c | 36 | ||||
-rw-r--r-- | src/Output2D.c | 44 | ||||
-rw-r--r-- | src/Output3D.c | 44 | ||||
-rw-r--r-- | src/Startup.c | 24 | ||||
-rw-r--r-- | src/Write1D.c | 24 | ||||
-rw-r--r-- | src/Write2D.c | 8 | ||||
-rw-r--r-- | src/Write3D.c | 4 | ||||
-rw-r--r-- | src/ioASCIIGH.h | 2 |
9 files changed, 75 insertions, 140 deletions
diff --git a/src/ChooseOutput.c b/src/ChooseOutput.c index 55fb071..42ad065 100644 --- a/src/ChooseOutput.c +++ b/src/ChooseOutput.c @@ -31,25 +31,10 @@ CCTK_FILEVERSION(CactusBase_IOASCII_ChooseOutput_c) 3. Coords from IOASCII 4. Coords from IOUtil */ -#define GET_SLICE(IOASCII_param, IOUtil_param, origin_index, origin_phys) \ +#define GET_SLICE(IOASCII_param, IOUtil_param, index, coord) \ { \ - origin_index = -1; \ - if (CCTK_ParameterQueryTimesSet (#IOASCII_param "i", "IOASCII") > 0)\ - { \ - origin_index = IOASCII_param##i; \ - } \ - else if (CCTK_ParameterQueryTimesSet (#IOUtil_param "i", "IOUtil")>0)\ - { \ - origin_index = IOUtil_param##i; \ - } \ - else if (CCTK_ParameterQueryTimesSet (#IOASCII_param, "IOASCII") > 0)\ - { \ - origin_phys = IOASCII_param; \ - } \ - else \ - { \ - origin_phys = IOUtil_param; \ - } \ + index = IOASCII_param##i >= 0 ? IOASCII_param##i : IOUtil_param##i; \ + coord = IOASCII_param != -424242 ? IOASCII_param : IOUtil_param; \ } @@ -68,11 +53,10 @@ void IOASCII_Choose2D (const cGH *GH); Use parameters to choose the 1D slices through the output data. @enddesc - @calls CCTK_ParameterQueryTimesSet - IOUtil_1DLines + @calls IOUtil_1DLines @var GH - @vdesc Pointer to CCTK grid hierarchy + @vdesc pointer to CCTK grid hierarchy @vtype const cGH * @vio in @endvar @@ -135,8 +119,7 @@ void IOASCII_Choose1D (const cGH *GH) Use parameters to choose the 2D slices through the output data. @enddesc - @calls CCTK_ParameterQueryTimesSet - IOUtil_2DPlanes + @calls IOUtil_2DPlanes @var GH @vdesc Pointer to CCTK grid hierarchy diff --git a/src/Output1D.c b/src/Output1D.c index 5b1a297..8bcdd3d 100644 --- a/src/Output1D.c +++ b/src/Output1D.c @@ -54,22 +54,17 @@ static void SetOutputFlag (int vindex, const char *optstring, void *arg); int IOASCII_Output1DGH (const cGH *GH) { int vindex, retval; - asciiioGH *myGH; + const asciiioGH *myGH; - myGH = (asciiioGH *) CCTK_GHExtension (GH, "IOASCII"); + retval = 0; + myGH = (const asciiioGH *) CCTK_GHExtension (GH, "IOASCII"); /* loop over all variables */ - for (vindex = retval = 0; vindex < CCTK_NumVars (); vindex++) + for (vindex = CCTK_NumVars () - 1; vindex >= 0; vindex--) { - /* check if this variable should be output */ - if (! IOASCII_TimeFor1D (GH, vindex)) - { - continue; - } - - /* do the output */ - if (IOASCII_Write1D (GH, vindex, CCTK_VarName (vindex)) == 0) + if (IOASCII_TimeFor1D (GH, vindex) && + IOASCII_Write1D (GH, vindex, CCTK_VarName (vindex)) == 0) { /* register variable as having 1D output this iteration */ myGH->out1D_last[vindex] = GH->cctk_iteration; @@ -160,19 +155,17 @@ int IOASCII_Output1DVarAs (const cGH *GH, const char *fullname, const char *alia int IOASCII_TimeFor1D (const cGH *GH, int vindex) { int retval; - asciiioGH *myGH; char *fullname; + asciiioGH *myGH; - /* default is not do any output */ - retval = 0; - myGH = (asciiioGH *) CCTK_GHExtension (GH, "IOASCII"); CheckSteerableParameters (myGH); /* check if this variable should be output */ - if (myGH->out1D_every[vindex] > 0 && - GH->cctk_iteration % myGH->out1D_every[vindex] == 0) + retval = myGH->out1D_every[vindex] > 0 && + GH->cctk_iteration % myGH->out1D_every[vindex] == 0; + if (retval) { /* check if this variable wasn't already output this iteration */ if (myGH->out1D_last[vindex] == GH->cctk_iteration) @@ -182,10 +175,7 @@ int IOASCII_TimeFor1D (const cGH *GH, int vindex) "Already done IOASCII 1D output for '%s' in current " "iteration (probably via triggers)", fullname); free (fullname); - } - else - { - retval = 1; + retval = 0; } } @@ -251,7 +241,7 @@ static void CheckSteerableParameters (asciiioGH *myGH) myGH->out1D_every_default = out1D_every >= 0 ? out1D_every : out_every; /* report if frequency changed */ - if (myGH->out1D_every_default != i && ! CCTK_Equals (newverbose, "none")) + if (myGH->out1D_every_default != i && ! CCTK_Equals (verbose, "none")) { if (myGH->out1D_every_default > 0) { @@ -271,7 +261,7 @@ static void CheckSteerableParameters (asciiioGH *myGH) memset (myGH->out1D_every, 0, num_vars * sizeof (int)); CCTK_TraverseString (out1D_vars, SetOutputFlag, myGH, CCTK_GROUP_OR_VAR); - if (myGH->out1D_every_default == i || ! CCTK_Equals (newverbose, "none")) + if (myGH->out1D_every_default == i || ! CCTK_Equals (verbose, "none")) { msg = NULL; for (i = 0; i < num_vars; i++) diff --git a/src/Output2D.c b/src/Output2D.c index f62a635..80788a7 100644 --- a/src/Output2D.c +++ b/src/Output2D.c @@ -40,7 +40,7 @@ static void SetOutputFlag (int vindex, const char *optstring, void *arg); IOASCII_Write2D @var GH - @vdesc Pointer to CCTK GH + @vdesc pointer to CCTK GH @vtype const cGH * @vio in @endvar @@ -54,22 +54,17 @@ static void SetOutputFlag (int vindex, const char *optstring, void *arg); int IOASCII_Output2DGH (const cGH *GH) { int vindex, retval; - asciiioGH *myGH; + const asciiioGH *myGH; - myGH = (asciiioGH *) CCTK_GHExtension (GH, "IOASCII"); + retval = 0; + myGH = (const asciiioGH *) CCTK_GHExtension (GH, "IOASCII"); /* loop over all variables */ - for (vindex = retval = 0; vindex < CCTK_NumVars (); vindex++) + for (vindex = CCTK_NumVars () - 1; vindex >= 0; vindex--) { - /* check if this variable should be output */ - if (! IOASCII_TimeFor2D (GH, vindex)) - { - continue; - } - - /* do the output */ - if (IOASCII_Write2D (GH, vindex, CCTK_VarName (vindex)) == 0) + if (IOASCII_TimeFor2D (GH, vindex) && + IOASCII_Write2D (GH, vindex, CCTK_VarName (vindex)) == 0) { /* register variable as having 2D output this iteration */ myGH->out2D_last[vindex] = GH->cctk_iteration; @@ -92,7 +87,7 @@ int IOASCII_Output2DGH (const cGH *GH) @calls IOASCII_Write2D @var GH - @vdesc Pointer to CCTK GH + @vdesc pointer to CCTK GH @vtype const cGH * @vio in @endvar @@ -140,7 +135,7 @@ int IOASCII_Output2DVarAs (const cGH *GH, const char *fullname, const char *alia @enddesc @var GH - @vdesc Pointer to CCTK GH + @vdesc pointer to CCTK GH @vtype const cGH * @vio in @endvar @@ -159,19 +154,17 @@ int IOASCII_Output2DVarAs (const cGH *GH, const char *fullname, const char *alia int IOASCII_TimeFor2D (const cGH *GH, int vindex) { int retval; - asciiioGH *myGH; char *fullname; + asciiioGH *myGH; - /* default is not do any output */ - retval = 0; - myGH = (asciiioGH *) CCTK_GHExtension (GH, "IOASCII"); CheckSteerableParameters (myGH); /* check if this variable should be output */ - if (myGH->out2D_every[vindex] > 0 && - GH->cctk_iteration % myGH->out2D_every[vindex] == 0) + retval = myGH->out2D_every[vindex] > 0 && + GH->cctk_iteration % myGH->out2D_every[vindex] == 0; + if (retval) { /* check if variable wasn't already output this iteration */ if (myGH->out2D_last[vindex] == GH->cctk_iteration) @@ -181,10 +174,7 @@ int IOASCII_TimeFor2D (const cGH *GH, int vindex) "Already done IOASCII 2D output for '%s' in current " "iteration (probably via triggers)", fullname); free (fullname); - } - else - { - retval = 1; + retval = 0; } } @@ -203,7 +193,7 @@ int IOASCII_TimeFor2D (const cGH *GH, int vindex) @calls IOASCII_Write2D @var GH - @vdesc Pointer to CCTK GH + @vdesc pointer to CCTK GH @vtype const cGH * @vio in @endvar @@ -251,7 +241,7 @@ static void CheckSteerableParameters (asciiioGH *myGH) myGH->out2D_every_default = out2D_every >= 0 ? out2D_every : out_every; /* report if frequency changed */ - if (myGH->out2D_every_default != i && ! CCTK_Equals (newverbose, "none")) + if (myGH->out2D_every_default != i && ! CCTK_Equals (verbose, "none")) { if (myGH->out2D_every_default > 0) { @@ -271,7 +261,7 @@ static void CheckSteerableParameters (asciiioGH *myGH) memset (myGH->out2D_every, 0, num_vars * sizeof (int)); CCTK_TraverseString (out2D_vars, SetOutputFlag, myGH, CCTK_GROUP_OR_VAR); - if (myGH->out2D_every_default == i || ! CCTK_Equals (newverbose, "none")) + if (myGH->out2D_every_default == i || ! CCTK_Equals (verbose, "none")) { msg = NULL; for (i = 0; i < num_vars; i++) diff --git a/src/Output3D.c b/src/Output3D.c index c2f8dc4..4cf537f 100644 --- a/src/Output3D.c +++ b/src/Output3D.c @@ -40,7 +40,7 @@ static void SetOutputFlag (int vindex, const char *optstring, void *arg); IOASCII_Write3D @var GH - @vdesc Pointer to CCTK GH + @vdesc pointer to CCTK GH @vtype const cGH * @vio in @endvar @@ -54,22 +54,17 @@ static void SetOutputFlag (int vindex, const char *optstring, void *arg); int IOASCII_Output3DGH (const cGH *GH) { int vindex, retval; - asciiioGH *myGH; + const asciiioGH *myGH; - myGH = (asciiioGH *) CCTK_GHExtension (GH, "IOASCII"); + retval = 0; + myGH = (const asciiioGH *) CCTK_GHExtension (GH, "IOASCII"); /* loop over all variables */ - for (vindex = retval = 0; vindex < CCTK_NumVars (); vindex++) + for (vindex = CCTK_NumVars () - 1; vindex >= 0; vindex--) { - /* check if this variable should be output */ - if (! IOASCII_TimeFor3D (GH, vindex)) - { - continue; - } - - /* do the output */ - if (IOASCII_Write3D (GH, vindex, CCTK_VarName (vindex)) == 0) + if (IOASCII_TimeFor3D (GH, vindex) && + IOASCII_Write3D (GH, vindex, CCTK_VarName (vindex)) == 0) { /* register variable as having 3D output this iteration */ myGH->out3D_last[vindex] = GH->cctk_iteration; @@ -92,7 +87,7 @@ int IOASCII_Output3DGH (const cGH *GH) @calls IOASCII_Write3D @var GH - @vdesc Pointer to CCTK GH + @vdesc pointer to CCTK GH @vtype const cGH * @vio in @endvar @@ -141,7 +136,7 @@ int IOASCII_Output3DVarAs (const cGH *GH, const char *fullname, const char *alia @enddesc @var GH - @vdesc Pointer to CCTK GH + @vdesc pointer to CCTK GH @vtype const cGH * @vio in @endvar @@ -160,19 +155,17 @@ int IOASCII_Output3DVarAs (const cGH *GH, const char *fullname, const char *alia int IOASCII_TimeFor3D (const cGH *GH, int vindex) { int retval; - asciiioGH *myGH; char *fullname; + asciiioGH *myGH; - /* default is not do any output */ - retval = 0; - myGH = (asciiioGH *) CCTK_GHExtension (GH, "IOASCII"); CheckSteerableParameters (myGH); /* check if this variable should be output */ - if (myGH->out3D_every[vindex] > 0 && - GH->cctk_iteration % myGH->out3D_every[vindex] == 0) + retval = myGH->out3D_every[vindex] > 0 && + GH->cctk_iteration % myGH->out3D_every[vindex] == 0; + if (retval) { /* check if variable wasn't already output this iteration */ if (myGH->out3D_last[vindex] == GH->cctk_iteration) @@ -182,10 +175,7 @@ int IOASCII_TimeFor3D (const cGH *GH, int vindex) "Already done IOASCII 3D output for '%s' in current " "iteration (probably via triggers)", fullname); free (fullname); - } - else - { - retval = 1; + retval = 0; } } @@ -204,7 +194,7 @@ int IOASCII_TimeFor3D (const cGH *GH, int vindex) @calls IOASCII_Write3D @var GH - @vdesc Pointer to CCTK GH + @vdesc pointer to CCTK GH @vtype const cGH * @vio in @endvar @@ -252,7 +242,7 @@ static void CheckSteerableParameters (asciiioGH *myGH) myGH->out3D_every_default = out3D_every >= 0 ? out3D_every : out_every; /* report if frequency changed */ - if (myGH->out3D_every_default != i && ! CCTK_Equals (newverbose, "none")) + if (myGH->out3D_every_default != i && ! CCTK_Equals (verbose, "none")) { if (myGH->out3D_every_default > 0) { @@ -272,7 +262,7 @@ static void CheckSteerableParameters (asciiioGH *myGH) memset (myGH->out3D_every, 0, num_vars * sizeof (int)); CCTK_TraverseString (out3D_vars, SetOutputFlag, myGH, CCTK_GROUP_OR_VAR); - if (myGH->out3D_every_default == i || ! CCTK_Equals (newverbose, "none")) + if (myGH->out3D_every_default == i || ! CCTK_Equals (verbose, "none")) { msg = NULL; for (i = 0; i < num_vars; i++) diff --git a/src/Startup.c b/src/Startup.c index eb24978..bee548b 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -26,12 +26,12 @@ CCTK_FILEVERSION(CactusBase_IOASCII_Startup_c) /******************************************************************** ******************** Macro Definitions ************************ ********************************************************************/ -#define CREATE_OUTDIR(dir) \ +#define CREATE_OUTDIR(method, dir) \ { \ - /* check whether "dir" was set; if not default to "IO::outdir" */ \ + /* check whether "dir" was set; if not default to "IO::out_dir" */ \ if (*dir == 0) \ { \ - dir = outdir; \ + dir = out_dir; \ } \ \ /* omit the directory name if it's the current working dir */ \ @@ -50,13 +50,13 @@ CCTK_FILEVERSION(CactusBase_IOASCII_Startup_c) if (i < 0) \ { \ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, \ - "IOASCII_SetupGH: Problem creating IOASCII output " \ - "directory '%s'", myGH->dir); \ + "IOASCII_SetupGH: Problem creating %s output " \ + "directory '%s'", method, myGH->dir); \ } \ - else if (i >= 0 && CCTK_Equals (newverbose, "full")) \ + else if (i >= 0 && CCTK_Equals (verbose, "full")) \ { \ - CCTK_VInfo (CCTK_THORNSTRING, "IOASCII_1D: Output to directory " \ - "'%s'", myGH->dir); \ + CCTK_VInfo (CCTK_THORNSTRING, "%s: Output to directory '%s'", \ + method, myGH->dir); \ } \ } @@ -168,7 +168,7 @@ static void *IOASCII_SetupGH (tFleshConfig *config, int conv_level, cGH *GH) CCTK_RegisterIOMethodTimeToOutput (i, IOASCII_TimeFor3D); CCTK_RegisterIOMethodTriggerOutput (i, IOASCII_TriggerOutput3D); - if (! CCTK_Equals (newverbose, "none")) + if (! CCTK_Equals (verbose, "none")) { CCTK_INFO ("I/O Method 'IOASCII_1D' registered"); CCTK_INFO ("IOASCII_1D: Output of 1D lines of grid functions/arrays " @@ -207,9 +207,9 @@ static void *IOASCII_SetupGH (tFleshConfig *config, int conv_level, cGH *GH) myGH->fileList_3D = NULL; /* make sure all output directories exist */ - CREATE_OUTDIR (outdir1D); - CREATE_OUTDIR (outdir2D); - CREATE_OUTDIR (outdir3D); + CREATE_OUTDIR ("IOASCII_1D", out1D_dir); + CREATE_OUTDIR ("IOASCII_2D", out2D_dir); + CREATE_OUTDIR ("IOASCII_3D", out3D_dir); return (myGH); } diff --git a/src/Write1D.c b/src/Write1D.c index 303ea2b..60ab901 100644 --- a/src/Write1D.c +++ b/src/Write1D.c @@ -211,24 +211,6 @@ int IOASCII_Write1D (const cGH *GH, int vindex, const char *alias) } } - /* DEPRICATED IN BETA12 */ - if (CCTK_ParameterQueryTimesSet ("out_style", CCTK_THORNSTRING) > 0) - { - static int user_was_warned = 0; - - - if (! user_was_warned) - { - CCTK_WARN (1, "IOASCII_Write1D: parameter 'IOASCII::out_style' is " - "deprecated in BETA12, please use 'IOASCII::out1D_style' " - "instead"); - user_was_warned = 1; - } - - out1D_style = CCTK_Equals (out_style, "gnuplot") ? - "gnuplot f(x)" : "xgraph"; - } - /* set header format string */ if (CCTK_Equals (out1D_style, "xgraph")) { @@ -505,7 +487,7 @@ static void OpenFile (const cGH *GH, /* 20 extra characters should be enough for '/', the type extension, the file extension, and the trailing '\0' */ - filename = (char *) malloc (strlen (myGH->outdir1D) + strlen (alias) + + filename = (char *) malloc (strlen (myGH->out1D_dir) + strlen (alias) + sizeof (slicename) + 20); for (i = 0; i < num_files; i++) @@ -572,12 +554,12 @@ static void OpenFile (const cGH *GH, sprintf (slicename, "%s%dD_diagonal", type_extension, gdata->dim); } - sprintf (filename, "%s%s_%s%s", myGH->outdir1D, alias, slicename, + sprintf (filename, "%s%s_%s%s", myGH->out1D_dir, alias, slicename, file_extension); } else { - sprintf (filename, "%s%s%s.%s", myGH->outdir1D, alias, type_extension, + sprintf (filename, "%s%s%s.%s", myGH->out1D_dir, alias, type_extension, extensions[dir]); } diff --git a/src/Write2D.c b/src/Write2D.c index a60dc1c..a3f31e2 100644 --- a/src/Write2D.c +++ b/src/Write2D.c @@ -396,7 +396,7 @@ static FILE **OpenFile (const cGH *GH, sprintf (zlabel_fmt_string, " (%%c = %%%s),", out_format); fileset = (FILE **) malloc (3 * sizeof (FILE *)); - filename = (char *) malloc (strlen (myGH->outdir2D) + strlen (alias) + + filename = (char *) malloc (strlen (myGH->out2D_dir) + strlen (alias) + sizeof (slicename) + 20); /* open/create files for each slice */ @@ -415,17 +415,17 @@ static FILE **OpenFile (const cGH *GH, myGH->sp2xyz[dim - 1][dir]); } - sprintf (filename, "%s/%s_%s.asc", myGH->outdir2D, alias, slicename); + sprintf (filename, "%s/%s_%s.asc", myGH->out2D_dir, alias, slicename); } else { if (dim == 2) { - sprintf (filename, "%s%s_2D.gnuplot", myGH->outdir2D, alias); + sprintf (filename, "%s%s_2D.gnuplot", myGH->out2D_dir, alias); } else { - sprintf (filename, "%s%s_2d_%s.gnuplot", myGH->outdir2D, alias, + sprintf (filename, "%s%s_2d_%s.gnuplot", myGH->out2D_dir, alias, extensions[dir]); } } diff --git a/src/Write3D.c b/src/Write3D.c index cc3bf6b..1c1e650 100644 --- a/src/Write3D.c +++ b/src/Write3D.c @@ -341,10 +341,10 @@ static FILE *OpenFile (const cGH *GH, const char *fullname, const char *alias) } file = (FILE **) malloc (sizeof (FILE *)); - filename = (char *) malloc (strlen (myGH->outdir3D) + strlen (alias) + 9); + filename = (char *) malloc (strlen (myGH->out3D_dir) + strlen (alias) + 9); /* open/create the file */ - sprintf (filename, "%s%s_3D.asc", myGH->outdir3D, alias); + sprintf (filename, "%s%s_3D.asc", myGH->out3D_dir, alias); /* if restart from recovery, try to open an existing file ... */ *file = fopen (filename, ioUtilGH->recovered ? "a" : "w"); diff --git a/src/ioASCIIGH.h b/src/ioASCIIGH.h index 6a60458..74bb44f 100644 --- a/src/ioASCIIGH.h +++ b/src/ioASCIIGH.h @@ -29,7 +29,7 @@ typedef struct IOASCIIGH char *out1D_vars, *out2D_vars, *out3D_vars; /* directories in which to output */ - char *outdir1D, *outdir2D, *outdir3D; + char *out1D_dir, *out2D_dir, *out3D_dir; /* the last iteration output for var [i] */ int *out1D_last, *out2D_last, *out3D_last; |