/*@@ @file GHExtension.c @date 01 Oct 1999 @author Jonghyun Lee @desc IOPanda GH extension stuff @enddesc @history @endhistory @@*/ /*#define DEBUG_IO*/ #include #include #include #include "cctk.h" #include "cctk_DefineThorn.h" #include "cctk_Parameters.h" #ifdef CACTUSPUGH_PUGH #include "CactusPUGH/PUGH/src/include/pugh.h" #endif #include "CactusBase/IOUtil/src/ioGH.h" #include "ioPandaGH.h" void Panda_Create(int, int); void *IOPanda_SetupGH (tFleshConfig *config, int convergence_level, cGH *GH) { int i, numvars; pandaGH *newGH; numvars = CCTK_NumVars (); newGH = (pandaGH *) malloc (sizeof (pandaGH)); newGH->IO_3Dnum = (int *) malloc (numvars * sizeof (int)); newGH->IO_3Dlast = (int *) malloc (numvars * sizeof (int)); return (newGH); } int IOPanda_InitGH (cGH *GH) { DECLARE_CCTK_PARAMETERS int i; ioGH *ioUtilGH; pandaGH *myGH; /* get the handles for IOUtil and IOPanda extensions */ ioUtilGH = (ioGH *) GH->extensions [CCTK_GHExtensionHandle ("IO")]; myGH = (pandaGH *) GH->extensions [CCTK_GHExtensionHandle ("IOPanda")]; /* How often to output */ myGH->IO_3Devery = out_every; if (out3D_every > 0) myGH->IO_3Devery = out3D_every; InitIONum (myGH->IO_3Dnum, out3D_vars); /* Deal with the output directories */ myGH->outpfx_3D = outdir; if (!CCTK_Equals(outdir3D,"outdir")) myGH->outpfx_3D = outdir3D; /* Create the output directories */ if (myGH->IO_3Devery > 0) { if (CCTK_MyProc (GH) == 0) { FILE *fp; if (CCTK_mkdir (myGH->outpfx_3D) != 0) CCTK_WARN (2,"Problem creating IO 3D directory"); fp = fopen("FILEPREFIX", "w"); fprintf(fp, "%s", myGH->outpfx_3D); fclose(fp); } } for (i=0; iIO_3Dlast [i] = -1; myGH->fileList_3D = NULL; Panda_Create(ioUtilGH->ioproc_every, 1); return (0); }