diff options
Diffstat (limited to 'src/GHExtension.c')
-rw-r--r-- | src/GHExtension.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/GHExtension.c b/src/GHExtension.c index 67e4908..b11e7ab 100644 --- a/src/GHExtension.c +++ b/src/GHExtension.c @@ -58,15 +58,53 @@ int IOFlexIO_InitGH (cGH *GH) DECLARE_CCTK_PARAMETERS int i; ioGH *ioUtilGH; - flexioGH *myGH; + flexioGH *myGH; /* get the handles for IOUtil and IOFlexIO extensions */ ioUtilGH = (ioGH *) GH->extensions [CCTK_GHExtensionHandle ("IO")]; myGH = (flexioGH *) GH->extensions [CCTK_GHExtensionHandle ("IOFlexIO")]; + /* How often to output */ + myGH->IO_2Devery = output_every; + myGH->IO_3Devery = output_every; + if (output2d_every > 0) + myGH->IO_2Devery = output2d_every; + if (output3d_every > 0) + myGH->IO_3Devery = output3d_every; + InitIONum (myGH->IO_2Dnum, output2D); InitIONum (myGH->IO_3Dnum, output3D); + /* Deal with the output directories */ + myGH->outpfx_2D = outdir; + myGH->outpfx_3D = outdir; + if (!CCTK_Equals(outdir2d,"outdir")) + myGH->outpfx_2D = outdir2d; + if (!CCTK_Equals(outdir3d,"outdir")) + myGH->outpfx_3D = outdir3d; + + /* Create the output directories */ + if (myGH->IO_2Devery > 0) { + if (CCTK_MyProc (GH) == 0) { + char *command = (char *) malloc (1024 * sizeof (char)); + + sprintf (command, "mkdir -p %s", myGH->outpfx_2D); + if (system (command) < 0) + CCTK_WARN (1,"Problem creating IO 2D directory"); + free (command); + } + } + if (myGH->IO_3Devery > 0) { + if (CCTK_MyProc (GH) == 0) { + char *command = (char *) malloc (1024 * sizeof (char)); + + sprintf (command, "mkdir -p %s", myGH->outpfx_3D); + if (system (command) < 0) + CCTK_WARN (1,"Problem creating IO 3D directory"); + free (command); + } + } + for (i=0; i<CCTK_NumVars(); i++) myGH->IO_2Dlast [i] = myGH->IO_3Dlast [i] = -1; |