#include #include #include #include "cctk.h" #include "cctk_Parameters.h" #include "cctk_Arguments.h" #include "CactusPUGH/PUGH/src/include/pugh.h" #include "IOJpeg.h" void IOJpeg_DefaultGeo(cGH *GH, int sdim, IOJpegGeo_t *geo); void *IOJpeg_SetupGH (tFleshConfig *config, int convergence_level, cGH *GH) { int numvars,iv; IOJpegGH *newGH; numvars = CCTK_NumVars (); newGH = (IOJpegGH *) malloc (sizeof (IOJpegGH)); newGH->do_out2D = (char *) malloc (numvars * sizeof (char)); newGH->out2D_last = (int *) malloc (numvars * sizeof (int)); /* Allocate geometry structure for each grid variable/array */ newGH->out_geo = (IOJpegGeo_t**) malloc(SLABSKEL_MAXDIM * sizeof (IOJpegGeo_t)); for (iv=0;ivout_geo[iv] = (IOJpegGeo_t*) malloc(SLABSKEL_MAXDIM * sizeof (IOJpegGeo_t)); } return (newGH); } int IOJpeg_InitGH (cGH *GH) { DECLARE_CCTK_PARAMETERS int inum; IOJpegGH *myGH; myGH = (IOJpegGH *) GH->extensions [CCTK_GHExtensionHandle ("IOJpeg")]; myGH->out2D_every = out_every > 0 ? out_every : -1; if (out2D_every > 0) { myGH->out2D_every = out2D_every; } for (inum=0; inumout2D_last [inum] = -1; } /* Deal with the output directories */ /* Check whether "outdirXD" was set. If so take this dir otherwise default to "IO::outdir" */ myGH->outdir2D = CCTK_ParameterQueryTimesSet("out2D_dir",CCTK_THORNSTRING)>0 ? strdup (out2D_dir) : strdup (outdir); /* create the output dir */ if (CCTK_MyProc (GH) == 0) { int i; i = CCTK_CreateDirectory (0755, myGH->outdir2D); if (i < 0) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, "IOASCII_InitGH: Problem creating 2D output directory '%s'", myGH->outdir2D); } if (i > 0) { CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, "IOASCII_InitGH: 2D output directory '%s' already exists", myGH->outdir2D); } } myGH->fileList_2D = NULL; return (0); } void IOJpeg_SliceCenterSetup(CCTK_ARGUMENTS) { DECLARE_CCTK_PARAMETERS int inum,idim; IOJpegGeo_t geo_default; IOJpegGH *myGH; myGH = (IOJpegGH *) cctkGH->extensions [CCTK_GHExtensionHandle ("IOJpeg")]; /* Loop over all slab dimension */ for (idim = 0; idim < SLABSKEL_MAXDIM; idim++) { IOJpeg_DefaultGeo(cctkGH, idim, &geo_default); /* Set the default HDF5 slab geometry for slab with dimension -idim-*/ for (inum = 0; inum < CCTK_NumVars (); inum++) { myGH->out_geo[inum][idim] = geo_default; } } }