From 5b469bd4a94f2cba17ca871a39548eb671dd1da6 Mon Sep 17 00:00:00 2001 From: tradke Date: Tue, 26 Oct 1999 23:40:17 +0000 Subject: Tidying up several things: - use ParseVarsForOutput() instead of InitIONum() for parsing the out_vars parameter - decide which output dir shall be used by using CCTK_ParameterInfo() rather than comparing it with its old "outdir" default value - outdirs are always created now (not only if out_vars was non-empty) because IO methods might be invoked via CCTK_OutputVarAs() also - some variables renamed for better readability git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOBasic/trunk@14 b589c3ab-70e8-4b4d-a09f-cba2dd200880 --- src/GHExtension.c | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) (limited to 'src/GHExtension.c') diff --git a/src/GHExtension.c b/src/GHExtension.c index 3cfaa02..3313abc 100644 --- a/src/GHExtension.c +++ b/src/GHExtension.c @@ -15,6 +15,7 @@ #include "cctk.h" #include "cctk_parameters.h" +#include "cctk_ParameterFunctions.h" #include "CactusBase/IOUtil/src/ioGH.h" #include "iobasicGH.h" @@ -29,11 +30,11 @@ void *IOBasic_SetupGH (tFleshConfig *config, int convergence_level, cGH *GH) for (i=0;iinfovals[i] = (CCTK_REAL *) malloc (2 * sizeof (CCTK_REAL)); - newGH->Scalarnum = (int *) malloc (CCTK_NumVars () * sizeof (int)); - newGH->Scalarlast = (int *) malloc (CCTK_NumVars () * sizeof (int)); + newGH->do_outScalar = (char *) malloc (CCTK_NumVars () * sizeof (char)); + newGH->outScalar_last = (int *) malloc (CCTK_NumVars () * sizeof (int)); - newGH->infonum = (int *) malloc (CCTK_NumVars () * sizeof (int)); - newGH->infolast = (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; } @@ -43,39 +44,40 @@ 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->infoevery = out_every > 0 ? out_every : -1; + myGH->outInfo_every = out_every > 0 ? out_every : -1; if (outInfo_every > 0) - myGH->infoevery = outInfo_every; + myGH->outInfo_every = outInfo_every; - myGH->Scalarevery = out_every > 0 ? out_every : -1; + myGH->outScalar_every = out_every > 0 ? out_every : -1; if (outScalar_every > 0) - myGH->Scalarevery = outScalar_every; + myGH->outScalar_every = outScalar_every; - InitIONum(myGH->infonum,outInfo_vars); - InitIONum(myGH->Scalarnum,outScalar_vars); + ParseVarsForOutput (outInfo_vars, myGH->do_outInfo); + ParseVarsForOutput (outScalar_vars, myGH->do_outScalar); - /* Deal with the output directories */ - myGH->outpfx_Scalar = outdir; - if (!CCTK_Equals(outdirScalar,"outdir")) - myGH->outpfx_Scalar = outdirScalar; + /* 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 = outdirScalar; + else + myGH->outdirScalar = outdir; - /* Create the output directories */ - if (myGH->Scalarevery > 0) { - if (CCTK_MyProc (GH) == 0) { - CCTK_mkdir(myGH->outpfx_Scalar); - } - } + /* create the output dir */ + if (CCTK_MyProc (GH) == 0) + CCTK_mkdir (myGH->outdirScalar); for (i=0; iScalarlast[i] = -1; + myGH->outScalar_last[i] = -1; for (i=0; iinfolast [i] = -1; + myGH->outInfo_last [i] = -1; for (i=0; i