aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlanfer <lanfer@0888f3d4-9f52-45d2-93bc-d00801ff5e46>2000-08-01 19:01:00 +0000
committerlanfer <lanfer@0888f3d4-9f52-45d2-93bc-d00801ff5e46>2000-08-01 19:01:00 +0000
commit4b25e98415938d02f6ab5738c4842ac74fa5f6d4 (patch)
tree11c80dbd94de47a0f786caa7fa5ea546ee6bd14f
parent2131180644740cc1e36a2ca0cd9fca479077c960 (diff)
steerable Hyperslab capabilities for Streamed HDF5
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOStreamedHDF5/trunk@11 0888f3d4-9f52-45d2-93bc-d00801ff5e46
-rw-r--r--src/DumpVar.c28
-rw-r--r--src/GHExtension.c1
-rw-r--r--src/Output.c2
-rw-r--r--src/Startup.c9
-rw-r--r--src/StreamedHDF5GH.h16
-rw-r--r--src/make.code.defn3
6 files changed, 34 insertions, 25 deletions
diff --git a/src/DumpVar.c b/src/DumpVar.c
index 2c33110..e44f0d7 100644
--- a/src/DumpVar.c
+++ b/src/DumpVar.c
@@ -1,7 +1,7 @@
/*@@
@file DumpVar.c
@date Fri May 21 1999
- @author Thomas Radke
+ @author Thomas Radke / Gerd Lanfermann
@desc
Do the actual writing of a variable.
@enddesc
@@ -37,6 +37,7 @@ static int GetHDF5type (StreamedHDF5GH *myGH, int vtype, hid_t *hdf5_type);
@author Thomas Radke
@desc
Generic dump routine, just calls the appropriate dump routine
+ Extracts the data with Hyperslab.
@enddesc
@calledby StreamedHDF5_DumpGH IOHDF5_Write3D
@history
@@ -67,9 +68,10 @@ int StreamedHDF5_DumpVar (cGH *GH, int index, int timelevel, hid_t fid)
DECLARE_CCTK_PARAMETERS
int i, vdim;
void *data;
- int *origin, *directions, *lengths, *downsamples, *hsizes;
+ int *hsizes;
hid_t hdf5_type;
StreamedHDF5GH *myGH;
+ StreamGeo_t geo;
int vtype;
@@ -83,26 +85,18 @@ int StreamedHDF5_DumpVar (cGH *GH, int index, int timelevel, hid_t fid)
"Unsupported variable type %d", vtype);
return (-1);
}
+ /* shortcut to the slab geometry */
+ geo = myGH->geo_output[index];
/* get the dimension of the variable */
vdim = CCTK_GroupDimI (CCTK_GroupIndexFromVarI (index));
- origin = (int *) malloc (5 * vdim * sizeof (int));
- directions = origin + 1*vdim;
- lengths = origin + 2*vdim;
- downsamples = origin + 3*vdim;
- hsizes = origin + 4*vdim;
-
- for (i = 0; i < vdim; i++)
- {
- origin [i] = 0;
- lengths [i] = -1;
- downsamples [i] = 1;
- }
+ hsizes = (int*)malloc(geo.sdim*sizeof(int));
data = NULL;
- if (Hyperslab_GetHyperslab (GH, 0, index, timelevel, vdim, origin,
- directions, lengths, downsamples,
+
+ if (Hyperslab_GetHyperslab (GH, 0, index, timelevel, geo.sdim, geo.origin,
+ geo.direction, geo.length, geo.downs,
&data, hsizes) < 0)
{
char *fullname = CCTK_FullName (index);
@@ -111,7 +105,6 @@ int StreamedHDF5_DumpVar (cGH *GH, int index, int timelevel, hid_t fid)
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
"Failed to extract hyperslab for variable '%s'", fullname);
free (fullname);
- free (origin);
return (-1);
}
@@ -122,7 +115,6 @@ int StreamedHDF5_DumpVar (cGH *GH, int index, int timelevel, hid_t fid)
if (data)
free (data);
- free (origin);
return (0);
}
diff --git a/src/GHExtension.c b/src/GHExtension.c
index 9912b0f..b64386e 100644
--- a/src/GHExtension.c
+++ b/src/GHExtension.c
@@ -34,6 +34,7 @@ void *StreamedHDF5_SetupGH (tFleshConfig *config, int convergence_level, cGH *GH
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 */
diff --git a/src/Output.c b/src/Output.c
index 199db92..7309065 100644
--- a/src/Output.c
+++ b/src/Output.c
@@ -261,7 +261,7 @@ static void CheckSteerableParameters (StreamedHDF5GH *myGH)
/* re-parse the 'out_vars' parameter if it was changed */
if (paramdata->n_set != out_vars_lastset) {
- IOUtil_ParseVarsForOutput (out_vars, myGH->do_output);
+ ParseVarsForOutput (myGH, out_vars);
/* Save the last setting of 'out_vars' parameter */
out_vars_lastset = paramdata->n_set;
diff --git a/src/Startup.c b/src/Startup.c
index 650570f..bd1cdb9 100644
--- a/src/Startup.c
+++ b/src/Startup.c
@@ -151,9 +151,10 @@ static void *StreamedHDF5_SetupGH (tFleshConfig *config, int convergence_level,
numvars = CCTK_NumVars ();
newGH = (StreamedHDF5GH *) malloc (sizeof (StreamedHDF5GH));
- newGH->do_output = (char *) malloc (numvars * sizeof (char));
- newGH->out_last = (int *) malloc (numvars * sizeof (int));
- newGH->socket = socket;
+ 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));
+ newGH->socket = socket;
/* save the original error printing routine and its argument */
CACTUS_IOHDF5_ERROR (H5Eget_auto (&newGH->printErrorFn,
@@ -197,7 +198,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;
- IOUtil_ParseVarsForOutput (out_vars, myGH->do_output);
+ 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 f0433a7..020bd27 100644
--- a/src/StreamedHDF5GH.h
+++ b/src/StreamedHDF5GH.h
@@ -105,6 +105,19 @@ extern "C" {
H5T_NATIVE_INT : H5T_NATIVE_SHORT)
#define IOHDF5_CHAR H5T_NATIVE_CHAR
+#define STREAM_MAXDIM 5
+
+/* Geometry information structure for output variable */
+typedef struct
+{
+ int vdim;
+ int sdim;
+ int direction[STREAM_MAXDIM];
+ int origin[STREAM_MAXDIM];
+ int length[STREAM_MAXDIM];
+ int downs[STREAM_MAXDIM];
+} StreamGeo_t;
+
/* StreamedHDF5 GH extension structure */
typedef struct StreamedHDF5GH
@@ -113,7 +126,8 @@ typedef struct StreamedHDF5GH
int out_every;
/* flags indicating output for var [i] */
- char *do_output;
+ char *do_output;
+ StreamGeo_t *geo_output;
/* the last iteration output */
int *out_last;
diff --git a/src/make.code.defn b/src/make.code.defn
index bab18b5..6cdc182 100644
--- a/src/make.code.defn
+++ b/src/make.code.defn
@@ -2,4 +2,5 @@
# $Header$
# Source files in this directory
-SRCS = Startup.c GHExtension.c Output.c Write.c DumpVar.c
+SRCS = Startup.c GHExtension.c Output.c Write.c DumpVar.c ParseGeometry.c ParseVars.c
+