aboutsummaryrefslogtreecommitdiff
path: root/src/Output1D.c
diff options
context:
space:
mode:
authortradke <tradke@94b1c47f-dcfd-45ef-a468-0854c0e9e350>2000-11-23 21:39:04 +0000
committertradke <tradke@94b1c47f-dcfd-45ef-a468-0854c0e9e350>2000-11-23 21:39:04 +0000
commit8817019f6d31f718986aed295b2af6ca97e404e7 (patch)
tree298ec1175e7d718fb8bf17c683ae316fd0f280bb /src/Output1D.c
parentc0ae07722d68be265a8d8a8be6583ab78348f95a (diff)
Fixed gcc verbose warnings about missing prototypes and use of variables
named 'index' which hides a global function index(3). Also polished grdocs, added missing version and rcs IDs. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOASCII/trunk@32 94b1c47f-dcfd-45ef-a468-0854c0e9e350
Diffstat (limited to 'src/Output1D.c')
-rw-r--r--src/Output1D.c192
1 files changed, 98 insertions, 94 deletions
diff --git a/src/Output1D.c b/src/Output1D.c
index ace1a38..4bcdcf7 100644
--- a/src/Output1D.c
+++ b/src/Output1D.c
@@ -3,12 +3,11 @@
@date Tue Jan 9 1999
@author Gabrielle Allen
@desc
- Functions to deal with 1D output of GFs
+ Functions to deal with 1D ASCII output of variables
@enddesc
+ @version $Id$
@@*/
-/*#define IO_DEBUG*/
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -17,11 +16,22 @@
#include "cctk_Parameters.h"
#include "ioASCIIGH.h"
-/* function prototypes */
-int IOASCII_TimeFor1D (cGH *GH, int index);
-static int CheckOutputVar (int index);
+/* the rcs ID and its dummy function to use it */
+static char *rcsid = "$Id$";
+CCTK_FILEVERSION(CactusBase_IOASCII_Output1D_c)
+
+/* define this if you want debugging output */
+/*#define IO_DEBUG 1*/
+
+
+/* prototypes of routines defined in this source file */
+int IOASCII_Output1DGH (cGH *GH);
+int IOASCII_Output1DVarAs (cGH *GH, const char *fullname, const char *alias);
+int IOASCII_TimeFor1D (cGH *GH, int vindex);
+int IOASCII_TriggerOutput1D (cGH *GH, int vindex);
+static int CheckOutputVar (int vindex);
static void CheckSteerableParameters (asciiioGH *myGH);
-static void SetOutputFlag (int index, const char *optstring, void *arg);
+static void SetOutputFlag (int vindex, const char *optstring, void *arg);
/*@@
@@ -29,27 +39,26 @@ static void SetOutputFlag (int index, const char *optstring, void *arg);
@date Sat March 6 1999
@author Gabrielle Allen
@desc
- Loops over all variables and outputs them if necessary
+ Loops over all variables and outputs them if necessary
@enddesc
- @calledby CCTK_OutputGH ("IOASCII")
- @history
-
- @endhistory
- @var GH
- @vdesc Pointer to CCTK GH
- @vtype cGH
- @vio in
+ @calls IOASCII_TimeFor1D
+ IOASCII_Write1D
+
+ @var GH
+ @vdesc Pointer to CCTK GH
+ @vtype cGH *
+ @vio in
@endvar
@@*/
int IOASCII_Output1DGH (cGH *GH)
{
- int index;
+ int vindex;
asciiioGH *myGH;
const char *name;
/* Get the GH extensions for IOASCII */
- myGH = (asciiioGH *) GH->extensions [CCTK_GHExtensionHandle ("IOASCII")];
+ myGH = (asciiioGH *) CCTK_GHExtension (GH, "IOASCII");
CheckSteerableParameters (myGH);
@@ -60,31 +69,31 @@ int IOASCII_Output1DGH (cGH *GH)
}
/* Loop over all variables */
- for (index = 0; index < CCTK_NumVars (); index++)
+ for (vindex = 0; vindex < CCTK_NumVars (); vindex++)
{
/* Check if this variable should be output */
- if (! IOASCII_TimeFor1D (GH, index))
+ if (! IOASCII_TimeFor1D (GH, vindex))
{
continue;
}
/* Get the variable name for this index (for filename) */
- name = CCTK_VarName (index);
+ name = CCTK_VarName (vindex);
#ifdef IO_DEBUG
printf ("\nIn IOASCII Output1DGH\n---------------------\n");
- printf (" Index = %d\n", index);
+ printf (" Index = %d\n", vindex);
printf (" Variable = -%s-\n", name);
printf (" On iteration %d\n", GH->cctk_iteration);
- printf (" Last output iteration was = %d\n", myGH->out1D_last [index]);
+ printf (" Last output iteration was = %d\n", myGH->out1D_last[vindex]);
#endif
/* Make the IO call */
- IOASCII_Write1D (GH, index, name);
+ IOASCII_Write1D (GH, vindex, name);
/* Register variable as having 1D output this iteration */
- myGH->out1D_last [index] = GH->cctk_iteration;
+ myGH->out1D_last[vindex] = GH->cctk_iteration;
} /* end of loop over all variables */
@@ -97,45 +106,45 @@ int IOASCII_Output1DGH (cGH *GH)
@date Sat March 6 1999
@author Gabrielle Allen
@desc
- unconditional output of a variable using the IOASCII output method
+ Unconditional output of a variable
+ using the IOASCII output method
@enddesc
- @calledby IOASCII_Output1DGH, CCTK_OutputVarAsByMethod ("IOASCII")
- @var GH
- @vdesc Pointer to CCTK GH
- @vtype cGH
- @vio in
- @vcomment
+ @calls IOASCII_Write1D
+
+ @var GH
+ @vdesc Pointer to CCTK GH
+ @vtype cGH *
+ @vio in
@endvar
- @var fullname
- @vdesc complete name of variable to output
- @vtype const char *
- @vio in
- @vcomment
+ @var fullname
+ @vdesc complete name of variable to output
+ @vtype const char *
+ @vio in
@endvar
- @var alias
- @vdesc alias name of variable to output (used to generate output filename)
- @vtype const char *
- @vio in
- @vcomment
+ @var alias
+ @vdesc alias name of variable to output
+ (used to generate output filename)
+ @vtype const char *
+ @vio in
@endvar
@@*/
int IOASCII_Output1DVarAs (cGH *GH, const char *fullname, const char *alias)
{
- int index;
+ int vindex;
- index = CCTK_VarIndex (fullname);
+ vindex = CCTK_VarIndex (fullname);
#ifdef IO_DEBUG
printf ("\nIn IOASCII Output1DVarAs\n-------------------\n");
printf (" Fullname = -%s-\n", fullname);
printf (" Alias = -%s-\n", alias);
- printf (" Index = %d\n", index);
+ printf (" Index = %d\n", vindex);
#endif
- if (CheckOutputVar (index) == 0)
+ if (CheckOutputVar (vindex) == 0)
{
- IOASCII_Write1D (GH, index, alias);
+ IOASCII_Write1D (GH, vindex, alias);
}
return (0);
@@ -147,27 +156,22 @@ int IOASCII_Output1DVarAs (cGH *GH, const char *fullname, const char *alias)
@date Sat March 6 1999
@author Gabrielle Allen
@desc
- Decides if it is time to output a variable using the IO 1D output
- method
+ Decides if it is time to output a variable
+ using the IO 1D output method
@enddesc
- @calledby IOASCII_Output1DGH
- @history
- @endhistory
- @var GH
- @vdesc Pointer to CCTK GH
- @vtype cGH
- @vio in
- @vcomment
- @endvar
- @var index
- @vdesc index of variable
- @vtype int
- @vio in
- @vcomment
- @endvar
+ @var GH
+ @vdesc Pointer to CCTK GH
+ @vtype cGH *
+ @vio in
+ @endvar
+ @var vindex
+ @vdesc index of variable
+ @vtype int
+ @vio in
+ @endvar
@@*/
-int IOASCII_TimeFor1D (cGH *GH, int index)
+int IOASCII_TimeFor1D (cGH *GH, int vindex)
{
int return_type;
asciiioGH *myGH;
@@ -178,7 +182,7 @@ int IOASCII_TimeFor1D (cGH *GH, int index)
return_type = 0;
/* Get the GH extensions for IOASCII */
- myGH = (asciiioGH *) GH->extensions [CCTK_GHExtensionHandle ("IOASCII")];
+ myGH = (asciiioGH *) CCTK_GHExtension (GH, "IOASCII");
CheckSteerableParameters (myGH);
@@ -189,13 +193,13 @@ int IOASCII_TimeFor1D (cGH *GH, int index)
}
/* Check if this variable should be output */
- if (myGH->do_out1D [index] &&
+ if (myGH->do_out1D[vindex] &&
GH->cctk_iteration % myGH->out1D_every == 0)
{
/* Check if this variable wasn't already output this iteration */
- if (myGH->out1D_last[index] == GH->cctk_iteration)
+ if (myGH->out1D_last[vindex] == GH->cctk_iteration)
{
- fullname = CCTK_FullName (index);
+ fullname = CCTK_FullName (vindex);
CCTK_VWarn (5, __LINE__, __FILE__, CCTK_THORNSTRING,
"Already done IOASCII 1D output for '%s' in current "
"iteration (probably via triggers)", fullname);
@@ -216,43 +220,43 @@ int IOASCII_TimeFor1D (cGH *GH, int index)
@date Sat March 6 1999
@author Gabrielle Allen
@desc
- Triggers the output a variable using the IOASCII output method
- method
+ Triggers the output a variable
+ using the IOASCII output method method
@enddesc
- @calledby CCTK scheduler
- @var GH
- @vdesc Pointer to CCTK GH
- @vtype cGH
- @vio in
- @vcomment
+ @calls IOASCII_Write1D
+
+ @var GH
+ @vdesc Pointer to CCTK GH
+ @vtype cGH *
+ @vio in
@endvar
- @var index
- @vdesc index of variable to output
- @vtype int
- @vio in
- @vcomment
+ @var vindex
+ @vdesc index of variable to output
+ @vtype int
+ @vio in
@endvar
@@*/
-int IOASCII_TriggerOutput1D (cGH *GH, int index)
+int IOASCII_TriggerOutput1D (cGH *GH, int vindex)
{
const char *var;
asciiioGH *myGH;
- myGH = (asciiioGH *) GH->extensions [CCTK_GHExtensionHandle ("IOASCII")];
+
+ myGH = (asciiioGH *) CCTK_GHExtension (GH, "IOASCII");
- var = CCTK_VarName (index);
+ var = CCTK_VarName (vindex);
/* Do the 1D output */
#ifdef IO_DEBUG
printf ("\nIn IOASCII TriggerOutput1D\n---------------------\n");
- printf (" Index = %d\n", index);
+ printf (" Index = %d\n", vindex);
printf (" Variable = -%s-\n", var);
#endif
- IOASCII_Write1D (GH, index, var);
+ IOASCII_Write1D (GH, vindex, var);
/* Register variables as having 1D output this iteration */
- myGH->out1D_last [index] = GH->cctk_iteration;
+ myGH->out1D_last[vindex] = GH->cctk_iteration;
return (0);
}
@@ -290,7 +294,7 @@ static void CheckSteerableParameters (asciiioGH *myGH)
/* check if this variable can be output (static conditions) */
-static int CheckOutputVar (int index)
+static int CheckOutputVar (int vindex)
{
int retval;
int grouptype;
@@ -298,11 +302,11 @@ static int CheckOutputVar (int index)
/* check the variable type */
- grouptype = CCTK_GroupTypeFromVarI (index);
+ grouptype = CCTK_GroupTypeFromVarI (vindex);
retval = grouptype != CCTK_GF && grouptype != CCTK_ARRAY;
if (retval)
{
- fullname = CCTK_FullName (index);
+ fullname = CCTK_FullName (vindex);
CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
"No IOASCII 1D output for '%s' (not a grid function "
"or an array)", fullname);
@@ -315,14 +319,14 @@ static int CheckOutputVar (int index)
/* callback for CCTK_TraverseString() to set the output flag
for the given variable */
-static void SetOutputFlag (int index, const char *optstring, void *arg)
+static void SetOutputFlag (int vindex, const char *optstring, void *arg)
{
char *flags = (char *) arg;
- if (CheckOutputVar (index) == 0)
+ if (CheckOutputVar (vindex) == 0)
{
- flags[index] = 1;
+ flags[vindex] = 1;
}
if (optstring)