diff options
Diffstat (limited to 'src/IsoSurfacerInit.c')
-rw-r--r-- | src/IsoSurfacerInit.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/src/IsoSurfacerInit.c b/src/IsoSurfacerInit.c index 7fb1981..0cfe99b 100644 --- a/src/IsoSurfacerInit.c +++ b/src/IsoSurfacerInit.c @@ -9,9 +9,10 @@ #include <ctype.h> -#include <cctk.h> -#include <cctk_Parameters.h> +#include "cctk.h" +#include "cctk_Parameters.h" #include "CactusPUGH/PUGH/src/include/pugh.h" +#include "CactusBase/IOUtil/src/ioutil_Utils.h" #include "IsoSurfacerInit.h" static const char *rcsid = "$Id$"; @@ -61,14 +62,19 @@ int IsoSurfacer_InitGH (cGH *GH){ int Iso_SetupServer(cGH *, isosurfacerGH *, int , int , int , int ); - myGH = (isosurfacerGH *) GH->extensions [CCTK_GHExtensionHandle ("IsoSurfacer")]; + myGH = (isosurfacerGH *) CCTK_GHExtension (GH, "IsoSurfacer"); /*printf("IsoInit\n"); */ /* initialize values */ myGH->funcName=0; myGH->formats=0; - myGH->outfreq=output_frequency; - myGH->firstIteration=output_start; + myGH->outfreq=out_every; + if (myGH->outfreq < 0) + { + myGH->outfreq = *(const CCTK_INT *) + CCTK_ParameterGet ("out_every", CCTK_ImplementationThorn ("IO"), NULL); + } + myGH->firstIteration=out_start; myGH->ComputeNormals=compute_normals; /* printf("************* compute Normals = %u *****************\n", myGH->ComputeNormals); */ @@ -84,7 +90,7 @@ int IsoSurfacer_InitGH (cGH *GH){ for(i=0,n=CCTK_NumVars();i<n;i++){ char *fullname = CCTK_FullName (i); - if(CCTK_Equals (fullname, output_var)) + if(CCTK_Equals (fullname, out_vars)) myGH->funcName=strdup (fullname); /* Maybe even set the GF here ? */ free(fullname); @@ -106,12 +112,22 @@ int IsoSurfacer_InitGH (cGH *GH){ else myGH->RunIsoSurfacer = 1; - if (CCTK_MyProc (GH) == 0 && strcmp(outdir,".")){ - char *cmd = (char *) malloc (strlen (outdir) + 80); - sprintf (cmd, "mkdir -p %s", outdir); - if (system (cmd) < 0) - CCTK_WARN (1, "Problem creating IsoSurfacer output directory"); - free (cmd); + /* get the name for IsoSurfacer output directory and make sure it exists */ + if (*out_dir == 0) + { + out_dir = *(const char **) + CCTK_ParameterGet ("out_dir", CCTK_ImplementationThorn ("IO"), NULL); + } + i = IOUtil_CreateDirectory (GH, out_dir, 0, 0); + if (i < 0) + { + CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Problem creating IsoSurfacer output directory '%s'", out_dir); + } + else if (i >= 0 && CCTK_Equals (verbose, "full")) + { + CCTK_VInfo (CCTK_THORNSTRING, "IsoSurfacer: Output to directory '%s'", + out_dir); } Iso_SetupServer(GH,myGH,dataport,controlport, 5, 1); /* needs to move into InitGH */ /* otherwise, the outdir need not be created if it is '.' */ |