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 --- par/iso_demo.par | 6 ++--- param.ccl | 69 +++++++++++++++++++++++++++++++++++---------------- schedule.ccl | 1 - src/IsoSurfacer.c | 8 +++--- src/IsoSurfacerInit.c | 40 ++++++++++++++++++++--------- 5 files changed, 83 insertions(+), 41 deletions(-) diff --git a/par/iso_demo.par b/par/iso_demo.par index 6ac01a9..d6639a0 100644 --- a/par/iso_demo.par +++ b/par/iso_demo.par @@ -25,7 +25,7 @@ driver::global_nz = 70 cactus::cctk_final_time = 50000000 IO::out_every = 0 -IO::outdir = "http_demo" +IO::out_dir = "http_demo" IOBasic::outInfo_every = 10 IOBasic::outInfo_vars = "WAVETOY::phi" @@ -33,7 +33,7 @@ IOBasic::outInfo_vars = "WAVETOY::phi" IOascii::out1d_every = 0 IOascii::out1d_vars = "wavetoy::phi" -isosurfacer::output_format="SOCK" -isosurfacer::output_var = "WAVETOY::phi" +IsoSurfacer::out_format="SOCK" +IsoSurfacer::out_vars = "WAVETOY::phi" isosurfacer::isovalue=0.35: diff --git a/param.ccl b/param.ccl index 8985537..c0f9137 100644 --- a/param.ccl +++ b/param.ccl @@ -3,31 +3,64 @@ private: -STRING output_format "What form to output the datasets" # STEERABLE = ALWAYS +STRING out_dir "Output directory for IsoSurfacer files, overrides IO::out_dir" { - .* :: "Comma separated list. Can be UCD, VRML, ASCII, SOCK or None" -} "None" + ".+" :: "A valid directory name" + "^$" :: "An empty string to choose the default from IO::out_dir" +} "" +STRING outdir "Output directory for IsoSurfacer files, overrides IO::out_dir DEPRECATED IN BETA13)" +{ + ".+" :: "A valid directory name" + "^$" :: "An empty string to choose the default from IO::out_dir" +} "" -STRING output_var "What Grid Function name to output" # STEERABLE = ALWAYS +STRING out_vars "Variable to output isosurfaces for" # STEERABLE = ALWAYS { - .* :: "Eventually a comma separated list, but now a single name" -} "None" + ".+" :: "Fully qualified variable name" + "^$" :: "An empty string to output nothing" +} "" +STRING output_var "Variable to output isosurfaces for (DEPRECATED IN BETA13)" # STEERABLE = ALWAYS +{ + ".+" :: "Fully qualified variable name" + "^$" :: "An empty string to output nothing" +} "" -CCTK_REAL isovalue "Isosurface value" STEERABLE = ALWAYS +INT out_every "How often to output isosurfaces, overrides IO::out_every" # STEERABLE = ALWAYS { - : :: "Any floating point value" -} 1.0 + 1:* :: "Every so many iterations" + 0: :: "Disable IsoSurfacer output" + -1: :: "Default to IO::out_every" +} -1 +INT output_frequency "How often to output isosurfaces, overrides IO::out_every (DEPRECATED IN BETA13)" # STEERABLE = ALWAYS +{ + 1:* :: "Every so many iterations" + 0: :: "Disable IsoSurfacer output" + -1: :: "Default to IO::out_every" +} -1 -INT output_frequency "How often to output the isosurfaces" # STEERABLE = ALWAYS +INT out_start "First iteration to start drawing isosurfaces" # STEERABLE = ALWAYS { 1: :: "Some positive integer" } 1 - -INT output_start "First iteration to start drawing isosurfaces. Default=1" # STEERABLE = ALWAYS +INT output_start "First iteration to start drawing isosurfaces (DEPRECATED IN BETA13)" # STEERABLE = ALWAYS { 1: :: "Some positive integer" } 1 +STRING out_format "What format to output isosufaces" # STEERABLE = ALWAYS +{ + .* :: "Comma separated list. Can be UCD, VRML, ASCII, SOCK or None" +} "None" +STRING output_format "What format to output isosufaces (DEPRECATED IN BETA13)" # STEERABLE = ALWAYS +{ + .* :: "Comma separated list. Can be UCD, VRML, ASCII, SOCK or None" +} "None" + +REAL isovalue "Isosurface value" STEERABLE = ALWAYS +{ + : :: "Any floating point value" +} 1.0 + INT dataport "dataport for socket connection (output port)" { 1:65535 :: "Some positive integer" @@ -51,11 +84,6 @@ BOOLEAN allow_empty_sends "Allow the Isosurfacer to send zero-length vertex list { } "no" -STRING outdir "Output directory for isosurface data files" -{ - .* :: "A regex which matches everything" -} "." - STRING isosurfacer " What to isosurface and how. Format:{(functionName) (isolevel1, isolevel2, ...) (format1, format2, ...) (itiso, resolution, firstIteration, uniqverts)} {} ...:: only for backward compability with old isosurfacer" { .* :: "compatability with original isosurfacer" @@ -67,7 +95,6 @@ STRING isosurfacer " What to isosurface and how. Format:{(functionName) (isoleve ############################################################################# shares: IO -#################### -# verbose flag -#################### -USES BOOLEAN verbose +#FIXME: want USES STRING out_dir AS default_out_dir +#FIXME: want USES INT out_every AS default_out_every +USES KEYWORD verbose diff --git a/schedule.ccl b/schedule.ccl index 2c8ab9b..f812d36 100644 --- a/schedule.ccl +++ b/schedule.ccl @@ -1,6 +1,5 @@ # Schedule definitions for thorn IsoSurfacer # $Header$ -# schedule IsoSurfacer_Startup at STARTUP schedule IsoSurfacer_Startup at STARTUP { 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