diff options
author | tradke <tradke@38c3d835-c875-442e-b0fe-21c19ce1d001> | 2002-05-06 09:23:48 +0000 |
---|---|---|
committer | tradke <tradke@38c3d835-c875-442e-b0fe-21c19ce1d001> | 2002-05-06 09:23:48 +0000 |
commit | 03a92f415aea5cdd2ac04f749bcc07c86c1b6869 (patch) | |
tree | 2112331cf052c630c4e3f2cc370d0215335ca2cf /src | |
parent | 57daa72811142a5f0377bfd2cdba07eebb73e977 (diff) |
Parameter names changes as announced in today's mail to users@cactuscode.org.
You must also update thorn IOUtil now.
This thorn will be moved from BetaThorns to CactusPUGHIO now.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOPanda/trunk@32 38c3d835-c875-442e-b0fe-21c19ce1d001
Diffstat (limited to 'src')
-rw-r--r-- | src/Output.c | 49 | ||||
-rw-r--r-- | src/Startup.c | 55 | ||||
-rw-r--r-- | src/ioPandaGH.h | 2 | ||||
-rw-r--r-- | src/make.code.defn | 2 |
4 files changed, 54 insertions, 54 deletions
diff --git a/src/Output.c b/src/Output.c index 467fd22..e18615d 100644 --- a/src/Output.c +++ b/src/Output.c @@ -23,7 +23,7 @@ /* the rcs ID and its dummy funtion to use it */ static const char *rcsid = "$Header$"; -CCTK_FILEVERSION(BetaThorns_IOPanda_Output_c) +CCTK_FILEVERSION(CactusPUGHIO_IOPanda_Output_c) /******************************************************************** @@ -46,9 +46,8 @@ static void AddChunkAttributes (const cGH *GH, const ioRequest *request, Loops over all variables and outputs them if necessary @enddesc - @calls CheckSteerableParameters - IOPanda_TimeFor - IOPanda_OutputVarAs + @calls IOPanda_TimeFor + DumpVar @var GH @vdesc pointer to CCTK GH @@ -65,42 +64,26 @@ static void AddChunkAttributes (const cGH *GH, const ioRequest *request, int IOPanda_OutputGH (const cGH *GH) { int vindex, retval; - pandaGH *myGH; - char *fullname; - const char *name; - DECLARE_CCTK_PARAMETERS - + const pandaGH *myGH; - CheckSteerableParameters (GH); - myGH = (pandaGH *) CCTK_GHExtension (GH, "IOPanda"); + myGH = (const pandaGH *) CCTK_GHExtension (GH, "IOPanda"); if (myGH->out_every <= 0) { return (0); } + retval = 0; + /* loop over all variables */ - for (vindex = retval = 0; vindex < CCTK_NumVars (); vindex++) + for (vindex = CCTK_NumVars () - 1; vindex >= 0; vindex--) { - if (IOPanda_TimeFor (GH, vindex)) + if (IOPanda_TimeFor (GH, vindex) && + DumpVar (GH, myGH->requests[vindex], CCTK_VarName (vindex)) == 0) { - name = CCTK_VarName (vindex); - fullname = CCTK_FullName (vindex); - - if (verbose) - { - CCTK_VInfo (CCTK_THORNSTRING, "IOPanda_OutputGH: " - "(fullname, name) = (%s, %s)", fullname, name); - } - - if (IOPanda_OutputVarAs (GH, fullname, name) == 0) - { - /* register variable as having output this iteration */ - myGH->out_last[vindex] = GH->cctk_iteration; - retval++; - } - - free (fullname); + /* register variable as having output this iteration */ + myGH->out_last[vindex] = GH->cctk_iteration; + retval++; } } @@ -150,7 +133,7 @@ int IOPanda_OutputVarAs (const cGH *GH, const char *fullname, const char *alias) vindex = CCTK_VarIndex (fullname); - if (verbose) + if (CCTK_Equals (verbose, "full")) { CCTK_VInfo (CCTK_THORNSTRING, "IOPanda_OutputVarAs: (fullname, alias, " "index) = (%s, %s, %d)", fullname, alias, vindex); @@ -207,8 +190,8 @@ int IOPanda_OutputVarAs (const cGH *GH, const char *fullname, const char *alias) int IOPanda_TimeFor (const cGH *GH, int vindex) { int retval; - const pandaGH *myGH; char *fullname; + const pandaGH *myGH; CheckSteerableParameters (GH); @@ -270,7 +253,7 @@ int IOPanda_TriggerOutput (const cGH *GH, int vindex) varname = CCTK_VarName (vindex); - if (verbose) + if (CCTK_Equals (verbose, "full")) { CCTK_VInfo (CCTK_THORNSTRING, "TriggerOutput: " "name, index = %s, %d", varname, vindex); diff --git a/src/Startup.c b/src/Startup.c index d5f59c1..7d48617 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -21,8 +21,8 @@ #include "Panda/c_interface.h" /* the rcs ID and its dummy function to use it */ -static const char *rcsid = "$Id$"; -CCTK_FILEVERSION(BetaThorns_IOPanda_Startup_c) +static const char *rcsid = "$Header$"; +CCTK_FILEVERSION(CactusPUGHIO_IOPanda_Startup_c) /******************************************************************** @@ -134,8 +134,8 @@ static void *SetupGH (tFleshConfig *config, int convergence_level, cGH *GH) (void) (convergence_level + 0); - /* Register IOPanda's routines as a new I/O method */ - i = CCTK_RegisterIOMethod ("IOPandaIO"); + /* register IOPanda's routines as a new I/O method */ + i = CCTK_RegisterIOMethod ("IOPanda"); CCTK_RegisterIOMethodOutputGH (i, IOPanda_OutputGH); CCTK_RegisterIOMethodOutputVarAs (i, IOPanda_OutputVarAs); CCTK_RegisterIOMethodTimeToOutput (i, IOPanda_TimeFor); @@ -152,40 +152,57 @@ static void *SetupGH (tFleshConfig *config, int convergence_level, cGH *GH) myGH->out_last[i] = -1; } - /* get the handle for IOUtil extensions */ - ioUtilGH = (const ioGH *) CCTK_GHExtension (GH, "IO"); + /* get the name of IOPanda's output directory */ + if (*out_dir == 0) + { + out_dir = *(const char **) + CCTK_ParameterGet ("out_dir", CCTK_ImplementationThorn ("IO"), + NULL); + } - /* Check whether "IOPanda::outdir" was set. - If so take this directory otherwise default to "IO::outdir" */ - if (CCTK_ParameterQueryTimesSet ("outdir", CCTK_THORNSTRING) > 0) + /* skip the directory pathname if output goes into current directory */ + if (strcmp (out_dir, ".")) { - myGH->outdir = strdup (outdir); + i = strlen (out_dir); + if (CCTK_Equals (out_mode, "onefile") || ! strstr (out_dir, "%u")) + { + myGH->out_dir = (char *) malloc (i + 2); + strcpy (myGH->out_dir, out_dir); + myGH->out_dir[i] = '/'; + myGH->out_dir[i+1] = 0; + } + else + { + myGH->out_dir = (char *) malloc (i + 20); + sprintf (myGH->out_dir, out_dir, CCTK_MyProc (GH)); + strcat (myGH->out_dir, "/"); + } } else { - myGH->outdir = CCTK_ParameterValString ("outdir", - CCTK_ImplementationThorn ("IO")); + myGH->out_dir = strdup (""); } - /* Create the output directory */ - i = IOUtil_CreateDirectory (GH, myGH->outdir, - ! CCTK_Equals (out3D_mode, "onefile"), + /* create the output directory */ + ioUtilGH = (const ioGH *) CCTK_GHExtension (GH, "IO"); + i = IOUtil_CreateDirectory (GH, myGH->out_dir, + ! CCTK_Equals (out_mode, "onefile"), ioUtilGH->ioproc); if (i < 0) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Problem creating IOPanda output directory '%s'", myGH->outdir); + "Problem creating IOPanda output directory '%s'",myGH->out_dir); } - else if (i > 0 && CCTK_Equals (newverbose, "full")) + else if (i > 0 && CCTK_Equals (verbose, "full")) { CCTK_VInfo (CCTK_THORNSTRING, - "IOPanda output directory '%s' already exists", myGH->outdir); + "IOPanda output directory '%s' already exists", myGH->out_dir); } if (CCTK_MyProc (GH) == 0) { fp = fopen ("FILEPREFIX", "w"); - fprintf (fp, "%s", myGH->outdir); + fprintf (fp, "%s", myGH->out_dir); fclose (fp); } diff --git a/src/ioPandaGH.h b/src/ioPandaGH.h index 7434e1f..736ca58 100644 --- a/src/ioPandaGH.h +++ b/src/ioPandaGH.h @@ -29,7 +29,7 @@ typedef struct ioRequest **requests; /* directory in which to output */ - char *outdir; + char *out_dir; /* the last iteration output for variable[i] */ int *out_last; diff --git a/src/make.code.defn b/src/make.code.defn index f16782d..17142ba 100644 --- a/src/make.code.defn +++ b/src/make.code.defn @@ -2,7 +2,7 @@ # $Header$ # Source files in this directory -SRCS = Startup.c Output.c DumpVar.c +SRCS = Startup.c Output.c # Other subdirectories SUBDIRS = Panda |