From 963aacf088f5c62136db11d92fbe117918b97887 Mon Sep 17 00:00:00 2001 From: tradke Date: Mon, 6 May 2002 09:16:15 +0000 Subject: Parameter names changes as announced in today's mail to users@cactuscode.org. You must also update thorn IOUtil now. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IsoSurfacer/trunk@60 bfcf8e34-485d-4d46-a995-1fd6fa6fb178 --- src/IsoSurfacer.c | 8 ++++---- src/IsoSurfacerInit.c | 40 ++++++++++++++++++++++++++++------------ 2 files changed, 32 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/IsoSurfacer.c b/src/IsoSurfacer.c index 2ef852c..ef9fb9f 100644 --- a/src/IsoSurfacer.c +++ b/src/IsoSurfacer.c @@ -121,7 +121,7 @@ static int IsoSurfacerHandleCommands(const cGH *GH) CCTK_REAL tmpval; pGH *pughGH = PUGH_pGH (GH); if(pughGH->myproc==0 && Iso_PollCommand(GH,&command)){ - if (verbose) + if (CCTK_Equals (verbose, "full")) { printf("+++++++++Process Command [%s] [%s] [%s]\n", command.cmd.object,command.cmd.target,command.cmd.value); @@ -146,7 +146,7 @@ static int IsoSurfacerHandleCommands(const cGH *GH) } #else if(Iso_PollCommand(GH,&command)){ - if (verbose) + if (CCTK_Equals (verbose, "full")) { printf("+++++++++Process Command [%s] [%s] [%s]\n", command.cmd.object,command.cmd.target,command.cmd.value); @@ -242,13 +242,13 @@ static void computeIso(int vindex, const cGH *GH, isosurfacerGH *myGH) polybackup=myGH->totals.polys; myGH->totals.polys = tmppolys; vertbackup=myGH->totals.verts; myGH->totals.verts = tmpverts; } - if (verbose) + if (CCTK_Equals (verbose, "full")) printf(" | IsoSurfacer: GF=%s, value %f,", fullname, myGH->isovalue); if(myGH->totals.nverts > 0) { - if (verbose) + if (CCTK_Equals (verbose, "full")) printf("%d vertices, %d triangles\n", myGH->totals.nverts, myGH->totals.npolys); if(myGH->formats & BIN) 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 -#include -#include +#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();ifuncName=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 '.' */ -- cgit v1.2.3