/*@@ @file GHExtension.c @date Friday 18th September @author Gabrielle Allen @desc IO GH extension stuff. @enddesc @@*/ /* #define DEBUG_IO */ #include #include #include #include "cctk.h" #include "cctk_parameters.h" #include "cctk_ParameterFunctions.h" #include "CactusBase/IOUtil/src/ioGH.h" #include "iobasicGH.h" void *IOBasic_SetupGH (tFleshConfig *config, int convergence_level, cGH *GH) { int i; iobasicGH *newGH; newGH = (iobasicGH *) malloc (sizeof (iobasicGH)); newGH->infovals = (CCTK_REAL **) malloc (CCTK_NumVars () * sizeof (CCTK_REAL *)); for (i=0;iinfovals[i] = (CCTK_REAL *) malloc (2 * sizeof (CCTK_REAL)); newGH->do_outScalar = (char *) malloc (CCTK_NumVars () * sizeof (char)); newGH->outScalar_last = (int *) malloc (CCTK_NumVars () * sizeof (int)); newGH->do_outInfo = (char *) malloc (CCTK_NumVars () * sizeof (char)); newGH->outInfo_last = (int *) malloc (CCTK_NumVars () * sizeof (int)); return newGH; } int IOBasic_InitGH (cGH *GH) { DECLARE_CCTK_PARAMETERS int i; iobasicGH *myGH; t_param_prop *param_prop; /* get the handles for IOBasic extensions */ myGH = (iobasicGH *) GH->extensions [CCTK_GHExtensionHandle ("IOBasic")]; myGH->filenameListScalar = NULL; /* How often to output */ myGH->outInfo_every = out_every > 0 ? out_every : -1; if (outInfo_every > 0) myGH->outInfo_every = outInfo_every; myGH->outScalar_every = out_every > 0 ? out_every : -1; if (outScalar_every > 0) myGH->outScalar_every = outScalar_every; ParseVarsForOutput (outInfo_vars, myGH->do_outInfo); ParseVarsForOutput (outScalar_vars, myGH->do_outScalar); /* Check whether "outdirScalar" was set. If so take this dir otherwise default to "IO::outdir" */ param_prop = CCTK_ParameterInfo ("outdirScalar", CCTK_THORNSTRING); if (param_prop && param_prop->n_set > 0) myGH->outdirScalar = strdup (outdirScalar); else myGH->outdirScalar = strdup (outdir); /* create the output dir */ if (CCTK_MyProc (GH) == 0) CCTK_mkdir (myGH->outdirScalar); for (i=0; ioutScalar_last[i] = -1; for (i=0; ioutInfo_last [i] = -1; for (i=0; iinfovals[i][0] = 0.0; myGH->infovals[i][1] = 0.0; } myGH->filenameListScalar = NULL; return 0; USE_CCTK_PARAMETERS } int IOBasic_rfrTraverseGH(cGH *GH, int rfrpoint) { return 0; }