Compare commits

..

32 Commits

Author SHA1 Message Date
gsell c41bd6ec54 Merge branch '21-hdf5-1-12-and-newer-support' into 'master'
Resolve "hdf5 1.12 and newer support"

Closes #21

See merge request H5hut/src!6
2024-10-02 14:58:27 +02:00
gsell a69a88c49c version bumped to 2.0.0rc7 2024-10-02 14:57:51 +02:00
gsell 4088d02f55 hdf5 >=1.12.0 support added 2024-10-02 14:48:53 +02:00
gsell 5f57c23499 Merge branch '20-unknown-macro-ac_msg_erro' into 'master'
Resolve "unknown macro AC_MSG_ERROR"

Closes #20

See merge request H5hut/src!5
2020-08-18 09:52:31 +02:00
gsell b71fa8c9dc LT_INIT added to configure.ac, should fix unknown AC_MSG_ERROR 2020-08-18 09:51:44 +02:00
gsell 7e7a85f14f Merge branch '19-release-2-0-0rc6' into 'master'
Resolve "release 2.0.0rc6"

Closes #19

See merge request H5hut/src!4
2019-06-20 20:49:00 +02:00
gsell fc1322432c version set to 2.0.0rc6 2019-06-20 20:48:48 +02:00
gsell f5778e0197 Merge branch '18-memory-leaks-in-h5part' into 'master'
Resolve "memory leaks in H5Part"

Closes #18

See merge request H5hut/src!3
2019-06-20 20:42:33 +02:00
gsell fb084fdff4 memory leaks in H5Port core functions fixed 2019-06-20 20:42:42 +02:00
gsell be7cd1d471 Merge branch '17-in-configure-ac-exit-after-ac_msg_error-is-not-required' into 'master'
Resolve "in configure.ac: exit after AC_MSG_ERROR is not required"

Closes #17

See merge request H5hut/src!2
2019-06-20 19:01:02 +02:00
gsell f7b7a45a28 configure.ac: exit calls after ASC_MSG_ERROR removed 2019-06-20 19:01:17 +02:00
gsell e41db835eb Merge branch '15-move-dissolving-ghost-zones-into-dedicated-function' into 'master'
Resolve "move dissolving ghost-zones into dedicated function"

Closes #15

See merge request H5hut/src!1
2019-06-20 18:57:49 +02:00
gsell 8140378213 H5Block3dSetView() does not dissolve ghost-zones any more
- new API function H5Block3dSetViewDissolveGhostZones() added
2019-06-20 18:52:02 +02:00
gsell 6a4d711b99 test: use independent IO in h5u_test_{read,write}3() for hdf5 > 1.8.12
Since MPI-POSIX VFD has been removed from hdf5 > 1.8.12, but a test
with stride data should be performed, we use independent IO instead for
hdf5 > 1.8.12
2018-11-19 17:08:48 +01:00
gsell 2ae76250e6 src/h5core/h5u_model.c: bug fixed in h5_set_view()
In h5_set_view() u->shape was created two times.
2018-11-19 17:01:08 +01:00
gsell f1cb1c981e Merge branch 'master' of gitlab.psi.ch:H5hut/src 2018-11-19 14:51:52 +01:00
gsell 627d6673e1 src/include/h5core/h5_log.h: bugfix: declaration of 'h5_initialized()' declared insite 'extern C' 2018-11-19 14:51:28 +01:00
gsell ed85fb32b7 changes merged from upstrean 2018-11-19 14:47:57 +01:00
gsell df2be38428 examples/H5Part/write_setview.c
- include of "mpi.h" removed. There is no need for it and this breaks the serial case
2018-11-08 16:42:03 +01:00
gsell d423367d4f most warnings fixed if compiling with NDEBUG defined 2018-11-08 15:34:32 +01:00
gsell 1985a0a2e0 src/h5core/h5u_model.c:
- h5u_get_totalnum_particles_by_idx():
  - comment added
  - definition of 'total' and 'dmax' moved
2018-11-05 16:47:48 +01:00
gsell 24533c4c2e examples/H5/openclose.c:
- set DEBUGMASK to all
2018-11-05 16:43:47 +01:00
Achim Gsell 72365540a3 src/include/h5core/h5_log.h: missing backslashes in definition of macro 'H5_API_ENTER()' if NDEBUG is set fixed 2018-11-02 23:56:27 +01:00
Gsell Achim 4daf9b786c * C-API
- H5PartSetNumPoints() renamed to H5PartSetNumItems()
- H5PartGetNumPoints() renamed to H5PartGetNumItems()
- Dataset names longer then 64 bytes are handled as error.
- Same for step/iteration names.
* core API
- we use the term 'iteration' instead of 'step'
- we use the term 'item' instead of 'point'
- re-factor function and variable names
- in printing messages/debug output fixed
- do not flush (sync to disk) after writing a dataset by default,
  can be controlled by a property
