aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@0888f3d4-9f52-45d2-93bc-d00801ff5e46>2000-08-01 20:04:09 +0000
committertradke <tradke@0888f3d4-9f52-45d2-93bc-d00801ff5e46>2000-08-01 20:04:09 +0000
commitc569da39709cd447ad646a8b3a3eb2e7fe75e11d (patch)
treeb515edeb96d79045cdf4fa0a2c498680dd4e664f
parent7235d480563efd9a6a5e8b32a8901e2e550fb070 (diff)
Fixed bugs for outputting multiple vars.
Fixed some warnings. Removed GHExtensions.c which did the same as Startup.c. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOStreamedHDF5/trunk@15 0888f3d4-9f52-45d2-93bc-d00801ff5e46
-rw-r--r--src/DumpVar.c5
-rw-r--r--src/GHExtension.c84
-rw-r--r--src/Startup.c6
-rw-r--r--src/StreamedHDF5GH.h1
-rw-r--r--src/make.code.defn3
5 files changed, 9 insertions, 90 deletions
diff --git a/src/DumpVar.c b/src/DumpVar.c
index e44f0d7..86fb5cc 100644
--- a/src/DumpVar.c
+++ b/src/DumpVar.c
@@ -66,7 +66,7 @@ static int GetHDF5type (StreamedHDF5GH *myGH, int vtype, hid_t *hdf5_type);
int StreamedHDF5_DumpVar (cGH *GH, int index, int timelevel, hid_t fid)
{
DECLARE_CCTK_PARAMETERS
- int i, vdim;
+ int vdim;
void *data;
int *hsizes;
hid_t hdf5_type;
@@ -331,7 +331,8 @@ static void StreamedHDF5_Dump (cGH *GH, int index, int timelevel, void *outme,
/* build the unique dataset name */
name = CCTK_FullName (index);
- datasetname = (char *) malloc (strlen (name) + 3);
+ datasetname = (char *) malloc (strlen (name) + 30); /* 30 chars should be
+ enough for 2 ints */
sprintf (datasetname, "%s@%d@%d", name, GH->cctk_iteration, timelevel);
free (name);
diff --git a/src/GHExtension.c b/src/GHExtension.c
deleted file mode 100644
index b64386e..0000000
--- a/src/GHExtension.c
+++ /dev/null
@@ -1,84 +0,0 @@
- /*@@
- @file GHExtension.c
- @date Fri May 21 1999
- @author Thomas Radke
- @desc
- StreamedHDF5 GH extension stuff.
- @enddesc
- @history
- @hauthor Thomas Radke @hdate May 21 1999
- @hdesc Just copied from thorn FlexIO.
- @endhistory
- @@*/
-
-
-/*#define DEBUG_IO*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "cctk.h"
-#include "cctk_Parameters.h"
-#include "CactusBase/IOUtil/src/ioGH.h"
-#include "StreamedHDF5GH.h"
-
-
-void *StreamedHDF5_SetupGH (tFleshConfig *config, int convergence_level, cGH *GH)
-{
- int numvars;
- StreamedHDF5GH *newGH;
-
-
- numvars = CCTK_NumVars ();
-
- newGH = (StreamedHDF5GH *) malloc (sizeof (StreamedHDF5GH));
- newGH->do_output = (char *) malloc (numvars * sizeof (char));
- newGH->geo_output = (StreamGeo_t*) malloc (numvars * sizeof (StreamGeo_t));
- newGH->out_last = (int *) malloc (numvars * sizeof (int));
-
- /* save the original error printing routine and its argument */
- CACTUS_IOHDF5_ERROR (H5Eget_auto (&newGH->printErrorFn,
- &newGH->printErrorFnArg));
-
- /* predefine dataspaces for writing scalar and array attributes */
- /* the dimension of the array dataspace is set when used */
- CACTUS_IOHDF5_ERROR (newGH->scalarDataspace = H5Screate (H5S_SCALAR));
- CACTUS_IOHDF5_ERROR (newGH->arrayDataspace = H5Screate (H5S_SIMPLE));
-
- /* predefine a IOHDF5_COMPLEX datatype */
- CACTUS_IOHDF5_ERROR (newGH->IOHDF5_COMPLEX =
- H5Tcreate (H5T_COMPOUND, sizeof (CCTK_COMPLEX)));
- CACTUS_IOHDF5_ERROR (H5Tinsert (newGH->IOHDF5_COMPLEX, "real",
- offsetof (CCTK_COMPLEX, Re), IOHDF5_REAL));
- CACTUS_IOHDF5_ERROR (H5Tinsert (newGH->IOHDF5_COMPLEX, "imag",
- offsetof (CCTK_COMPLEX, Im), IOHDF5_REAL));
-
- /* predefine a C string datatype */
- CACTUS_IOHDF5_ERROR (newGH->IOHDF5_STRING = H5Tcopy (H5T_C_S1));
-
- return (newGH);
-}
-
-
-int StreamedHDF5_InitGH (cGH *GH)
-{
- DECLARE_CCTK_PARAMETERS
- int i;
- StreamedHDF5GH *myGH;
- const cParamData *paramdata;
-
-
- myGH = (StreamedHDF5GH *) GH->extensions [CCTK_GHExtensionHandle ("StreamedHDF5")];
-
- /* How often to output */
- myGH->out_every = out_every > 0 ? out_every : -1;
- if (outHDF5_every > 0)
- myGH->out_every = outHDF5_every;
- IOUtil_ParseVarsForOutput (out_vars, myGH->do_output);
-
- for (i = 0; i < CCTK_NumVars (); i++)
- myGH->out_last [i] = -1;
-
- return (0);
-}
diff --git a/src/Startup.c b/src/Startup.c
index bd1cdb9..2faf55a 100644
--- a/src/Startup.c
+++ b/src/Startup.c
@@ -31,7 +31,9 @@ int StreamedHDF5_TimeFor(cGH *GH, int);
int StreamedHDF5_OutputVarAs(cGH *GH, const char *var, const char *alias);
/* local function prototypes */
-static void *StreamedHDF5_SetupGH (tFleshConfig *config, int convergence_level, cGH *GH);
+static void *StreamedHDF5_SetupGH (tFleshConfig *config,
+ int convergence_level,
+ cGH *GH);
static int StreamedHDF5_InitGH (cGH *GH);
@@ -198,7 +200,7 @@ static int StreamedHDF5_InitGH (cGH *GH)
myGH->out_every = out_every > 0 ? out_every : -1;
if (outHDF5_every > 0)
myGH->out_every = outHDF5_every;
- ParseVarsForOutput(myGH, out_vars);
+ ParseVarsForOutput (myGH, out_vars);
for (i = 0; i < CCTK_NumVars (); i++)
myGH->out_last [i] = -1;
diff --git a/src/StreamedHDF5GH.h b/src/StreamedHDF5GH.h
index 020bd27..3b7e464 100644
--- a/src/StreamedHDF5GH.h
+++ b/src/StreamedHDF5GH.h
@@ -155,6 +155,7 @@ void StreamedHDF5_Write (cGH *GH, int index, const char *alias);
void StreamedHDF5_DumpParams (cGH *GH, hid_t group);
void StreamedHDF5_DumpGHExtensions (cGH *GH, hid_t group);
int StreamedHDF5_DumpVar (cGH *GH, int index, int timelevel, hid_t iof);
+void ParseVarsForOutput (StreamedHDF5GH *h5GH, const char *var_list);
#ifdef __cplusplus
} // extern "C" {
diff --git a/src/make.code.defn b/src/make.code.defn
index 6cdc182..2cbdc9c 100644
--- a/src/make.code.defn
+++ b/src/make.code.defn
@@ -2,5 +2,4 @@
# $Header$
# Source files in this directory
-SRCS = Startup.c GHExtension.c Output.c Write.c DumpVar.c ParseGeometry.c ParseVars.c
-
+SRCS = Startup.c Output.c Write.c DumpVar.c ParseGeometry.c ParseVars.c