aboutsummaryrefslogtreecommitdiff
path: root/src/Startup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Startup.c')
-rw-r--r--src/Startup.c55
1 files changed, 36 insertions, 19 deletions
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);
}