aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668>2000-11-29 01:10:37 +0000
committertradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668>2000-11-29 01:10:37 +0000
commit27d64bac96cfd0b3896763d2abad84dd08a93381 (patch)
tree7631b9b83e51a13a890ba27ee4ae912813772d0e /src
parent257767c90a7f5cc2248e697feacd1337f8fd4a8e (diff)
Use new PUGHSlab API for passing the directions of a hyperslab.
Also support single-precision output of CCTK_COMPLEX datatypes. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5Util/trunk@14 7842ec3a-9562-4be5-9c5b-06ba18f2b668
Diffstat (limited to 'src')
-rw-r--r--src/DumpUtils.c118
-rw-r--r--src/DumpVar.c222
2 files changed, 149 insertions, 191 deletions
diff --git a/src/DumpUtils.c b/src/DumpUtils.c
index 73d7fe3..d0895b3 100644
--- a/src/DumpUtils.c
+++ b/src/DumpUtils.c
@@ -57,7 +57,7 @@ int IOHDF5Util_DumpGH (cGH *GH,
hid_t file)
{
DECLARE_CCTK_PARAMETERS
- int index;
+ int vindex;
int maxdim;
int timelevel, current_timelevel;
int *old_downsample;
@@ -65,21 +65,24 @@ int IOHDF5Util_DumpGH (cGH *GH,
ioGH *ioUtilGH;
const char *thorn;
const char *impl;
- ioHDF5Geo_t slab;
+ ioHDF5Geo_t request;
/* Get the GH extension for IOUtil */
ioUtilGH = (ioGH *) CCTK_GHExtension (GH, "IO");
- /* disable downsampling after saving original downsampling params */
maxdim = CCTK_MaxDim ();
- old_downsample = (int *) malloc (maxdim * sizeof (int));
- for (index = 0; index < maxdim; index++)
+ request.origin = (int *) calloc (4 + maxdim, maxdim * sizeof (int));
+ request.length = request.origin + 1 * maxdim;
+ request.downsample = request.origin + 2 * maxdim;
+ request.actlen = request.origin + 3 * maxdim;
+ request.direction = request.origin + 4 * maxdim;
+
+ for (vindex = 0; vindex < maxdim; vindex++)
{
- old_downsample[index] = ioUtilGH->downsample[index];
- ioUtilGH->downsample[index] = 1;
- slab.direction[index] = index;
- slab.downsample[index] = 1;
+ request.length[vindex] = -1;
+ request.downsample[vindex] = 1;
+ request.direction[vindex * maxdim + vindex] = 1;
}
/* disable output in single precision */
@@ -87,12 +90,12 @@ int IOHDF5Util_DumpGH (cGH *GH,
ioUtilGH->out_single = 0;
/* sync all active groups */
- for (index = CCTK_NumGroups () - 1; index >= 0; index--)
+ for (vindex = CCTK_NumGroups () - 1; vindex >= 0; vindex--)
{
if (CCTK_IsImplementationActive (
- CCTK_ImpFromVarI (CCTK_FirstVarIndexI (index))))
+ CCTK_ImpFromVarI (CCTK_FirstVarIndexI (vindex))))
{
- CCTK_SyncGroupI (GH, index);
+ CCTK_SyncGroupI (GH, vindex);
}
}
@@ -130,10 +133,10 @@ int IOHDF5Util_DumpGH (cGH *GH,
}
/* ... now the variables */
- for (index = CCTK_NumVars () - 1; index >= 0; index--)
+ for (vindex = CCTK_NumVars () - 1; vindex >= 0; vindex--)
{
/* find out the thorn implementing variable with index */
- impl = CCTK_ImpFromVarI (index);
+ impl = CCTK_ImpFromVarI (vindex);
thorn = CCTK_ImplementationThorn (impl);
if (! thorn)
{
@@ -143,29 +146,29 @@ int IOHDF5Util_DumpGH (cGH *GH,
/* let only variables pass which belong to an active thorn and
have storage assigned */
if (! CCTK_IsThornActive (thorn) ||
- ! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (index)))
+ ! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (vindex)))
{
continue;
}
if (verbose && file >= 0)
{
- CCTK_VInfo (CCTK_THORNSTRING, " %s", CCTK_VarName (index));
+ CCTK_VInfo (CCTK_THORNSTRING, " %s", CCTK_VarName (vindex));
}
/* get the current timelevel */
- current_timelevel = CCTK_NumTimeLevelsFromVarI (index) - 1;
+ current_timelevel = CCTK_NumTimeLevelsFromVarI (vindex) - 1;
if (current_timelevel > 0)
{
current_timelevel--;
}
- slab.sdim = slab.vdim = CCTK_GroupDimFromVarI (index);
+ request.sdim = request.vdim = CCTK_GroupDimFromVarI (vindex);
/* now dump all timelevels up to the current */
for (timelevel = 0; timelevel <= current_timelevel; timelevel++)
{
- IOHDF5Util_DumpVar (GH, index, timelevel, &slab, file, 0);
+ IOHDF5Util_DumpVar (GH, vindex, timelevel, &request, file, 0);
}
} /* end of loop over all variables */
@@ -179,9 +182,8 @@ int IOHDF5Util_DumpGH (cGH *GH,
/* restore output precision flag */
ioUtilGH->out_single = old_out_single;
- /* restore original downsampling params */
- memcpy (ioUtilGH->downsample, old_downsample, maxdim * sizeof (int));
- free (old_downsample);
+ /* free temporary resources */
+ free (request.origin);
return (0);
}
@@ -209,7 +211,7 @@ int IOHDF5Util_DumpGH (cGH *GH,
@vtype cGH *
@vio in
@endvar
- @var index
+ @var vindex
@vdesc CCTK index of the variable to dump
@vtype int
@vio in
@@ -224,8 +226,8 @@ int IOHDF5Util_DumpGH (cGH *GH,
@vtype CCTK_INT []
@vio in
@endvar
- @var slab
- @vdesc pointer to hyperslab structure describing the dataset
+ @var request
+ @vdesc pointer to IO request structure describing the hyperslab
@vtype ioHDF5Geo_t *
@vio in
@endvar
@@ -236,15 +238,15 @@ int IOHDF5Util_DumpGH (cGH *GH,
@endvar
@@*/
void IOHDF5Util_DumpCommonAttributes (cGH *GH,
- int index,
+ int vindex,
int timelevel,
CCTK_INT global_shape[],
- ioHDF5Geo_t *slab,
+ ioHDF5Geo_t *request,
hid_t dataset)
{
DECLARE_CCTK_PARAMETERS
- int dim;
char *groupname;
+ int maxdim;
CCTK_INT attr_int;
CCTK_REAL *attr_real;
ioHDF5UtilGH *myGH;
@@ -254,56 +256,57 @@ void IOHDF5Util_DumpCommonAttributes (cGH *GH,
myGH = (ioHDF5UtilGH *) CCTK_GHExtension (GH, "IOHDF5Util");
/* attributes describing the variable */
- dim = CCTK_GroupDimI (CCTK_GroupIndexFromVarI (index));
- groupname = CCTK_GroupNameFromVarI (index);
+ groupname = CCTK_GroupNameFromVarI (vindex);
WRITE_ATTRIBUTE ("groupname", groupname, dataset,
myGH->scalar_dataspace, 0, myGH->IOHDF5_STRING);
free (groupname);
- attr_int = CCTK_GroupTypeFromVarI (index);
+ attr_int = CCTK_GroupTypeFromVarI (vindex);
WRITE_ATTRIBUTE ("grouptype", &attr_int, dataset,
myGH->scalar_dataspace, 0, IOHDF5_INT);
- attr_int = CCTK_NumTimeLevelsFromVarI (index);
+ attr_int = CCTK_NumTimeLevelsFromVarI (vindex);
WRITE_ATTRIBUTE ("ntimelevels", &attr_int, dataset,
myGH->scalar_dataspace, 0, IOHDF5_INT);
WRITE_ATTRIBUTE ("global_size", global_shape, dataset,
- myGH->array_dataspace, dim, IOHDF5_INT);
+ myGH->array_dataspace, request->sdim, IOHDF5_INT);
WRITE_ATTRIBUTE ("time", &GH->cctk_time, dataset,
myGH->scalar_dataspace, 0, IOHDF5_REAL);
/* attributes describing the underlying grid */
- dim = CCTK_MaxDim ();
- attr_real = (CCTK_REAL *) malloc (2 * dim * sizeof (CCTK_REAL));
- CCTK_CoordRange (GH, &attr_real[0], &attr_real[dim + 0], -1, "x", "cart3d");
- CCTK_CoordRange (GH, &attr_real[1], &attr_real[dim + 1], -1, "y", "cart3d");
- CCTK_CoordRange (GH, &attr_real[2], &attr_real[dim + 2], -1, "z", "cart3d");
+ maxdim = CCTK_MaxDim ();
+ attr_real = (CCTK_REAL *) malloc (2 * maxdim * sizeof (CCTK_REAL));
+ CCTK_CoordRange (GH, &attr_real[0], &attr_real[maxdim+0], -1, "x", "cart3d");
+ CCTK_CoordRange (GH, &attr_real[1], &attr_real[maxdim+1], -1, "y", "cart3d");
+ CCTK_CoordRange (GH, &attr_real[2], &attr_real[maxdim+2], -1, "z", "cart3d");
WRITE_ATTRIBUTE ("origin", attr_real, dataset,
- myGH->array_dataspace, dim, IOHDF5_REAL);
+ myGH->array_dataspace, maxdim, IOHDF5_REAL);
WRITE_ATTRIBUTE ("min_ext", attr_real, dataset,
- myGH->array_dataspace, dim, IOHDF5_REAL);
- WRITE_ATTRIBUTE ("max_ext", attr_real + dim, dataset,
- myGH->array_dataspace, dim, IOHDF5_REAL);
+ myGH->array_dataspace, maxdim, IOHDF5_REAL);
+ WRITE_ATTRIBUTE ("max_ext", attr_real + maxdim, dataset,
+ myGH->array_dataspace, maxdim, IOHDF5_REAL);
WRITE_ATTRIBUTE ("delta", GH->cctk_delta_space, dataset,
- myGH->array_dataspace, dim, IOHDF5_REAL);
+ myGH->array_dataspace, maxdim, IOHDF5_REAL);
free (attr_real);
+#if 0
/* attributes describing the hyperslab */
- if (slab)
+ /* FIXME: what attributes are really needed here ?? ***/
+ if (request)
{
- attr_real = (CCTK_REAL *) malloc (4 * slab->sdim * sizeof (CCTK_REAL));
- for (dim = 0; dim < slab->sdim; dim++)
+ attr_real = (CCTK_REAL *) malloc (4 * request->sdim * sizeof (CCTK_REAL));
+ for (dim = 0; dim < request->sdim; dim++)
{
- attr_real[dim + 0*slab->sdim] =
- slab->origin[slab->direction[dim]] *
- GH->cctk_delta_space[slab->direction[dim]];
- attr_real[dim + 1*slab->sdim] =
- slab->origin[dim] * GH->cctk_delta_space[dim];
- attr_real[dim + 2*slab->sdim] =
- (slab->origin[dim] + slab->actlen[dim]-1) *
- GH->cctk_delta_space[dim] * slab->downsample[dim];
- attr_real[dim + 3*slab->sdim] =
- GH->cctk_delta_space[slab->direction[dim]] *
- slab->downsample[slab->direction[dim]];
+ attr_real[dim + 0*request->sdim] =
+ request->origin[request->direction[dim]] *
+ GH->cctk_delta_space[request->direction[dim]];
+ attr_real[dim + 1*request->sdim] =
+ request->origin[dim] * GH->cctk_delta_space[dim];
+ attr_real[dim + 2*request->sdim] =
+ (request->origin[dim] + request->actlen[dim]-1) *
+ GH->cctk_delta_space[dim] * request->downsample[dim];
+ attr_real[dim + 3*request->sdim] =
+ GH->cctk_delta_space[request->direction[dim]] *
+ request->downsample[request->direction[dim]];
}
WRITE_ATTRIBUTE ("origin_slab", attr_real + 0*dim, dataset,
myGH->array_dataspace, dim, IOHDF5_REAL);
@@ -315,6 +318,7 @@ void IOHDF5Util_DumpCommonAttributes (cGH *GH,
myGH->array_dataspace, dim, IOHDF5_REAL);
free (attr_real);
}
+#endif
}
diff --git a/src/DumpVar.c b/src/DumpVar.c
index adfad6b..7ecf7e0 100644
--- a/src/DumpVar.c
+++ b/src/DumpVar.c
@@ -35,31 +35,32 @@ typedef struct
} dumpInfo;
-/* local function prototypes */
+/* prototypes of routines defined in this source file */
static int IOHDF5Util_DumpGS (cGH *GH,
int vindex,
int timelevel,
int iohdf5_type,
+ ioHDF5Geo_t *request,
int check_exisiting_objects,
hid_t file);
static int IOHDF5Util_DumpGA (cGH *GH,
int vindex,
int timelevel,
- ioHDF5Geo_t *slab,
+ ioHDF5Geo_t *request,
dumpInfo *info,
int check_exisiting_objects,
hid_t file);
static int IOHDF5Util_getDumpData (cGH *GH,
int vindex,
int timelevel,
- ioHDF5Geo_t *slab,
+ ioHDF5Geo_t *request,
void **outme,
int *free_outme,
CCTK_INT *geom);
static void IOHDF5Util_procDump (cGH *GH,
int vindex,
int timelevel,
- ioHDF5Geo_t *slab,
+ ioHDF5Geo_t *request,
void *outme,
CCTK_INT *geom,
int proc,
@@ -71,7 +72,7 @@ static void IOHDF5Util_procDump (cGH *GH,
static void IOHDF5Util_collectiveDump (cGH *GH,
int vindex,
int timelevel,
- ioHDF5Geo_t *slab,
+ ioHDF5Geo_t *request,
void *outme,
CCTK_INT *geom,
int hdf5io_type,
@@ -107,8 +108,8 @@ static void IOHDF5Util_collectiveDump (cGH *GH,
@vtype int
@vio in
@endvar
- @var slab
- @vdesc pointer to the hyperslab structure
+ @var request
+ @vdesc pointer to the IO request structure
@vtype ioHDF5Geo_t *
@vio in
@endvar
@@ -136,7 +137,7 @@ static void IOHDF5Util_collectiveDump (cGH *GH,
int IOHDF5Util_DumpVar (cGH *GH,
int vindex,
int timelevel,
- ioHDF5Geo_t *slab,
+ ioHDF5Geo_t *request,
hid_t file,
int check_exisiting_objects)
{
@@ -181,10 +182,13 @@ int IOHDF5Util_DumpVar (cGH *GH,
break;
case CCTK_VARIABLE_COMPLEX:
- info.iohdf5_type = myGH->IOHDF5_COMPLEX;
- info.element_size = sizeof (CCTK_COMPLEX);
+ info.iohdf5_type = ioUtilGH->out_single ? myGH->IOHDF5_COMPLEX8 :
+ myGH->IOHDF5_COMPLEX;
+ info.element_size = ioUtilGH->out_single ?
+ sizeof (CCTK_COMPLEX8) : sizeof (CCTK_COMPLEX);
#ifdef CCTK_MPI
- info.mpi_type = pughGH->PUGH_mpi_complex;
+ info.mpi_type = ioUtilGH->out_single ? pughGH->PUGH_mpi_complex8 :
+ pughGH->PUGH_mpi_complex;
#endif
break;
@@ -200,11 +204,11 @@ int IOHDF5Util_DumpVar (cGH *GH,
if (gtype == CCTK_SCALAR)
{
retval = IOHDF5Util_DumpGS (GH, vindex, timelevel, info.iohdf5_type,
- check_exisiting_objects, file);
+ request, check_exisiting_objects, file);
}
else if (gtype == CCTK_ARRAY || gtype == CCTK_GF)
{
- retval = IOHDF5Util_DumpGA (GH, vindex, timelevel, slab, &info,
+ retval = IOHDF5Util_DumpGA (GH, vindex, timelevel, request, &info,
check_exisiting_objects, file);
}
else
@@ -245,6 +249,11 @@ int IOHDF5Util_DumpVar (cGH *GH,
@vtype int
@vio in
@endvar
+ @var request
+ @vdesc pointer to the IO request structure
+ @vtype ioHDF5Geo_t *
+ @vio in
+ @endvar
@var check_exisiting_objects
@vdesc flag indicating if we should check for already existing objects
before these are created anew
@@ -267,6 +276,7 @@ static int IOHDF5Util_DumpGS (cGH *GH,
int vindex,
int timelevel,
int iohdf5_type,
+ ioHDF5Geo_t *request,
int check_exisiting_objects,
hid_t file)
{
@@ -307,7 +317,7 @@ static int IOHDF5Util_DumpGS (cGH *GH,
CCTK_VarDataPtrI (GH, timelevel, vindex)));
IOHDF5Util_DumpCommonAttributes (GH, vindex, timelevel, global_shape,
- NULL, dataset);
+ request, dataset);
IOHDF5_ERROR (H5Dclose (dataset));
@@ -345,8 +355,8 @@ static int IOHDF5Util_DumpGS (cGH *GH,
@vtype int
@vio in
@endvar
- @var slab
- @vdesc pointer to the hyperslab structure
+ @var request
+ @vdesc pointer to the IO request structure
@vtype ioHDF5Geo_t *
@vio in
@endvar
@@ -380,7 +390,7 @@ static int IOHDF5Util_DumpGS (cGH *GH,
static int IOHDF5Util_DumpGA (cGH *GH,
int vindex,
int timelevel,
- ioHDF5Geo_t *slab,
+ ioHDF5Geo_t *request,
dumpInfo *info,
int check_exisiting_objects,
hid_t file)
@@ -408,10 +418,10 @@ static int IOHDF5Util_DumpGA (cGH *GH,
ioUtilGH = (ioGH *) CCTK_GHExtension (GH, "IO");
/* allocate the geometry buffer */
- geom = (CCTK_INT *) malloc (3 * slab->sdim * sizeof (CCTK_INT));
+ geom = (CCTK_INT *) malloc (3 * request->sdim * sizeof (CCTK_INT));
/* Get the pointer to the data we want to output (includes downsampling) */
- retval = IOHDF5Util_getDumpData (GH, vindex, timelevel, slab, &outme,
+ retval = IOHDF5Util_getDumpData (GH, vindex, timelevel, request, &outme,
&free_outme, geom);
if (retval < 0)
{
@@ -425,7 +435,7 @@ static int IOHDF5Util_DumpGA (cGH *GH,
#ifdef HAVE_PARALLEL
if (ioUtilGH->unchunked)
{
- IOHDF5Util_collectiveDump (GH, vindex, timelevel, slab, outme, geom,
+ IOHDF5Util_collectiveDump (GH, vindex, timelevel, request, outme, geom,
info->iohdf5_type, file);
if (free_outme)
{
@@ -440,7 +450,7 @@ static int IOHDF5Util_DumpGA (cGH *GH,
/* Dump data held on IO processor */
if (myproc == ioUtilGH->ioproc)
{
- IOHDF5Util_procDump (GH, vindex, timelevel, slab, outme, geom,
+ IOHDF5Util_procDump (GH, vindex, timelevel, request, outme, geom,
myproc, info->iohdf5_type, check_exisiting_objects,
file);
}
@@ -451,14 +461,14 @@ static int IOHDF5Util_DumpGA (cGH *GH,
for (i = myproc+1; i < myproc+ioUtilGH->ioproc_every && i < nprocs; i++)
{
/* receive geometry */
- CACTUS_MPI_ERROR (MPI_Recv (geom, 3*slab->sdim, PUGH_MPI_INT, i,
+ CACTUS_MPI_ERROR (MPI_Recv (geom, 3*request->sdim, PUGH_MPI_INT, i,
2*i + IOTAGBASE + 1, pughGH->PUGH_COMM_WORLD,
&ms));
- incoming = geom[slab->sdim];
- for (j = 1; j < slab->sdim; j++)
+ incoming = geom[request->sdim];
+ for (j = 1; j < request->sdim; j++)
{
- incoming *= geom[slab->sdim + j];
+ incoming *= geom[request->sdim + j];
}
/* receive data */
@@ -469,7 +479,7 @@ static int IOHDF5Util_DumpGA (cGH *GH,
2*i + IOTAGBASE, pughGH->PUGH_COMM_WORLD,
&ms));
- IOHDF5Util_procDump (GH, vindex, timelevel, slab, tmpd, geom, i,
+ IOHDF5Util_procDump (GH, vindex, timelevel, request, tmpd, geom, i,
info->iohdf5_type, check_exisiting_objects, file);
free (tmpd);
}
@@ -483,14 +493,14 @@ static int IOHDF5Util_DumpGA (cGH *GH,
/* Send the geometry and data from the non-IO processors
* to the IO processors
*/
- outgoing = geom[slab->sdim];
- for (i = 1; i < slab->sdim; i++)
+ outgoing = geom[request->sdim];
+ for (i = 1; i < request->sdim; i++)
{
- outgoing *= geom[slab->sdim + i];
+ outgoing *= geom[request->sdim + i];
}
/* send geometry */
- CACTUS_MPI_ERROR (MPI_Send (geom, 3*slab->sdim, PUGH_MPI_INT,
+ CACTUS_MPI_ERROR (MPI_Send (geom, 3*request->sdim, PUGH_MPI_INT,
ioUtilGH->ioproc, 2*myproc + IOTAGBASE + 1,
pughGH->PUGH_COMM_WORLD));
if (outgoing > 0)
@@ -526,71 +536,48 @@ static int IOHDF5Util_DumpGA (cGH *GH,
static int IOHDF5Util_getDumpData (cGH *GH,
int vindex,
int timelevel,
- ioHDF5Geo_t *slab,
+ ioHDF5Geo_t *request,
void **outme,
int *free_outme,
CCTK_INT *geom)
{
+ int i;
+ int cctk_output_type;
ioGH *ioUtilGH;
- int myproc;
- int i, sdim, vdim; /*iteration, slab dim, variable dim */
int *hsizes,*hsizes_global,*hsizes_offset; /* geometry information */
- int sdir[3]; /* slab direction FIXME */
- int locdowns[3]; /* Holds the downsampling in the order
- specified in slab->direction[] */
- int slabstart[3]; /* global start index for slab to extract */
- void *data;
char *fullname;
- myproc = CCTK_MyProc (GH);
-
/* get GH extension for IOUtil */
ioUtilGH = (ioGH *) CCTK_GHExtension (GH, "IO");
- /* Shortcuts */
- vdim = slab->vdim;
- sdim = slab->sdim;
-
- /* FIXME */
- if (vdim>3)
+ /* determine the datatype for the hyperslab */
+ cctk_output_type = CCTK_VarTypeI (vindex);
+ if (ioUtilGH->out_single)
{
- CCTK_WARN(1,"Cannot treat GFs with dim>3, check with cactus support\n");
- return (-1);
+ if (cctk_output_type == CCTK_VARIABLE_INT)
+ {
+ cctk_output_type = CCTK_VARIABLE_INT4;
+ }
+ else if (cctk_output_type == CCTK_VARIABLE_REAL)
+ {
+ cctk_output_type = CCTK_VARIABLE_REAL4;
+ }
+ else if (cctk_output_type == CCTK_VARIABLE_COMPLEX)
+ {
+ cctk_output_type = CCTK_VARIABLE_COMPLEX8;
+ }
}
- for (i=0;i<sdim;i++)
- locdowns[i]=slab->downsample[slab->direction[i]];
-
- /* allocate array to hold size information of slab */
- hsizes = (int *) malloc (3 * sdim * sizeof (int));
- hsizes_global = hsizes + 1*sdim;
- hsizes_offset = hsizes + 2*sdim;
-
- /* TEMPORARY FIX DUE TO INCONSISTENT DIR SPECIFICATION */
- /* direction vector of 1d line in 3d volume */
- if (sdim == 1)
- {
- sdir[0] = slab->direction[0] == 0;
- sdir[1] = slab->direction[0] == 1;
- sdir[2] = slab->direction[0] == 2;
- }
- /* norm vector of 2d surface in 3d volume */
- else if (sdim==2)
- {
- sdir[0] = slab->direction[0] == 1 && slab->direction[1] == 2;
- sdir[1] = slab->direction[0] == 0 && slab->direction[1] == 2;
- sdir[2] = slab->direction[0] == 0 && slab->direction[1] == 1;
- }
- /* spanning directions for 3d */
- else if (sdim==3)
- {
- sdir[0] = slab->direction[0];
- sdir[1] = slab->direction[1];
- sdir[2] = slab->direction[2];
- }
-
- /* Get the start indeces for the slab from origin. */
+ /* FIXME */
+ /* allocate array to hold size information of request */
+ hsizes = (int *) malloc (3 * request->sdim * sizeof (int));
+ hsizes_global = hsizes + 1*request->sdim;
+ hsizes_offset = hsizes + 2*request->sdim;
+
+#if 0
+ FIXME: what is this for ???
+ /* Get the start indeces for the request from origin. */
/* Slab_start from the geo structure is not a true start index,
it is currently used as the intersection point of three surfaces,
that's why two entries have to be set to zero in the case of a
@@ -598,16 +585,19 @@ static int IOHDF5Util_getDumpData (cGH *GH,
FIXME */
for (i = 0; i < vdim; i++)
{
- slabstart[i] = slab->origin[i];
+ slabstart[i] = request->origin[i];
}
- for (i = 0; i < sdim; i++)
+ for (i = 0; i < request->sdim; i++)
{
- slabstart[slab->direction[i]] = 0;
+ slabstart[request->direction[i]] = 0;
}
+#endif
- if (NewHyperslab_GetLocalHyperslab (GH, vindex, timelevel, sdim, CCTK_VARIABLE_REAL4, NULL, slab->origin,
- sdir, slab->length, locdowns, outme,
- hsizes, hsizes_global, hsizes_offset) < 0)
+ if (NewHyperslab_GetLocalHyperslab (GH, vindex, timelevel, request->sdim,
+ cctk_output_type, NULL, request->origin,
+ request->direction, request->length,
+ request->downsample, outme,
+ hsizes, hsizes_global, hsizes_offset) < 0)
{
fullname = CCTK_FullName (vindex);
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
@@ -619,52 +609,16 @@ static int IOHDF5Util_getDumpData (cGH *GH,
*free_outme = 1;
- for (i = 0; i < sdim; i++)
+ for (i = 0; i < request->sdim; i++)
{
- geom[i + 0*sdim] = hsizes_offset[i];
- geom[i + 1*sdim] = hsizes[i];
- geom[i + 2*sdim] = hsizes_global[i];
- slab->actlen[i] = hsizes_global[i];
+ geom[i + 0*request->sdim] = hsizes_offset[i];
+ geom[i + 1*request->sdim] = hsizes[i];
+ geom[i + 2*request->sdim] = hsizes_global[i];
+ request->actlen[i] = hsizes_global[i];
}
free (hsizes);
-#ifdef DEBUG_ME
- printf ("***** %dD \n",sdim);
- printf ("Lower bound: %d", (int) geom[0]);
- for (i = 1; i < sdim; i++)
- printf (" %d", (int) geom[i]);
- printf ("\n");
- printf ("Chunk size : %d", (int) geom[1*sdim + 0]);
- for (i = 1; i < sdim; i++)
- printf (" %d", (int) geom[1*sdim + i]);
- printf ("\n");
- printf ("Global size: %d", (int) geom[2*sdim + 0]);
- for (i = 1; i < sdim; i++)
- printf (" %d", (int) geom[2*sdim + i]);
- printf ("\n");
- printf ("Downsampling: ");
- for (i = 0; i < sdim; i++)
- printf (" %d", locdowns[i]);
- printf ("\n");
- printf ("Direction: ");
- for (i = 0; i < sdim; i++)
- printf (" %d",slab->direction[i]);
- printf ("\n");
- printf ("Slab Start: %d", (int) slabstart[0]);
- for (i = 1; i < vdim; i++)
- printf (" %d", (int) slabstart[i]);
- printf ("\n");
- printf ("Slab intersect cntr: %d", (int) slab->origin[0]);
- for (i = 1; i < vdim; i++)
- printf (" %d", (int) slab->origin[i]);
- printf ("\n");
- printf ("SlabDelta: ");
- for (i = 0; i < sdim; i++)
- printf (" %f",GH->cctk_delta_space[slab->direction[i]]*locdowns[i]);
- printf ("\n");
-#endif
-
return (0);
}
@@ -728,7 +682,7 @@ static int IOHDF5Util_getDumpData (cGH *GH,
static void IOHDF5Util_procDump (cGH *GH,
int vindex,
int timelevel,
- ioHDF5Geo_t *slab,
+ ioHDF5Geo_t *request,
void *outme,
CCTK_INT *geom,
int proc,
@@ -752,7 +706,7 @@ static void IOHDF5Util_procDump (cGH *GH,
ioUtilGH = (ioGH *) CCTK_GHExtension (GH, "IO");
myGH = (ioHDF5UtilGH *) CCTK_GHExtension (GH, "IOHDF5Util");
- sdim = slab->sdim;
+ sdim = request->sdim;
myproc = CCTK_MyProc (GH);
/* Check if there are points to output */
@@ -811,7 +765,7 @@ static void IOHDF5Util_procDump (cGH *GH,
IOHDF5_ERROR (dataset = H5Dcreate (file, datasetname,
iohdf5_type, filespace, H5P_DEFAULT));
IOHDF5Util_DumpCommonAttributes (GH, vindex, timelevel, &geom[2*sdim],
- slab, dataset);
+ request, dataset);
}
else
{
@@ -841,7 +795,7 @@ static void IOHDF5Util_procDump (cGH *GH,
{
IOHDF5_ERROR (group = H5Gcreate (file, datasetname, 0));
IOHDF5Util_DumpCommonAttributes (GH, vindex, timelevel, &geom[2*sdim],
- slab, group);
+ request, group);
IOHDF5_ERROR (H5Gclose (group));
}
@@ -927,7 +881,7 @@ static void IOHDF5Util_procDump (cGH *GH,
static void IOHDF5Util_collectiveDump (cGH *GH,
int vindex,
int timelevel,
- ioHDF5Geo_t *slab,
+ ioHDF5Geo_t *request,
void *outme,
CCTK_INT *geom,
int hdf5io_type,
@@ -946,7 +900,7 @@ static void IOHDF5Util_collectiveDump (cGH *GH,
myGH = (ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5Util");
/* get the dimension of the variable */
- sdim = slab->sdim;
+ sdim = request->sdim;
chunk_origin = (hssize_t *) malloc (sdim * sizeof (hssize_t));
chunk_dims = (hsize_t *) malloc (2*sdim * sizeof (hsize_t));
@@ -989,7 +943,7 @@ static void IOHDF5Util_collectiveDump (cGH *GH,
if (CCTK_MyProc (GH) == 0)
{
IOHDF5Util_DumpCommonAttributes (GH, vindex, timelevel, &geom[2*sdim],
- slab, dataset);
+ request, dataset);
}
/* increase the buffer size if the default isn't sufficient */