diff options
Diffstat (limited to 'src/Startup.c')
-rw-r--r-- | src/Startup.c | 89 |
1 files changed, 37 insertions, 52 deletions
diff --git a/src/Startup.c b/src/Startup.c index 3821d86..ab26165 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -8,7 +8,6 @@ @version $Id$ @@*/ -#include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> @@ -28,12 +27,11 @@ CCTK_FILEVERSION(CactusBase_IOBasic_Startup_c) ********************************************************************/ void IOBasic_Startup (void); + /******************************************************************** ******************** Internal Routines ************************ ********************************************************************/ -static void *IOBasic_SetupGH (tFleshConfig *config, - int convergence_level, - cGH *GH); +static void *IOBasic_SetupGH (tFleshConfig *config, int conv_level, cGH *GH); /*@@ @@ -82,7 +80,7 @@ void IOBasic_Startup (void) @vtype tFleshConfig * @vio unused @endvar - @var convergence_level + @var conv_level @vdesc the convergence level @vtype int @vio unused @@ -98,23 +96,21 @@ void IOBasic_Startup (void) pointer to the allocated GH extension structure @endreturndesc @@*/ -static void *IOBasic_SetupGH (tFleshConfig *config, - int convergence_level, - cGH *GH) +static void *IOBasic_SetupGH (tFleshConfig *config, int conv_level, cGH *GH) { - DECLARE_CCTK_PARAMETERS int i; - iobasicGH *newGH; + iobasicGH *myGH; + DECLARE_CCTK_PARAMETERS - /* suppress compiler warnings about unused variables */ - config = config; - convergence_level = convergence_level; - GH = GH; + /* suppress compiler warnings about unused parameters */ + (void) (config + 0); + (void) (conv_level + 0); + (void) (GH + 0); /* allocate the GH extension and its components */ - newGH = (iobasicGH *) malloc (sizeof (iobasicGH)); - if (newGH) + myGH = (iobasicGH *) malloc (sizeof (iobasicGH)); + if (myGH) { /* Register the IOBasic routines as output methods */ i = CCTK_RegisterIOMethod ("Scalar"); @@ -127,7 +123,7 @@ static void *IOBasic_SetupGH (tFleshConfig *config, CCTK_RegisterIOMethodTimeToOutput (i, IOBasic_TimeForInfoOutput); CCTK_RegisterIOMethodTriggerOutput (i, IOBasic_TriggerInfoOutput); - if (! CCTK_Equals (newverbose, "none")) + if (! CCTK_Equals (verbose, "none")) { CCTK_INFO ("I/O Method 'Scalar' registered"); CCTK_INFO ("Scalar: Output of scalar quantities (grid scalars, " @@ -139,68 +135,57 @@ static void *IOBasic_SetupGH (tFleshConfig *config, i = CCTK_NumVars (); - newGH->info_reductions = (iobasic_reductionlist_t *) + myGH->info_reductions = (iobasic_reductionlist_t *) calloc (2 * i, sizeof (iobasic_reductionlist_t)); - newGH->scalar_reductions = newGH->info_reductions + i; - newGH->outInfo_last = (int *) malloc (2 * i * sizeof (int)); - newGH->outScalar_last = newGH->outInfo_last + i; + myGH->scalar_reductions = myGH->info_reductions + i; + myGH->outInfo_last = (int *) malloc (2 * i * sizeof (int)); + myGH->outScalar_last = myGH->outInfo_last + i; - memset (newGH->outInfo_last, -1, 2 * i * sizeof (int)); + memset (myGH->outInfo_last, -1, 2 * i * sizeof (int)); - newGH->filenameListScalar = NULL; + myGH->filenameListScalar = NULL; - /* Check whether "IOBasic::outdir" was set. - If so take this dir otherwise default to "IO::outdir" */ - if (CCTK_ParameterQueryTimesSet ("outdir", CCTK_THORNSTRING) > 0 || - CCTK_ParameterQueryTimesSet ("outdirScalar", CCTK_THORNSTRING) > 0) + /* get the name of IOBasic's output directory */ + if (*out_dir == 0) { - if (CCTK_ParameterQueryTimesSet ("outdir", CCTK_THORNSTRING) <= 0) - { - CCTK_WARN (1, "Parameter 'IOBasic::outdirScalar is depricated in " - "BETA12, please use 'IOBasic::outdir' instead"); - outdir = outdirScalar; - } - } - else - { - outdir = *(const char **) - CCTK_ParameterGet ("outdir", CCTK_ImplementationThorn ("IO"), &i); + out_dir = *(const char **) + CCTK_ParameterGet ("out_dir", CCTK_ImplementationThorn ("IO"), + NULL); } /* skip the directory pathname if output goes into current directory */ - if (strcmp (outdir, ".")) + if (strcmp (out_dir, ".")) { - i = strlen (outdir); - newGH->outdir = (char *) malloc (i + 2); - strcpy (newGH->outdir, outdir); - newGH->outdir[i] = '/'; - newGH->outdir[i+1] = 0; + i = strlen (out_dir); + myGH->out_dir = (char *) malloc (i + 2); + strcpy (myGH->out_dir, out_dir); + myGH->out_dir[i] = '/'; + myGH->out_dir[i+1] = 0; } else { - newGH->outdir = ""; + myGH->out_dir = strdup (""); } /* create the output dir */ - if (*newGH->outdir && CCTK_MyProc (GH) == 0) + if (*myGH->out_dir && CCTK_MyProc (GH) == 0) { - i = IOUtil_CreateDirectory (GH, newGH->outdir, 0, 0); + i = IOUtil_CreateDirectory (GH, myGH->out_dir, 0, 0); if (i < 0) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, "IOBasic_SetupGH: Couldn't create Scalar output directory " - "'%s'", newGH->outdir); + "'%s'", myGH->out_dir); } - else if (i >= 0 && CCTK_Equals (newverbose, "full")) + else if (i >= 0 && CCTK_Equals (verbose, "full")) { CCTK_VInfo (CCTK_THORNSTRING, "Scalar: Output to directory '%s'", - newGH->outdir); + myGH->out_dir); } - } } - return (newGH); + return (myGH); } |