From 38fbe980f6b9275467ce7c54d9d4ab5cd68478d3 Mon Sep 17 00:00:00 2001 From: tradke Date: Wed, 9 Jun 2004 10:42:16 +0000 Subject: After setup, do an initial I/O parameter parsing and warn/stop on parsing errors (depending on IO::strict_io_parameter_check). You will also need to update CactusBase/IOUtil. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5/trunk@197 4825ed28-b72c-4eae-9704-e50c059e567d --- src/Output.c | 38 ++++++++++++++++++++------------------ src/Startup.c | 9 +++++++++ src/ioHDF5GH.h | 5 ++++- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/src/Output.c b/src/Output.c index 05b6789..4d192bd 100644 --- a/src/Output.c +++ b/src/Output.c @@ -38,7 +38,6 @@ typedef struct /******************************************************************** ******************** Internal Routines ************************ ********************************************************************/ -static void CheckSteerableParameters (const cGH *GH); static void OutputVarAs (int vindex, const char *optstring, void *arg); @@ -149,7 +148,7 @@ int IOHDF5_OutputVarAs (const cGH *GH, const char *fullname, const char *alias) using the IOHDF5 I/O method. @enddesc - @calls CheckSteerableParameters + @calls IOHDF5_CheckSteerableParameters @var GH @vdesc pointer to CCTK GH @@ -172,13 +171,13 @@ int IOHDF5_TimeFor (const cGH *GH, int vindex) { int retval; char *fullname; - const ioHDF5GH *myGH; + ioHDF5GH *myGH; - CheckSteerableParameters (GH); + myGH = CCTK_GHExtension (GH, "IOHDF5"); + IOHDF5_CheckSteerableParameters (GH, myGH); /* check if this variable should be output */ - myGH = CCTK_GHExtension (GH, "IOHDF5"); retval = myGH->requests[vindex] && myGH->requests[vindex]->out_every > 0 && GH->cctk_iteration % myGH->requests[vindex]->out_every == 0; if (retval) @@ -260,11 +259,8 @@ int IOHDF5_TriggerOutput (const cGH *GH, int vindex) } -/******************************************************************** - ******************** Internal Routines ************************ - ********************************************************************/ /*@@ - @routine CheckSteerableParameters + @routine IOHDF5_CheckSteerableParameters @date Mon Oct 10 2000 @author Thomas Radke @desc @@ -279,17 +275,20 @@ int IOHDF5_TriggerOutput (const cGH *GH, int vindex) @vtype const cGH * @vio in @endvar + @var myGH + @vdesc pointer to IOHDF5 grid hierarchy + @vtype ioHDF5GH * + @vio inout + @endvar @@*/ -static void CheckSteerableParameters (const cGH *GH) +void IOHDF5_CheckSteerableParameters (const cGH *GH, ioHDF5GH *myGH) { int i; - ioHDF5GH *myGH; char *fullname, *msg; DECLARE_CCTK_PARAMETERS /* how often to output */ - myGH = CCTK_GHExtension (GH, "IOHDF5"); i = myGH->out_every_default; myGH->out_every_default = out_every >= 0 ? out_every : io_out_every; @@ -298,12 +297,12 @@ static void CheckSteerableParameters (const cGH *GH) { if (myGH->out_every_default > 0) { - CCTK_VInfo (CCTK_THORNSTRING, "IOHDF5: Periodic output every %d " + CCTK_VInfo (CCTK_THORNSTRING, "Periodic HDF5 output every %d " "iterations", myGH->out_every_default); } else { - CCTK_INFO ("IOHDF5: Periodic output turned off"); + CCTK_INFO ("Periodic HDF5 output turned off"); } } @@ -311,8 +310,8 @@ static void CheckSteerableParameters (const cGH *GH) if (strcmp (out_vars, myGH->out_vars) || myGH->out_every_default != i) { IOUtil_ParseVarsForOutput (GH, CCTK_THORNSTRING, "IOHDF5::out_vars", - out_vars, myGH->out_every_default, - myGH->requests); + myGH->stop_on_parse_errors, out_vars, + myGH->out_every_default, myGH->requests); if (myGH->out_every_default == i || ! CCTK_Equals (verbose, "none")) { @@ -324,7 +323,7 @@ static void CheckSteerableParameters (const cGH *GH) fullname = CCTK_FullName (i); if (! msg) { - Util_asprintf (&msg, "IOHDF5: Periodic output requested for '%s'", + Util_asprintf (&msg, "Periodic HDF5 output requested for '%s'", fullname); } else @@ -348,6 +347,9 @@ static void CheckSteerableParameters (const cGH *GH) } +/******************************************************************** + ******************** Internal Routines ************************ + ********************************************************************/ /*@@ @routine OutputVarAs @date Fri 6 June 2003 @@ -400,7 +402,7 @@ static void OutputVarAs (int vindex, const char *optstring, void *arg) if (oneshot) { IOUtil_ParseVarsForOutput (info->GH, CCTK_THORNSTRING, "IOHDF5::out_vars", - info->fullname, 1, myGH->requests); + 0, info->fullname, 1, myGH->requests); } /* do the output */ diff --git a/src/Startup.c b/src/Startup.c index 9bafc73..2d2e06e 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -137,6 +137,15 @@ static void *SetupGH (tFleshConfig *config, int conv_level, cGH *GH) myGH->out_every_default = out_every - 1; myGH->last_checkpoint_iteration = -1; + myGH->stop_on_parse_errors = strict_io_parameter_check; + if (! CCTK_Equals (verbose, "none")) + { + CCTK_INFO ("I/O Method 'IOHDF5' registered: output of grid variables and " + "hyperslabs thereof to HDF5 files"); + } + IOHDF5_CheckSteerableParameters (GH, myGH); + myGH->stop_on_parse_errors = 0; + /* get the name of IOHDF5's output directory */ my_out_dir = out_dir; if (*my_out_dir == 0) diff --git a/src/ioHDF5GH.h b/src/ioHDF5GH.h index 35c924b..927389e 100644 --- a/src/ioHDF5GH.h +++ b/src/ioHDF5GH.h @@ -51,6 +51,9 @@ typedef struct /* iteration number of the last checkpoint */ int last_checkpoint_iteration; + /* stop on I/O parameter parsing errors ? */ + int stop_on_parse_errors; + } ioHDF5GH; #ifdef __cplusplus @@ -79,7 +82,7 @@ int IOHDF5_WriteIsosurface (const cGH *GH, const CCTK_INT4 *triangles, int nVertices, const CCTK_REAL4 *vertices); - +void IOHDF5_CheckSteerableParameters (const cGH *GH, ioHDF5GH *myGH); #ifdef __cplusplus } // extern "C" #endif -- cgit v1.2.3