aboutsummaryrefslogtreecommitdiff
path: root/src/GHExtension.c
diff options
context:
space:
mode:
authorallen <allen@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2000-03-23 16:02:11 +0000
committerallen <allen@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2000-03-23 16:02:11 +0000
commit80631ac6c5509ee69d8bf76343a703550cb5d7e8 (patch)
tree8302f8678df79af4b3a40bcbf5faebf246c67a7d /src/GHExtension.c
parentce573e602773f737f664904cc68051bad16f910a (diff)
Changes for new PUGH structures
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@98 ebee0441-1374-4afa-a3b5-247f3ba15b9a
Diffstat (limited to 'src/GHExtension.c')
-rw-r--r--src/GHExtension.c108
1 files changed, 86 insertions, 22 deletions
diff --git a/src/GHExtension.c b/src/GHExtension.c
index 5f53c67..ef10919 100644
--- a/src/GHExtension.c
+++ b/src/GHExtension.c
@@ -71,9 +71,13 @@ int IOFlexIO_InitGH (cGH *GH)
myGH->out2D_every = out_every > 0 ? out_every : -1;
myGH->out3D_every = out_every > 0 ? out_every : -1;
if (out2D_every > 0)
+ {
myGH->out2D_every = out2D_every;
+ }
if (out3D_every > 0)
+ {
myGH->out3D_every = out3D_every;
+ }
ParseVarsForOutput (out2D_vars, myGH->do_out2D);
ParseVarsForOutput (out3D_vars, myGH->do_out3D);
@@ -82,15 +86,23 @@ int IOFlexIO_InitGH (cGH *GH)
If so take these dirs otherwise default to "IO::outdir" */
paramdata = CCTK_ParameterData ("outdir2D", CCTK_THORNSTRING);
if (paramdata && paramdata->n_set > 0)
+ {
myGH->outdir2D = strdup (outdir2D);
+ }
else
+ {
myGH->outdir2D = strdup (outdir);
+ }
paramdata = CCTK_ParameterData ("outdir3D", CCTK_THORNSTRING);
if (paramdata && paramdata->n_set > 0)
+ {
myGH->outdir3D = strdup (outdir3D);
+ }
else
+ {
myGH->outdir3D = strdup (outdir);
+ }
/* Create the output directories */
if (CCTK_MyProc (GH) == 0) {
@@ -101,19 +113,23 @@ int IOFlexIO_InitGH (cGH *GH)
}
for (i=0; i<CCTK_NumVars(); i++)
+ {
myGH->out2D_last [i] = myGH->out3D_last [i] = -1;
+ }
myGH->out3d_reuse_filehandles = out3d_reuse_filehandles;
/* Only have reuse for chunked data */
- if (myGH->out3d_reuse_filehandles && ioUtilGH->unchunked) {
+ if (myGH->out3d_reuse_filehandles && ioUtilGH->unchunked)
+ {
CCTK_WARN (2, "Cannot reuse handles with unchunked data. "
"Ignoring parameter 'out3d_reuse_filehandles'");
myGH->out3d_reuse_filehandles = 0;
}
/* Only have reuse if not one file per slice */
- if (myGH->out3d_reuse_filehandles && out3D_septimefiles) {
+ if (myGH->out3d_reuse_filehandles && out3D_septimefiles)
+ {
CCTK_WARN (2, "Cannot reuse handles with 'out3D_septimefiles = yes'. "
"Ignoring parameter 'out3d_reuse_filehandles'");
myGH->out3d_reuse_filehandles = 0;
@@ -126,7 +142,8 @@ int IOFlexIO_InitGH (cGH *GH)
SetupSliceCenter (GH);
/* create timers if timing info was requested */
- if (print_timing_info) {
+ if (print_timing_info)
+ {
myGH->dumpVarsTimer = CCTK_TimerCreateI ();
myGH->dumpParamsTimer = CCTK_TimerCreateI ();
myGH->checkpointTotalTimer = CCTK_TimerCreateI ();
@@ -135,25 +152,35 @@ int IOFlexIO_InitGH (cGH *GH)
myGH->recoverTotalTimer = CCTK_TimerCreateI ();
if (myGH->dumpVarsTimer < 0)
- CCTK_WARN (1, "Could not create timer ! Timing info on dumping datasets "
+ {
+ CCTK_WARN (1, "Could not create timer. Timing info on dumping datasets "
"will not be available.");
+ }
if (myGH->dumpParamsTimer < 0)
- CCTK_WARN (1, "Could not create timer ! Timing info on dumping parameters"
+ {
+ CCTK_WARN (1, "Could not create timer. Timing info on dumping parameters"
" will not be available.");
+ }
if (myGH->checkpointTotalTimer < 0)
+ {
CCTK_WARN (1, "Could not create timer ! Timing info on total checkpoint "
"time will not be available.");
-
+ }
if (myGH->recoverVarsTimer < 0)
+ {
CCTK_WARN (1, "Could not create timer ! Timing info on recovering "
"datasets will not be available.");
+ }
if (myGH->recoverParamsTimer < 0)
+ {
CCTK_WARN (1, "Could not create timer ! Timing info on recovering "
" parameters will not be available.");
+ }
if (myGH->recoverTotalTimer < 0)
+ {
CCTK_WARN (1, "Could not create timer ! Timing info on total recovery "
"time will not be available.");
-
+ }
CCTK_TimerResetI (myGH->checkpointTotalTimer);
CCTK_TimerResetI (myGH->recoverTotalTimer);
}
@@ -169,7 +196,8 @@ int IOFlexIO_Terminate (cGH *GH)
{
DECLARE_CCTK_PARAMETERS
- if (print_timing_info) {
+ if (print_timing_info)
+ {
CCTK_TimerDestroyI (myGH->dumpVarsTimer);
CCTK_TimerDestroyI (myGH->dumpParamsTimer);
CCTK_TimerDestroyI (myGH->checkpointTotalTimer);
@@ -205,7 +233,9 @@ static void SetupSliceCenter (cGH *GH)
if ( CCTK_Equals (domain, "octant")
|| CCTK_Equals (domain, "quadrant")
|| CCTK_Equals (domain, "bitant"))
+ {
slice_center=0;
+ }
if (slice_center)
{
@@ -214,11 +244,18 @@ static void SetupSliceCenter (cGH *GH)
/* (unless nx,ny,nz=1) */
for (dim = 0; dim < GH->cctk_dim; dim++)
- if (pughGH->lnsize [dim] == 1)
+ {
+ if (pughGH->GFExtras[GH->cctk_dim-1]->lnsize [dim] == 1)
+ {
myGH->sp2xyz [dim] = 0;
+ }
else
- myGH->sp2xyz [dim] = pughGH->nsize [dim]/2 -
- pughGH->lb [pughGH->myproc][dim];
+ {
+ myGH->sp2xyz [dim] =
+ pughGH->GFExtras[GH->cctk_dim-1]->nsize [dim]/2 -
+ pughGH->GFExtras[GH->cctk_dim-1]->lb [pughGH->myproc][dim];
+ }
+ }
}
@@ -227,30 +264,57 @@ static void SetupSliceCenter (cGH *GH)
{
for (dim = 0; dim < GH->cctk_dim; dim++)
- if (pughGH->lnsize [dim] == 1)
+ {
+ if (pughGH->GFExtras[GH->cctk_dim-1]->lnsize [dim] == 1)
+ {
myGH->sp2xyz [dim] = 0;
+ }
else
- myGH->sp2xyz [dim] = 1 - pughGH->lb [pughGH->myproc][dim];
+ {
+ myGH->sp2xyz [dim] = 1 -
+ pughGH->GFExtras[GH->cctk_dim-1]->lb [pughGH->myproc][dim];
+ }
+ }
}
/* In quadrant mode x and y are like full, but z is like octant */
- if (CCTK_Equals (domain, "quadrant")) {
- if (pughGH->lnsize [2] == 1)
+ if (CCTK_Equals (domain, "quadrant"))
+ {
+ if (pughGH->GFExtras[GH->cctk_dim-1]->lnsize [2] == 1)
+ {
myGH->sp2xyz[2] = 0;
+ }
else
- myGH->sp2xyz[2] = pughGH->lnsize [2]/2 - pughGH->lb [pughGH->myproc][2];
+ {
+ myGH->sp2xyz[2] =
+ pughGH->GFExtras[GH->cctk_dim-1]->lnsize [2]/2 -
+ pughGH->GFExtras[GH->cctk_dim-1]->lb [pughGH->myproc][2];
+ }
}
- if (CCTK_Equals (domain, "bitant")) {
- if (pughGH->lnsize [0] == 1)
+ if (CCTK_Equals (domain, "bitant"))
+ {
+ if (pughGH->GFExtras[GH->cctk_dim-1]->lnsize [0] == 1)
+ {
myGH->sp2xyz[0] = 0;
+ }
else
- myGH->sp2xyz[0] = myGH->sp2xyz[0]/2 - pughGH->lb [pughGH->myproc][0];
-
- if (pughGH->lnsize [1] == 1)
+ {
+ myGH->sp2xyz[0] =
+ myGH->sp2xyz[0]/2 -
+ pughGH->GFExtras[GH->cctk_dim-1]->lb [pughGH->myproc][0];
+ }
+
+ if (pughGH->GFExtras[GH->cctk_dim-1]->lnsize [1] == 1)
+ {
myGH->sp2xyz[1] = 0;
+ }
else
- myGH->sp2xyz[1] = pughGH->lnsize [1]/2 - pughGH->lb [pughGH->myproc][1];
+ {
+ myGH->sp2xyz[1] =
+ pughGH->GFExtras[GH->cctk_dim-1]->lnsize [1]/2 -
+ pughGH->GFExtras[GH->cctk_dim-1]->lb [pughGH->myproc][1];
+ }
}