aboutsummaryrefslogtreecommitdiff
path: root/src/GHExtension.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/GHExtension.c')
-rw-r--r--src/GHExtension.c95
1 files changed, 77 insertions, 18 deletions
diff --git a/src/GHExtension.c b/src/GHExtension.c
index cfac94b..735b407 100644
--- a/src/GHExtension.c
+++ b/src/GHExtension.c
@@ -15,35 +15,82 @@
#include <stdio.h>
#include "cctk.h"
-#include "cctk_DefineThorn.h"
#include "cctk_Parameters.h"
#include "CactusBase/IOUtil/src/ioGH.h"
-#include "CactusPUGH/PUGH/src/include/pugh.h"
#include "ioPandaGH.h"
void Panda_Create(int, int);
-void *IOPanda_SetupGH (tFleshConfig *config, int convergence_level, cGH *GH)
+
+ /*@@
+ @routine IOPanda_SetupGH
+ @date Fri 01 Oct 1999
+ @author Jonghyun Lee
+ @desc
+ Allocates the IOPanda GH extension structure.
+ @enddesc
+ @calledby CCTK scheduler at CCTK_INITIALIZE
+ @var config
+ @vdesc flesh configuration structure (unused)
+ @vtype tFleshConfig *
+ @vio in
+ @endvar
+ @var convergence_level
+ @vdesc convergence level (unused)
+ @vtype int
+ @vio in
+ @endvar
+ @var GH
+ @vdesc pointer to grid hierarchy
+ @vtype cGH *
+ @vio in
+ @endvar
+ @history
+
+ @endhistory
+@@*/
+void *IOPanda_SetupGH (tFleshConfig *config,
+ int convergence_level,
+ cGH *GH)
{
- int i, numvars;
+ int numvars;
pandaGH *newGH;
+
numvars = CCTK_NumVars ();
- newGH = (pandaGH *) malloc (sizeof (pandaGH));
- newGH->do_out3D = (char *) malloc (numvars * sizeof (char));
- newGH->out3D_last = (int *) malloc (numvars * sizeof (int));
+ newGH = (pandaGH *) malloc (sizeof (pandaGH));
+ newGH->do_out3D = (char *) malloc (numvars * sizeof (char));
+ newGH->out3D_last = (int *) malloc (numvars * sizeof (int));
return (newGH);
}
+
+ /*@@
+ @routine IOPanda_InitGH
+ @date Fri 01 Oct 1999
+ @author Jonghyun Lee
+ @desc
+ The GH initialization routine for IOFlexIO.
+ Necessary output dirs are created.
+ @enddesc
+ @calledby CCTK scheduler at CCTK_INITIALIZE
+ @var GH
+ @vdesc pointer to grid hierarchy
+ @vtype cGH *
+ @vio in
+ @endvar
+ @history
+
+ @endhistory
+@@*/
int IOPanda_InitGH (cGH *GH)
{
DECLARE_CCTK_PARAMETERS
int i;
ioGH *ioUtilGH;
pandaGH *myGH;
- const cParamData *paramdata;
/* get the handles for IOUtil and IOPanda extensions */
@@ -53,37 +100,49 @@ int IOPanda_InitGH (cGH *GH)
/* How often to output */
myGH->out3D_every = out_every > 0 ? out_every : -1;
if (out3D_every > 0)
+ {
myGH->out3D_every = out3D_every;
+ }
- IOUtil_ParseVarsForOutput (out3D_vars, myGH->do_out3D);
-
- /* Deal with the output directories */
/* Check whether "outdir3D" was set.
If so take this dir otherwise default to "IO::outdir" */
- paramdata = CCTK_ParameterData ("outdir3D", CCTK_THORNSTRING);
- if (paramdata && paramdata->n_set > 0)
+ if (CCTK_ParameterQueryTimesSet ("outdir3D", CCTK_THORNSTRING) > 0)
+ {
myGH->outdir3D = strdup (outdir3D);
+ }
else
+ {
myGH->outdir3D = strdup (outdir);
+ }
- /* create the output dir */
- if (CCTK_MyProc (GH) == 0) {
+ /* Create the output directory */
+ if (CCTK_MyProc (GH) == 0)
+ {
FILE *fp;
- i = CCTK_CreateDirectory(myGH->outdir3D,0755);
+
+ i = CCTK_CreateDirectory (0755, myGH->outdir3D);
if (i < 0)
+ {
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "Problem creating IOPanda 3D output directory '%s'", myGH->outdir3D);
+ "IOPanda_InitGH: Problem creating IOPanda 3D output "
+ "directory '%s'", myGH->outdir3D);
+ }
else if (i > 0)
+ {
CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
- "IOPanda 3D output directory '%s' already exists", myGH->outdir3D);
+ "IOPanda_InitGH: IOPanda 3D output directory '%s' already "
+ "exists", myGH->outdir3D);
+ }
fp = fopen ("FILEPREFIX", "w");
fprintf (fp, "%s", myGH->outdir3D);
fclose (fp);
}
for (i = 0; i < CCTK_NumVars (); i++)
+ {
myGH->out3D_last [i] = -1;
+ }
Panda_Create (ioUtilGH->ioproc_every, 1);