From 60d2690fc086c69a8a4849e7ccbd11bd1211e715 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/IOPanda/trunk@70 38c3d835-c875-442e-b0fe-21c19ce1d001 --- src/Output.c | 28 +++++++++++++--------------- src/Startup.c | 8 ++++++++ src/ioPandaGH.h | 3 +++ 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/Output.c b/src/Output.c index a7b8813..2b3bc75 100644 --- a/src/Output.c +++ b/src/Output.c @@ -30,7 +30,6 @@ CCTK_FILEVERSION(CactusPUGHIO_IOPanda_Output_c) /******************************************************************** ******************** Internal Routines ************************ ********************************************************************/ -static void CheckSteerableParameters (const cGH *GH); static int DumpVar (const cGH *GH, const ioRequest *request, const char *alias); static void IEEEIOStructDump (const cGH *GH, const char *fname); static void AddCommonAttributes (const cGH *GH, const ioRequest *request, @@ -141,7 +140,7 @@ int IOPanda_OutputVarAs (const cGH *GH, const char *fullname, const char *alias) if (oneshot) { IOUtil_ParseVarsForOutput (GH, CCTK_THORNSTRING, "IOPanda::out_vars", - fullname, 1, myGH->requests); + 0, fullname, 1, myGH->requests); } /* do the output */ @@ -165,7 +164,7 @@ int IOPanda_OutputVarAs (const cGH *GH, const char *fullname, const char *alias) using the IOPanda output method @enddesc - @calls CheckSteerableParameters + @calls IOPanda_CheckSteerableParameters @var GH @vdesc pointer to CCTK GH @@ -191,7 +190,7 @@ int IOPanda_TimeFor (const cGH *GH, int vindex) const pandaGH *myGH; - CheckSteerableParameters (GH); + IOPanda_CheckSteerableParameters (GH); /* check if this variable should be output */ myGH = (const pandaGH *) CCTK_GHExtension (GH, "IOPanda"); @@ -270,11 +269,8 @@ int IOPanda_TriggerOutput (const cGH *GH, int vindex) } -/******************************************************************** - ******************** Internal Routines ************************ - ********************************************************************/ /*@@ - @routine CheckSteerableParameters + @routine IOPanda_CheckSteerableParameters @date Mon Oct 10 2000 @author Thomas Radke @desc @@ -290,7 +286,7 @@ int IOPanda_TriggerOutput (const cGH *GH, int vindex) @vio in @endvar @@*/ -static void CheckSteerableParameters (const cGH *GH) +void IOPanda_CheckSteerableParameters (const cGH *GH) { int i, vindex, num_vars; pandaGH *myGH; @@ -308,12 +304,12 @@ static void CheckSteerableParameters (const cGH *GH) { if (myGH->out_every_default > 0) { - CCTK_VInfo (CCTK_THORNSTRING, "IOPanda: Periodic output every %d " + CCTK_VInfo (CCTK_THORNSTRING, "Periodic IOPanda output every %d " "iterations", myGH->out_every_default); } else { - CCTK_INFO ("IOPanda: Periodic output turned off"); + CCTK_INFO ("Periodic IOPanda output turned off"); } } @@ -321,8 +317,8 @@ static void CheckSteerableParameters (const cGH *GH) if (strcmp (out_vars, myGH->out_vars) || myGH->out_every_default != i) { IOUtil_ParseVarsForOutput (GH, CCTK_THORNSTRING, "IOPanda::out_vars", - out_vars, myGH->out_every_default, - myGH->requests); + myGH->stop_on_parse_errors, out_vars, + myGH->out_every_default, myGH->requests); /*** FIXME: IEEEIO doesn't provide a COMPLEX datatype so we should map CCTK_COMPLEX to two REALs here. @@ -369,7 +365,7 @@ static void CheckSteerableParameters (const cGH *GH) fullname = CCTK_FullName (vindex); if (! msg) { - Util_asprintf (&msg, "IOPanda: Periodic output requested for '%s'", + Util_asprintf (&msg, "Periodic IOPanda output requested for '%s'", fullname); } else @@ -393,6 +389,9 @@ static void CheckSteerableParameters (const cGH *GH) } +/******************************************************************** + ******************** Internal Routines ************************ + ********************************************************************/ static int DumpVar (const cGH *GH, const ioRequest *request, const char *alias) { void *hdata; @@ -579,7 +578,6 @@ static void AddCommonAttributes (const cGH *GH, const ioRequest *request, CCTK_REAL *dtmp; CCTK_INT *coord_handles; const ioGH *ioUtilGH; - char coord_system_name[20]; ioUtilGH = CCTK_GHExtension (GH, "IO"); diff --git a/src/Startup.c b/src/Startup.c index 457198f..eaaa737 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -157,6 +157,14 @@ static void *SetupGH (tFleshConfig *config, int convergence_level, cGH *GH) myGH->out_last[i] = -1; } + myGH->stop_on_parse_errors = strict_io_parameter_check; + if (! CCTK_Equals (verbose, "none")) + { + CCTK_INFO ("I/O Method 'IOPanda' registered: output of grid variables and " + "hyperslabs thereof to Panda files"); + } + IOPanda_CheckSteerableParameters (GH); + /* get the name of IOPanda's output directory */ my_out_dir = out_dir; if (*my_out_dir == 0) diff --git a/src/ioPandaGH.h b/src/ioPandaGH.h index 51017a8..c5856a2 100644 --- a/src/ioPandaGH.h +++ b/src/ioPandaGH.h @@ -39,6 +39,9 @@ typedef struct /* directory in which to output */ char *out_dir; + + /* stop on I/O parameter parsing errors ? */ + int stop_on_parse_errors; } pandaGH; -- cgit v1.2.3