2018-09-14 16:46:40 +02:00
gsell 072a2781fc configure.ac
- set version to 2.0.0rc5
2018-09-04 10:34:04 +02:00
gsell 9c9bfda054 src/Python/Makefileam
- print message if Python is disabled
2018-09-04 10:33:44 +02:00
gsell 604dade2a1 src/h5core/h5b_model.c
- warning in 'h5b_3d_set_grid()' if compiled serial fixed
2018-09-04 10:33:09 +02:00
gsell 2da69d1095 error in logging/debug output fixed, see issue #13 2018-09-04 10:32:04 +02:00
gsell 15317a9bb0 do not include 'h5_init.h' where not required 2018-09-04 10:30:13 +02:00
gsell c5f3b7fa02 src/h5core/{h5_file.c,h5_init.c,private/h5_init.h}
- refactor 'h5_initialize()' and 'h5_finalize()'
2018-09-04 10:28:08 +02:00
gsell a81c79e5c4 src/h5core/Makefile.am:
- adapt to moved h5_init
2018-09-04 10:21:38 +02:00
gsell 664cee709b src/h5core/h5_init.c:
- moved from 'private'
2018-09-04 10:17:47 +02:00
68 changed files with 1073 additions and 750 deletions
+15
View File
@@ -0,0 +1,15 @@
2018-09-14 Gsell Achim <achi.gsell@psi.ch>
* C-API
- H5PartSetNumPoints() renamed to H5PartSetNumItems()
- H5PartGetNumPoints() renamed to H5PartGetNumItems()
- Dataset names longer then 64 bytes are handled as error.
- Same for step/iteration names.
* core API
- we use the term 'iteration' instead of 'step'
- we use the term 'item' instead of 'point'
- re-factor function and variable names
- in printing messages/debug output fixed
- do not flush (sync to disk) after writing a dataset by default,
can be controlled by a property
+6 -15
View File
@@ -1,15 +1,16 @@
#
# Copyright (c) 2006-2017, The Regents of the University of California,
# Copyright (c) 2006-2018, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
# Institut (Switzerland). All rights reserved.
#
# License: see file COPYING in top level of source distribution.
#
AC_INIT([H5hut], [2.0.0rc4], [h5part@lists.psi.ch], H5hut)
AC_INIT([H5hut], [2.0.0rc7], [h5part@lists.psi.ch], H5hut)
AC_PREREQ(2.60)
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_MACRO_DIR([m4])
LT_INIT
AM_INIT_AUTOMAKE
ENABLE_DEBUG='no'
@@ -138,7 +139,6 @@ fi
AC_PROG_CC($c_compilers)
if test "x$ac_cv_prog_cc_c89" = "xno"; then
AC_MSG_ERROR([C compiler not found!])
exit 1
fi
AC_PROG_CXX($cxx_compilers)
@@ -147,7 +147,6 @@ if test "X$ENABLE_FORTRAN" = "Xyes"; then
AC_PROG_FC($fc_compiler)
if test "x$FC" = "x"; then
AC_MSG_ERROR([Fortran compiler not found!])
exit 1
fi
fi
@@ -159,7 +158,6 @@ AX_CXX_COMPILE_STDCXX_11
AC_PROG_CC_C99
if test "x$ac_cv_prog_cc_c99" = "xno"; then
AC_MSG_ERROR([Cannot set C compiler to use C99 standard!])
exit 1
fi
@@ -281,8 +279,7 @@ if test -n "${HDF5_PREFIX}"; then
fi
AC_CHECK_LIB([hdf5], [H5open])
AS_IF([test "x$ac_cv_lib_hdf5_H5open" != xyes],
[AC_MSG_ERROR([Cannot compile and link a HDF5 program]);
exit 1])
[AC_MSG_ERROR([Cannot compile and link a HDF5 program])])
AC_MSG_CHECKING([checking whether hdf5 lib supports parallel IO])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include "hdf5.h"
@@ -429,12 +426,10 @@ if test "X$ENABLE_PARALLEL" = "Xyes"; then
AC_MSG_RESULT([yes])
AS_IF([test "x$H5_HAVE_PARALLEL" = "xno"],
[AC_MSG_ERROR([hdf5 does not support parallel IO!]);
exit 1])
[AC_MSG_ERROR([hdf5 does not support parallel IO!])])
if test "X$ENABLE_VTKCONVERTER" = "Xyes"; then
AC_MSG_ERROR([VTK to H5hut grid converter cannot be compiled parallel!])
exit 1
fi
CPPFLAGS="${CPPFLAGS} -DPARALLEL_IO -DMPICH_IGNORE_CXX_SEEK"
@@ -453,14 +448,12 @@ if test "X$ENABLE_PARALLEL" = "Xyes"; then
if test "X$r" = "Xno"; then
AC_MSG_ERROR([ParMETIS])
exit 1
fi
fi
else # --enable-parallel=no
AC_MSG_RESULT([no])
AS_IF([test "x$H5_HAVE_PARALLEL" = "xyes"],
[AC_MSG_ERROR([hdf5 with support for parallel IO cannot be used for non-parallel H5hut!]);
exit 1])
[AC_MSG_ERROR([hdf5 with support for parallel IO cannot be used for non-parallel H5hut!])])
fi
###############################################################################
@@ -481,7 +474,6 @@ if test "X$ENABLE_VTKCONVERTER" = "Xyes"; then
if test "X$?" != "X0"; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([Cannot compile VTK to H5hut converter])
exit 1
else
AC_MSG_RESULT([yes])
fi
@@ -490,7 +482,6 @@ if test "X$ENABLE_VTKCONVERTER" = "Xyes"; then
if test "X$?" != "X0"; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([Cannot compile VTK to H5hut converter]);
exit 1
else
AC_MSG_RESULT([yes])
fi
+2 -2
View File
@@ -19,8 +19,8 @@
Use H5_DEBUG_ALL to get full debug output
*/
#if !defined(DEBUGMASK)
#define DEBUGMASK H5_DEBUG_NONE
//#define DEBUGMASK H5_DEBUG_ALL
//#define DEBUGMASK H5_DEBUG_NONE
#define DEBUGMASK H5_DEBUG_ALL
#endif
int
+51 -5
View File
@@ -7,6 +7,8 @@
License: see file COPYING in top level of source distribution.
*/
#include <stdlib.h>
#include "H5hut.h"
#include "examples.h"
@@ -15,16 +17,51 @@ const char* fname = "example_setview.h5";
// H5hut verbosity level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
const h5_int64_t h5_debug_mask = 0;
// we are going to write multiple consecutive blocks
const h5_int64_t num_blocks = 4;
const h5_int64_t num_particles_per_block = 32;
//const h5_int64_t num_blocks = 32;
//const h5_int64_t num_particles_per_block = 1048576*8;
int
main (
int argc,
char* argv[]
){
if (argc < 3) {
fprintf (stderr, "Usage: %s <number_of_blocks> <sizeof_block>\n", argv[0]);
exit (1);
}
char* endptr = NULL;
long long n = strtoll (argv[1], &endptr, 10);
if (*endptr != 0) {
fprintf (stderr, "first argument (number of blocks) is not a unsigned integer!\n");
exit (1);
}
if (n < 1) {
fprintf (stderr, "first argument (number of block) must be >= 1!\n");
exit (1);
}
if (n == LLONG_MAX) {
fprintf (stderr, "first argument (number of block) to large!\n");
exit (1);
}
h5_int64_t num_blocks = (h5_int64_t)n;
n = strtoll (argv[2], &endptr, 10);
if (*endptr != 0) {
fprintf (stderr, "second argument (sizeof blocks) is not a unsigned integer!\n");
exit (1);
}
if (n < 1024) {
fprintf (stderr, "second argument (sizeof block) must be >= 1024!\n");
exit (1);
}
if (n == LLONG_MAX) {
fprintf (stderr, "second argument (sizeof block) to large!\n");
exit (1);
}
h5_int64_t num_particles_per_block = (h5_int64_t)n;
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
@@ -33,9 +70,16 @@ main (
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
H5SetDebugMask (h5_debug_mask);
h5_prop_t prop = H5CreateFileProp ();
H5SetPropFileAlign (prop, 1048576*8);
H5SetPropFileMPIOIndependent (prop, &comm);
//H5SetPropFileMPIOCollective (prop, &comm);
// open file and create first step
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, H5_PROP_DEFAULT);
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, prop);
//H5PartSetChunkSize (file, 1048576*1);
H5SetStep (file, 0);
/*
@@ -52,7 +96,9 @@ main (
// write multiple consecutive blocks
for (int i = 0; i < num_blocks; i++) {
// create fake data
h5_int32_t data[num_particles_per_block];
//h5_int32_t data[num_particles_per_block];
h5_int64_t *data;
data = calloc (num_particles_per_block, sizeof(*data));
for (int j = 0; j < num_particles_per_block; j++) {
data[j] = j + i*num_particles_per_block + offset;
}
@@ -63,7 +109,7 @@ main (
offset + i*num_particles_per_block,
offset + (i+1)*num_particles_per_block - 1);
// write data
H5PartWriteDataInt32 (file, "data", data);
H5PartWriteDataInt64 (file, "data", data);
}
// done
+120
View File
@@ -0,0 +1,120 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include <stdlib.h>
#include <mpi.h>
#include "H5hut.h"
#include "examples.h"
// name of output file
const char* fname = "example_setview.h5";
// H5hut verbosity level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
const h5_int64_t h5_debug_mask = 0;
// we are going to write multiple consecutive blocks
//const h5_int64_t num_blocks = 32;
//const h5_int64_t num_particles_per_block = 1048576*8;
int
main (
int argc,
char* argv[]
){
if (argc < 3) {
fprintf (stderr, "Usage: %s <number_of_blocks> <sizeof_block>\n", argv[0]);
exit (1);
}
char* endptr = NULL;
long long n = strtoll (argv[1], &endptr, 10);
if (*endptr != 0) {
fprintf (stderr, "first argument (number of blocks) is not a unsigned integer!\n");
exit (1);
}
if (n < 1) {
fprintf (stderr, "first argument (number of block) must be >= 1!\n");
exit (1);
}
if (n == LLONG_MAX) {
fprintf (stderr, "first argument (number of block) to large!\n");
exit (1);
}
h5_int64_t num_blocks = (h5_int64_t)n;
n = strtoll (argv[2], &endptr, 10);
if (*endptr != 0) {
fprintf (stderr, "second argument (sizeof blocks) is not a unsigned integer!\n");
exit (1);
}
if (n < 1024) {
fprintf (stderr, "second argument (sizeof block) must be >= 1024!\n");
exit (1);
}
if (n == LLONG_MAX) {
fprintf (stderr, "second argument (sizeof block) to large!\n");
exit (1);
}
h5_int64_t num_particles_per_block = (h5_int64_t)n;
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
H5SetDebugMask (h5_debug_mask);
h5_prop_t prop = H5CreateFileProp ();
H5SetPropFileAlign (prop, 1048576*8);
H5SetPropFileMPIOIndependent (prop, &comm);
//H5SetPropFileMPIOCollective (prop, &comm);
// open file and create first step
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, prop);
//H5PartSetChunkSize (file, 1048576*1);
H5SetStep (file, 0);
/*
If we want to write consecutive blocks, the 'view' can be defined
with H5PartSetview(). Otherwise we have to define the total number
of particles with H5PartSetNumParticles().
*/
const h5_int64_t offset = comm_rank * num_blocks * num_particles_per_block;
H5PartSetView (
file,
offset,
offset + num_blocks*num_particles_per_block -1);
dataset_id = H5PartCreateDataSet (file, "data");
// write multiple consecutive blocks
for (int i = 0; i < num_blocks; i++) {
// create fake data
//h5_int32_t data[num_particles_per_block];
h5_int64_t *data;
data = calloc (num_particles_per_block, sizeof(*data));
for (int j = 0; j < num_particles_per_block; j++) {
data[j] = j + i*num_particles_per_block + offset;
}
// set the "view" to select a subset of the dataset
H5PartSetViewOnDataset (
file,
offset + i*num_particles_per_block,
offset + (i+1)*num_particles_per_block - 1);
// write data
H5PartWriteDatasetInt64 (dataset_id, data);
}
H5CloseDataset (dataset_id);
// done
H5CloseFile(file);
MPI_Finalize();
return 0;
}
+2 -3
View File
@@ -165,10 +165,9 @@ h5_openfile (
h5_int64_t* _props,
const int _len_fname
) {
int len_fname = strlenf (_fname, _len_fname);
H5_API_ENTER (h5_int64_t,
"fname = %*s, mode=%lld, props=%lld",
len_fname, _fname, (long long int)*_mode, (long long int)*_props);
_len_fname, _fname, (long long int)*_mode, (long long int)*_props);
char* fname = h5_strdupfor2c (_fname, _len_fname);
h5_int64_t mode = *_mode;
h5_prop_t props = (h5_prop_t)*_props;
@@ -222,7 +221,7 @@ h5_flushstep (
) {
h5_file_t fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
H5_API_RETURN (h5_flush_step (fh));
H5_API_RETURN (h5_flush_iteration (fh));
}
#define h5_finalize FC_MANGLING( \
+2 -1
View File
@@ -69,7 +69,8 @@ h5bl_3d_setview (
f,
*i_start-1, *i_end-1,
*j_start-1, *j_end-1,
*k_start-1, *k_end-1 ));
*k_start-1, *k_end-1,
0));
}
#define h5bl_3d_getview FC_MANGLING ( \
+8 -8
View File
@@ -28,7 +28,7 @@ h5pt_writedata_r8 (
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_write_data (
h5_int64_t herr = h5u_write_dataset (
f, name2, (void*)data, H5_FLOAT64_T );
free ( name2 );
H5_API_RETURN(herr);
@@ -49,7 +49,7 @@ h5pt_writedata_r4 (
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_write_data (
h5_int64_t herr = h5u_write_dataset (
f, name2, (void*)data, H5_FLOAT32_T );
free ( name2 );
H5_API_RETURN(herr);
@@ -70,7 +70,7 @@ h5pt_writedata_i8 (
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_write_data (
h5_int64_t herr = h5u_write_dataset (
f, name2, (void*)data, H5_INT64_T );
free ( name2 );
H5_API_RETURN(herr);
@@ -91,7 +91,7 @@ h5pt_writedata_i4 (
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_write_data (
h5_int64_t herr = h5u_write_dataset (
f, name2, (void*)data, H5_INT32_T );
free ( name2 );
H5_API_RETURN(herr);
@@ -114,7 +114,7 @@ h5pt_readdata_r8 (
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_read_data (
h5_int64_t herr = h5u_read_dataset (
f, name2, data, H5_FLOAT64_T );
free ( name2 );
H5_API_RETURN(herr);
@@ -135,7 +135,7 @@ h5pt_readdata_r4 (
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_read_data (
h5_int64_t herr = h5u_read_dataset (
f, name2, data, H5_FLOAT32_T );
free ( name2 );
H5_API_RETURN(herr);
@@ -156,7 +156,7 @@ h5pt_readdata_i8 (
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_read_data (
h5_int64_t herr = h5u_read_dataset (
f, name2, data, H5_INT64_T );
free ( name2 );
@@ -178,7 +178,7 @@ h5pt_readdata_i4 (
"hf=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_read_data (
h5_int64_t herr = h5u_read_dataset (
f, name2, data, H5_INT32_T );
free ( name2 );
H5_API_RETURN(herr);
+7 -7
View File
@@ -22,13 +22,13 @@
h5_int64_t
h5pt_setnpoints (
const h5_int64_t* const fh,
const h5_int64_t* const npoints
const h5_int64_t* const num_items
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, npoints=%lld",
(h5_file_p)f, (long long)*npoints);
H5_API_RETURN (h5u_set_num_points (f, *npoints, 1));
(h5_file_p)f, (long long)*num_items);
H5_API_RETURN (h5u_set_num_items (f, *num_items, 1));
}
#define h5pt_setnpoints_strided FC_MANGLING ( \
@@ -37,14 +37,14 @@ h5pt_setnpoints (
h5_int64_t
h5pt_setnpoints_strided (
const h5_int64_t* const fh,
const h5_int64_t* const npoints,
const h5_int64_t* const num_items,
const h5_int64_t* const stride
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, npoints=%lld, stride=%lld",
(h5_file_p)f, (long long)*npoints, (long long)*stride);
H5_API_RETURN (h5u_set_num_points (f, *npoints, *stride));
(h5_file_p)f, (long long)*num_items, (long long)*stride);
H5_API_RETURN (h5u_set_num_items (f, *num_items, *stride));
}
@@ -172,7 +172,7 @@ h5pt_getnpoints (
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t, "fh=%p", (h5_file_p)f);
H5_API_RETURN (h5u_get_num_points (f));
H5_API_RETURN (h5u_get_num_items (f));
}
#define h5pt_getdatasetname FC_MANGLING ( \
+19 -17
View File
@@ -380,7 +380,7 @@ h5_getnstepattribs (
H5_API_ENTER (h5_int64_t,
"fh=%p",
(h5_file_p)f);
H5_API_RETURN (h5_get_num_step_attribs (f));
H5_API_RETURN (h5_get_num_iteration_attribs (f));
}
#define h5_getstepattribinfo FC_MANGLING( \
@@ -405,7 +405,7 @@ h5_getstepattribinfo (
(h5_file_p)f,
(long long)*attrib_idx,
attrib_name, attrib_type, attrib_nelem);
h5_int64_t h5err = h5_get_step_attrib_info_by_idx (
h5_int64_t h5err = h5_get_iteration_attrib_info_by_idx (
f,
*attrib_idx - 1,
attrib_name, l_attrib_name,
@@ -435,7 +435,7 @@ h5_getstepattribinfo_by_name (
(h5_file_p)fh,
l_name, _name, _type, _nelem);
char* name = h5_strdupfor2c (_name, l_name);
h5_int64_t h5err = h5_get_step_attrib_info_by_name (
h5_int64_t h5err = h5_get_iteration_attrib_info_by_name (
f,
name,
_type,
@@ -459,7 +459,7 @@ h5_getstepattribinfo_by_name (
*/
static inline h5_int64_t
write_step_attrib (
write_iteration_attrib (
const h5_file_t fh,
const char* name,
const int l_name,
@@ -468,13 +468,14 @@ write_step_attrib (
const hsize_t l_buffer
) {
char *name2 = h5_strdupfor2c (name, l_name);
h5_int64_t herr = h5_write_step_attrib (fh, name2, type, buffer, l_buffer );
h5_int64_t herr = h5_write_iteration_attrib (
fh, name2, type, buffer, l_buffer );
free (name2);
return herr;
}
static inline h5_int64_t
read_step_attrib (
read_iteration_attrib (
const h5_file_t fh,
const char* name,
const int l_name,
@@ -482,7 +483,7 @@ read_step_attrib (
void* const buffer
) {
char* name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5_read_step_attrib (fh, name2, type, buffer);
h5_int64_t herr = h5_read_iteration_attrib (fh, name2, type, buffer);
free (name2);
return herr;
}
@@ -503,7 +504,7 @@ h5_writestepattrib_string (
"f=%p, name='%.*s', buffer='%.*s'",
(h5_file_p)f, l_name, name, l_buffer, buffer);
char *buffer2 = h5_strdupfor2c (buffer, l_buffer);
h5_int64_t herr = write_step_attrib (
h5_int64_t herr = write_iteration_attrib (
f, name, l_name, H5_STRING_T, buffer2, strlen(buffer2)+1 );
free (buffer2);
H5_API_RETURN (herr);
@@ -524,7 +525,8 @@ h5_readstepattrib_string (
H5_API_ENTER (h5_int64_t,
"f=%p, name='%.*s', buffer='%.*s'",
(h5_file_p)f, l_name, name, l_buffer, buffer);
h5_int64_t herr = read_step_attrib (f, name, l_name, H5_STRING_T, buffer);
h5_int64_t herr = read_iteration_attrib (
f, name, l_name, H5_STRING_T, buffer);
h5_strc2for (buffer, l_buffer);
H5_API_RETURN (herr);
}
@@ -544,7 +546,7 @@ h5_writestepattrib_r8 (
H5_API_ENTER (h5_int64_t,
"f=%p, name='%.*s', buffer=%p, nelem=%lld",
(h5_file_p)f, l_name, name, buffer, (long long)*nelem);
H5_API_RETURN (write_step_attrib(
H5_API_RETURN (write_iteration_attrib(
f,
name, l_name,
H5_FLOAT64_T,
@@ -565,7 +567,7 @@ h5_readstepattrib_r8 (
H5_API_ENTER (h5_int64_t,
"f=%p, name='%.*s', buffer=%p",
(h5_file_p)f, l_name, name, buffer);
H5_API_RETURN (read_step_attrib(
H5_API_RETURN (read_iteration_attrib(
f,
name, l_name,
H5_FLOAT64_T,
@@ -587,7 +589,7 @@ h5_writestepattrib_r4 (
H5_API_ENTER (h5_int64_t,
"f=%p, name='%.*s', buffer=%p, nelem=%lld",
(h5_file_p)f, l_name, name, buffer, (long long)*nelem);
H5_API_RETURN (write_step_attrib(
H5_API_RETURN (write_iteration_attrib(
f,
name, l_name,
H5_FLOAT32_T,
@@ -608,7 +610,7 @@ h5_readstepattrib_r4 (
H5_API_ENTER (h5_int64_t,
"f=%p, name='%.*s', buffer=%p",
(h5_file_p)f, l_name, name, buffer);
H5_API_RETURN (read_step_attrib(
H5_API_RETURN (read_iteration_attrib(
f,
name, l_name,
H5_FLOAT32_T,
@@ -630,7 +632,7 @@ h5_writestepattrib_i8 (
H5_API_ENTER (h5_int64_t,
"f=%p, name='%.*s', buffer=%p, nelem=%lld",
(h5_file_p)f, l_name, name, buffer, (long long)*nelem);
H5_API_RETURN (write_step_attrib(
H5_API_RETURN (write_iteration_attrib(
f,
name, l_name,
H5_INT64_T,
@@ -651,7 +653,7 @@ h5_readstepattrib_i8 (
H5_API_ENTER (h5_int64_t,
"f=%p, name='%.*s', buffer=%p",
(h5_file_p)f, l_name, name, buffer);
H5_API_RETURN (read_step_attrib(
H5_API_RETURN (read_iteration_attrib(
f,
name, l_name,
H5_INT64_T,
@@ -673,7 +675,7 @@ h5_writestepattrib_i4 (
H5_API_ENTER (h5_int64_t,
"f=%p, name='%.*s', buffer=%p, nelem=%lld",
(h5_file_p)f, l_name, name, buffer, (long long)*nelem);
H5_API_RETURN (write_step_attrib(
H5_API_RETURN (write_iteration_attrib(
f,
name, l_name,
H5_INT32_T,
@@ -694,7 +696,7 @@ h5_readstepattrib_i4 (
H5_API_ENTER (h5_int64_t,
"f=%p, name='%.*s', buffer=%p",
(h5_file_p)f, l_name, name, buffer);
H5_API_RETURN (read_step_attrib(
H5_API_RETURN (read_iteration_attrib(
f,
name, l_name,
H5_INT32_T,
+4 -4
View File
@@ -28,7 +28,7 @@ h5_hasstep (
int,
"f=%p, stepno=%lld",
(h5_file_p)fh, (long long int)step);
H5_API_RETURN (h5_has_step (fh, (*step)-1));
H5_API_RETURN (h5_has_iteration (fh, (*step)-1));
}
#define h5_setstep FC_MANGLING( \
@@ -41,7 +41,7 @@ h5_setstep (
h5_file_t fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p, step=%lld", (h5_file_p)fh, (long long)*step);
H5_API_RETURN (h5_set_step (fh, (*step)-1));
H5_API_RETURN (h5_set_iteration (fh, (*step)-1));
}
#define h5_getstep FC_MANGLING( \
@@ -54,7 +54,7 @@ h5_getstep (
h5_file_t fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
H5_API_RETURN (h5_get_step (fh) + 1);
H5_API_RETURN (h5_get_iteration (fh) + 1);
}
#define h5_getnsteps FC_MANGLING( \
@@ -67,5 +67,5 @@ h5_getnsteps (
h5_file_t fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
H5_API_RETURN (h5_get_num_steps (fh));
H5_API_RETURN (h5_get_num_iterations (fh));
}
+2
View File
@@ -28,6 +28,8 @@ H5hut_wrap.c : $(SWIG_SOURCES)
endif
else
$(info Python is disabled)
endif
clean: clean-am
+1 -1
View File
@@ -60,7 +60,7 @@ libH5hut_la_SOURCES = \
h5b_model.c \
h5b_attribs.c \
private/h5_hdf5.c \
private/h5_init.c \
h5_init.c \
private/h5_hsearch.c \
private/h5_maps.c \
private/h5_fcmp.c \
+19 -27
View File
@@ -31,7 +31,7 @@ h5_has_file_attrib (
}
h5_err_t
h5_has_step_attrib (
h5_has_iteration_attrib (
const h5_file_t f_,
const char* const attrib_name
) {
@@ -41,9 +41,8 @@ h5_has_step_attrib (
"attrib_name='%s'",
f,
attrib_name);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (ret_value = hdf5_attribute_exists (f->step_gid, attrib_name));
check_iteration_handle_is_valid (f);
TRY (ret_value = hdf5_attribute_exists (f->iteration_gid, attrib_name));
H5_RETURN (ret_value);
}
@@ -59,14 +58,13 @@ h5_get_num_file_attribs (
}
h5_ssize_t
h5_get_num_step_attribs (
h5_get_num_iteration_attribs (
const h5_file_t f_ /*!< handle to open file */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (ret_value = hdf5_get_num_attribute (f->step_gid));
check_iteration_handle_is_valid (f);
TRY (ret_value = hdf5_get_num_attribute (f->iteration_gid));
H5_RETURN (ret_value);
}
@@ -122,7 +120,7 @@ h5_get_file_attrib_info_by_name (
}
h5_err_t
h5_get_step_attrib_info_by_idx (
h5_get_iteration_attrib_info_by_idx (
const h5_file_t f_, /*!< handle to open file */
const h5_size_t attrib_idx, /*!< index of attribute */
char* attrib_name, /*!< OUT: name of attribute */
@@ -140,10 +138,9 @@ h5_get_step_attrib_info_by_idx (
(long long unsigned)attrib_idx,
attrib_name, (long long unsigned)len_attrib_name,
attrib_type, attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (ret_value = h5priv_get_attrib_info_by_idx (
f->step_gid,
f->iteration_gid,
attrib_idx,
attrib_name, len_attrib_name,
attrib_type, attrib_nelem));
@@ -151,7 +148,7 @@ h5_get_step_attrib_info_by_idx (
}
h5_err_t
h5_get_step_attrib_info_by_name (
h5_get_iteration_attrib_info_by_name (
const h5_file_t f_, /*!< handle to open file */
const char* const attrib_name, /*!< OUT: name of attribute */
h5_int64_t* const attrib_type, /*!< OUT: H5 type of attribute */
@@ -165,10 +162,9 @@ h5_get_step_attrib_info_by_name (
f,
attrib_name,
attrib_type, attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (ret_value = h5priv_get_attrib_info_by_name (
f->step_gid,
f->iteration_gid,
attrib_name,
attrib_type, attrib_nelem));
H5_RETURN (ret_value);
@@ -199,7 +195,7 @@ h5_read_file_attrib (
}
h5_err_t
h5_read_step_attrib (
h5_read_iteration_attrib (
const h5_file_t f_,
const char* const attrib_name,
const h5_types_t attrib_type,
@@ -213,12 +209,10 @@ h5_read_step_attrib (
attrib_name,
(long long int)attrib_type,
attrib_value);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
CHECK_READABLE_MODE (f);
check_iteration_is_readable (f);
TRY (ret_value = h5priv_read_attrib (
f->step_gid,
f->iteration_gid,
attrib_name,
attrib_type,
attrib_value));
@@ -263,7 +257,7 @@ h5_write_file_attrib (
}
h5_err_t
h5_write_step_attrib (
h5_write_iteration_attrib (
const h5_file_t f_,
const char* const attrib_name,
const h5_types_t attrib_type,
@@ -279,19 +273,17 @@ h5_write_step_attrib (
(long long int)attrib_type,
attrib_value,
(long long)attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
CHECK_WRITABLE_MODE (f);
check_iteration_is_writable (f);
if (is_appendonly (f)) {
TRY (h5priv_append_attrib (
f->step_gid,
f->iteration_gid,
attrib_name,
attrib_type,
attrib_value,
attrib_nelem));
} else {
TRY (h5priv_write_attrib (
f->step_gid,
f->iteration_gid,
attrib_name,
attrib_type,
attrib_value,
+6 -4
View File
@@ -9,7 +9,9 @@
#include "h5core/h5_log.h"
#include "h5core/h5_err.h"
#include "private/h5_init.h"
extern int h5_myproc;
#include <stdlib.h>
@@ -101,7 +103,7 @@ h5_verror (
const char* const fmt,
va_list ap
) {
if (h5_log_level == 0) return;
if (__h5_log_level == 0) return;
char fmt2[2048];
snprintf (fmt2,
sizeof(fmt2), "[proc %d] E: %s: %s\n",
@@ -125,7 +127,7 @@ h5_report_errorhandler (
const char* const fmt,
va_list ap
) {
if (h5_log_level > 0) {
if (__h5_log_level > 0) {
h5_verror (fmt, ap);
}
return h5_errno;
@@ -142,7 +144,7 @@ h5_abort_errorhandler (
const char* const fmt,
va_list ap
) {
if (h5_log_level > 0) {
if (__h5_log_level > 0) {
h5_verror (fmt, ap);
}
#ifdef H5_HAVE_PARALLEL
+74 -79
View File
@@ -42,12 +42,7 @@ h5_check_filehandle (
const h5_file_t f_ /*!< filehandle to check validity of */
) {
h5_file_p f = (h5_file_p)f_;
if (f == NULL || f_ == H5_FAILURE || f->file < 0 || f->u == NULL || f->b == NULL) {
return h5_error (
H5_ERR_BADF,
"Called with bad filehandle.");
}
return H5_SUCCESS;
return is_valid_file_handle (f) ? H5_SUCCESS : H5_ERR;
}
hid_t
@@ -56,7 +51,7 @@ h5_get_hdf5_file(
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (hid_t, "f=%p", f);
CHECK_FILEHANDLE (f);
check_file_handle_is_valid (f);
H5_RETURN (f->file);
}
@@ -69,7 +64,7 @@ hdf5_error_handler (
void* __f
) {
UNUSED_ARGUMENT (__f);
if (h5_get_loglevel() >= 5) {
if (h5_get_loglevel() >= 4) {
H5Eprint (estack_id, stderr);
}
return 0;
@@ -97,7 +92,7 @@ mpi_init (
TRY (hdf5_set_fapl_mpiposix_property (f->props->access_prop,
f->props->comm, use_gpfs));
} else if ((f->props->flags & H5_VFD_CORE)) {
} else if ((f->props->flags & H5_VFD_CORE_IO)) {
h5_info("Selecting CORE VFD");
TRY (hdf5_set_fapl_core (f->props->access_prop,
f->props->align, 1));
@@ -117,7 +112,7 @@ mpi_init (
}
#else
// VFD_MPIO_POSIX has been removed in HDF5 1.8.13
if ((f->props->flags & H5_VFD_CORE)) {
if ((f->props->flags & H5_VFD_CORE_IO)) {
h5_info("Selecting CORE VFD");
TRY (hdf5_set_fapl_core (f->props->access_prop,
f->props->align, 1));
@@ -175,12 +170,12 @@ set_default_file_props (
h5_prop_file_t* props = (h5_prop_file_t*)_props;
bzero (props, sizeof (*props));
props->class = H5_PROP_FILE;
TRY (props->prefix_step_name = h5_calloc (1, H5_STEPNAME_LEN));
TRY (props->prefix_iteration_name = h5_calloc (1, H5_ITERATION_NAME_LEN));
strncpy (
props->prefix_step_name,
H5_STEPNAME,
H5_STEPNAME_LEN - 1);
props->width_step_idx = H5_STEPWIDTH;
props->prefix_iteration_name,
H5_ITERATION_NAME,
H5_ITERATION_NAME_LEN - 1);
props->width_iteration_idx = H5_ITERATION_NUM_WIDTH;
#ifdef H5_HAVE_PARALLEL
props->comm = MPI_COMM_WORLD;
#endif
@@ -202,7 +197,7 @@ h5_set_prop_file_mpio_collective (
(long long int)props->class);
}
#ifdef H5_HAVE_PARALLEL
props->flags &= ~(H5_VFD_MPIO_POSIX | H5_VFD_MPIO_INDEPENDENT | H5_VFD_CORE);
props->flags &= ~(H5_VFD_MPIO_POSIX | H5_VFD_MPIO_INDEPENDENT | H5_VFD_CORE_IO);
props->flags |= H5_VFD_MPIO_COLLECTIVE;
props->comm = *comm;
if (props->throttle > 0) {
@@ -230,7 +225,7 @@ h5_set_prop_file_mpio_independent (
(long long int)props->class);
}
#ifdef H5_HAVE_PARALLEL
props->flags &= ~(H5_VFD_MPIO_COLLECTIVE | H5_VFD_MPIO_POSIX | H5_VFD_CORE);
props->flags &= ~(H5_VFD_MPIO_COLLECTIVE | H5_VFD_MPIO_POSIX | H5_VFD_CORE_IO);
props->flags |= H5_VFD_MPIO_INDEPENDENT;
props->comm = *comm;
#else
@@ -255,7 +250,7 @@ h5_set_prop_file_mpio_posix (
(long long int)props->class);
}
#ifdef H5_HAVE_PARALLEL
props->flags &= ~(H5_VFD_MPIO_COLLECTIVE | H5_VFD_MPIO_POSIX | H5_VFD_CORE);
props->flags &= ~(H5_VFD_MPIO_COLLECTIVE | H5_VFD_MPIO_POSIX | H5_VFD_CORE_IO);
props->flags |= H5_VFD_MPIO_INDEPENDENT;
props->comm = *comm;
#else
@@ -271,7 +266,8 @@ h5_set_prop_file_core_vfd (
const h5_int64_t increment
) {
h5_prop_file_t* props = (h5_prop_file_t*)_props;
H5_CORE_API_ENTER (h5_err_t, "props=%p, increment=%lld", props, (long long int)increment);
H5_CORE_API_ENTER (h5_err_t, "props=%p, increment=%lld",
props, (long long int)increment);
if (props->class != H5_PROP_FILE) {
H5_RETURN_ERROR (
@@ -280,7 +276,9 @@ h5_set_prop_file_core_vfd (
(long long int)props->class);
}
#ifdef H5_HAVE_PARALLEL
props->flags &= ~(H5_VFD_MPIO_COLLECTIVE | H5_VFD_MPIO_INDEPENDENT | H5_VFD_MPIO_POSIX);
props->flags &= ~(H5_VFD_MPIO_COLLECTIVE |
H5_VFD_MPIO_INDEPENDENT |
H5_VFD_MPIO_POSIX);
props->flags |= H5_VFD_MPIO_INDEPENDENT;
props->comm = MPI_COMM_SELF;
props->increment = increment;
@@ -315,26 +313,24 @@ h5_set_prop_file_align (
H5_RETURN (H5_SUCCESS);
}
#if 0
h5_err_t
h5_set_prop_file_flush_step (
h5_set_prop_file_flush_after_write (
h5_prop_t _props
) {
h5_prop_file_t* props = (h5_prop_file_t*)_props;
H5_CORE_API_ENTER (
h5_err_t,
"props=%p, align=%lld",
props, (long long int)align);
"props=%p",
props);
if (props->class != H5_PROP_FILE) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
"Invalid property class: %lld",
(long long int)props->class);
}
props-> = align;
props->flush = 1;
H5_RETURN (H5_SUCCESS);
}
#endif
h5_err_t
h5_set_prop_file_throttle (
@@ -411,7 +407,7 @@ h5_close_prop (
switch (prop->class) {
case H5_PROP_FILE: {
h5_prop_file_t* file_prop = (h5_prop_file_t*)prop;
TRY (h5_free (file_prop->prefix_step_name));
TRY (h5_free (file_prop->prefix_iteration_name));
break;
}
default:
@@ -436,14 +432,14 @@ open_file (
f->nprocs = 1; // queried later
f->myproc = 0; // queried later
f->step_gid = -1;
f->iteration_gid = -1;
TRY (f->step_name = h5_calloc (2, H5_STEPNAME_LEN));
TRY (f->iteration_name = h5_calloc (2, H5_ITERATION_NAME_LEN));
sprintf (
f->step_name,
f->iteration_name,
"%s#%0*lld",
f->props->prefix_step_name,
f->props->width_step_idx, (long long)f->step_idx);
f->props->prefix_iteration_name,
f->props->width_iteration_idx, (long long)f->iteration_idx);
TRY (hdf5_set_errorhandler (H5E_DEFAULT, hdf5_error_handler, NULL));
@@ -526,15 +522,17 @@ h5_open_file2 (
f->props->align = props->align;
strncpy (
f->props->prefix_step_name,
props->prefix_step_name,
H5_STEPNAME_LEN - 1);
f->props->width_step_idx = props->width_step_idx;
f->props->prefix_iteration_name,
props->prefix_iteration_name,
H5_ITERATION_NAME_LEN - 1);
f->props->width_iteration_idx = props->width_iteration_idx;
}
TRY (open_file (f, filename, mode));
TRY (h5_set_stepname_fmt ((uintptr_t)f, H5_STEPNAME, H5_STEPWIDTH));
TRY (h5_set_iteration_name_fmt ((uintptr_t)f,
H5_ITERATION_NAME,
H5_ITERATION_NUM_WIDTH));
H5_RETURN ((h5_file_t)f);
}
@@ -595,9 +593,9 @@ h5_close_file (
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
h5_errno = H5_SUCCESS;
CHECK_FILEHANDLE (f);
check_file_handle_is_valid (f);
TRY (h5priv_close_step (f));
TRY (h5priv_close_iteration (f));
TRY (h5upriv_close_file (f));
TRY (h5bpriv_close_file (f));
TRY (hdf5_close_property (f->props->xfer_prop));
@@ -607,7 +605,7 @@ h5_close_file (
TRY (hdf5_flush (f->file, H5F_SCOPE_GLOBAL));
TRY (h5_close_prop ((h5_prop_t)f->props));
TRY (hdf5_close_file (f->file));
TRY (h5_free (f->step_name));
TRY (h5_free (f->iteration_name));
TRY (h5_free (f));
H5_RETURN (H5_SUCCESS);
}
@@ -617,22 +615,21 @@ h5_close_h5hut (
void
) {
H5_CORE_API_ENTER (h5_err_t, "%s", "");
TRY (h5priv_finalize ());
TRY (h5_finalize ());
TRY (hdf5_close ());
H5_RETURN (H5_SUCCESS);
}
h5_err_t
h5_flush_step (
h5_flush_iteration (
const h5_file_t f_
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_writable (f);
ret_value = H5_SUCCESS;
if (f->step_gid >= 0) {
TRY (ret_value = hdf5_flush (f->step_gid, H5F_SCOPE_LOCAL));
if (f->iteration_gid >= 0) {
TRY (ret_value = hdf5_flush (f->iteration_gid, H5F_SCOPE_LOCAL));
}
H5_RETURN (ret_value);
}
@@ -643,7 +640,7 @@ h5_flush_file (
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
CHECK_FILEHANDLE (f);
check_file_is_writable (f);
TRY (ret_value = hdf5_flush (f->file, H5F_SCOPE_GLOBAL));
H5_RETURN (ret_value);
}
@@ -652,15 +649,15 @@ h5_flush_file (
/*!
\ingroup h5_core_filehandling
Define format of the step names.
Define format of the iteration names.
Example: ==H5FedDefineStepNameFormat( f, "Step", 6 )== defines step names
like ==Step#000042==.
Example: ==h5_set_iteration_name_fmt (f, "Step", 6)==
defines iteration names like ==Step#000042==.
\return \c H5_SUCCESS or error code
*/
h5_err_t
h5_set_stepname_fmt (
h5_set_iteration_name_fmt (
const h5_file_t f_,
const char* name,
int width
@@ -669,14 +666,14 @@ h5_set_stepname_fmt (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, name='%s', width=%d",
f, name, width);
CHECK_FILEHANDLE (f);
check_file_handle_is_valid (f);
if (width < 0) width = 0;
else if (width > H5_STEPNAME_LEN - 1) width = H5_STEPNAME_LEN - 1;
else if (width > H5_ITERATION_NAME_LEN - 1) width = H5_ITERATION_NAME_LEN - 1;
strncpy (
f->props->prefix_step_name,
f->props->prefix_iteration_name,
name,
H5_STEPNAME_LEN - 1);
f->props->width_step_idx = width;
H5_ITERATION_NAME_LEN - 1);
f->props->width_iteration_idx = width;
H5_RETURN (H5_SUCCESS);
}
@@ -684,16 +681,16 @@ h5_set_stepname_fmt (
/*!
\ingroup h5_core_filehandling
Get format of the step names.
Get format of the iteration names.
\return \c H5_SUCCESS or error code
*/
h5_err_t
h5_get_stepname_fmt (
h5_get_iteration_name_fmt (
const h5_file_t f_, /*!< Handle to file */
char* const name, /*!< OUT: Prefix */
const int l_name, /*!< length of buffer name */
int* const width /*!< OUT: Width of the number */
char* const name, /*!< OUT: Prefix */
const int l_name, /*!< length of buffer name */
int* const width /*!< OUT: Width of the number */
) {
h5_file_p f = (h5_file_p)f_;
UNUSED_ARGUMENT (f);
@@ -706,19 +703,18 @@ h5_get_stepname_fmt (
/*!
\ingroup h5_core_filehandling
Get current step number.
Get current iteration number.
\return Current step number or error code
\return Current iteration number or error code
*/
h5_id_t
h5_get_step (
h5_get_iteration (
const h5_file_t f_ /*!< file handle */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_id_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
H5_RETURN (f->step_idx);
check_iteration_is_readable (f);
H5_RETURN (f->iteration_idx);
}
/*!
@@ -734,43 +730,42 @@ h5_get_num_procs (
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (int, "f=%p", f);
CHECK_FILEHANDLE (f);
check_file_handle_is_valid (f);
H5_RETURN (f->nprocs);
}
/*!
\ingroup h5_core_filehandling
Get number of steps.
Get number of iterations.
\return Number of steps or error code
\return Number of iterations or error code
*/
h5_ssize_t
h5_get_num_steps(
h5_get_num_iterations (
const h5_file_t f_ /*!< file handle */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (int, "f=%p", f);
CHECK_FILEHANDLE (f);
check_file_handle_is_valid (f);
TRY (ret_value = hdf5_get_num_groups_matching_prefix (
f->root_gid,
f->props->prefix_step_name));
f->props->prefix_iteration_name));
H5_RETURN (ret_value);
}
/*!
\ingroup h5_core_filehandling
Start traversing steps.
Start traversing iterations.
\return \c H5_SUCCESS or error code
*/
h5_err_t
h5_start_traverse_steps (
h5_start_traverse_iterations (
const h5_file_t f_ /*!< file handle */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (int, "f=%p", f);
H5_CORE_API_ENTER (int, "f=%p", (void*)f_);
/*
fast test: Does Step#0 or Step#1 exist?
@@ -784,12 +779,12 @@ h5_start_traverse_steps (
/*!
\ingroup h5_core_filehandling
Go to next step.
Go to next iteration.
\return \c H5_SUCCESS or error code
*/
h5_err_t
h5_traverse_steps (
h5_traverse_iterations (
const h5_file_t f_ /*!< file handle */
) {
h5_file_p f = (h5_file_p)f_;
@@ -741,9 +741,10 @@ _h5_exit (int status) {
}
h5_err_t
h5priv_initialize (
h5_initialize (
void
) {
if (h5_initialized) return 0;
memset (&h5_call_stack, 0, sizeof (h5_call_stack));
// must be set here, otherwise next statement will fail!
h5_initialized = 1;
@@ -785,7 +786,7 @@ h5priv_initialize (
}
h5_err_t
h5priv_finalize (
h5_finalize (
void
) {
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
+24 -12
View File
@@ -9,9 +9,13 @@
#include "h5core/h5_log.h"
#include "h5core/h5_err.h"
#include "private/h5_init.h"
h5_int32_t h5_log_level = H5_VERBOSE_ERROR;
extern int h5_myproc;
h5_int64_t __h5_log_level = H5_VERBOSE_ERROR;
h5_int64_t __h5_debug_mask = 0;
struct call_stack h5_call_stack;
char *h5_rfmts[] = {
@@ -20,7 +24,10 @@ char *h5_rfmts[] = {
[e_char_p] = "%s",
[e_void_p] = "%p",
[e_h5_err_t] = "%lld",
[e_h5_int32_t] = "%ld",
[e_h5_uint32_t] = "%lu",
[e_h5_int64_t] = "%lld",
[e_h5_uint64_t] = "%llu",
[e_h5_id_t] = "%lld",
[e_h5_ssize_t] = "%lld",
[e_h5_errorhandler_t] = "%p",
@@ -56,12 +63,17 @@ char *h5_rfmts[] = {
*/
h5_err_t
h5_set_loglevel (
const h5_id_t level /*!< debug level */
const h5_int64_t level /*!< log level */
) {
if (level < 0)
h5_log_level = ((1 << 20) - 1) & ~0x7;
else
h5_log_level = level;
__h5_log_level = level & 0x7;
return H5_SUCCESS;
}
h5_err_t
h5_set_debug_mask (
const h5_int64_t mask /*!< debug level */
) {
__h5_debug_mask = mask;
return H5_SUCCESS;
}
@@ -72,11 +84,11 @@ h5_set_loglevel (
\return current debug level
*/
h5_err_t
h5_int64_t
h5_get_loglevel (
void
) {
return h5_log_level;
return __h5_log_level;
}
void
@@ -98,7 +110,7 @@ h5_warn (
const char* fmt,
...
) {
if (h5_log_level >= 2) {
if (__h5_log_level >= 2) {
va_list ap;
va_start (ap, fmt);
h5priv_vprintf (stderr, "W", h5_get_funcname(), fmt, ap);
@@ -112,7 +124,7 @@ h5_info (
const char* fmt,
...
) {
if (h5_log_level >= 3) {
if (__h5_log_level >= 3) {
va_list ap;
va_start (ap, fmt);
h5priv_vprintf (stdout, "I", h5_get_funcname(), fmt, ap);
@@ -125,7 +137,7 @@ h5_debug (
const char* const fmt,
...
) {
if (h5_log_level >= 4) {
if (__h5_log_level >= 4) {
char prefix[1024];
snprintf (prefix, sizeof(prefix), "%*s %s",
h5_call_stack_get_level(), "",
+39 -39
View File
@@ -15,94 +15,94 @@
#include "private/h5_model.h"
h5_err_t
h5priv_close_step (
h5priv_close_iteration (
const h5_file_p f
) {
H5_PRIV_API_ENTER (h5_err_t, "f=%p", f);
if (f->step_gid <= 0)
if (f->iteration_gid <= 0)
H5_LEAVE (H5_SUCCESS);
TRY (hdf5_close_group (f->step_gid));
TRY (hdf5_close_group (f->iteration_gid));
f->step_gid = -1;
f->iteration_gid = -1;
H5_RETURN (H5_SUCCESS);
}
h5_err_t
h5_set_step (
h5_set_iteration (
const h5_file_t f_, /*!< [in] Handle to open file */
const h5_id_t step_idx /*!< [in] Step to set. */
const h5_id_t iteration_idx /*!< [in] Iteration to set. */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, step_idx=%lld",
f, (long long)step_idx);
"f=%p, iteration_idx=%lld",
f, (long long)iteration_idx);
CHECK_FILEHANDLE (f);
TRY (h5priv_close_step (f));
f->step_idx = step_idx;
TRY (h5priv_close_iteration (f));
f->iteration_idx = iteration_idx;
sprintf (
f->step_name,
f->iteration_name,
"%s#%0*lld",
f->props->prefix_step_name, f->props->width_step_idx,
(long long) f->step_idx);
f->props->prefix_iteration_name, f->props->width_iteration_idx,
(long long) f->iteration_idx);
h5_info (
"Open step #%lld for file %lld",
(long long)f->step_idx,
"Open iteration #%lld in file %lld",
(long long)f->iteration_idx,
(long long)(size_t) f);
h5_err_t exists;
TRY (exists = hdf5_link_exists (f->file, f->step_name));
TRY (exists = hdf5_link_exists (f->file, f->iteration_name));
if (exists) {
TRY (f->step_gid = h5priv_open_group (
TRY (f->iteration_gid = h5priv_open_group (
f->file,
f->step_name));
f->iteration_name));
} else if (is_writable (f)) {
TRY (f->step_gid = h5priv_create_group (
TRY (f->iteration_gid = h5priv_create_group (
f->file,
f->step_name));
f->iteration_name));
}
H5_RETURN (H5_SUCCESS);
}
/*
returns:
TRUE (value > 0): if step exists
FALSE (i.e. 0): if step does not exist
TRUE (value > 0): if iteration exists
FALSE (i.e. 0): if iteration does not exist
H5_FAILURE: on error
*/
h5_err_t
h5_has_step (
h5_has_iteration (
const h5_file_t f_, /*!< [in] Handle to open file */
const h5_id_t step_idx /*!< [in] Step number to query */
const h5_id_t iteration_idx /*!< [in] Step number to query */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t, "f=%p, step_idx=%lld", f, (long long)step_idx);
H5_CORE_API_ENTER (h5_err_t,
"f=%p, iteration_idx=%lld",
f, (long long)iteration_idx);
CHECK_FILEHANDLE (f);
char name[2*H5_STEPNAME_LEN];
char name[2*H5_ITERATION_NAME_LEN];
sprintf (name,
"%s#%0*lld",
f->props->prefix_step_name, f->props->width_step_idx,
(long long)step_idx);
f->props->prefix_iteration_name, f->props->width_iteration_idx,
(long long)iteration_idx);
TRY (ret_value = hdf5_link_exists (f->file, name));
H5_RETURN (ret_value);
}
h5_err_t
h5priv_normalize_dataset_name (
const char *name,
char *name2
char* const name
) {
H5_CORE_API_ENTER (h5_err_t, "name='%s', name2='%p'", name, name2);
if ( strlen(name) > H5_DATANAME_LEN-1 ) {
strncpy ( name2, name, H5_DATANAME_LEN-1 );
name2[H5_DATANAME_LEN-1] = '\0';
h5_warn ("Truncated name '%s' to '%s'.", name, name2);
} else {
strcpy (name2, name);
H5_CORE_API_ENTER (h5_err_t, "name='%s'", name);
if (strlen(name) > H5_DATANAME_LEN-1) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
"Dataset name '%s' to long! "
"Must be less then %d characters.",
name, H5_DATANAME_LEN);
}
if ( strcmp( name2, H5BLOCK_GROUPNAME_BLOCK ) == 0 ) {
if (strcmp (name, H5BLOCK_GROUPNAME_BLOCK) == 0) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
"Can't create dataset or field with name '%s'"
+9 -17
View File
@@ -33,9 +33,7 @@ h5b_write_field_attrib (
(long long int)attrib_type,
attrib_value,
(long long)attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_WRITABLE_MODE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_writable (f);
TRY( h5bpriv_create_field_group(f, field_name) );
if (is_appendonly (f)) {
@@ -74,8 +72,7 @@ h5b_read_field_attrib (
attrib_name,
(long long)attrib_type,
buffer);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_readable (f);
TRY (h5bpriv_open_field_group(f, field_name));
@@ -102,8 +99,7 @@ h5b_has_field_attrib (
f,
field_name,
attrib_name);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (h5bpriv_open_field_group(f, field_name));
@@ -120,8 +116,7 @@ h5b_get_num_field_attribs (
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t, "f=%p field_name='%s'", f, field_name);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (h5bpriv_open_field_group(f, field_name));
@@ -151,8 +146,7 @@ h5b_get_field_attrib_info_by_idx (
(long long unsigned)attrib_idx,
attrib_name, (long long unsigned)len_attrib_name,
attrib_type, attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (h5bpriv_open_field_group(f, field_name));
TRY (ret_value = h5priv_get_attrib_info_by_idx (
f->b->field_gid,
@@ -180,8 +174,7 @@ h5b_get_field_attrib_info_by_name (
field_name,
attrib_name,
attrib_type, attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (h5bpriv_open_field_group(f, field_name));
TRY (ret_value = h5priv_get_attrib_info_by_name (
f->b->field_gid,
@@ -248,8 +241,7 @@ h5b_set_3d_field_coords (
field_name,
attrib_name,
coords, (long long unsigned)n_coords);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_writable (f);
TRY (check_coords (f, rank, n_coords));
TRY (h5b_write_field_attrib (
@@ -284,8 +276,8 @@ h5b_get_3d_field_coords (
field_name,
attrib_name,
coords, (long long unsigned)n_coords);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_readable (f);
TRY (check_coords (f, rank, n_coords));
TRY (h5b_read_field_attrib (
+4 -10
View File
@@ -256,9 +256,7 @@ h5b_write_scalar_data (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, field_name='%s', data=%p, type=%lld",
f, field_name, data, (long long int)type);
CHECK_FILEHANDLE (f);
CHECK_WRITABLE_MODE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_writable (f);
CHECK_LAYOUT (f);
TRY (h5bpriv_create_field_group (f, field_name));
@@ -285,9 +283,7 @@ h5b_write_vector3d_data (
"zdata=%p, "
"type=%lld",
f, field_name, xdata, ydata, zdata, (long long int)type);
CHECK_FILEHANDLE (f);
CHECK_WRITABLE_MODE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_writable (f);
CHECK_LAYOUT (f);
TRY (h5bpriv_create_field_group(f, field_name));
@@ -430,8 +426,7 @@ h5b_read_scalar_data (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, field_name='%s', data=%p, type=%lld",
f, field_name, data, (long long int)type);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_readable (f);
CHECK_LAYOUT (f);
TRY (h5bpriv_open_field_group(f, field_name));
@@ -457,8 +452,7 @@ h5b_read_vector3d_data (
"zdata=%p, "
"type=%lld",
f, field_name, xdata, ydata, zdata, (long long int)type);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_readable (f);
CHECK_LAYOUT (f);
TRY (h5bpriv_open_field_group(f, field_name));
+62 -76
View File
@@ -41,9 +41,8 @@ h5b_has_field_data (
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (ret_value = hdf5_link_exists (f->step_gid, H5BLOCK_GROUPNAME_BLOCK));
check_iteration_handle_is_valid (f);
TRY (ret_value = hdf5_link_exists (f->iteration_gid, H5BLOCK_GROUPNAME_BLOCK));
H5_RETURN (ret_value);
}
@@ -418,7 +417,6 @@ _dissolve_ghostzones (
p_el = p_save;
}
}
}
h5_free (p_begin);
H5_RETURN (H5_SUCCESS);
@@ -453,12 +451,12 @@ h5bpriv_open_block_group (
h5b_fdata_t *b = f->b;
TRY (hdf5_close_group (b->block_gid));
b->block_gid = hdf5_open_group (f->step_gid, H5BLOCK_GROUPNAME_BLOCK);
b->block_gid = hdf5_open_group (f->iteration_gid, H5BLOCK_GROUPNAME_BLOCK);
if (f->b->block_gid < 0)
H5_RETURN_ERROR (
H5_ERR_INVAL,
"%s",
"Time step does not contain H5Block data!");
"step/iteration does not contain H5Block data!");
H5_RETURN (H5_SUCCESS);
}
@@ -469,14 +467,14 @@ _create_block_group (
) {
H5_PRIV_FUNC_ENTER (h5_err_t, "f=%p", f);
h5_err_t exists;
TRY (exists = hdf5_link_exists (f->step_gid, H5BLOCK_GROUPNAME_BLOCK));
TRY (exists = hdf5_link_exists (f->iteration_gid, H5BLOCK_GROUPNAME_BLOCK));
if (exists > 0) {
TRY (h5bpriv_open_block_group(f));
} else {
TRY (hdf5_close_group(f->b->block_gid) );
TRY (f->b->block_gid = hdf5_create_group(
f->step_gid, H5BLOCK_GROUPNAME_BLOCK) );
f->iteration_gid, H5BLOCK_GROUPNAME_BLOCK) );
}
H5_RETURN (H5_SUCCESS);
}
@@ -484,19 +482,18 @@ _create_block_group (
h5_err_t
h5bpriv_open_field_group (
const h5_file_p f, /*!< IN: file handle */
const char *name
char* const name
) {
H5_PRIV_API_ENTER (h5_err_t, "f=%p, name='%s'", f, name);
char name2[H5_DATANAME_LEN];
h5priv_normalize_dataset_name (name, name2);
h5priv_normalize_dataset_name (name);
TRY (hdf5_close_group (f->b->field_gid));
TRY (h5bpriv_open_block_group (f));
f->b->field_gid = hdf5_open_group (f->b->block_gid, name2);
f->b->field_gid = hdf5_open_group (f->b->block_gid, name);
if (f->b->field_gid < 0)
return h5_error(
H5_ERR_INVAL,
"Field '%s' does not exist!", name2);
"Field '%s' does not exist!", name);
H5_RETURN (H5_SUCCESS);
}
@@ -504,24 +501,23 @@ h5bpriv_open_field_group (
h5_err_t
h5bpriv_create_field_group (
const h5_file_p f, /*!< IN: file handle */
const char *name /*!< IN: name of field group to create */
char* const name /*!< IN: name of field group to create */
) {
H5_PRIV_API_ENTER (h5_err_t, "f=%p, name='%s'", f, name);
h5b_fdata_t *b = f->b;
TRY( _create_block_group(f) );
char name2[H5_DATANAME_LEN];
h5priv_normalize_dataset_name (name, name2);
h5priv_normalize_dataset_name (name);
h5_err_t exists;
TRY (exists = hdf5_link_exists ( b->block_gid, name2));
TRY (exists = hdf5_link_exists ( b->block_gid, name));
if (exists > 0) {
TRY (h5bpriv_open_field_group (f, name2));
TRY (h5bpriv_open_field_group (f, name));
} else {
TRY (hdf5_close_group (f->b->field_gid) );
TRY (b->field_gid = hdf5_create_group (b->block_gid, name2));
TRY (b->field_gid = hdf5_create_group (b->block_gid, name));
}
H5_RETURN (H5_SUCCESS);
@@ -535,8 +531,7 @@ h5b_3d_has_view (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, ",
f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
H5_RETURN (((h5_file_p)fh)->b->have_layout > 0);
}
@@ -548,7 +543,8 @@ h5b_3d_set_view (
const h5_size_t j_start, /*!< IN: start index of \c j */
const h5_size_t j_end, /*!< IN: end index of \c j */
const h5_size_t k_start, /*!< IN: start index of \c k */
const h5_size_t k_end /*!< IN: end index of \c k */
const h5_size_t k_end, /*!< IN: end index of \c k */
const h5_int64_t dissolve_ghostzones /*!< IN: bool: dissolve ghost-zones */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t,
@@ -560,8 +556,7 @@ h5b_3d_set_view (
(long long unsigned)i_start, (long long unsigned)i_end,
(long long unsigned)j_start, (long long unsigned)j_end,
(long long unsigned)k_start, (long long unsigned)k_end);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
h5b_fdata_t *b = f->b;
b->user_layout[0].i_start = i_start;
b->user_layout[0].i_end = i_end;
@@ -576,7 +571,6 @@ h5b_3d_set_view (
h5b_partition_t *write_layout;
TRY (user_layout = h5_calloc (f->nprocs, sizeof (*user_layout)));
TRY (write_layout = h5_calloc (f->nprocs, sizeof (*write_layout)));
user_layout[f->myproc] = b->user_layout[0];
@@ -585,11 +579,7 @@ h5b_3d_set_view (
user_layout, 1, f->b->partition_mpi_t, f->props->comm));
_get_max_dimensions(f, user_layout);
TRY (_dissolve_ghostzones (f, user_layout, write_layout));
b->user_layout[0] = user_layout[f->myproc];
b->write_layout[0] = write_layout[f->myproc];
//b->user_layout[0] = user_layout[f->myproc];
h5_debug (
"User layout: %lld:%lld, %lld:%lld, %lld:%lld",
(long long)b->user_layout[0].i_start,
@@ -599,17 +589,25 @@ h5b_3d_set_view (
(long long)b->user_layout[0].k_start,
(long long)b->user_layout[0].k_end );
h5_debug (
"Ghost-zone layout: %lld:%lld, %lld:%lld, %lld:%lld",
(long long)b->write_layout[0].i_start,
(long long)b->write_layout[0].i_end,
(long long)b->write_layout[0].j_start,
(long long)b->write_layout[0].j_end,
(long long)b->write_layout[0].k_start,
(long long)b->write_layout[0].k_end );
if (dissolve_ghostzones) {
TRY (write_layout = h5_calloc (f->nprocs, sizeof (*write_layout)));
TRY (_dissolve_ghostzones (f, user_layout, write_layout));
b->write_layout[0] = write_layout[f->myproc];
h5_debug (
"Ghost-zone layout: %lld:%lld, %lld:%lld, %lld:%lld",
(long long)b->write_layout[0].i_start,
(long long)b->write_layout[0].i_end,
(long long)b->write_layout[0].j_start,
(long long)b->write_layout[0].j_end,
(long long)b->write_layout[0].k_start,
(long long)b->write_layout[0].k_end );
h5_free(write_layout);
} else {
b->write_layout[0] = b->user_layout[0];
}
h5_free(user_layout);
h5_free(write_layout);
#else
b->write_layout[0] = b->user_layout[0];
b->i_max = b->user_layout->i_end;
@@ -642,8 +640,7 @@ h5b_3d_get_view (
i_start, i_end,
j_start, j_end,
k_start, k_end);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
h5b_partition_t *p = f->b->user_layout;
*i_start = p->i_start;
@@ -676,8 +673,7 @@ h5b_3d_get_reduced_view (
i_start, i_end,
j_start, j_end,
k_start, k_end);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
h5b_partition_t *p = f->b->write_layout;
*i_start = p->i_start;
@@ -704,8 +700,7 @@ h5b_3d_set_chunk (
(long long unsigned)i,
(long long unsigned)j,
(long long unsigned)k);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
if ( i == 0 || j == 0 || k == 0 )
{
h5_info ("Disabling chunking" );
@@ -724,21 +719,20 @@ h5b_3d_set_chunk (
h5_err_t
h5b_3d_get_chunk (
const h5_file_t fh, /*!< IN: File handle */
const char *field_name, /*!< IN: name of dataset */
h5_size_t *const i, /*!< OUT: size of \c i */
h5_size_t *const j, /*!< OUT: size of \c j */
h5_size_t *const k /*!< OUT: size of \c k */
char* const field_name, /*!< IN: name of dataset */
h5_size_t* const i, /*!< OUT: size of \c i */
h5_size_t* const j, /*!< OUT: size of \c j */
h5_size_t* const k /*!< OUT: size of \c k */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, i=%p, j=%p, k=%p",
f, i, j, k);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
h5b_fdata_t *b = f->b;
TRY( h5bpriv_open_field_group ( f, field_name ) );
TRY (h5bpriv_open_field_group (f, field_name));
hid_t dataset_id;
hid_t plist_id;
@@ -776,8 +770,7 @@ h5b_3d_set_grid (
(long long unsigned)i,
(long long unsigned)j,
(long long unsigned)k);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
if (i*j*k != f->nprocs) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
@@ -793,9 +786,9 @@ h5b_3d_set_grid (
f->b->j_grid = j;
f->b->i_grid = k;
#ifdef H5_HAVE_PARALLEL
int dims[3] = { k, j, i };
int period[3] = { 0, 0, 0 };
#ifdef H5_HAVE_PARALLEL
TRY( h5priv_mpi_cart_create(
f->props->comm, 3, dims, period, 0, &f->b->cart_comm) );
#else
@@ -817,8 +810,7 @@ h5b_3d_get_grid_coords (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, proc=%d, i=%p, j=%p, k=%p",
f, proc, i, j, k);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
if ( !f->b->have_grid )
H5_RETURN_ERROR (
H5_ERR_INVAL,
@@ -852,8 +844,7 @@ h5b_3d_set_dims (
(long long unsigned)i,
(long long unsigned)j,
(long long unsigned)k);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
if ( !f->b->have_grid )
H5_RETURN_ERROR (
H5_ERR_INVAL,
@@ -924,8 +915,7 @@ h5b_3d_set_halo (
(long long unsigned)j,
(long long unsigned)k);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
if ( !f->b->have_grid ) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
@@ -955,8 +945,7 @@ h5b_get_num_fields (
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (h5bpriv_open_block_group(f));
TRY (ret_value = hdf5_get_num_objs_in_group (f->b->block_gid));
@@ -972,35 +961,33 @@ h5b_has_field (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, name='%s'",
f, name);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
const char* path[] = { H5BLOCK_GROUPNAME_BLOCK, name };
TRY (ret_value = h5priv_link_exists_(f->step_gid, path, 2));
TRY (ret_value = h5priv_link_exists_(f->iteration_gid, path, 2));
H5_RETURN (ret_value);
}
h5_err_t
h5b_get_field_info_by_name (
const h5_file_t fh, /*!< IN: file handle */
const char *name, /*!< IN: field name */
h5_size_t *field_rank, /*!< OUT: field rank */
h5_size_t *field_dims, /*!< OUT: field dimensions */
h5_size_t *elem_rank, /*!< OUT: element rank */
h5_int64_t *type /*!< OUT: datatype */
char* const name, /*!< IN: field name */
h5_size_t* field_rank, /*!< OUT: field rank */
h5_size_t* field_dims, /*!< OUT: field dimensions */
h5_size_t* elem_rank, /*!< OUT: element rank */
h5_int64_t* type /*!< OUT: datatype */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, name='%s', "
"field_rank=%p, field_dims=%p, elem_rank=%p, type=%p",
f, name, field_rank, field_dims, elem_rank, type);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
/* give it plenty of space even though we don't expect rank > 3 */
hsize_t dims[16];
TRY( h5bpriv_open_field_group(f, name) );
TRY (h5bpriv_open_field_group (f, name));
hid_t dataset_id;
hid_t dataspace_id;
@@ -1054,8 +1041,7 @@ h5b_get_field_info (
(long long unsigned)idx,
name, (long long unsigned)len_name,
field_rank, field_dims, elem_rank, type);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (h5bpriv_open_block_group(f));
TRY (hdf5_get_objname_by_idx(
+6 -6
View File
@@ -2002,7 +2002,7 @@ distribute_octree_parmetis (
TRY (vtxdist = h5_calloc (m->f->nprocs+1, sizeof (*vtxdist)));
vtxdist[0] = 0;
#if !defined(NDEBUG)
if (h5_log_level & (1<<5) ) {
if (__h5_debug_mask & (1<<5) ) {
h5_debug ("vtxdist[%d]: %d", 0, 0);
}
#endif
@@ -2014,7 +2014,7 @@ distribute_octree_parmetis (
vtxdist[i] = vtxdist[i-1] + n;
}
#if !defined(NDEBUG)
if (h5_log_level & (1<<5) ) {
if (__h5_debug_mask & (1<<5) ) {
h5_debug ("vtxdist[%d]: %d", i, vtxdist[i]);
}
#endif
@@ -2060,7 +2060,7 @@ distribute_octree_parmetis (
}
xadj[i+1] = xadj[i] + num_neigh;
#if !defined(NDEBUG)
if (h5_log_level & (1<<5) ) {
if (__h5_debug_mask & (1<<5) ) {
h5_debug ("xadj[%d]: %d", i+1, xadj[i+1]);
}
#endif
@@ -2070,7 +2070,7 @@ distribute_octree_parmetis (
if (new_numbering[j] == neighbors[k]) {
adjncy[counter] = j;
#if !defined(NDEBUG)
if (h5_log_level & (1<<5) ) {
if (__h5_debug_mask & (1<<5) ) {
h5_debug ("adjncy[%d]: %d", counter, adjncy[counter]);
}
#endif
@@ -2139,7 +2139,7 @@ distribute_octree_parmetis (
TRY (h5_free (ubvec));
#if !defined(NDEBUG)
if (h5_log_level & (1<<5) ) {
if (__h5_debug_mask & (1<<5) ) {
for (i = 0; i < num_interior_oct; i++) {
h5_debug ("part[%d]: %llu", i, (unsigned long long)part[i]);
}
@@ -2498,7 +2498,7 @@ read_chunked_elements (
#if NDEBUG == 0
if (h5_log_level & (1<<6) ) {
if (__h5_debug_mask & (1<<6) ) {
sleep (m->f->myproc*2);
for (int i = 0; i < num_interior_elems;i++) {
h5_debug ("\n"
-2
View File
@@ -23,8 +23,6 @@
#include "private/h5t_io.h"
#include "private/h5t_tags.h"
#include "private/h5_init.h"
#include "h5core/h5_model.h"
#include "private/h5t_core.h"
#include "private/h5t_store.h"
+3 -1
View File
@@ -17,7 +17,6 @@
#include "private/h5t_store.h"
#include "private/h5t_core.h"
#include "private/h5t_io.h"
#include "private/h5_init.h"
#include "private/h5_file.h"
#include "private/h5_mpi.h"
@@ -687,6 +686,8 @@ rebuild_map_elem_g2l (
h5priv_sort_idxmap (map);
H5_RETURN (H5_SUCCESS);
}
#if defined(WITH_PARALLEL_H5GRID)
/*
Rebuild mapping of global element indices to their local indices.
*/
@@ -716,6 +717,7 @@ rebuild_map_elem_g2l_partial (
h5priv_sort_idxmap (map);
H5_RETURN (H5_SUCCESS);
}
#endif
h5_err_t
h5t_end_store_elems (
-2
View File
@@ -21,8 +21,6 @@
#include "private/h5t_model.h"
#include "private/h5t_tags.h"
#include "private/h5_init.h"
#include <assert.h>
static h5_err_t
+82 -62
View File
@@ -76,9 +76,9 @@ h5upriv_close_file (
}
h5_err_t
h5u_read_data (
h5u_read_dataset (
const h5_file_t fh, /*!< [in] Handle to open file */
const char* name, /*!< [in] Name to associate dataset with */
char* const name, /*!< [in] Name to associate dataset with */
void* data, /*!< [out] Array of data */
const h5_types_t type
) {
@@ -86,36 +86,30 @@ h5u_read_data (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, name='%s', data=%p, type=%lld",
f, name, data, (long long int)type);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_readable (f);
TRY (h5priv_normalize_dataset_name (name));
hid_t hdf5_type;
TRY (hdf5_type = h5priv_map_enum_to_normalized_type (type));
struct h5u_fdata *u = f->u;
hid_t dataset_id;
hid_t space_id;
hid_t memspace_id;
hsize_t ndisk, nread, nmem;
if ( f->step_gid < 0 ) {
TRY (h5_set_step ((h5_file_t)f, f->step_idx));
if ( f->iteration_gid < 0 ) {
TRY (h5_set_iteration ((h5_file_t)f, f->iteration_idx));
}
char name2[H5_DATANAME_LEN];
TRY (h5priv_normalize_dataset_name (name, name2));
TRY (dataset_id = hdf5_open_dataset_by_name (f->step_gid, name2));
hid_t dataset_id;
TRY (dataset_id = hdf5_open_dataset_by_name (f->iteration_gid, name));
/* default spaces, if not using a view selection */
memspace_id = H5S_ALL;
hid_t memspace_id = H5S_ALL;
hid_t space_id;
TRY (space_id = hdf5_get_dataset_space (dataset_id));
/* get the number of elements on disk for the datset */
hsize_t ndisk;
TRY (ndisk = hdf5_get_npoints_of_dataspace (space_id));
if (u->diskshape != H5S_ALL) {
TRY (nread = hdf5_get_selected_npoints_of_dataspace (u->diskshape));
hsize_t nread;
if (f->u->diskshape != H5S_ALL) {
TRY (nread = hdf5_get_selected_npoints_of_dataspace (f->u->diskshape));
/* make sure the disk space selected by the view doesn't
* exceed the size of the dataset */
@@ -131,7 +125,7 @@ h5u_read_data (
"Ignoring view: dataset[%s] has fewer "
"elements on disk (%lld) than are selected "
"(%lld).",
name2, (long long)ndisk, (long long)nread );
name, (long long)ndisk, (long long)nread );
nread = ndisk;
}
} else {
@@ -140,8 +134,9 @@ h5u_read_data (
nread = ndisk;
}
if (u->memshape != H5S_ALL) {
TRY (nmem = hdf5_get_npoints_of_dataspace (u->memshape));
if (f->u->memshape != H5S_ALL) {
hid_t nmem;
TRY (nmem = hdf5_get_npoints_of_dataspace (f->u->memshape));
/* make sure the memory space selected by the view has
* enough capacity for the read */
@@ -154,7 +149,7 @@ h5u_read_data (
"Ignoring view: dataset[%s] has more "
"elements selected (%lld) than are available "
"in memory (%lld).",
name2, (long long)nread, (long long)nmem );
name, (long long)nread, (long long)nmem );
memspace_id = H5S_ALL;
}
}
@@ -177,63 +172,88 @@ h5u_read_data (
}
h5_err_t
h5u_write_data (
h5u_write (
const h5_file_t fh, /*!< IN: Handle to open file */
const char *name, /*!< IN: Name to associate array with */
const void *data, /*!< IN: Array to commit to disk */
hid_t dset_id,
hid_t type,
const void* data
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, dset_id=%lld, type=%lld, data=%p",
f, (long long)dset_id, (long long int)type, data);
TRY (h5priv_start_throttle (f));
hid_t hdf5_type;
TRY (hdf5_type = h5priv_map_enum_to_normalized_type (type));
TRY (hdf5_write_dataset (
dset_id,
hdf5_type,
f->u->memshape,
f->u->diskshape,
f->props->xfer_prop,
data));
TRY (h5priv_end_throttle (f));
f->empty = 0;
if (f->props->flush) {
TRY (hdf5_flush (f->iteration_gid, H5F_SCOPE_LOCAL));
}
H5_RETURN (H5_SUCCESS);
}
hid_t
h5u_open_dataset (
const h5_file_t fh, /*!< IN: Handle to open file */
char* const name, /*!< IN: Name to associate array with */
const h5_types_t type /*!< IN: Type of data */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, name='%s', data=%p, type=%lld",
f, name, data, (long long int)type);
CHECK_FILEHANDLE (f);
CHECK_WRITABLE_MODE (f);
CHECK_TIMEGROUP (f);
"f=%p, name='%s', type=%lld",
f, name, (long long int)type);
check_iteration_handle_is_valid (f);
TRY (h5priv_normalize_dataset_name (name));
hid_t hdf5_type;
TRY (hdf5_type = h5priv_map_enum_to_normalized_type (type));
struct h5u_fdata *u = f->u;
hid_t dset_id;
if ( f->iteration_gid < 0 ) {
TRY (h5_set_iteration ((h5_file_t)f, f->iteration_idx));
}
char name2[H5_DATANAME_LEN];
TRY (h5priv_normalize_dataset_name (name, name2));
if ( u->shape == H5S_ALL )
if (f->u->shape == H5S_ALL )
h5_warn("The view is unset or invalid.");
/* test for existing dataset */
hid_t dset_id;
H5E_BEGIN_TRY
dset_id = H5Dopen(f->step_gid, name2, H5P_DEFAULT);
dset_id = H5Dopen(f->iteration_gid, name, H5P_DEFAULT);
H5E_END_TRY
if (dset_id > 0) {
h5_warn("Dataset %s/%s already exists",
hdf5_get_objname(f->step_gid), name2);
hdf5_get_objname (f->iteration_gid), name);
} else {
TRY (dset_id = hdf5_create_dataset (
f->step_gid,
name2,
f->iteration_gid,
name,
hdf5_type,
u->shape,
f->u->shape,
H5P_DEFAULT));
}
H5_RETURN (dset_id);
}
TRY (h5priv_start_throttle (f));
h5_info ("Writing dataset %s/%s.",
hdf5_get_objname(f->step_gid), name2);
TRY (hdf5_write_dataset (
dset_id,
hdf5_type,
u->memshape,
u->diskshape,
f->props->xfer_prop,
data));
TRY (h5priv_end_throttle (f));
TRY (hdf5_close_dataset (dset_id));
f->empty = 0;
TRY (hdf5_flush (f->step_gid, H5F_SCOPE_LOCAL));
h5_err_t
h5u_write_dataset (
const h5_file_t fh, /*!< IN: Handle to open file */
char* const name, /*!< IN: Name to associate array with */
const void* data, /*!< IN: Array to commit to disk */
const h5_types_t type /*!< IN: Type of data */
) {
H5_CORE_API_ENTER (h5_err_t,
"f=%p, name='%s', data=%p, type=%lld",
(void*)fh, name, data, (long long int)type);
hid_t dset_id;
TRY (dset_id = h5u_open_dataset (fh, name, type));
TRY (h5u_write (fh, dset_id, type, data));
TRY (hdf5_close_dataset(dset_id));
H5_RETURN (H5_SUCCESS);
}
+76 -102
View File
@@ -22,21 +22,20 @@
#include <string.h>
h5_ssize_t
h5u_get_num_points (
h5u_get_num_items (
const h5_file_t fh /*!< [in] Handle to open file */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
h5_ssize_t nparticles;
if (h5u_has_view ((h5_file_t)f)) {
/* if a view exists, use its size as the number of particles */
TRY (nparticles = h5u_get_num_points_in_view (fh));
TRY (nparticles = h5u_get_num_items_in_view (fh));
} else {
/* otherwise, report all particles on disk in the first dataset
for this timestep */
for this iteration */
TRY (nparticles = h5u_get_totalnum_particles_by_idx (fh, 0));
}
@@ -44,13 +43,12 @@ h5u_get_num_points (
}
h5_ssize_t
h5u_get_num_points_in_view (
h5u_get_num_items_in_view (
const h5_file_t fh /*!< [in] Handle to open file */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
h5_ssize_t nparticles;
if (!h5u_has_view (fh)) {
@@ -73,16 +71,26 @@ h5u_get_totalnum_particles_by_name (
H5_CORE_API_ENTER (h5_ssize_t,
"f=%p, dataset_name=%s",
f, dataset_name);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
h5_ssize_t nparticles;
TRY (nparticles = hdf5_get_npoints_of_dataset_by_name (
f->step_gid, dataset_name));
f->iteration_gid, dataset_name));
h5_debug ("Found %lld particles in dataset %s.",
(long long)nparticles, dataset_name);
H5_RETURN (nparticles);
}
/*
Query number of items in dataset in current timestep. Dataset is
given by index.
returns:
H5_NOK if dataset does not exist
H5_ERROR on error
else number of items
*/
h5_ssize_t
h5u_get_totalnum_particles_by_idx (
const h5_file_t fh, ///< [in] Handle to open file
@@ -90,13 +98,12 @@ h5u_get_totalnum_particles_by_idx (
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p, idx=%lld", f, (long long)idx);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
char dataset_name[H5_DATANAME_LEN];
dataset_name[0] = '\0';
h5_err_t h5err;
TRY (h5err = hdf5_get_name_of_dataset_by_idx (
f->step_gid,
f->iteration_gid,
idx,
dataset_name,
H5_DATANAME_LEN));
@@ -104,14 +111,14 @@ h5u_get_totalnum_particles_by_idx (
H5_LEAVE (H5_NOK);
h5_ssize_t nparticles;
TRY (nparticles = hdf5_get_npoints_of_dataset_by_name (
f->step_gid, dataset_name));
f->iteration_gid, dataset_name));
h5_debug ("Found %lld particles in dataset %s.",
(long long)nparticles, dataset_name);
H5_RETURN (nparticles);
}
h5_err_t
h5u_set_num_points (
h5u_set_num_items (
const h5_file_t fh, /*!< [in] Handle to open file */
const h5_size_t nparticles, /*!< [in] Number of particles */
const h5_size_t stride /*!< [in] Stride of particles in memory */
@@ -122,10 +129,9 @@ h5u_set_num_points (
f, (long long unsigned)nparticles,
(long long unsigned)stride);
CHECK_FILEHANDLE (f);
if (f->step_gid < 0) {
TRY (h5_set_step (fh, 0));
if (f->iteration_gid < 0) {
TRY (h5_set_iteration (fh, 0));
}
CHECK_TIMEGROUP (f);
struct h5u_fdata *u = f->u;
hsize_t start;
hsize_t dmax = H5S_UNLIMITED;
@@ -146,6 +152,8 @@ h5u_set_num_points (
TRY (hdf5_close_dataspace (u->shape));
u->shape = H5S_ALL;
TRY (hdf5_close_dataspace (u->memshape));
u->memshape = H5S_ALL;
u->nparticles = (hsize_t)nparticles;
@@ -206,7 +214,8 @@ h5u_set_num_points (
TRY( u->shape = hdf5_create_dataspace(1, &count, NULL) );
/* declare overall data size but then will select a subset */
TRY( u->diskshape = hdf5_create_dataspace(1, &count, NULL) );
TRY (hdf5_close_dataspace (u->diskshape));
TRY (u->diskshape = hdf5_create_dataspace(1, &count, NULL));
count = nparticles;
if (count > 0) {
@@ -229,8 +238,7 @@ h5u_has_view (
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
H5_RETURN (f->u->viewindexed || f->u->viewstart >= 0);
}
@@ -240,8 +248,7 @@ h5u_reset_view (
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
struct h5u_fdata *u = f->u;
u->viewstart = -1;
@@ -270,10 +277,7 @@ h5u_set_view (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, start=%lld, end=%lld",
f, (long long)start, (long long)end);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
hsize_t total = 0;
hsize_t dmax = H5S_UNLIMITED;
check_iteration_handle_is_valid (f);
struct h5u_fdata *u = f->u;
TRY (h5u_reset_view (fh));
@@ -281,72 +285,49 @@ h5u_set_view (
if (start == -1 && end == -1) // we are already done
H5_LEAVE (H5_SUCCESS);
hssize_t total = 0;
if (f->u->shape > 0) {
TRY (total = hdf5_get_npoints_of_dataspace (f->u->shape) );
} else {
TRY (total = (hsize_t)h5u_get_totalnum_particles_by_idx (fh, 0));
// if iteration does not contain a dataset, next function
// returns -1
TRY (total = h5u_get_totalnum_particles_by_idx (fh, 0));
}
h5_debug ("Total = %lld", (long long) total);
if ((long long)total <= 0) {
if (total <= 0) {
/*
No datasets have been created yet and no views are set.
We have to leave the view empty because we don't know how
many particles there should be!
:FIXME: Should 'total == 0' be considered valid or not?
:FIXME: why not gather total size?
iteration does not contain a dataset yet!
*/
/*
:FIXME: Should 'total == 0' be considered valid or not?
*/
if (start < 0) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
"Start of selection '%lld' out of range: "
"must be >= 0",
(long long)start);
}
if (end < start) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
"End of selection '%lld' out of range: "
"must be >= %lld",
(long long)end,
(long long)start);
}
#if H5_HAVE_PARALLEL
TRY (
h5priv_mpi_allreduce_max (
&end, &total, 1, MPI_LONG_LONG, f->props->comm)
);
#else
total = end - start;
total = end;
#endif
total++;
TRY (h5u_reset_view(fh));
TRY (hdf5_close_dataspace (u->shape));
TRY (u->shape = hdf5_create_dataspace(1, &total, NULL) );
hsize_t htotal = (hsize_t)total;
TRY (u->shape = hdf5_create_dataspace(1, &htotal, NULL) );
} else {
if (end < 0) {
end = total+end;
}
if (start < 0 || start >= total) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
"Start of selection '%lld' out of range: "
"must be in [0..%lld]",
(long long)start, (long long)total-1);
} else if (end < 0 || end >= total) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
"End of selection '%lld' out of range: "
"must be in [0..%lld]",
(long long)end, (long long)total-1);
} else if (end+1 < start) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
"Invalid selection: start=%lld > end=%lld!\n",
(long long)start, (long long)end);
end = total + end;
}
}
if ((start < 0) ||
(start >= total) ||
(end >= total) ||
(end+1 < start)) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
"Invalid view: start=%lld, end=%lld, total=%lld!",
(long long)start,
(long long)end,
(long long)total);
}
/* setting up the new view */
@@ -361,8 +342,9 @@ h5u_set_view (
"This view includes %lld particles.",
(long long)u->nparticles );
hsize_t htotal = (hsize_t)total;
/* declare overall data size but then will select a subset */
TRY (u->diskshape = hdf5_create_dataspace ( 1, &total, NULL ));
TRY (u->diskshape = hdf5_create_dataspace (1, &htotal, NULL));
hsize_t hstart = (hsize_t)start;
hsize_t hstride = 1;
@@ -375,6 +357,7 @@ h5u_set_view (
NULL));
/* declare local memory datasize */
hsize_t dmax = H5S_UNLIMITED;
TRY (u->memshape = hdf5_create_dataspace (1, &hcount, &dmax));
H5_RETURN (H5_SUCCESS);
}
@@ -389,8 +372,7 @@ h5u_set_view_length (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, start=%lld, length=%lld",
f, (long long)start, (long long)length);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
struct h5u_fdata *u = f->u;
TRY (h5u_reset_view (fh));
@@ -460,10 +442,9 @@ h5u_set_view_indices (
"f=%p, indices=%p, nelems=%llu",
f, indices, (long long unsigned)nelems);
CHECK_FILEHANDLE (f);
if (f->step_gid < 0) {
TRY (h5_set_step (fh, 0));
if (f->iteration_gid < 0) {
TRY (h5_set_iteration (fh, 0));
}
CHECK_TIMEGROUP (f);
hsize_t total = 0;
hsize_t dmax = H5S_UNLIMITED;
struct h5u_fdata *u = f->u;
@@ -520,8 +501,7 @@ h5u_get_view (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, start=%p, end=%p",
f, start, end);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
struct h5u_fdata *u = f->u;
if ( u->viewindexed ) {
@@ -542,7 +522,7 @@ h5u_get_view (
viewend = u->viewend;
}
else {
TRY (viewend = h5u_get_num_points (fh));
TRY (viewend = h5u_get_num_items (fh));
}
if ( start ) *start = viewstart;
@@ -557,15 +537,14 @@ h5u_set_canonical_view (
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_int64_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
h5u_fdata_t* u = f->u;
TRY( h5u_reset_view (fh) );
h5_int64_t start = 0;
h5_int64_t total = 0;
TRY (total = h5u_get_num_points (fh));
TRY (total = h5u_get_num_items (fh));
u->nparticles = total / f->nprocs;
@@ -595,9 +574,8 @@ h5u_get_num_datasets (
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (ret_value = hdf5_get_num_datasets (f->step_gid));
check_iteration_handle_is_valid (f);
TRY (ret_value = hdf5_get_num_datasets (f->iteration_gid));
H5_RETURN (ret_value);
}
@@ -610,9 +588,8 @@ h5u_has_dataset (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, name='%s'",
f, name);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (ret_value = hdf5_link_exists (f->step_gid, name));
check_iteration_handle_is_valid (f);
TRY (ret_value = hdf5_link_exists (f->iteration_gid, name));
H5_RETURN (ret_value);
}
@@ -693,10 +670,9 @@ h5u_get_dataset_info_by_idx (
dataset_name,
(long long unsigned)len_dataset_name,
dataset_type, dataset_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (h5priv_get_dataset_info_by_idx (
f->step_gid,
f->iteration_gid,
idx,
dataset_name, len_dataset_name,
dataset_type, dataset_nelem));
@@ -742,10 +718,9 @@ h5u_get_dataset_info_by_name (
f,
dataset_name,
dataset_type, dataset_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (h5priv_get_dataset_info_by_name (
f->step_gid,
f->iteration_gid,
dataset_name,
dataset_type, dataset_nelem));
H5_RETURN (H5_SUCCESS);
@@ -782,13 +757,12 @@ h5u_get_chunk (
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_int64_t, "f=%p, name='%s', size=%p", f,name,size);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
hid_t dataset_id;
hid_t plist_id;
hsize_t hsize;
TRY (dataset_id = hdf5_open_dataset_by_name (f->step_gid, name) );
TRY (dataset_id = hdf5_open_dataset_by_name (f->iteration_gid, name) );
TRY (plist_id = hdf5_get_dataset_create_plist (dataset_id) );
TRY (hdf5_get_chunk_property (plist_id, 1, &hsize) );
TRY (hdf5_close_property ( plist_id) );
+2 -2
View File
@@ -99,7 +99,7 @@ h5priv_write_attrib (
attrib_name,
(long long int)attrib_type,
attrib_value,
attrib_nelem);
(long long unsigned)attrib_nelem);
hid_t space_id;
hid_t attrib_id;
hid_t hdf5_type;
@@ -147,7 +147,7 @@ h5priv_append_attrib (
attrib_name,
(long long int)attrib_type,
attrib_value,
attrib_nelem);
(long long unsigned)attrib_nelem);
h5_err_t exists;
TRY (exists = hdf5_attribute_exists (id, attrib_name));
if (exists) {
+4 -2
View File
@@ -29,11 +29,13 @@ h5priv_fcmp (
assert (sizeof (long long) == sizeof (h5_int64_t) );
// Make [ab]Int lexicographically ordered as a twos-complement int
h5_int64_t aInt = *(h5_int64_t*)&A;
void* p = (void*)&A;
h5_int64_t aInt = *(h5_int64_t*)p;
if (aInt < 0)
aInt = 0x8000000000000000LL - aInt;
h5_int64_t bInt = *(h5_int64_t*)&B;
p = (void*)&B;
h5_int64_t bInt = *(h5_int64_t*)p;
if (bInt < 0)
bInt = 0x8000000000000000LL - bInt;
+53 -22
View File
@@ -9,38 +9,50 @@
#define H5_VFD_MPIO_POSIX 0x00000010
#define H5_VFD_MPIO_INDEPENDENT 0x00000020
#define H5_VFD_MPIO_COLLECTIVE 0x00000040
#define H5_VFD_CORE 0x00000080
#define H5_VFD_CORE_IO 0x00000080
#define H5_FLUSH_FILE 0x00001000
#define H5_FLUSH_STEP 0x00002000
#define H5_FLUSH_ITERATION 0x00002000
#define H5_FLUSH_DATASET 0x00004000
#define H5_FS_LUSTRE 0x00010000
static inline h5_err_t
check_filehandle (
const h5_file_p f
) {
if (f == NULL || f->file < 0 || f->u == NULL || f->b == NULL) {
return h5_error (
H5_ERR_BADF,
"Called with bad filehandle.");
}
return H5_SUCCESS;
static inline int
is_valid_file_handle(h5_file_p f) {
return ((f != NULL) &&
(f->file > 0) &&
(f->u != NULL) &&
(f->b != NULL));
}
#define CHECK_FILEHANDLE(f) \
TRY (check_filehandle (f));
static inline int is_writable(h5_file_p f) {
static inline int
is_writable (h5_file_p f) {
return (f->props->flags & (H5_O_RDWR | H5_O_WRONLY | H5_O_APPENDONLY));
}
#define is_readable(f) (f->props->flags & (H5_O_RDWR | H5_O_RDONLY))
#define is_readonly(f) (f->props->flags & H5_O_RDONLY)
#define is_appendonly(f) (f->props->flags & H5_O_APPENDONLY)
static inline int
is_readable (h5_file_p f) {
return (f->props->flags & (H5_O_RDWR | H5_O_RDONLY));
}
static inline int
is_readonly (h5_file_p f) {
return (f->props->flags & H5_O_RDONLY);
}
static inline int
is_appendonly (h5_file_p f) {
return (f->props->flags & H5_O_APPENDONLY);
}
#define CHECK_FILEHANDLE(f) \
TRY (is_valid_file_handle(f) ? H5_SUCCESS : h5_error ( \
H5_ERR_BADF, \
"Called with bad filehandle."));
#define CHECK_WRITABLE_MODE(f) \
TRY (is_writable (f) ? H5_SUCCESS : h5_error ( \
TRY (is_writable (f) ? H5_SUCCESS : h5_error ( \
H5_ERR_INVAL, \
"Attempting to write to read-only file handle"));
@@ -50,10 +62,29 @@ static inline int is_writable(h5_file_p f) {
"Attempting to read from write-only file handle"));
#define CHECK_TIMEGROUP(f) \
TRY ((f->step_gid > 0) ? H5_SUCCESS : h5_error ( \
TRY ((f->iteration_gid > 0) ? H5_SUCCESS : h5_error ( \
H5_ERR_INVAL, \
"Time step is invalid! Have you set the time step?"));
"Iteration is invalid! Have you set the time step?"));
#define check_file_handle_is_valid(f) \
CHECK_FILEHANDLE(f); \
#define check_file_is_writable(f) \
CHECK_FILEHANDLE(f); \
CHECK_WRITABLE_MODE(f);
#define check_iteration_handle_is_valid(f) \
CHECK_FILEHANDLE(f); \
CHECK_TIMEGROUP(f);
#define check_iteration_is_readable(f) \
CHECK_FILEHANDLE(f); \
CHECK_READABLE_MODE(f); \
CHECK_TIMEGROUP(f);
#define check_iteration_is_writable(f) \
CHECK_FILEHANDLE(f); \
CHECK_WRITABLE_MODE(f); \
CHECK_TIMEGROUP(f);
#endif
+12 -2
View File
@@ -110,10 +110,18 @@ iter_op_get_obj_type (
name);
return H5O_TYPE_UNKNOWN;
}
#if H5_VERSION_GE(1,12,0)
herr = H5Oget_info(obj_id, &objinfo, H5O_INFO_ALL);
#else
herr = H5Oget_info(obj_id, &objinfo);
#endif
}
else { // H5L_TYPE_HARD
#if H5_VERSION_GE(1,12,0)
herr = H5Oget_info_by_name(g_id, name, &objinfo, H5O_INFO_BASIC, H5P_DEFAULT);
#else
herr = H5Oget_info_by_name(g_id, name, &objinfo, H5P_DEFAULT);
#endif
}
if (herr < 0) {
@@ -245,7 +253,8 @@ hdf5_get_name_of_group_by_idx (
HDF5_WRAPPER_ENTER (h5_err_t,
"loc_id=%lld (%s), idx=%llu, name=%p, len=%llu",
(long long int)loc_id, hdf5_get_objname (loc_id),
idx, name, (unsigned long long)len);
(long long unsigned)idx,
name, (unsigned long long)len);
op_data_t op_data;
memset (&op_data, 0, sizeof (op_data));
op_data.type = H5O_TYPE_GROUP;
@@ -304,7 +313,8 @@ hdf5_get_name_of_dataset_by_idx (
HDF5_WRAPPER_ENTER (h5_err_t,
"loc_id=%lld (%s), idx=%llu, name=%p, len=%llu",
(long long int)loc_id, hdf5_get_objname (loc_id),
idx, name, (unsigned long long)len);
(long long unsigned)idx,
name, (unsigned long long)len);
op_data_t op_data;
memset (&op_data, 0, sizeof (op_data));
op_data.type = H5O_TYPE_DATASET;
+19 -8
View File
@@ -718,7 +718,7 @@ hdf5_set_dataset_extent (
"dataset_id=%lld (%s), size=%llu",
(long long int)dataset_id,
hdf5_get_objname(dataset_id),
*size);
(long long unsigned int)*size);
if (H5Dset_extent(dataset_id, size) < 0) {
H5_RETURN_ERROR (
H5_ERR_HDF5,
@@ -873,7 +873,7 @@ static inline hid_t
hdf5_create_string_type(
const hsize_t len
) {
HDF5_WRAPPER_ENTER (hid_t, "len = %llu", len);
HDF5_WRAPPER_ENTER (hid_t, "len = %llu", (long long unsigned)len);
hid_t type_id = H5Tcopy (H5T_C_S1);
if (type_id < 0)
H5_RETURN_ERROR (
@@ -1003,7 +1003,7 @@ hdf5_set_chunk_property (
) {
HDF5_WRAPPER_ENTER (h5_err_t,
"plist=%lld, rank=%d, dims[0]=%llu ...",
(long long int)plist, rank, dims[0]);
(long long int)plist, rank, (long long unsigned)dims[0]);
if (H5Pset_chunk (plist, rank, dims) < 0)
H5_RETURN_ERROR (
H5_ERR_HDF5,
@@ -1146,7 +1146,8 @@ hdf5_set_btree_ik_property (
) {
HDF5_WRAPPER_ENTER (h5_err_t,
"fapl_id=%lld, btree_ik=%llu",
(long long int)fcpl_id, btree_ik);
(long long int)fcpl_id,
(long long unsigned)btree_ik);
if (H5Pset_istore_k (fcpl_id, btree_ik) < 0)
H5_RETURN_ERROR (
H5_ERR_HDF5,
@@ -1164,13 +1165,16 @@ hdf5_set_alignment_property (
) {
HDF5_WRAPPER_ENTER (h5_err_t,
"plist=%lld, threshold=%llu, alignment=%llu",
(long long int)plist, threshold, alignment);
(long long int)plist,
(long long unsigned)threshold,
(long long unsigned)alignment);
if (H5Pset_alignment (plist, threshold, alignment) < 0)
H5_RETURN_ERROR (
H5_ERR_HDF5,
"Cannot set alignment property to %llu "
"and threshold %llu",
alignment, threshold);
(long long unsigned)alignment,
(long long unsigned)threshold);
H5_RETURN (H5_SUCCESS);
}
@@ -1181,12 +1185,13 @@ hdf5_set_meta_block_size (
) {
HDF5_WRAPPER_ENTER (h5_err_t,
"fapl_id=%lld, size=%llu",
(long long int)fapl_id, size);
(long long int)fapl_id,
(long long unsigned)size);
if (H5Pset_meta_block_size (fapl_id, size) < 0)
H5_RETURN_ERROR (
H5_ERR_HDF5,
"Cannot set meta block size property to %llu",
size);
(long long unsigned)size);
H5_RETURN (H5_SUCCESS);
}
@@ -1292,9 +1297,15 @@ hdf5_close_file (
for (ssize_t i = 0; i < max_objs; i++) {
hid_t object_id = obj_id_list [i];
h5_debug ("Open object: %lld", (long long)object_id);
#if H5_VERSION_GE(1,12,0)
H5O_info_t object_info;
if (H5Oget_info (object_id, &object_info, H5O_INFO_ALL) < 0)
continue;
#else
H5O_info_t object_info;
if (H5Oget_info (object_id, &object_info) < 0)
continue;
#endif
switch (object_info.type) {
case H5O_TYPE_GROUP:
case H5O_TYPE_DATASET:
+2 -2
View File
@@ -20,10 +20,10 @@ extern "C" {
#endif
h5_err_t
h5priv_initialize (void);
h5_initialize (void);
h5_err_t
h5priv_finalize (void);
h5_finalize (void);
extern int h5_initialized;
extern h5_dta_types_t h5_dta_types;
+1 -2
View File
@@ -58,8 +58,7 @@ h5priv_read_dataset (
h5_err_t
h5priv_normalize_dataset_name (
const char *name,
char *name2
char* const name
);
#endif
+10 -4
View File
@@ -23,8 +23,8 @@
#define __FUNC_ENTER(type, mask, fmt, ...) \
type ret_value = (type)H5_ERR; \
int __log__ = h5_log_level & mask; \
if (__log__ ) { \
int __log__ = __h5_debug_mask & mask; \
if (__log__) { \
h5_call_stack_push (__func__,e_##type); \
h5_debug ("(" fmt ")", __VA_ARGS__); \
}
@@ -33,7 +33,7 @@
#define H5_CORE_API_ENTER(type, fmt, ...) \
if (!h5_initialized) { \
h5priv_initialize(); \
h5_initialize(); \
} \
__FUNC_ENTER(type, H5_DEBUG_CORE_API, fmt, __VA_ARGS__)
@@ -43,9 +43,15 @@
#define H5_PRIV_FUNC_ENTER(type, fmt, ...) \
__FUNC_ENTER(type, H5_DEBUG_PRIV_FUNC, fmt, __VA_ARGS__ )
#ifdef NDEBUG
#define H5_INLINE_FUNC_ENTER(type) \
type ret_value = (type)H5_ERR;
#else
#define H5_INLINE_FUNC_ENTER(type) \
type ret_value = (type)H5_ERR; int __log__ = 0;
#endif
#define HDF5_WRAPPER_ENTER(type, fmt, ...) \
__FUNC_ENTER(type, H5_DEBUG_HDF5, fmt, __VA_ARGS__ )
+5 -4
View File
@@ -15,9 +15,9 @@
* file incompatibilities with previous versions. */
#define H5_DATANAME_LEN H5_MAX_NAME_LEN
#define H5_STEPNAME_LEN H5_MAX_NAME_LEN
#define H5_STEPNAME "Step"
#define H5_STEPWIDTH 1
#define H5_ITERATION_NAME_LEN H5_MAX_NAME_LEN
#define H5_ITERATION_NAME "Step"
#define H5_ITERATION_NUM_WIDTH 1
#define H5BLOCK_GROUPNAME_BLOCK "Block"
#define H5_BLOCKNAME_X "0"
#define H5_BLOCKNAME_Y "1"
@@ -115,7 +115,7 @@ h5priv_end_throttle (const h5_file_p f) {
h5_err_t
h5priv_close_step (
h5priv_close_iteration (
const h5_file_p f
);
@@ -123,6 +123,7 @@ h5priv_close_step (
Map given enumeration type to corresponding HDF5 type. We use this HDF5
type for reading and writing datasets and attributes.
*/
static inline hid_t
h5priv_map_enum_to_normalized_type (
h5_types_t type
+8 -7
View File
@@ -41,8 +41,9 @@ struct h5_prop_file { // file property
hid_t xfer_prop; // dataset transfer properties
hid_t access_prop; // file access properties
hid_t create_prop; // file create properties
char* prefix_step_name; // Prefix of step name
int width_step_idx; // pad step index with 0 up to this
char* prefix_iteration_name; // Prefix of step name
int width_iteration_idx; // pad iteration index with 0 up to this
int flush; // flush iteration after writing dataset
};
typedef struct h5_prop_file h5_prop_file_t;
typedef h5_prop_file_t* h5_prop_file_p;
@@ -66,12 +67,12 @@ struct h5_file {
/* HDF5 */
hid_t root_gid; // HDF5 group id of root
hid_t step_gid; // HDF5 group id of current step
hid_t iteration_gid; // HDF5 group id of current iteration
/* step internal data */
char* step_name; // full current step name
h5_int64_t step_idx; // current step index
int is_new_step; // :FIXME: ?
/* iteration internal data */
char* iteration_name; // full current iteration name
h5_int64_t iteration_idx; // current iteration index
int is_new_iteration;// :FIXME: ?
struct h5u_fdata *u; // pointer to unstructured data
struct h5b_fdata *b; // pointer to block data
+1 -1
View File
@@ -11,7 +11,7 @@ struct h5b_partition {
};
struct h5b_fdata {
h5_id_t step_idx;
h5_id_t iteration_idx;
h5_size_t i_max;
h5_size_t j_max;
h5_size_t k_max;
-1
View File
@@ -12,7 +12,6 @@
#include "private/h5_file.h"
#include "private/h5_types.h"
#include "private/h5_init.h"
#include "private/h5t_types.h"
#include "private/h5t_model.h"
#include "private/h5t_access.h"
-1
View File
@@ -11,7 +11,6 @@
#include "h5core/h5_syscall.h"
#include "private/h5_file.h"
#include "private/h5_init.h"
#include "private/h5t_types.h"
#include "private/h5t_model.h"
#include "private/h5t_access.h"
+1 -1
View File
@@ -219,7 +219,7 @@ update_internal_structs (
// create index sets
#if (!defined(NDEBUG) && (h5_log_level & (1<<5)))
#if (!defined(NDEBUG) && (__h5_debug_mask & (1<<5)))
if (!m->is_chunked) {
h5t_adjacencies_t* adj = &m->adjacencies;
h5_loc_idx_t idx = 0;
+2 -3
View File
@@ -21,7 +21,6 @@
#include "private/h5t_store.h"
#include "private/h5_file.h"
#include "private/h5_init.h"
#include "private/h5t_core.h"
static struct h5t_methods tet_funcs = {
@@ -192,9 +191,9 @@ h5t_add_chunked_tetrahedral_mesh (
const h5_weight_t num_weights,
h5t_mesh_t** mesh
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t, "f=%p, name=%s, mesh=%p", f, name, mesh);
H5_CORE_API_ENTER (h5_err_t, "f=%p, name=%s, mesh=%p", (void*)fh, name, mesh);
#ifdef WITH_PARALLEL_H5GRID
h5_file_p f = (h5_file_p)fh;
CHECK_WRITABLE_MODE (f);
h5_err_t exists;
TRY (exists = h5priv_link_exists (
+2 -3
View File
@@ -20,7 +20,6 @@
#include "private/h5t_retrieve.h"
#include "private/h5t_store.h"
#include "private/h5_init.h"
#include "private/h5t_core.h"
static struct h5t_methods tri_funcs = {
@@ -210,9 +209,9 @@ h5t_add_chunked_triangle_mesh(
const h5_weight_t num_weights,
h5t_mesh_t** mesh
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t, "f=%p, name=%s, mesh=%p", f, name, mesh);
H5_CORE_API_ENTER (h5_err_t, "f=%p, name=%s, mesh=%p", (void*)fh, name, mesh);
#ifdef WITH_PARALLEL_H5GRID
h5_file_p f = (h5_file_p)fh;
int size = -1;
TRY (h5priv_mpi_comm_size (f->props->comm, &size));
if (size != 1) {
+1 -1
View File
@@ -202,7 +202,7 @@ compute_neighbor_of_face (
}
if (elem_idx < -1) { // this should only happen if we are on the boarder
// of a loaded chunk and the parent is on a different chunk
if (h5_log_level >= 6) {
if (__h5_debug_mask >= 6) {
h5_debug ("Elem %d is on different proc than its parent %d \n"
"therefore neighborhood idx is not correct resolved", old_elem_idx, elem_idx);
}
+4 -4
View File
@@ -21,11 +21,11 @@
* Complex numbers can be stored as array of float64 with even dimension
* Tags are addressed via a name and the entity id.
* Tags with the same name are called a "tagset"
* Tagsets can be used to store time/step-constant data. These tagsets are
* Tagsets can be used to store iteration-constant data. These tagsets are
called "m-tagsets" and are assigned directly to a mesh.
* Tagsets can be used to store data which may change from step to step.
These tagsets are called "s-tagsets" and are assigned to a mesh and a
(time-)step.
* Tagsets can be used to store data which may change from iteration to
iteration. These tagsets are called "s-tagsets" and are assigned to
a mesh and a step/iteration.
ToDo
* Scalar values
+7 -5
View File
@@ -233,7 +233,8 @@ H5Block3dGetFieldOrigin (
}
/**
Set field spacing for field \c field_name in the current step.
Set field spacing for field \c field_name in the current
step/iteration.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
@@ -263,7 +264,8 @@ H5Block3dSetFieldSpacing (
}
/**
Get field spacing for field \c field_name in the current time step.
Get field spacing for field \c field_name in the current
step/iteration.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
@@ -316,7 +318,7 @@ H5Block3dGetFieldSpacing (
)
Set an explicit list of X,Y respective Z coordinates for field \c
field_name in the current time step. The coordinates are a 1D array
field_name in the current step/iteration. The coordinates are a 1D array
of floating point values with dimension \c n_coords.
By convention, the \c coords array should have the same length as
@@ -414,8 +416,8 @@ H5Block3dSetFieldZCoords (
)
Get the explicit list of X, Y respective Z coordinates for field \c
field_name in the current step. The coordinates are read into the 1D
array \c coords which has length \c n_coords.
field_name in the current step/iteration. The coordinates are read
into the 1D array \c coords which has length \c n_coords.
By convention, the \c coords array should have the same length as
the X, Y respective Z dimension of the field. A warning will be
+10 -9
View File
@@ -56,9 +56,10 @@ extern "C" {
const h5_int32_t* buffer
)
Write a 3-dimensional field with scalar values to the current step
using the previously defined field view. Ensure that the size of
the buffer matches the number of elements in the view.
Write a 3-dimensional field with scalar values to the current
step/iteration using the previously defined field view. Ensure
that the size of the buffer matches the number of elements in
the view.
Supported data types are
@@ -176,8 +177,8 @@ H5Block3dWriteScalarFieldInt32 (
h5_int32_t* buffer
)
Read a 3-dimensional field with scalar values from the current step
using the previously defined field layout.
Read a 3-dimensional field with scalar values from the current
step/iteration using the previously defined field layout.
Ensure that the size of the buffer matches the number of elements in
the view.
@@ -295,9 +296,9 @@ H5Block3dReadScalarFieldInt32 (
)
Write a 3-dimensional field with 3-dimensional vectors as values to
the current step using the previously defined field view. Ensure
that the size of the buffer matches the number of elements in the
view.
the current step/iteration using the previously defined field view.
Ensure that the size of the buffer matches the number of elements in
the view.
Supported data types are
@@ -439,7 +440,7 @@ H5Block3dWriteVector3dFieldInt32 (
)
Read a 3-dimensional field with 3-dimensional vectors as values from
the current step using the previously defined field layout.
the current step/iteration using the previously defined field layout.
Ensure that the size of the buffer matches the number of elements in
the view.
+56 -12
View File
@@ -33,10 +33,10 @@ extern "C" {
*/
/**
Checks whether the current time-step has field data or not.
Checks whether the current step/iteration has field data or not.
\return true (value \c >0) if step exists
\return false (\c 0) if step does not exist
\return true (value \c >0) if step/iteration exists
\return false (\c 0) if step/iteration does not exist
\return \c H5_FAILURE on error
*/
static inline h5_err_t
@@ -51,7 +51,7 @@ H5BlockHasFieldData (
/**
Query number of fields in current time step.
Query number of fields in current step/iteration.
\return \c number of fields
\return H5_FAILURE on error
@@ -74,8 +74,8 @@ H5BlockGetNumFields (
(e.g. scalar or vector).
This function can be used to retrieve all fields bound to the
current time-step by looping from \c 0 to the number of fields
minus one. The number of fields bound to the current time-step
current step/iteration by looping from \c 0 to the number of fields
minus one. The number of fields bound to the current step/iteration
can be queried by calling the function \ref H5BlockGetNumFields.
\return \c H5_SUCCESS on success
@@ -171,8 +171,8 @@ H5BlockGetFieldInfoByName (
Tests whether a view has been set, either directly with
\ref H5Block3dSetView or indirectly with \ref H5Block3dSetGrid.
\return true (value \c >0) if step exists
\return false (\c 0) if step does not exist
\return true (value \c >0) if step/iteration exists
\return false (\c 0) if step/iteration does not exist
\return \c H5_FAILURE on error
*/
static inline h5_int64_t
@@ -190,9 +190,9 @@ H5Block3dHasView (
Fortran ordering: the fastest moving index is \c i.
This routine uses an MPI_Allgather, so at large concurrency it should
be called as infrequently as possible. For instance, if several timesteps
use the same field dimensions, set the layout only once before the
first timestep.
be called as infrequently as possible. For instance, if several
steps/iteration use the same field dimensions, set the layout only
once.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
@@ -220,7 +220,51 @@ H5Block3dSetView (
h5b_3d_set_view (f,
i_start, i_end,
j_start, j_end,
k_start, k_end));
k_start, k_end,
0
));
}
/**
Defines the partition of the field that this processor owns, using
Fortran ordering: the fastest moving index is \c i.
For writing ghost-zone are dissolved.
This routine uses an MPI_Allgather, so at large concurrency it should
be called as infrequently as possible. For instance, if several
steps/iteration use the same field dimensions, set the layout only
once.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5Block3dSetViewDissolveGhostZones (
const h5_file_t f, ///< [in] File handle.
const h5_int64_t i_start, ///< [in] start index of \c i
const h5_int64_t i_end, ///< [in] end index of \c i
const h5_int64_t j_start, ///< [in] start index of \c j
const h5_int64_t j_end, ///< [in] end index of \c j
const h5_int64_t k_start, ///< [in] start index of \c k
const h5_int64_t k_end ///< [in] end index of \c k
) {
H5_API_ENTER (h5_err_t,
"f=%p, "
"i_start=%lld, i_end=%lld, "
"j_start=%lld, j_end=%lld, "
"k_start=%lld, k_end=%lld",
(h5_file_p)f,
(long long)i_start, (long long)i_end,
(long long)j_start, (long long)j_end,
(long long)k_start, (long long)k_end);
H5_API_RETURN (
h5b_3d_set_view (f,
i_start, i_end,
j_start, j_end,
k_start, k_end,
1
));
}
/**
+18 -16
View File
@@ -56,12 +56,13 @@ extern "C" {
const h5_int32_t* data
)
Write a dataset to the current step.
Write a dataset to the current step/iteration.
After the current (time-)step and view, you can start writing datasets
into the file. Each dataset has a name associated with it (chosen by the
user) in order to facilitate later retrieval. The name of the dataset is
specified in the parameter \c name, which must be a null-terminated string.
After setting the current (time-)step/iteration and view, you can start
writing datasets into the file. Each dataset has a name associated with
it (chosen by the user) in order to facilitate later retrieval. The name
of the dataset is specified in the parameter \c name, which must be a
null-terminated string.
There are no restrictions on naming of datasets, but it is useful to arrive
at some common naming convention when sharing data with other groups.
@@ -70,9 +71,10 @@ extern "C" {
the array can be reconstructed properly on other systems with incompatible
type representations.
All data that is written after setting the timestep is associated with that
timestep. While the number of elements can change for each timestep, you
cannot change the number of elements in the middle of a given timestep.
All data that is written after setting the (time-)step/iteration is
associated with that (time-)step/iteratiion. While the number of
elements can change for each timestep, you cannot change the number
of elements in the middle of a given (time-)step/iteration.
The data is committed to disk before the routine returns.
\param f [in] file handle.
@@ -97,7 +99,7 @@ H5PartWriteDataFloat64 (
"f=%p, name='%s', date=%p",
(h5_file_p)f, name, data);
H5_API_RETURN (
h5u_write_data (
h5u_write_dataset (
f, name, (void*)data,
H5_FLOAT64_T));
}
@@ -112,7 +114,7 @@ H5PartWriteDataFloat32 (
"f=%p, name='%s', date=%p",
(h5_file_p)f, name, data);
H5_API_RETURN (
h5u_write_data(
h5u_write_dataset (
f, name, (void*)data,
H5_FLOAT32_T));
}
@@ -127,7 +129,7 @@ H5PartWriteDataInt64 (
"f=%p, name='%s', date=%p",
(h5_file_p)f, name, data);
H5_API_RETURN (
h5u_write_data (
h5u_write_dataset (
f, name, (void*)data,
H5_INT64_T));
}
@@ -142,7 +144,7 @@ H5PartWriteDataInt32 (
"f=%p, name='%s', date=%p",
(h5_file_p)f, name, data);
H5_API_RETURN (
h5u_write_data (
h5u_write_dataset (
f, name, (void*)data,
H5_INT32_T));
}
@@ -198,7 +200,7 @@ H5PartReadDataFloat64 (
"f=%p, name='%s', date=%p",
(h5_file_p)f, name, data);
H5_API_RETURN (
h5u_read_data (
h5u_read_dataset (
f, name, data, H5_FLOAT64_T));
}
@@ -212,7 +214,7 @@ H5PartReadDataFloat32 (
"f=%p, name='%s', date=%p",
(h5_file_p)f, name, data);
H5_API_RETURN (
h5u_read_data (
h5u_read_dataset (
f, name, data, H5_FLOAT32_T));
}
@@ -226,7 +228,7 @@ H5PartReadDataInt64 (
"f=%p, name='%s', date=%p",
(h5_file_p)f, name, data);
H5_API_RETURN (
h5u_read_data (
h5u_read_dataset (
f, name, data,
H5_INT64_T));
}
@@ -241,7 +243,7 @@ H5PartReadDataInt32 (
"f=%p, name='%s', date=%p",
(h5_file_p)f, name, data);
H5_API_RETURN (
h5u_read_data (
h5u_read_dataset (
f, name, data,
H5_INT32_T));
}
+42 -39
View File
@@ -33,9 +33,10 @@ extern "C" {
*/
/**
Get the number of datasets that are stored at the current step.
Get the number of datasets that are stored at the current
step/iteration.
\return number of datasets in current timestep
\return number of datasets in current step/iteration
\return \c H5_FAILURE on error
*/
static inline h5_ssize_t
@@ -49,7 +50,8 @@ H5PartGetNumDatasets (
}
/**
Query the name of a dataset given by it's index in the current step.
Query the name of a dataset given by it's index in the current
step/iteration.
If the number of datasets is \c n, the range of \c _index is \c 0 to \c n-1.
@@ -80,7 +82,7 @@ H5PartGetDatasetName (
/**
Gets the name, type and number of elements of a dataset based on its
index in the current timestep.
index in the current step/iteration.
Type is one of the following values:
@@ -121,10 +123,11 @@ H5PartGetDatasetInfo (
type, nelems));
}
/**
Determines whether a dataset with given name exists in current step.
Determines whether a dataset with given name exists in current
step/iteration.
\return true (value \c >0) if step exists
\return false (\c 0) if step does not exist
\return true (value \c >0) if step/iteration exists
\return false (\c 0) if step/iteration does not exist
\return \c H5_FAILURE on error
*/
static inline h5_err_t
@@ -140,7 +143,7 @@ H5PartHasDataset (
/**
Gets the type and number of elements of a dataset based on its
name in the current timestep.
name in the current step/iteration.
Type is one of the following values:
@@ -177,7 +180,7 @@ H5PartGetDatasetInfoByName (
}
/**
Set the number of points/particles for the current time-step.
Set the number of items/particles for the current step/iteration.
After you call this subroutine, all subsequent
operations will assume this number of particles will be written.
@@ -203,19 +206,19 @@ H5PartGetDatasetInfoByName (
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5PartSetNumPoints (
H5PartSetNumItems (
const h5_file_t f, ///< [in] file handle.
h5_size_t npoints ///< [in] Number of elements.
h5_size_t num_items ///< [in] Number of elements.
) {
H5_API_ENTER (h5_err_t,
"f=%p, npoints=%llu",
(h5_file_p)f, (long long unsigned)npoints);
"f=%p, num_items=%llu",
(h5_file_p)f, (long long unsigned)num_items);
h5_size_t stride = 1;
H5_API_RETURN (h5u_set_num_points (f, npoints, stride));
H5_API_RETURN (h5u_set_num_items (f, num_items, stride));
}
/**
\see H5PartSetNumPoints()
\see H5PartSetNumItems()
*/
static inline h5_err_t
H5PartSetNumParticles (
@@ -226,7 +229,7 @@ H5PartSetNumParticles (
"f=%p, nparticles=%llu",
(h5_file_p)f, (long long unsigned)nparticles);
h5_size_t stride = 1;
H5_API_RETURN (h5u_set_num_points (f, nparticles, stride));
H5_API_RETURN (h5u_set_num_items (f, nparticles, stride));
}
/**
@@ -238,28 +241,28 @@ H5PartSetNumParticles (
If you have neither set the number of particles
nor set a view, then this returns the total number of
particles in the first data set of the current time step.
Note that H5Part assumes that all data sets within a given time step
particles in the first data set of the current step/iteration.
Note that H5Part assumes that all data sets within a given step/iteration
have the same number of particles (although the number particles can
vary across time steps).
vary across steps/iteration).
If none of these conditions are met, an error is thrown.
\return number of elements in datasets in current step.
\return number of elements in datasets in current step/iteration.
\return \c H5_FAILURE on error.
*/
static inline h5_ssize_t
H5PartGetNumPoints (
H5PartGetNumItems (
const h5_file_t f ///< [in] file handle.
) {
H5_API_ENTER (h5_ssize_t,
"f=%p",
(h5_file_p)f);
H5_API_RETURN (h5u_get_num_points (f));
H5_API_RETURN (h5u_get_num_items (f));
}
/**
\see H5PartGetNumPoints()
\see H5PartGetNumItems()
*/
static inline h5_ssize_t
H5PartGetNumParticles (
@@ -268,12 +271,12 @@ H5PartGetNumParticles (
H5_API_ENTER (h5_ssize_t,
"f=%p",
(h5_file_p)f);
H5_API_RETURN (h5u_get_num_points (f));
H5_API_RETURN (h5u_get_num_items (f));
}
/**
Set the number of particles for the current time-step.
Set the number of particles for the current step/iteration.
After you call this subroutine, all subsequent
operations will assume this number of particles will be written.
@@ -301,15 +304,15 @@ H5PartGetNumParticles (
static inline h5_err_t
H5PartSetNumParticlesStrided (
const h5_file_t f, ///< [in] file handle.
h5_size_t npoints, ///< [in] number of elements.
h5_size_t num_items, ///< [in] number of elements.
h5_size_t stride ///< [in] stride value (e.g. number
///< of fields in the particle array).
) {
H5_API_ENTER (h5_err_t,
"f=%p, npoints=%llu, stride=%llu",
(h5_file_p)f, (long long unsigned)npoints,
"f=%p, num_items=%llu, stride=%llu",
(h5_file_p)f, (long long unsigned)num_items,
(long long unsigned)stride);
H5_API_RETURN (h5u_set_num_points (f, npoints, stride));
H5_API_RETURN (h5u_set_num_items (f, num_items, stride));
}
/**
@@ -361,8 +364,8 @@ H5PartResetView (
\ref H5PartSetNumParticles() or manually with \ref H5PartSetView
or \ref H5PartSetViewIndices.
\return true (value \c >0) if step exists
\return false (\c 0) if step does not exist
\return true (value \c >0) if step/iteration exists
\return false (\c 0) if step/iteration does not exist
\return \c H5_FAILURE on error
*/
static inline h5_err_t
@@ -384,10 +387,10 @@ H5PartHasView (
is set, or the number of particles in a dataset changes, or the view is
"unset" by calling \c H5PartSetView(file,-1,-1);
Before you set a view, \ref H5PartGetNumPoints will return the
total number of particles in the current time-step (even for the parallel
reads). However, after you set a view, it will return the number of
particles contained in the view.
Before you set a view, \ref H5PartGetNumItems will return the
total number of particles in the current step/iteration (even for
the parallel reads). However, after you set a view, it will
return the number of particles contained in the view.
The range is \e inclusive: the end value is the last index of the
data.
@@ -421,10 +424,10 @@ H5PartSetView (
for all the intermediate values (which will not be touched by the read
or write).
Before you set a view, the \c H5PartGetNumPoints() will return the
total number of particles in the current time-step (even for the parallel
reads). However, after you set a view, it will return the number of
particles contained in the view.
Before you set a view, the \c H5PartGetNumItems() will return the
total number of particles in the current step/iteration (even for
the parallel reads). However, after you set a view, it will return
the number of particles contained in the view.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
+2 -1
View File
@@ -13,7 +13,8 @@
INTEGER*8, PARAMETER :: H5_VFD_MPIPOSIX = Z'00000010'
INTEGER*8, PARAMETER :: H5_VFD_MPIIO_IND = Z'00000020'
INTEGER*8, PARAMETER :: H5_VFD_CORE = Z'00000040'
INTEGER*8, PARAMETER :: H5_VFD_MPIIO_COL = Z'00000040'
INTEGER*8, PARAMETER :: H5_VFD_CORE_IO = Z'00000080'
INTEGER*8, PARAMETER :: H5_PROP_DEFAULT = 0
+22 -2
View File
@@ -233,6 +233,26 @@ H5SetPropFileThrottle (
H5_API_RETURN (h5_set_prop_file_throttle (prop, throttle));
}
/**
Flush data after each write.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
\note
| Release | Change |
| :------ | :----- |
| \c 2.0.0rc5 | Function introduced in this release. |
*/
static inline h5_err_t
H5SetPropFileFlush (
h5_prop_t prop ///< [in,out] identifier for file property list
) {
H5_API_ENTER (h5_err_t, "prop=%p",
(void*)prop);
H5_API_RETURN (h5_set_prop_file_flush_after_write (prop));
}
/**
Close file property list.
@@ -357,7 +377,7 @@ H5CheckFile (
}
/**
Flush step data to disk.
Flush step/iteration data to disk.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
@@ -369,7 +389,7 @@ H5FlushStep (
H5_API_ENTER (h5_err_t,
"f=%p",
(h5_file_p)f);
H5_API_RETURN (h5_flush_step (f));
H5_API_RETURN (h5_flush_iteration (f));
}
/**
+6 -6
View File
@@ -50,7 +50,7 @@ extern "C" {
*/
static inline h5_err_t
H5SetVerbosityLevel2 (
const h5_id_t level ///< [in] verbosity level.
const h5_int32_t level ///< [in] verbosity level.
) {
return h5_set_loglevel (level & 0x03);
}
@@ -72,7 +72,7 @@ H5SetVerbosityLevel2 (
*/
static inline h5_err_t
H5SetVerbosityLevel1 (
const h5_id_t level ///< [in] verbosity level.
const h5_int64_t level ///< [in] verbosity level.
) {
return h5_set_loglevel (level);
}
@@ -84,7 +84,7 @@ H5SetVerbosityLevel1 (
\see H5SetVerbosityLevel()
*/
static inline h5_id_t
static inline h5_int64_t
H5GetVerbosityLevel (
void
) {
@@ -123,9 +123,9 @@ H5GetVerbosityLevel (
*/
static inline h5_err_t
H5SetDebugMask (
const h5_id_t mask ///< [in] debug mask
const h5_int64_t mask ///< [in] debug mask
) {
return h5_set_loglevel (mask & ~0x03);
return h5_set_debug_mask (mask);
}
/**
@@ -140,7 +140,7 @@ H5SetDebugMask (
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_id_t
static inline h5_int32_t
H5GetDebugMask (
void
) {
+20 -20
View File
@@ -23,7 +23,7 @@ extern "C" {
#endif
/**
Define format of the step names.
Define format of the step/iteration names.
Example: ==H5SetStepNameFormat( f, "Step", 6 )== defines step names
like ==Step#000042==.
@@ -35,16 +35,16 @@ static inline h5_err_t
H5SetStepNameFormat (
const h5_file_t f, ///< [in] file handle
const char* name, ///< [in] prefix, defaults to \c Step
const h5_int64_t width ///< [in] width of step number
const h5_int64_t width ///< [in] width of step/iteration number
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', width=%lld",
(h5_file_p)f, name, (long long) width);
H5_API_RETURN (h5_set_stepname_fmt (f, name, width));
H5_API_RETURN (h5_set_iteration_name_fmt (f, name, width));
}
/**
Get format of the step names.
Get format of the step/iteration names.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
@@ -54,16 +54,16 @@ H5GetStepNameFormat (
const h5_file_t f, ///< [in] file handle
char* name, ///< [out] prefix
const h5_size_t l_name, ///< [in] length of buffer name
int* width ///< [out] width of step number
int* width ///< [out] width of step/iteration number
) {
H5_API_ENTER (h5_err_t,
"f=%p, name=%p, l_name=%llu, width=%p",
(h5_file_p)f, name, (unsigned long long)l_name, width);
H5_API_RETURN (h5_get_stepname_fmt (f, name, l_name, width));
H5_API_RETURN (h5_get_iteration_name_fmt (f, name, l_name, width));
}
/**
Set the current step.
Set the current step/iteration.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
@@ -71,18 +71,18 @@ H5GetStepNameFormat (
static inline h5_err_t
H5SetStep (
const h5_file_t f, ///< [in] file handle.
const h5_id_t step ///< [in] step to set.
const h5_id_t step ///< [in] step/iteration to set.
) {
H5_API_ENTER (h5_err_t,
"f=%p, step=%lld",
(h5_file_p)f, (long long)step);
H5_API_RETURN (h5_set_step (f, step));
H5_API_RETURN (h5_set_iteration (f, step));
}
/**
Get current step.
Get current step/iteration.
\return Step number
\return Step/iteration number
\return \c H5_FAILURE on error
*/
static inline h5_id_t
@@ -92,17 +92,17 @@ H5GetStep (
H5_API_ENTER (h5_err_t,
"f=%p",
(h5_file_p)f);
H5_API_RETURN (h5_get_step (f));
H5_API_RETURN (h5_get_iteration (f));
}
/**
Get the number of time-steps that are currently stored in the file
\c f.
Get the number of steps/iterations that are currently stored
in the file \c f.
It works for both reading and writing of files, but is probably
only typically used when you are reading.
\return Number of time-steps
\return Number of steps/iterations
\return \c H5_FAILURE on error.
*/
static inline h5_ssize_t
@@ -112,14 +112,14 @@ H5GetNumSteps (
H5_API_ENTER (h5_err_t,
"f=%p",
(h5_file_p)f);
H5_API_RETURN (h5_get_num_steps(f));
H5_API_RETURN (h5_get_num_iterations(f));
}
/**
Query whether a particular step already exists in the file.
Query whether a particular step/iteration already exists in the file.
\return true (value \c >0) if step exists
\return false (\c 0) if step does not exist
\return true (value \c >0) if step/iteration exists
\return false (\c 0) if step/iteration does not exist
\return \c H5_FAILURE on error
*/
static inline h5_err_t
@@ -130,7 +130,7 @@ H5HasStep (
H5_API_ENTER (h5_err_t,
"f=%p, stepno=%lld",
(h5_file_p)f, (long long)stepno);
H5_API_RETURN (h5_has_step (f, stepno));
H5_API_RETURN (h5_has_iteration (f, stepno));
}
/**
+25 -22
View File
@@ -29,12 +29,13 @@ extern "C" {
!
*/
/**
\addtogroup h5_step_attribs
\addtogroup h5_iteration_attribs
@{
*/
/**
Query the number of attributes attached to the current step.
Query the number of attributes attached to the current
step/iteration.
\return number of attributes
\return \c H5_FAILURE on error
@@ -46,17 +47,17 @@ H5GetNumStepAttribs (
H5_API_ENTER (h5_int64_t,
"f=%p",
(h5_file_p)f);
H5_API_RETURN (h5_get_num_step_attribs (f));
H5_API_RETURN (h5_get_num_iteration_attribs (f));
}
/**
Gets the name, type and number of elements of the step attribute
Gets the name, type and number of elements of the iteration attribute
given by its index.
This function can be used to retrieve all attributes attached to the
current step by looping from \c 0 to the number of attribute
current step/iteration by looping from \c 0 to the number of attribute
minus one. The number of attributes attached to the current
step can be queried by calling \ref H5GetNumStepAttribs().
step/iteration can be queried by calling \ref H5GetNumStepAttribs().
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
@@ -81,7 +82,7 @@ H5GetStepAttribInfo (
attrib_type,
nelems);
H5_API_RETURN (
h5_get_step_attrib_info_by_idx (
h5_get_iteration_attrib_info_by_idx (
f,
idx,
attrib_name,
@@ -105,7 +106,7 @@ H5GetStepAttribName (
attrib_name,
(long long unsigned)len_attrib_name);
H5_API_RETURN (
h5_get_step_attrib_info_by_idx (
h5_get_iteration_attrib_info_by_idx (
f,
idx,
attrib_name, len_attrib_name,
@@ -114,7 +115,8 @@ H5GetStepAttribName (
}
/**
Determines whether a step attribute with a given name exists in current step.
Determines whether a step attribute with a given name exists in
current step/iteration.
\return true (value \c >0) if atrribute exists
\return false (\c 0) if attribute does not exist
@@ -131,13 +133,14 @@ H5HasStepAttrib (
(h5_file_p)f,
attrib_name);
H5_API_RETURN (
h5_has_step_attrib (
h5_has_iteration_attrib (
f,
attrib_name));
}
/**
Gets the type and number of elements of a given step attribute.
Gets the type and number of elements of a given step/iteration
attribute.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
@@ -157,7 +160,7 @@ H5GetStepAttribInfoByName (
attrib_name,
attrib_type, nelems);
H5_API_RETURN (
h5_get_step_attrib_info_by_name (
h5_get_iteration_attrib_info_by_name (
f,
attrib_name,
attrib_type, nelems));
@@ -240,7 +243,7 @@ H5WriteStepAttribString (
"f=%p, attrib_name='%s', buffer='%s'",
(h5_file_p)f, attrib_name, buffer);
H5_API_RETURN (
h5_write_step_attrib (
h5_write_iteration_attrib (
f,
attrib_name,
H5_STRING_T,
@@ -259,7 +262,7 @@ H5WriteStepAttribFloat64 (
"f=%p, attrib_name='%s', buffer=%p, nelems=%llu",
(h5_file_p)f, attrib_name, buffer, (long long unsigned)nelems);
H5_API_RETURN (
h5_write_step_attrib (
h5_write_iteration_attrib (
f,
attrib_name,
H5_FLOAT64_T,
@@ -278,7 +281,7 @@ H5WriteStepAttribFloat32 (
"f=%p, attrib_name='%s', buffer=%p, nelems=%llu",
(h5_file_p)f, attrib_name, buffer, (long long unsigned)nelems);
H5_API_RETURN (
h5_write_step_attrib (
h5_write_iteration_attrib (
f,
attrib_name,
H5_FLOAT32_T,
@@ -297,7 +300,7 @@ H5WriteStepAttribInt64 (
"f=%p, attrib_name='%s', buffer=%p, nelems=%llu",
(h5_file_p)f, attrib_name, buffer, (long long unsigned)nelems);
H5_API_RETURN (
h5_write_step_attrib (
h5_write_iteration_attrib (
f,
attrib_name,
H5_INT64_T,
@@ -316,7 +319,7 @@ H5WriteStepAttribInt32 (
"f=%p, attrib_name='%s', buffer=%p, nelems=%llu",
(h5_file_p)f, attrib_name, buffer, (long long unsigned)nelems);
H5_API_RETURN (
h5_write_step_attrib (
h5_write_iteration_attrib (
f,
attrib_name,
H5_INT32_T,
@@ -393,7 +396,7 @@ H5ReadStepAttribString (
"f=%p, attrib_name='%s', buffer=%p",
(h5_file_p)f, attrib_name, buffer);
H5_API_RETURN (
h5_read_step_attrib (
h5_read_iteration_attrib (
f,
attrib_name,
H5_STRING_T,
@@ -410,7 +413,7 @@ H5ReadStepAttribFloat64 (
"f=%p, attrib_name='%s', buffer=%p",
(h5_file_p)f, attrib_name, buffer);
H5_API_RETURN (
h5_read_step_attrib (
h5_read_iteration_attrib (
f,
attrib_name,
H5_FLOAT64_T,
@@ -427,7 +430,7 @@ H5ReadStepAttribFloat32 (
"f=%p, attrib_name='%s', buffer=%p",
(h5_file_p)f, attrib_name, buffer);
H5_API_RETURN (
h5_read_step_attrib (
h5_read_iteration_attrib (
f,
attrib_name,
H5_FLOAT32_T,
@@ -444,7 +447,7 @@ H5ReadStepAttribInt64 (
"f=%p, attrib_name='%s', buffer=%p",
(h5_file_p)f, attrib_name, buffer);
H5_API_RETURN (
h5_read_step_attrib (
h5_read_iteration_attrib (
f,
attrib_name,
H5_INT64_T,
@@ -461,7 +464,7 @@ H5ReadStepAttribInt32 (
"f=%p, attrib_name='%s', buffer=%p",
(h5_file_p)f, attrib_name, buffer);
H5_API_RETURN (
h5_read_step_attrib (
h5_read_iteration_attrib (
f,
attrib_name,
H5_INT32_T,
+1 -1
View File
@@ -29,7 +29,7 @@
\ingroup h5block_model
\note
Different field sizes are allowed in the same time-step.
Different field sizes are allowed in the same step/iteration.
\note
The same layout can be used, if the size of the field matches the
+5 -1
View File
@@ -45,6 +45,10 @@ h5_err_t
h5_set_prop_file_core_vfd (
h5_prop_t, h5_int64_t);
h5_err_t
h5_set_prop_file_flush_after_write (
h5_prop_t _props);
h5_err_t
h5_close_prop (
h5_prop_t);
@@ -70,7 +74,7 @@ h5_close_h5hut (
void);
h5_err_t
h5_flush_step (
h5_flush_iteration (
const h5_file_t);
h5_err_t
+26 -8
View File
@@ -13,6 +13,7 @@
#include <stdio.h>
#include <stddef.h>
extern const char* H5_VER_STRING;
#include "h5core/h5_types.h"
@@ -22,6 +23,7 @@ extern const char* H5_VER_STRING;
#define H5_VERBOSE_ERROR (1)
#define H5_VERBOSE_WARN (2)
#define H5_VERBOSE_INFO (3)
#define H5_VERBOSE_DEBUG (4)
#define H5_VERBOSE_DEFAULT H5_VERBOSE_ERROR
@@ -45,7 +47,10 @@ enum h5_rtypes {
e_char_p,
e_void_p,
e_h5_err_t,
e_h5_int32_t,
e_h5_uint32_t,
e_h5_int64_t,
e_h5_uint64_t,
e_h5_id_t,
e_h5_ssize_t,
e_h5_errorhandler_t,
@@ -75,13 +80,18 @@ struct call_stack {
struct call_stack_entry entry[1024];
};
extern h5_int32_t h5_log_level;
extern h5_int64_t __h5_log_level;
extern h5_int64_t __h5_debug_mask;
extern struct call_stack h5_call_stack;
#ifdef __cplusplus
extern "C" {
#endif
// :FIXME: Should go to another header file
h5_err_t
h5_initialize (void);
static inline void
h5_call_stack_push (
const char* fname,
@@ -182,9 +192,13 @@ __attribute__ ((format (printf, 1, 2)))
h5_err_t
h5_set_loglevel (
const h5_id_t);
const h5_int64_t);
h5_err_t
h5_set_debug_mask (
const h5_int64_t);
h5_int64_t
h5_get_loglevel (
void);
@@ -196,17 +210,21 @@ h5_get_loglevel (
// function enter macro
#if defined(NDEBUG)
#define H5_API_ENTER(type, fmt, ...) \
type ret_value = (type)H5_ERR;
#define H5_API_ENTER(type, fmt, ...) \
type ret_value = (type)H5_ERR; \
h5_initialize(); \
h5_call_stack_reset (); \
h5_call_stack_push (__func__,e_##type);
#else // NDEBUG not defined
#define H5_API_ENTER(type, fmt, ...) \
h5_call_stack_reset (); \
type ret_value = (type)H5_ERR; \
int __log__ = h5_log_level & H5_DEBUG_API; \
h5_initialize(); \
h5_call_stack_reset (); \
h5_call_stack_push (__func__,e_##type); \
int __log__ = __h5_debug_mask & H5_DEBUG_API; \
if (__log__) { \
h5_call_stack_push (__func__,e_##type); \
h5_debug ("(" fmt ")", __VA_ARGS__); \
}
@@ -220,7 +238,7 @@ h5_get_loglevel (
}
#define H5_RETURN_ERROR(errno, fmt, ...) { \
ret_value = h5_error (errno, "(" fmt ")", __VA_ARGS__); \
ret_value = h5_error (errno, fmt, __VA_ARGS__); \
goto done; \
}
+6 -6
View File
@@ -19,29 +19,29 @@ extern "C" {
#define H5_MAX_NAME_LEN 64
h5_err_t
h5_set_stepname_fmt (
h5_set_iteration_name_fmt (
const h5_file_t, const char*, const int);
h5_err_t
h5_get_stepname_fmt (
h5_get_iteration_name_fmt (
const h5_file_t, char* const, const int, int* const);
h5_int64_t
h5_set_step (
h5_set_iteration (
const h5_file_t, const h5_int64_t);
h5_int64_t
h5_get_step (
h5_get_iteration (
const h5_file_t);
h5_ssize_t
h5_get_num_steps (
h5_get_num_iterations (
const h5_file_t);
h5_int64_t
h5_has_step (
h5_has_iteration (
const h5_file_t, const h5_int64_t);
int
+6 -6
View File
@@ -18,30 +18,30 @@ extern "C" {
#endif
h5_err_t
h5_has_step_attrib (
h5_has_iteration_attrib (
const h5_file_t, const char* const);
h5_err_t
h5_get_step_attrib_info_by_name (
h5_get_iteration_attrib_info_by_name (
const h5_file_t, const char* const,
h5_int64_t* const, h5_size_t* const);
h5_ssize_t
h5_get_num_step_attribs (
h5_get_num_iteration_attribs (
const h5_file_t f);
h5_err_t
h5_get_step_attrib_info_by_idx (
h5_get_iteration_attrib_info_by_idx (
const h5_file_t, const h5_size_t, char* const, const h5_size_t,
h5_int64_t* const, h5_size_t* const);
h5_err_t
h5_read_step_attrib (
h5_read_iteration_attrib (
const h5_file_t, const char* const, const h5_types_t,
void* const);
h5_err_t
h5_write_step_attrib (
h5_write_iteration_attrib (
const h5_file_t, const char* const, const h5_types_t,
const void* const, const h5_size_t);
+1 -1
View File
@@ -148,7 +148,7 @@ typedef struct h5_glb_idxlist {
} h5_glb_idxlist_t;
enum h5_iterators {
step_iterator
iteration_iterator
};
struct h5_iterator;
+2 -1
View File
@@ -51,7 +51,8 @@ h5b_3d_set_view (
const h5_file_t,
const h5_size_t, const h5_size_t,
const h5_size_t, const h5_size_t,
const h5_size_t, const h5_size_t);
const h5_size_t, const h5_size_t,
const h5_int64_t);
h5_err_t
h5b_3d_get_view (
+2 -2
View File
@@ -18,12 +18,12 @@ extern "C" {
#endif
h5_int64_t
h5u_read_data (
h5u_read_dataset (
const h5_file_t,
const char* const, void* const, const h5_types_t);
h5_int64_t
h5u_write_data (
h5u_write_dataset (
const h5_file_t,
const char* const, const void* const, const h5_types_t);
+3 -3
View File
@@ -41,11 +41,11 @@ h5u_get_dataset_info_by_name (
);
h5_ssize_t
h5u_get_num_points (
h5u_get_num_items (
const h5_file_t);
h5_ssize_t
h5u_get_num_points_in_view (
h5u_get_num_items_in_view (
const h5_file_t);
h5_ssize_t
@@ -59,7 +59,7 @@ h5u_get_totalnum_particles_by_idx (
h5_id_t);
h5_err_t
h5u_set_num_points (
h5u_set_num_items (
const h5_file_t,
const h5_size_t, const h5_size_t);
+17 -6
View File
@@ -360,7 +360,7 @@ test_read_data32(h5_file_t file, int nparticles, int step)
status = H5PartReadDataFloat32(file, "pz", pz);
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat32");
status = H5PartReadDataInt32(file, LONGNAME2, id);
status = H5PartReadDataInt32(file, "id", id);
RETURN(status, H5_SUCCESS, "H5PartReadDataInt32");
for (i=0; i<nparticles; i++)
@@ -471,25 +471,37 @@ void h5u_test_read2(void)
RETURN(status, H5_SUCCESS, "H5CloseFile");
}
#if H5_VERSION_LE(1,8,12)
void h5u_test_read3(void)
{
h5_file_t file1;
h5_int64_t status;
#if H5_VERSION_LE(1,8,12)
TEST("Opening file once, read-only, MPI-POSIX VFD");
#else
TEST("Opening file once, read-only, MPI-IO Independent VFD");
#endif
h5_prop_t props = H5CreateFileProp ();
#if defined(H5_HAVE_PARALLEL)
MPI_Comm comm = MPI_COMM_WORLD;
#if H5_VERSION_LE(1,8,12)
status = H5SetPropFileMPIOPosix (props, &comm);
RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOPosix");
#else
status = H5SetPropFileMPIOIndependent (props, &comm);
RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOIndependent");
#endif
#endif // H5_HAVE_PARALLEL
file1 = H5OpenFile(FILENAME, H5_O_RDONLY, props);
status = H5CheckFile(file1);
RETURN(status, H5_SUCCESS, "H5CheckFile");
TEST("Redefining step name");
status = H5SetStepNameFormat(file1, LONGNAME, 16);
status = H5SetStepNameFormat(file1, "data", 16);
RETURN(status, H5_SUCCESS, "H5SetStepNameFormat");
test_read_strided_data64(file1, NPARTICLES, 0);
@@ -498,7 +510,6 @@ void h5u_test_read3(void)
status = H5CloseFile(file1);
RETURN(status, H5_SUCCESS, "H5CloseFile");
}
#endif
void h5u_test_read4(void)
{
@@ -525,10 +536,10 @@ void h5u_test_read4(void)
RETURN(status, H5_SUCCESS, "H5CloseProp");
TEST("Redefining step name");
status = H5SetStepNameFormat(file1, LONGNAME, 16);
status = H5SetStepNameFormat(file1, "data", 16);
RETURN(status, H5_SUCCESS, "H5SetStepNameFormat");
status = H5SetStepNameFormat(file2, LONGNAME, 16);
status = H5SetStepNameFormat(file2, "data", 16);
RETURN(status, H5_SUCCESS, "H5SetStepNameFormat");
test_read_file_attribs(file1, 1);
+18 -8
View File
@@ -266,7 +266,7 @@ test_write_data32(h5_file_t file, int nparticles, int step)
status = H5PartWriteDataFloat32(file, "pz", pz);
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
status = H5PartWriteDataInt32(file, LONGNAME2, id);
status = H5PartWriteDataInt32(file, "id", id);
RETURN(status, H5_SUCCESS, "H5PartWriteDataInt32");
/* the second write phase... */
@@ -293,7 +293,7 @@ test_write_data32(h5_file_t file, int nparticles, int step)
status = H5PartWriteDataFloat32(file, "pz", pz+32);
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
status = H5PartWriteDataInt32(file, LONGNAME, id+32);
status = H5PartWriteDataInt32(file, "id", id+32);
RETURN(status, H5_SUCCESS, "H5PartWriteDataInt32");
}
}
@@ -411,21 +411,32 @@ void h5u_test_write2(void)
RETURN(status, H5_SUCCESS, "H5CloseFile");
}
#if H5_VERSION_LE(1,8,12)
void h5u_test_write3(void)
{
h5_file_t file1;
h5_err_t status;
#if H5_VERSION_LE(1,8,12)
TEST("Opening file once, write-truncate, MPI-POSIX VFD");
#else
TEST("Opening file once, write-truncate, MPI-IO Independent VFD");
#endif
h5_prop_t props = H5CreateFileProp ();
#if defined(H5_HAVE_PARALLEL)
MPI_Comm comm = MPI_COMM_WORLD;
#if H5_VERSION_LE(1,8,12)
status = H5SetPropFileMPIOPosix (props, &comm);
RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOPosix");
#else
status = H5SetPropFileMPIOIndependent (props, &comm);
RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOIndependent");
#endif
#endif // H5_HAVE_PARALLEL
file1 = H5OpenFile(FILENAME, H5_O_WRONLY, props);
status = H5CheckFile(file1);
@@ -435,7 +446,7 @@ void h5u_test_write3(void)
RETURN(status, H5_SUCCESS, "H5CloseProp");
TEST("Redefining step name");
status = H5SetStepNameFormat(file1, LONGNAME, 16);
status = H5SetStepNameFormat(file1, "data", 16);
RETURN(status, H5_SUCCESS, "H5SetStepNameFormat");
test_write_strided_data64(file1, NPARTICLES, 0);
@@ -444,7 +455,6 @@ void h5u_test_write3(void)
status = H5CloseFile(file1);
RETURN(status, H5_SUCCESS, "H5CloseFile");
}
#endif
void h5u_test_write4(void)
{
@@ -474,10 +484,10 @@ void h5u_test_write4(void)
RETURN(status, H5_SUCCESS, "H5CloseProp");
TEST("Redefining step name");
status = H5SetStepNameFormat(file1, LONGNAME, 16);
status = H5SetStepNameFormat(file1, "data", 16);
RETURN(status, H5_SUCCESS, "H5SetStepNameFormat");
status = H5SetStepNameFormat(file2, LONGNAME, 16);
status = H5SetStepNameFormat(file2, "data", 16);
RETURN(status, H5_SUCCESS, "H5SetStepNameFormat");
status = H5PartSetChunkSize(file1, NPARTICLES);
+5 -1
View File
@@ -658,7 +658,11 @@ test_open_objects(h5_file_t file, int max_objects)
H5O_info_t info;
int i;
for (i=0; i<nopen; i++) {
H5Oget_info(list[i], &info);
#if H5_VERSION_GE(1,12,0)
H5Oget_info(list[i], &info, H5O_INFO_BASIC);
#else
H5Oget_info(list[i], &info);
#endif
switch (info.type) {
case H5O_TYPE_GROUP:
TestErrPrintf("obj%d has type GROUP\n", i);