continued merging H5Block: still some functionality missing (attribs, read, write); added H5Part regression tests; simplified several Makefile.am files and configure.ac; began merging new Fortran interface
This commit is contained in:
+21
-2
@@ -377,10 +377,16 @@ src/C/H5Part.c -text
|
||||
src/C/H5_attribs.c -text
|
||||
src/C/H5_inquiry.c -text
|
||||
src/C/Makefile.am -text
|
||||
src/Fortran/H5Block.f90 -text
|
||||
src/Fortran/H5BlockF.c -text
|
||||
src/Fortran/H5BlockF90.inc -text
|
||||
src/Fortran/H5BlockReadWrite.f90 -text
|
||||
src/Fortran/H5BlockReadWriteF.c -text
|
||||
src/Fortran/H5F.c -text
|
||||
src/Fortran/H5Part.f90 -text
|
||||
src/Fortran/H5PartAttrib.f90 -text
|
||||
src/Fortran/H5PartAttribF.c -text
|
||||
src/Fortran/H5PartF.c -text
|
||||
src/Fortran/H5PartF90.inc -text
|
||||
src/Fortran/Makefile.am -text
|
||||
src/Fortran/TestUnderscore.f -text
|
||||
src/Fortran/TestUnderscoreC.c -text
|
||||
src/Makefile.am -text
|
||||
@@ -408,7 +414,11 @@ src/h5core/h5_readwrite_private.h -text
|
||||
src/h5core/h5_syscall.c -text
|
||||
src/h5core/h5_syscall_private.h -text
|
||||
src/h5core/h5_types_private.h -text
|
||||
src/h5core/h5b_attribs.c -text
|
||||
src/h5core/h5b_errorhandling_private.h -text
|
||||
src/h5core/h5b_model.c -text
|
||||
src/h5core/h5b_model_private.h -text
|
||||
src/h5core/h5b_readwrite.c -text
|
||||
src/h5core/h5b_types_private.h -text
|
||||
src/h5core/h5t_adjacencies.c -text
|
||||
src/h5core/h5t_adjacencies_tetm.c -text
|
||||
@@ -461,6 +471,7 @@ src/include/H5Part.h -text
|
||||
src/include/H5_attribs.h -text
|
||||
src/include/H5_inquiry.h -text
|
||||
src/include/H5hut.h -text
|
||||
src/include/grephdr -text
|
||||
src/include/h5core/h5_attribs.h -text
|
||||
src/include/h5core/h5_core.h -text
|
||||
src/include/h5core/h5_errno.h -text
|
||||
@@ -470,6 +481,8 @@ src/include/h5core/h5_maps.h -text
|
||||
src/include/h5core/h5_openclose.h -text
|
||||
src/include/h5core/h5_readwrite.h -text
|
||||
src/include/h5core/h5_types.h -text
|
||||
src/include/h5core/h5b_attribs.h -text
|
||||
src/include/h5core/h5b_model.h -text
|
||||
src/include/h5core/h5t_adjacencies.h -text
|
||||
src/include/h5core/h5t_core.h -text
|
||||
src/include/h5core/h5t_inquiry.h -text
|
||||
@@ -512,6 +525,12 @@ test/H5Part/H5testF.f -text
|
||||
test/H5Part/H5testFpar.f90 -text
|
||||
test/H5Part/Makefile.am -text
|
||||
test/Makefile.am -text
|
||||
test/h5u_read.c -text
|
||||
test/h5u_test.c -text
|
||||
test/h5u_write.c -text
|
||||
test/params.h -text
|
||||
test/testframe.c -text
|
||||
test/testframe.h -text
|
||||
tools/H5PartMerge/AUTHORS -text
|
||||
tools/H5PartMerge/COPYING -text
|
||||
tools/H5PartMerge/ChangeLog -text
|
||||
|
||||
+4
-20
@@ -207,6 +207,8 @@ if test "X$USE_FORTRAN" = "Xyes"; then
|
||||
AC_MSG_ERROR([Cannot build fortran executables!!!])
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FORTRAN_LIB=libH5hutF.a
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
@@ -291,7 +293,6 @@ if test "X$USE_PARALLEL" = "Xyes"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
MTARGET="libpH5Part.a"
|
||||
TPTARGET="${TPTARGET} H5PartTestP H5PartAndreasTest Bench"
|
||||
TBTARGET="${TBTARGET} H5BlockTestAttributes"
|
||||
TBTARGET="${TBTARGET} H5BlockParTestScalarField"
|
||||
@@ -317,7 +318,6 @@ if test "X$USE_PARALLEL" = "Xyes"; then
|
||||
FC=${MPIFC}
|
||||
fi
|
||||
|
||||
MTARGET="${MTARGET} libpH5PartF.a"
|
||||
TPTARGET="${TPTARGET} H5testFpar"
|
||||
TBTARGET="${TBTARGET} H5BlockParTestScalarFieldF"
|
||||
fi
|
||||
@@ -325,12 +325,10 @@ if test "X$USE_PARALLEL" = "Xyes"; then
|
||||
else # --enable-parallel=no
|
||||
AC_MSG_RESULT([no])
|
||||
|
||||
MTARGET="libH5Part.a"
|
||||
TPTARGET="${TPTARGET} H5test"
|
||||
TBTARGET="${TBTARGET} H5BlockTestAttributes"
|
||||
|
||||
if test "X$USE_FORTRAN" = "Xyes"; then
|
||||
MTARGET="${MTARGET} libH5PartF.a"
|
||||
TPTARGET="${TPTARGET} H5testF"
|
||||
TBTARGET="${TBTARGET} H5BlockTestAttributesF"
|
||||
fi
|
||||
@@ -442,7 +440,6 @@ if test -n "$SAVE_MPIINC"; then
|
||||
MPIINC=$SAVE_MPIINC
|
||||
fi
|
||||
|
||||
#CFLAGS="$SAVE_CFLAGS ${CFLAGS}"
|
||||
if test -n "$SAVE_CFLAGS"; then
|
||||
CFLAGS=$SAVE_CFLAGS $CFLAGS
|
||||
fi
|
||||
@@ -463,16 +460,6 @@ if test -n "$SAVE_LDFLAGS"; then
|
||||
LDFLAGS=$SAVE_LDFLAGS
|
||||
fi
|
||||
|
||||
if test -n "$MPICXX"; then
|
||||
TOOLS_CXX=$MPICXX
|
||||
TOOLS_H5PART_LIB="-lpH5Part"
|
||||
TOOLS_HDFLIB="-L$HDF5ROOT/lib -lhdf5"
|
||||
else
|
||||
TOOLS_CXX=$CXX
|
||||
TOOLS_H5PART_LIB="-lH5Part"
|
||||
TOOLS_HDFLIB="-L$HDF5ROOT/lib -lhdf5"
|
||||
fi
|
||||
|
||||
###############################################################################
|
||||
############## EXPORTING VARIABLES & CREATING OUTPUT FILES ####################
|
||||
###############################################################################
|
||||
@@ -490,7 +477,6 @@ AC_SUBST(MPILIB)
|
||||
AC_SUBST(MPICC)
|
||||
AC_SUBST(MPICXX)
|
||||
AC_SUBST(MPIFC)
|
||||
AC_SUBST(MTARGET)
|
||||
AC_SUBST(TPTARGET)
|
||||
AC_SUBST(TBTARGET)
|
||||
AC_SUBST(TFTARGET)
|
||||
@@ -500,10 +486,8 @@ AC_SUBST(FFLAGS)
|
||||
AC_SUBST(STDCXX)
|
||||
AC_SUBST(UNDERSCORE_H)
|
||||
AC_SUBST(BUILD_TOOLS)
|
||||
AC_SUBST(FORTRAN_LIB)
|
||||
AC_SUBST(LDFLAGS)
|
||||
AC_SUBST(TOOLS_CXX)
|
||||
AC_SUBST(TOOLS_H5PART_LIB)
|
||||
AC_SUBST(TOOLS_HDFLIB)
|
||||
|
||||
# Make AC_OUTPUT create each `file' by copying an input file (by default `file.in'),
|
||||
# substituting the output variable values.
|
||||
@@ -531,7 +515,7 @@ AC_MSG_RESULT([ ])
|
||||
AC_MSG_RESULT([Host OS: $host_os])
|
||||
AC_MSG_RESULT([Host CPU: $host_cpu])
|
||||
AC_MSG_RESULT([Host vendor: $host_vendor])
|
||||
AC_MSG_RESULT([Build libraries: $MTARGET])
|
||||
AC_MSG_RESULT([Build libraries: $FORTRAN_LIB])
|
||||
AC_MSG_RESULT([Build test programs: $TTARGET])
|
||||
AC_MSG_RESULT([Build tools: $BUILD_TOOLS])
|
||||
AC_MSG_RESULT([CC = $CC])
|
||||
|
||||
+15
@@ -74,6 +74,21 @@ H5CloseFile (
|
||||
return h5_close_file (f);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_c_api_general
|
||||
|
||||
Close file.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5CheckFile (
|
||||
h5_file_t* const f /*!< file handle */
|
||||
) {
|
||||
SET_FNAME (f, __func__);
|
||||
return h5_check_filehandle (f);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_c_api_general
|
||||
|
||||
|
||||
+177
-1653
File diff suppressed because it is too large
Load Diff
+7
-9
@@ -108,7 +108,7 @@ For further information contact: <a href="mailto:h5part@lists.psi.ch">h5part</a>
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartSetNumParticles (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
h5_int64_t nparticles /*!< [in] Number of particles */
|
||||
) {
|
||||
|
||||
@@ -147,9 +147,9 @@ H5PartSetNumParticles (
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartSetNumParticlesStrided (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
h5_int64_t nparticles, /*!< [in] Number of particles */
|
||||
h5_int64_t stride /*!< [in] Stride value (e.g. number of fields in the particle array) */
|
||||
h5_int64_t stride /*!< [in] Stride value (e.g. number of fields in the particle array) */
|
||||
) {
|
||||
|
||||
SET_FNAME( f, __func__ );
|
||||
@@ -161,14 +161,12 @@ H5PartSetNumParticlesStrided (
|
||||
\ingroup h5part_model
|
||||
|
||||
Define the chunk \c size and enables chunking in the underlying
|
||||
HDF5 layer. When combined with the \c align value in the
|
||||
\ref H5OpenFileAlign or \ref H5OpenFileParallelAlign
|
||||
function, this causes each group of \c size particles to be
|
||||
padded on disk out to the nearest multiple of \c align bytes.
|
||||
HDF5 layer.
|
||||
|
||||
Note that this policy wastes disk space, but can improve write
|
||||
bandwidth on parallel filesystems that are sensitive to alignment
|
||||
to stripe boundaries (e.g. lustre).
|
||||
bandwidth on parallel filesystems that are sensitive to write alignment
|
||||
(e.g. lustre). It is only recommended when using the MPI-POSIX or MPI-IO
|
||||
independent VFDs (see \ref H5OpenFile).
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
|
||||
+480
-21
@@ -3,12 +3,13 @@
|
||||
#include "h5core/h5_core.h"
|
||||
#include "H5.h"
|
||||
|
||||
/********************** attribute API ****************************************/
|
||||
|
||||
/*** WRITE ***/
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Writes an attribute \c name with the string \c value to
|
||||
Write an attribute \c name with the string \c value to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
@@ -22,9 +23,6 @@ H5WriteFileAttribString (
|
||||
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
|
||||
return h5_get_errno( f );
|
||||
|
||||
return h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
@@ -37,7 +35,7 @@ H5WriteFileAttribString (
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Writes an attribute \c name with the string \c value to
|
||||
Write an attribute \c name with the string \c value to
|
||||
the current timestep.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
@@ -51,9 +49,6 @@ H5WriteStepAttribString (
|
||||
|
||||
SET_FNAME ( f, __func__ );
|
||||
|
||||
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
|
||||
return h5_get_errno( f );
|
||||
|
||||
return h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
@@ -63,6 +58,476 @@ H5WriteStepAttribString (
|
||||
strlen(value) + 1 );
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Write an attribute \c name with float32 \c values to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteFileAttribFloat32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_float32_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
) {
|
||||
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
return h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5T_NATIVE_FLOAT,
|
||||
values,
|
||||
nelems );
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Write an attribute \c name with float32 \c values to
|
||||
the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteStepAttribFloat32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_float32_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
) {
|
||||
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
return h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5T_NATIVE_FLOAT,
|
||||
values,
|
||||
nelems );
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Write an attribute \c name with float64 \c values to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteFileAttribFloat64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_float64_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
) {
|
||||
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
return h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5T_NATIVE_DOUBLE,
|
||||
values,
|
||||
nelems );
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Write an attribute \c name with float64 \c values to
|
||||
the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteStepAttribFloat64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_float64_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
) {
|
||||
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
return h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5T_NATIVE_FLOAT,
|
||||
values,
|
||||
nelems );
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Write an attribute \c name with int32 \c values to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteFileAttribInt32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_int32_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
) {
|
||||
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
return h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5T_NATIVE_INT32,
|
||||
values,
|
||||
nelems );
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Write an attribute \c name with int32 \c values to
|
||||
the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteStepAttribInt32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_int32_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
) {
|
||||
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
return h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5T_NATIVE_INT32,
|
||||
values,
|
||||
nelems );
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Write an attribute \c name with int64 \c values to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteFileAttribInt64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_int64_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
) {
|
||||
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
return h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5T_NATIVE_INT64,
|
||||
values,
|
||||
nelems );
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Write an attribute \c name with int64 \c values to
|
||||
the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteStepAttribInt64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_int64_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
) {
|
||||
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
return h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5T_NATIVE_INT64,
|
||||
values,
|
||||
nelems );
|
||||
}
|
||||
|
||||
/*** READ ***/
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Read a string into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadFileAttribString (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
char *buffer /*!< [out] Value of attribute */
|
||||
) {
|
||||
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
return h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_STRING_T,
|
||||
(void*)buffer);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Read a string into a \c buffer from an attribute \c name
|
||||
in the current timestep.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadStepAttribString (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
char *buffer /*!< [out] Value of attribute */
|
||||
) {
|
||||
|
||||
SET_FNAME ( f, __func__ );
|
||||
|
||||
return h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_STRING_T,
|
||||
(void*)buffer);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Read int32 values into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadFileAttribInt32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_int32_t *buffer /*!< [out] Values of attribute */
|
||||
) {
|
||||
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
return h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_INT32_T,
|
||||
(void*)buffer);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Read int32 values into a \c buffer from an attribute \c name
|
||||
in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadStepAttribInt32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_int32_t *buffer /*!< [out] Values of attribute */
|
||||
) {
|
||||
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
return h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_INT32_T,
|
||||
(void*)buffer);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Read int64 values into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadFileAttribInt64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_int64_t *buffer /*!< [out] Values of attribute */
|
||||
) {
|
||||
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
return h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_INT64_T,
|
||||
(void*)buffer);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Read int64 values into a \c buffer from an attribute \c name
|
||||
in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadStepAttribInt64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_int64_t *buffer /*!< [out] Values of attribute */
|
||||
) {
|
||||
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
return h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_INT64_T,
|
||||
(void*)buffer);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Read float32 values into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadFileAttribFloat32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_float32_t *buffer /*!< [out] Values of attribute */
|
||||
) {
|
||||
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
return h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_FLOAT32_T,
|
||||
(void*)buffer);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Read float32 values into a \c buffer from an attribute \c name
|
||||
in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadStepAttribFloat32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_float32_t *buffer /*!< [out] Values of attribute */
|
||||
) {
|
||||
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
return h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_FLOAT32_T,
|
||||
(void*)buffer);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Read float64 values into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadFileAttribFloat64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_float64_t *buffer /*!< [out] Values of attribute */
|
||||
) {
|
||||
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
return h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_FLOAT64_T,
|
||||
(void*)buffer);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
Read float64 values into a \c buffer from an attribute \c name
|
||||
in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadStepAttribFloat64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_float64_t *buffer /*!< [out] Values of attribute */
|
||||
) {
|
||||
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
return h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_FLOAT64_T,
|
||||
(void*)buffer);
|
||||
}
|
||||
|
||||
/*** QUERY ***/
|
||||
|
||||
/*!
|
||||
\ingroup h5_attrib
|
||||
|
||||
@@ -76,9 +541,6 @@ H5GetNumFileAttribs (
|
||||
) {
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
|
||||
return h5_get_errno( f );
|
||||
|
||||
return h5_get_num_attribs ( f, H5_ATTRIB_FILE );
|
||||
}
|
||||
|
||||
@@ -95,9 +557,6 @@ H5GetNumStepAttribs (
|
||||
) {
|
||||
SET_FNAME( f, __func__ );
|
||||
|
||||
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
|
||||
return h5_get_errno( f );
|
||||
|
||||
return h5_get_num_attribs ( f, H5_ATTRIB_STEP );
|
||||
}
|
||||
|
||||
@@ -119,13 +578,13 @@ H5GetNumStepAttribs (
|
||||
h5_int64_t
|
||||
H5GetFileAttribInfo (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const h5_int64_t attrib_idx, /*!< [in] Index of attribute to get
|
||||
const h5_size_t attrib_idx, /*!< [in] Index of attribute to get
|
||||
infos about */
|
||||
char *attrib_name, /*!< [out] Name of attribute */
|
||||
const h5_int64_t len_of_attrib_name,
|
||||
const h5_size_t len_of_attrib_name,
|
||||
/*!< [in] length of buffer \c name */
|
||||
h5_int64_t *attrib_type, /*!< [out] Type of value. */
|
||||
h5_int64_t *attrib_nelem /*!< [out] Number of elements */
|
||||
h5_size_t *attrib_nelem /*!< [out] Number of elements */
|
||||
) {
|
||||
|
||||
SET_FNAME ( f, __func__ );
|
||||
@@ -160,13 +619,13 @@ H5GetFileAttribInfo (
|
||||
h5_int64_t
|
||||
H5GetStepAttribInfo (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const h5_int64_t attrib_idx, /*!< [in] Index of attribute to
|
||||
const h5_size_t attrib_idx, /*!< [in] Index of attribute to
|
||||
get infos about */
|
||||
char *attrib_name, /*!< [out] Name of attribute */
|
||||
const h5_int64_t len_of_attrib_name,
|
||||
const h5_size_t len_of_attrib_name,
|
||||
/*!< [in] length of buffer \c name */
|
||||
h5_int64_t *attrib_type, /*!< [out] Type of value. */
|
||||
h5_int64_t *attrib_nelem /*!< [out] Number of elements */
|
||||
h5_size_t *attrib_nelem /*!< [out] Number of elements */
|
||||
) {
|
||||
|
||||
SET_FNAME ( f, __func__ );
|
||||
|
||||
+12
-49
@@ -1,49 +1,23 @@
|
||||
# src level Makefile.am
|
||||
# src/C level Makefile.am
|
||||
|
||||
# PATH SETTING (IMPORTED FROM CONFIGURE)
|
||||
HDF5ROOT = @HDF5ROOT@
|
||||
OBJEXT=o
|
||||
|
||||
# COMPILERS
|
||||
CC = @CC@
|
||||
|
||||
#INCLUDES
|
||||
HDFINC = -I$(HDF5ROOT)/include
|
||||
MPIINC = @MPIINC@
|
||||
|
||||
INC = $(HDFINC) ${MPIINC} -I../include
|
||||
|
||||
# H5Part header file location
|
||||
H5PINC = -I@prefix@/include
|
||||
|
||||
# COMPILER FLAGS
|
||||
CFLAGS = @CFLAGS@ ${INC}
|
||||
|
||||
# H5Part compiled library location
|
||||
H5PLIB = -L@prefix@/lib
|
||||
|
||||
# HDF5 LIBRARY
|
||||
HDFLIB = -L$(HDF5ROOT)/lib -lhdf5 -lz $(SZLIB) @LDFLAGS@
|
||||
|
||||
# SZ LIBRARY
|
||||
SZLIB = @SZLIB@
|
||||
|
||||
# Extra files that I wish to include in the dist tar ball.
|
||||
EXTRA_DIST = TestUnderscoreC.c TestUnderscore.f $(EXTRA_HEADERS)
|
||||
|
||||
# Files that I don't want to include in the dist tar ball
|
||||
nodist_include_HEADERS = @UNDERSCORE_H@
|
||||
HDFLIB = -L@HDF5ROOT@/lib -lhdf5 -lz @SZLIB@
|
||||
LIBS = $(HDFLIB) @MPILIB@
|
||||
|
||||
INCLUDES = -I../include -I@HDF5ROOT@/include @MPIINC@
|
||||
|
||||
# What to build... Will be determined by configure script.
|
||||
OBJEXT = o
|
||||
lib_LIBRARIES = libH5.a
|
||||
lib_LIBRARIES = libH5hutC.a
|
||||
|
||||
# Listing of all possible targets that I may build.
|
||||
EXTRA_LIBRARIES = libH5.a
|
||||
EXTRA_LIBRARIES = libH5hutC.a
|
||||
|
||||
# Header files that I wish to install in $(prefix)/include
|
||||
include_HEADERS = \
|
||||
../include/H5hut.h \
|
||||
../include/H5.h \
|
||||
../include/H5_inquiry.h \
|
||||
../include/H5_attribs.h \
|
||||
../include/H5Block.h \
|
||||
../include/H5Fed.h \
|
||||
@@ -55,7 +29,7 @@ include_HEADERS = \
|
||||
EXTRA_HEADERS =
|
||||
|
||||
# Listing of sources
|
||||
libH5_a_SOURCES = \
|
||||
libH5hutC_a_SOURCES = \
|
||||
H5.c \
|
||||
H5_attribs.c \
|
||||
H5_inquiry.c \
|
||||
@@ -68,19 +42,8 @@ libH5_a_SOURCES = \
|
||||
H5Fed_tags.c \
|
||||
H5Part.c
|
||||
|
||||
all: ../lib/libH5.a
|
||||
all: ../lib/libH5hutC.a
|
||||
|
||||
../lib/libH5.a: libH5.a
|
||||
../lib/libH5hutC.a: libH5hutC.a
|
||||
-cp $^ $@
|
||||
|
||||
%.o : %.c
|
||||
$(CC) $(CFLAGS) $(INC) -c $<
|
||||
|
||||
clean:
|
||||
$(RM) -f *~ *.o *.a *.so
|
||||
|
||||
distclean: clean
|
||||
$(RM) -f Underscore.h
|
||||
$(RM) -rf .deps
|
||||
$(RM) -rf .libs
|
||||
$(RM) -f Makefile
|
||||
|
||||
@@ -0,0 +1,235 @@
|
||||
! Declaration of subroutines for Fortran Bindings
|
||||
|
||||
!> \defgroup h5block_f90_api H5Block F90 API
|
||||
|
||||
!> \ingroup h5block_f90_api
|
||||
!! \defgroup h5blockf_model Setting up the Data Model
|
||||
!<
|
||||
|
||||
!> \ingroup h5block_f90_api
|
||||
!! \defgroup h5blockf_data Reading and Writing Datasets
|
||||
!<
|
||||
|
||||
!> \ingroup h5block_f90_api
|
||||
!! \defgroup h5blockf_attrib Reading and Writing Attributes
|
||||
!<
|
||||
|
||||
|
||||
!!!!!!!! Setting up the Data Model !!!!!!!!
|
||||
|
||||
!> \ingroup h5blockf_model
|
||||
!! See \ref H5BlockDefine3DFieldLayout
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_define3dlayout ( filehandle, i_start, i_end, j_start, j_end, k_start, k_end )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
INTEGER*8, INTENT(IN) :: i_start
|
||||
INTEGER*8, INTENT(IN) :: i_end
|
||||
INTEGER*8, INTENT(IN) :: j_start
|
||||
INTEGER*8, INTENT(IN) :: j_end
|
||||
INTEGER*8, INTENT(IN) :: k_start
|
||||
INTEGER*8, INTENT(IN) :: k_end
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_model
|
||||
!! See \ref H5BlockDefine3DChunkDims
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_define3dchunkdims ( filehandle, i, j, k )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
INTEGER*8, INTENT(IN) :: i
|
||||
INTEGER*8, INTENT(IN) :: j
|
||||
INTEGER*8, INTENT(IN) :: k
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_model
|
||||
!! See \ref H5Block3dGetPartitionOfProc
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_get_partition_of_proc ( filehandle, proc, i_start, i_end, j_start, j_end, k_start, k_end )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
INTEGER*8, INTENT(OUT) :: proc
|
||||
INTEGER*8, INTENT(OUT) :: i_start
|
||||
INTEGER*8, INTENT(OUT) :: i_end
|
||||
INTEGER*8, INTENT(OUT) :: j_start
|
||||
INTEGER*8, INTENT(OUT) :: j_end
|
||||
INTEGER*8, INTENT(OUT) :: k_start
|
||||
INTEGER*8, INTENT(OUT) :: k_end
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_model
|
||||
!! See \ref H5Block3dGetReducedPartitionOfProc
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_get_reduced_partition_of_proc ( filehandle, proc, i_start, i_end, j_start, j_end, k_start, k_end )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
INTEGER*8, INTENT(OUT) :: proc
|
||||
INTEGER*8, INTENT(OUT) :: i_start
|
||||
INTEGER*8, INTENT(OUT) :: i_end
|
||||
INTEGER*8, INTENT(OUT) :: j_start
|
||||
INTEGER*8, INTENT(OUT) :: j_end
|
||||
INTEGER*8, INTENT(OUT) :: k_start
|
||||
INTEGER*8, INTENT(OUT) :: k_end
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_model
|
||||
!! See \ref H5Block3dGetProcOf
|
||||
!! \return rank of processor error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_get_proc_of ( filehandle, i, j, k )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
INTEGER*8, INTENT(IN) :: i
|
||||
INTEGER*8, INTENT(IN) :: j
|
||||
INTEGER*8, INTENT(IN) :: k
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_model
|
||||
!! See \ref H5BlockGetNumFields
|
||||
!! \return number of fields or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_getnumfields ( filehandle )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_model
|
||||
!! See \ref H5BlockGetFieldInfo
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_getfieldinfo ( filehandle, idx, field_name, grid_rank, grid_dims, field_dims )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
INTEGER*8, INTENT(IN) :: idx
|
||||
CHARACTER(LEN=*), INTENT(OUT) :: field_name
|
||||
INTEGER*8, INTENT(OUT) :: grid_rank
|
||||
INTEGER*8, INTENT(OUT) :: grid_dims(*)
|
||||
INTEGER*8, INTENT(OUT) :: field_dims
|
||||
INTEGER*8, INTENT(OUT) :: type
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_model
|
||||
!! See \ref H5BlockHasFieldData
|
||||
!! \return 0 if false, 1 if true, or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_has_fielddata ( filehandle )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
END FUNCTION
|
||||
|
||||
|
||||
!!!!!!!! Reading and Writing Attributes !!!!!!!!
|
||||
|
||||
!> \ingroup h5blockf_attrib
|
||||
!! See \ref H5BlockWriteFieldAttribString
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_writefieldattrib_string ( filehandle, field_name, attrib_name, attrib_value )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_value ! The array of data to write into the attribute
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_attrib
|
||||
!! See \ref H5BlockGetNumFieldAttribs
|
||||
!! \return number of attributes or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_getnfieldattribs ( filehandle, field_name )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_attrib
|
||||
!! See \ref H5BlockGetFieldAttribInfo
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_getfieldattribinfo ( filehandle, field_name, idx, attrib_name, attrib_nelem)
|
||||
INTEGER*8,INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
|
||||
INTEGER*8,INTENT(IN) :: idx ! index of the attribute being queried
|
||||
CHARACTER(LEN=*), INTENT(OUT):: attrib_name ! The name of the attribute
|
||||
INTEGER*8,INTENT(OUT):: attrib_nelem ! Number of elements in the attrib array
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_attrib
|
||||
!! Read the attribute \c attrib_name from the field \c field_name at the
|
||||
!! current timestep, and store the int64 value in \c attrib_value.
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_readfieldattrib_i8 ( filehandle, field_name, attrib_name, attrib_value )
|
||||
INTEGER*8,INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
|
||||
INTEGER*8,INTENT(OUT):: attrib_value(*)! the attribute data will be read into this array
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_attrib
|
||||
!! Read the attribute \c attrib_name from the field \c field_name at the
|
||||
!! current timestep, and store the float64 value in \c attrib_value.
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_readfieldattrib_r8 ( filehandle, field_name, attrib_name, attrib_value )
|
||||
INTEGER*8,INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
|
||||
REAL*8, INTENT(OUT):: attrib_value(*)! the attribute data will be read into this array
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_attrib
|
||||
!! Read the attribute \c attrib_name from the field \c field_name at the
|
||||
!! current timestep, and store the string value in \c attrib_value.
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_readfieldattrib_string ( filehandle, field_name, attrib_name, attrib_value )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_value ! The array of data to write into the attribute
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_attrib
|
||||
!! See \ref H5Block3dGetFieldSpacing
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_get_field_spacing ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name
|
||||
REAL*8, INTENT(OUT) :: x
|
||||
REAL*8, INTENT(OUT) :: y
|
||||
REAL*8, INTENT(OUT) :: z
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_attrib
|
||||
!! See \ref H5Block3dSetFieldSpacing
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_set_field_spacing ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name
|
||||
REAL*8, INTENT(IN) :: x
|
||||
REAL*8, INTENT(IN) :: y
|
||||
REAL*8, INTENT(IN) :: z
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_attrib
|
||||
!! See \ref H5Block3dGetFieldOrigin
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_get_field_origin ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name
|
||||
REAL*8, INTENT(OUT) :: x
|
||||
REAL*8, INTENT(OUT) :: y
|
||||
REAL*8, INTENT(OUT) :: z
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_attrib
|
||||
!! See \ref H5Block3dSetFieldOrigin
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_set_field_origin ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name
|
||||
REAL*8, INTENT(IN) :: x
|
||||
REAL*8, INTENT(IN) :: y
|
||||
REAL*8, INTENT(IN) :: z
|
||||
END FUNCTION
|
||||
|
||||
|
||||
+36
-170
@@ -1,6 +1,4 @@
|
||||
#include "H5Part.h"
|
||||
#include "H5PartPrivate.h"
|
||||
#include "H5Block.h"
|
||||
#include "H5hut.h"
|
||||
#include "Underscore.h"
|
||||
|
||||
#if defined(F77_SINGLE_UNDERSCORE)
|
||||
@@ -17,6 +15,9 @@
|
||||
#define h5bl_define3dlayout F77NAME ( \
|
||||
h5bl_define3dlayout_, \
|
||||
H5BL_DEFINE3DLAYOUT )
|
||||
#define h5bl_define3dchunkdims F77NAME ( \
|
||||
h5bl_define3dchunkdims_, \
|
||||
H5BL_DEFINE3DCHUNKDIMS )
|
||||
#define h5bl_get_partition_of_proc F77NAME ( \
|
||||
h5bl_get_partition_of_proc_, \
|
||||
H5BL_GET_PARTITION_OF_PROC )
|
||||
@@ -26,30 +27,12 @@
|
||||
#define h5bl_get_proc_of F77NAME ( \
|
||||
h5bl_get_proc_of_, \
|
||||
H5BL_GET_PROC_OF )
|
||||
#define h5bl_3d_read_scalar_field F77NAME ( \
|
||||
h5bl_3d_read_scalar_field_, \
|
||||
H5BL_3D_READ_SCALAR_FIELD )
|
||||
#define h5bl_3d_write_scalar_field F77NAME ( \
|
||||
h5bl_3d_write_scalar_field_, \
|
||||
H5BL_3D_WRITE_SCALAR_FIELD )
|
||||
#define h5bl_3d_read_3dvector_field F77NAME ( \
|
||||
h5bl_3d_read_3dvector_field_, \
|
||||
H5BL_3D_READ_3DVECTOR_FIELD )
|
||||
#define h5bl_3d_write_3dvector_field F77NAME ( \
|
||||
h5bl_3d_write_3dvector_field_, \
|
||||
H5BL_3D_WRITE_3DVECTOR_FIELD )
|
||||
#define h5bl_getnumfields F77NAME ( \
|
||||
h5bl_getnumfields_, \
|
||||
H5BL_GETNUMFIELDS )
|
||||
#define h5bl_getfieldinfo F77NAME ( \
|
||||
h5bl_getfieldinfo_, \
|
||||
H5BL_GETFIELDINFO )
|
||||
#define h5bl_writefieldattrib_r8 F77NAME ( \
|
||||
h5bl_writefieldattrib_r8_, \
|
||||
H5BL_WRITEFIELDATTRIB_R8 )
|
||||
#define h5bl_writefieldattrib_i8 F77NAME ( \
|
||||
h5bl_writefieldattrib_i8_, \
|
||||
H5BL_WRITEFIELDATTRIB_I8 )
|
||||
#define h5bl_writefieldattrib_string F77NAME ( \
|
||||
h5bl_writefieldattrib_string_, \
|
||||
H5BL_WRITEFIELDATTRIB_STRING )
|
||||
@@ -96,7 +79,7 @@ h5bl_define3dlayout (
|
||||
const h5part_int64_t *k_end /*!< end index of k */
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
return H5BlockDefine3DFieldLayout (
|
||||
filehandle,
|
||||
@@ -105,6 +88,19 @@ h5bl_define3dlayout (
|
||||
*k_start-1, *k_end-1 );
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_define3dchunkdims (
|
||||
h5part_int64_t *f,
|
||||
const h5part_int64_t *i,
|
||||
const h5part_int64_t *j,
|
||||
const h5part_int64_t *k
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
return H5BlockDefine3DChunkDims ( filehandle, *i, *j, *k );
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_get_partition_of_proc (
|
||||
h5part_int64_t *f, /*!< file handle */
|
||||
@@ -117,7 +113,7 @@ h5bl_get_partition_of_proc (
|
||||
h5part_int64_t *k_end /*!< end index of k */
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
h5part_int64_t herr = H5Block3dGetPartitionOfProc (
|
||||
filehandle,
|
||||
@@ -147,7 +143,7 @@ h5bl_get_reduced_partition_of_proc (
|
||||
h5part_int64_t *k_end
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
h5part_int64_t herr = H5Block3dGetReducedPartitionOfProc (
|
||||
filehandle,
|
||||
@@ -173,97 +169,17 @@ h5bl_get_proc_of (
|
||||
const h5part_int64_t *k
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
return H5Block3dGetProcOf ( filehandle, (*i)-1, (*j)-1, (*k)-1 );
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_read_scalar_field (
|
||||
h5part_int64_t *f,
|
||||
const char *field_name,
|
||||
h5part_float64_t *data,
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dReadScalarField (
|
||||
filehandle, field_name2, data );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_write_scalar_field (
|
||||
h5part_int64_t *f,
|
||||
const char *field_name,
|
||||
const h5part_float64_t *data,
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dWriteScalarField (
|
||||
filehandle, field_name2, data );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_read_3dvector_field (
|
||||
h5part_int64_t *f, /*!< file handle */
|
||||
const char *field_name, /*!< name of the data set */
|
||||
h5part_float64_t *xval, /*!< array of x component data */
|
||||
h5part_float64_t *yval, /*!< array of y component data */
|
||||
h5part_float64_t *zval, /*!< array of z component data */
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dRead3dVectorField (
|
||||
filehandle, field_name2, xval, yval, zval );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_write_3dvector_field (
|
||||
h5part_int64_t *f, /*!< file handle */
|
||||
const char *field_name, /*!< name of the data set */
|
||||
const h5part_float64_t *xval, /*!< array of x component data */
|
||||
const h5part_float64_t *yval, /*!< array of y component data */
|
||||
const h5part_float64_t *zval, /*!< array of z component data */
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dWrite3dVectorField (
|
||||
filehandle, field_name2, xval, yval, zval );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_getnumfields (
|
||||
h5part_int64_t *f /*!< file handle */
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
return H5BlockGetNumFields ( filehandle );
|
||||
}
|
||||
@@ -276,69 +192,19 @@ h5bl_getfieldinfo (
|
||||
h5part_int64_t *grid_rank,
|
||||
h5part_int64_t *grid_dims,
|
||||
h5part_int64_t *field_dims,
|
||||
h5part_int64_t *type,
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
h5part_int64_t herr = H5BlockGetFieldInfo (
|
||||
filehandle, *idx, field_name, l_field_name,
|
||||
grid_rank, grid_dims, field_dims );
|
||||
grid_rank, grid_dims, field_dims, type );
|
||||
_H5Part_strc2for ( field_name, l_field_name );
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_writefieldattrib_r8 (
|
||||
h5part_int64_t *f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
const h5part_float64_t *attrib_value,
|
||||
const h5part_int64_t *attrib_nelem,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
char *attrib_name2 =_H5Part_strdupfor2c ( attrib_name, l_attrib_name );
|
||||
|
||||
h5part_int64_t herr = H5BlockWriteFieldAttrib (
|
||||
filehandle, field_name2, attrib_name2, H5PART_FLOAT64,
|
||||
attrib_value, *attrib_nelem );
|
||||
|
||||
free ( field_name2 );
|
||||
free ( attrib_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_writefieldattrib_i8 (
|
||||
h5part_int64_t *f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
const h5part_int64_t *attrib_value,
|
||||
const h5part_int64_t *attrib_nelem,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
char *attrib_name2 =_H5Part_strdupfor2c ( attrib_name, l_attrib_name );
|
||||
|
||||
h5part_int64_t herr = H5BlockWriteFieldAttrib (
|
||||
filehandle, field_name2, attrib_name2, H5PART_INT64,
|
||||
attrib_value, *attrib_nelem );
|
||||
|
||||
free ( field_name2 );
|
||||
free ( attrib_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_writefieldattrib_string (
|
||||
h5part_int64_t *f,
|
||||
@@ -350,7 +216,7 @@ h5bl_writefieldattrib_string (
|
||||
const int l_attrib_value
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 =_H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
char *attrib_name2=_H5Part_strdupfor2c ( attrib_name, l_attrib_name );
|
||||
@@ -373,7 +239,7 @@ h5bl_getnfieldattribs (
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
@@ -395,7 +261,7 @@ h5bl_getfieldattribinfo (
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
h5part_int64_t attrib_type;
|
||||
|
||||
@@ -424,7 +290,7 @@ h5bl_readfieldattrib_i8 (
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 =_H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
char *attrib_name2=_H5Part_strdupfor2c ( attrib_name, l_attrib_name );
|
||||
@@ -447,7 +313,7 @@ h5bl_readfieldattrib_r8 (
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 =_H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
char *attrib_name2=_H5Part_strdupfor2c ( attrib_name, l_attrib_name );
|
||||
@@ -471,7 +337,7 @@ h5bl_readfieldattrib_string (
|
||||
const int l_attrib_value
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 =_H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
char *attrib_name2=_H5Part_strdupfor2c ( attrib_name, l_attrib_name );
|
||||
@@ -491,7 +357,7 @@ h5bl_has_fielddata (
|
||||
h5part_int64_t *f
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
return H5BlockHasFieldData ( filehandle );
|
||||
}
|
||||
@@ -506,7 +372,7 @@ h5b_3d_get_field_spacing (
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
@@ -527,7 +393,7 @@ h5b_3d_set_field_spacing (
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
@@ -548,7 +414,7 @@ h5b_3d_get_field_origin (
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
@@ -569,7 +435,7 @@ h5b_3d_set_field_origin (
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
|
||||
@@ -1,176 +0,0 @@
|
||||
INTERFACE
|
||||
INTEGER*8 FUNCTION h5bl_define3dlayout ( filehandle, i_start, i_end, j_start, j_end, k_start, k_end )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
INTEGER*8, INTENT(IN) :: i_start
|
||||
INTEGER*8, INTENT(IN) :: i_end
|
||||
INTEGER*8, INTENT(IN) :: j_start
|
||||
INTEGER*8, INTENT(IN) :: j_end
|
||||
INTEGER*8, INTENT(IN) :: k_start
|
||||
INTEGER*8, INTENT(IN) :: k_end
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_get_partition_of_proc ( filehandle, proc, i_start, i_end, j_start, j_end, k_start, k_end )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
INTEGER*8, INTENT(OUT) :: proc
|
||||
INTEGER*8, INTENT(OUT) :: i_start
|
||||
INTEGER*8, INTENT(OUT) :: i_end
|
||||
INTEGER*8, INTENT(OUT) :: j_start
|
||||
INTEGER*8, INTENT(OUT) :: j_end
|
||||
INTEGER*8, INTENT(OUT) :: k_start
|
||||
INTEGER*8, INTENT(OUT) :: k_end
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_get_reduced_partition_of_proc ( filehandle, proc, i_start, i_end, j_start, j_end, k_start, k_end )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
INTEGER*8, INTENT(OUT) :: proc
|
||||
INTEGER*8, INTENT(OUT) :: i_start
|
||||
INTEGER*8, INTENT(OUT) :: i_end
|
||||
INTEGER*8, INTENT(OUT) :: j_start
|
||||
INTEGER*8, INTENT(OUT) :: j_end
|
||||
INTEGER*8, INTENT(OUT) :: k_start
|
||||
INTEGER*8, INTENT(OUT) :: k_end
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_get_proc_of ( filehandle, i, j, k )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
INTEGER*8, INTENT(IN) :: i
|
||||
INTEGER*8, INTENT(IN) :: j
|
||||
INTEGER*8, INTENT(IN) :: k
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_3d_read_scalar_field ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name
|
||||
REAL*8, INTENT(OUT) :: data(*)
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_3d_write_scalar_field ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name
|
||||
REAL*8, INTENT(IN) :: data(*)
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_3d_read_3dvector_field ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name
|
||||
REAL*8, INTENT(OUT) :: x(*)
|
||||
REAL*8, INTENT(OUT) :: y(*)
|
||||
REAL*8, INTENT(OUT) :: z(*)
|
||||
END FUNCTION
|
||||
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name
|
||||
REAL*8, INTENT(IN) :: x(*)
|
||||
REAL*8, INTENT(IN) :: y(*)
|
||||
REAL*8, INTENT(IN) :: z(*)
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_getnumfields ( filehandle )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_getfieldinfo ( filehandle, idx, field_name, grid_rank, grid_dims, field_dims )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
INTEGER*8, INTENT(IN) :: idx
|
||||
CHARACTER(LEN=*), INTENT(OUT) :: field_name
|
||||
INTEGER*8, INTENT(OUT) :: grid_rank
|
||||
INTEGER*8, INTENT(OUT) :: grid_dims(*)
|
||||
INTEGER*8, INTENT(OUT) :: field_dims
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_writefieldattrib_r8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
|
||||
REAL*8, INTENT(IN) :: attrib_value(*) ! The array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: attrib_nelem ! Number of elements in the attrib array
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_writefieldattrib_i8 (filehandle, field_name, attrib_name,attrib_value,attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
|
||||
INTEGER*8, INTENT(IN) :: attrib_value(*) ! The array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: attrib_nelem ! Number of elements in the attrib array
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_writefieldattrib_string ( filehandle, field_name, attrib_name, attrib_value )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_value ! The array of data to write into the attribute
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_getnfieldattribs ( filehandle, field_name )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_getfieldattribinfo ( filehandle, field_name, idx, attrib_name, attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
|
||||
INTEGER*8, INTENT(IN) :: idx ! index of the attribute being queried
|
||||
CHARACTER(LEN=*), INTENT(OUT):: attrib_name ! The name of the attribute
|
||||
INTEGER*8, INTENT(OUT):: attrib_nelem ! Number of elements in the attrib array
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_readfieldattrib_i8 ( filehandle, field_name, attrib_name, attrib_value )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
|
||||
INTEGER*8, INTENT(OUT):: attrib_value(*)! the attribute data will be read into this array
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_readfieldattrib_r8 ( filehandle, field_name, attrib_name, attrib_value )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
|
||||
REAL*8, INTENT(OUT):: attrib_value(*)! the attribute data will be read into this array
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_readfieldattrib_string ( filehandle, field_name, attrib_name, attrib_value )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_value ! The array of data to write into the attribute
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_has_fielddata ( filehandle )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_3d_get_field_spacing ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name
|
||||
REAL*8, INTENT(OUT) :: x
|
||||
REAL*8, INTENT(OUT) :: y
|
||||
REAL*8, INTENT(OUT) :: z
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_3d_set_field_spacing ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name
|
||||
REAL*8, INTENT(IN) :: x
|
||||
REAL*8, INTENT(IN) :: y
|
||||
REAL*8, INTENT(IN) :: z
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_3d_get_field_origin ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name
|
||||
REAL*8, INTENT(OUT) :: x
|
||||
REAL*8, INTENT(OUT) :: y
|
||||
REAL*8, INTENT(OUT) :: z
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5bl_3d_set_field_origin ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name
|
||||
REAL*8, INTENT(IN) :: x
|
||||
REAL*8, INTENT(IN) :: y
|
||||
REAL*8, INTENT(IN) :: z
|
||||
END FUNCTION
|
||||
|
||||
END INTERFACE
|
||||
@@ -0,0 +1,224 @@
|
||||
|
||||
!> \ingroup h5blockf_data
|
||||
!! See \ref H5Block3dWriteScalarFieldFloat64
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_r8 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
REAL*8, INTENT(IN) :: data(*) !< the array of data
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_data
|
||||
!! See \ref H5Block3dReadScalarFieldFloat64
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_r8 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
REAL*8, INTENT(OUT) :: data(*) !< buffer to read the data into
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_data
|
||||
!! See \ref H5Block3dWrite3dVectorFieldFloat64
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_r8 ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
REAL*8, INTENT(IN) :: x(*) !< the array of x data to write
|
||||
REAL*8, INTENT(IN) :: y(*) !< the array of y data to write
|
||||
REAL*8, INTENT(IN) :: z(*) !< the array of z data to write
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_data
|
||||
!! See \ref H5Block3dRead3dVectorFieldFloat64
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_read_3dvector_field_r8 ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
REAL*8, INTENT(OUT) :: x(*) !< buffer to read the x data into
|
||||
REAL*8, INTENT(OUT) :: y(*) !< buffer to read the y data into
|
||||
REAL*8, INTENT(OUT) :: z(*) !< buffer to read the z data into
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_data
|
||||
!! See \ref H5Block3dWriteScalarFieldFloat32
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_r4 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
REAL*4, INTENT(IN) :: data(*) !< the array of data
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_data
|
||||
!! See \ref H5Block3dReadScalarFieldFloat32
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_r4 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
REAL*4, INTENT(OUT) :: data(*) !< buffer to read the data into
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_data
|
||||
!! See \ref H5Block3dWrite3dVectorFieldFloat32
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_r4 ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
REAL*4, INTENT(IN) :: x(*) !< the array of x data to write
|
||||
REAL*4, INTENT(IN) :: y(*) !< the array of y data to write
|
||||
REAL*4, INTENT(IN) :: z(*) !< the array of z data to write
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_data
|
||||
!! See \ref H5Block3dRead3dVectorFieldFloat32
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_read_3dvector_field_r4 ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
REAL*4, INTENT(OUT) :: x(*) !< buffer to read the x data into
|
||||
REAL*4, INTENT(OUT) :: y(*) !< buffer to read the y data into
|
||||
REAL*4, INTENT(OUT) :: z(*) !< buffer to read the z data into
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_data
|
||||
!! See \ref H5Block3dWriteScalarFieldInt64
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_i8 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
INTEGER*8, INTENT(IN) :: data(*) !< the array of data
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_data
|
||||
!! See \ref H5Block3dReadScalarFieldInt64
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_i8 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
INTEGER*8, INTENT(OUT) :: data(*) !< buffer to read the data into
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_data
|
||||
!! See \ref H5Block3dWrite3dVectorFieldInt64
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_i8 ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
INTEGER*8, INTENT(IN) :: x(*) !< the array of x data to write
|
||||
INTEGER*8, INTENT(IN) :: y(*) !< the array of y data to write
|
||||
INTEGER*8, INTENT(IN) :: z(*) !< the array of z data to write
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_data
|
||||
!! See \ref H5Block3dRead3dVectorFieldInt64
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_read_3dvector_field_i8 ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
INTEGER*8, INTENT(OUT) :: x(*) !< buffer to read the x data into
|
||||
INTEGER*8, INTENT(OUT) :: y(*) !< buffer to read the y data into
|
||||
INTEGER*8, INTENT(OUT) :: z(*) !< buffer to read the z data into
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_data
|
||||
!! See \ref H5Block3dWriteScalarFieldInt32
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_i4 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
INTEGER*4, INTENT(IN) :: data(*) !< the array of data
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_data
|
||||
!! See \ref H5Block3dReadScalarFieldInt32
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_i4 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
INTEGER*4, INTENT(OUT) :: data(*) !< buffer to read the data into
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_data
|
||||
!! See \ref H5Block3dWrite3dVectorFieldInt32
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_i4 ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
INTEGER*4, INTENT(IN) :: x(*) !< the array of x data to write
|
||||
INTEGER*4, INTENT(IN) :: y(*) !< the array of y data to write
|
||||
INTEGER*4, INTENT(IN) :: z(*) !< the array of z data to write
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_data
|
||||
!! See \ref H5Block3dRead3dVectorFieldInt32
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_3d_read_3dvector_field_i4 ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
INTEGER*4, INTENT(OUT) :: x(*) !< buffer to read the x data into
|
||||
INTEGER*4, INTENT(OUT) :: y(*) !< buffer to read the y data into
|
||||
INTEGER*4, INTENT(OUT) :: z(*) !< buffer to read the z data into
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_attrib
|
||||
!! See \ref H5BlockWriteFieldAttribFloat64
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_writefieldattrib_r8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
|
||||
REAL*8, INTENT(IN) :: attrib_value(*) !< the array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: attrib_nelem !< the number of elements in the array
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_attrib
|
||||
!! See \ref H5BlockWriteFieldAttribFloat32
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_writefieldattrib_r4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
|
||||
REAL*4, INTENT(IN) :: attrib_value(*) !< the array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: attrib_nelem !< the number of elements in the array
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_attrib
|
||||
!! See \ref H5BlockWriteFieldAttribInt64
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_writefieldattrib_i8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
|
||||
INTEGER*8, INTENT(IN) :: attrib_value(*) !< the array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: attrib_nelem !< the number of elements in the array
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5blockf_attrib
|
||||
!! See \ref H5BlockWriteFieldAttribInt32
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_writefieldattrib_i4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
|
||||
INTEGER*4, INTENT(IN) :: attrib_value(*) !< the array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: attrib_nelem !< the number of elements in the array
|
||||
END FUNCTION
|
||||
@@ -0,0 +1,555 @@
|
||||
|
||||
#include "H5Part.h"
|
||||
#include "H5PartPrivate.h"
|
||||
#include "H5Block.h"
|
||||
#include "H5BlockReadWrite.h"
|
||||
#include "Underscore.h"
|
||||
|
||||
#if defined(F77_SINGLE_UNDERSCORE)
|
||||
#define F77NAME(a,b) a
|
||||
#elif defined(F77_CRAY_UNDERSCORE)
|
||||
#define F77NAME(a,b) b
|
||||
#elif defined(F77_NO_UNDERSCORE)
|
||||
#else
|
||||
#error Error, no way to determine how to construct fortran bindings
|
||||
#endif
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_3d_write_scalar_field_r8 F77NAME ( \
|
||||
h5bl_3d_write_scalar_field_r8_, \
|
||||
H5BL_3D_WRITE_SCALAR_FIELD_R8 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_write_scalar_field_r8 (
|
||||
h5part_int64_t *f,
|
||||
const char *field_name,
|
||||
const h5part_float64_t *data,
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dWriteScalarFieldFloat64 (
|
||||
filehandle, field_name2, data );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_3d_read_scalar_field_r8 F77NAME ( \
|
||||
h5bl_3d_read_scalar_field_r8_, \
|
||||
H5BL_3D_READ_SCALAR_FIELD_R8 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_read_scalar_field_r8 (
|
||||
h5part_int64_t *f,
|
||||
const char *field_name,
|
||||
h5part_float64_t *data,
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dWriteScalarFieldFloat64 (
|
||||
filehandle, field_name2, data );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_3d_write_3dvector_field_r8 F77NAME ( \
|
||||
h5bl_3d_write_3dvector_field_r8_, \
|
||||
H5BL_3D_WRITE_3DVECTOR_FIELD_R8 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_write_3dvector_field_r8 (
|
||||
h5part_int64_t *f, /*!< file handle */
|
||||
const char *field_name, /*!< name of the data set */
|
||||
const h5part_float64_t *xval, /*!< array of x component data */
|
||||
const h5part_float64_t *yval, /*!< array of y component data */
|
||||
const h5part_float64_t *zval, /*!< array of z component data */
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dWrite3dVectorFieldFloat64 (
|
||||
filehandle, field_name2, xval, yval, zval );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_3d_read_3dvector_field_r8 F77NAME ( \
|
||||
h5bl_3d_read_3dvector_field_r8_, \
|
||||
H5BL_3D_READ_3DVECTOR_FIELD_R8 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_read_3dvector_field_r8 (
|
||||
h5part_int64_t *f, /*!< file handle */
|
||||
const char *field_name, /*!< name of the data set */
|
||||
h5part_float64_t *xval, /*!< array of x component data */
|
||||
h5part_float64_t *yval, /*!< array of y component data */
|
||||
h5part_float64_t *zval, /*!< array of z component data */
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dRead3dVectorFieldFloat64 (
|
||||
filehandle, field_name2, xval, yval, zval );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_3d_write_scalar_field_r4 F77NAME ( \
|
||||
h5bl_3d_write_scalar_field_r4_, \
|
||||
H5BL_3D_WRITE_SCALAR_FIELD_R4 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_write_scalar_field_r4 (
|
||||
h5part_int64_t *f,
|
||||
const char *field_name,
|
||||
const h5part_float32_t *data,
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dWriteScalarFieldFloat32 (
|
||||
filehandle, field_name2, data );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_3d_read_scalar_field_r4 F77NAME ( \
|
||||
h5bl_3d_read_scalar_field_r4_, \
|
||||
H5BL_3D_READ_SCALAR_FIELD_R4 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_read_scalar_field_r4 (
|
||||
h5part_int64_t *f,
|
||||
const char *field_name,
|
||||
h5part_float32_t *data,
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dWriteScalarFieldFloat32 (
|
||||
filehandle, field_name2, data );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_3d_write_3dvector_field_r4 F77NAME ( \
|
||||
h5bl_3d_write_3dvector_field_r4_, \
|
||||
H5BL_3D_WRITE_3DVECTOR_FIELD_R4 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_write_3dvector_field_r4 (
|
||||
h5part_int64_t *f, /*!< file handle */
|
||||
const char *field_name, /*!< name of the data set */
|
||||
const h5part_float32_t *xval, /*!< array of x component data */
|
||||
const h5part_float32_t *yval, /*!< array of y component data */
|
||||
const h5part_float32_t *zval, /*!< array of z component data */
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dWrite3dVectorFieldFloat32 (
|
||||
filehandle, field_name2, xval, yval, zval );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_3d_read_3dvector_field_r4 F77NAME ( \
|
||||
h5bl_3d_read_3dvector_field_r4_, \
|
||||
H5BL_3D_READ_3DVECTOR_FIELD_R4 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_read_3dvector_field_r4 (
|
||||
h5part_int64_t *f, /*!< file handle */
|
||||
const char *field_name, /*!< name of the data set */
|
||||
h5part_float32_t *xval, /*!< array of x component data */
|
||||
h5part_float32_t *yval, /*!< array of y component data */
|
||||
h5part_float32_t *zval, /*!< array of z component data */
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dRead3dVectorFieldFloat32 (
|
||||
filehandle, field_name2, xval, yval, zval );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_3d_write_scalar_field_i8 F77NAME ( \
|
||||
h5bl_3d_write_scalar_field_i8_, \
|
||||
H5BL_3D_WRITE_SCALAR_FIELD_I8 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_write_scalar_field_i8 (
|
||||
h5part_int64_t *f,
|
||||
const char *field_name,
|
||||
const h5part_int64_t *data,
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dWriteScalarFieldInt64 (
|
||||
filehandle, field_name2, data );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_3d_read_scalar_field_i8 F77NAME ( \
|
||||
h5bl_3d_read_scalar_field_i8_, \
|
||||
H5BL_3D_READ_SCALAR_FIELD_I8 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_read_scalar_field_i8 (
|
||||
h5part_int64_t *f,
|
||||
const char *field_name,
|
||||
h5part_int64_t *data,
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dWriteScalarFieldInt64 (
|
||||
filehandle, field_name2, data );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_3d_write_3dvector_field_i8 F77NAME ( \
|
||||
h5bl_3d_write_3dvector_field_i8_, \
|
||||
H5BL_3D_WRITE_3DVECTOR_FIELD_I8 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_write_3dvector_field_i8 (
|
||||
h5part_int64_t *f, /*!< file handle */
|
||||
const char *field_name, /*!< name of the data set */
|
||||
const h5part_int64_t *xval, /*!< array of x component data */
|
||||
const h5part_int64_t *yval, /*!< array of y component data */
|
||||
const h5part_int64_t *zval, /*!< array of z component data */
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dWrite3dVectorFieldInt64 (
|
||||
filehandle, field_name2, xval, yval, zval );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_3d_read_3dvector_field_i8 F77NAME ( \
|
||||
h5bl_3d_read_3dvector_field_i8_, \
|
||||
H5BL_3D_READ_3DVECTOR_FIELD_I8 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_read_3dvector_field_i8 (
|
||||
h5part_int64_t *f, /*!< file handle */
|
||||
const char *field_name, /*!< name of the data set */
|
||||
h5part_int64_t *xval, /*!< array of x component data */
|
||||
h5part_int64_t *yval, /*!< array of y component data */
|
||||
h5part_int64_t *zval, /*!< array of z component data */
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dRead3dVectorFieldInt64 (
|
||||
filehandle, field_name2, xval, yval, zval );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_3d_write_scalar_field_i4 F77NAME ( \
|
||||
h5bl_3d_write_scalar_field_i4_, \
|
||||
H5BL_3D_WRITE_SCALAR_FIELD_I4 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_write_scalar_field_i4 (
|
||||
h5part_int64_t *f,
|
||||
const char *field_name,
|
||||
const h5part_int32_t *data,
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dWriteScalarFieldInt32 (
|
||||
filehandle, field_name2, data );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_3d_read_scalar_field_i4 F77NAME ( \
|
||||
h5bl_3d_read_scalar_field_i4_, \
|
||||
H5BL_3D_READ_SCALAR_FIELD_I4 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_read_scalar_field_i4 (
|
||||
h5part_int64_t *f,
|
||||
const char *field_name,
|
||||
h5part_int32_t *data,
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dWriteScalarFieldInt32 (
|
||||
filehandle, field_name2, data );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_3d_write_3dvector_field_i4 F77NAME ( \
|
||||
h5bl_3d_write_3dvector_field_i4_, \
|
||||
H5BL_3D_WRITE_3DVECTOR_FIELD_I4 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_write_3dvector_field_i4 (
|
||||
h5part_int64_t *f, /*!< file handle */
|
||||
const char *field_name, /*!< name of the data set */
|
||||
const h5part_int32_t *xval, /*!< array of x component data */
|
||||
const h5part_int32_t *yval, /*!< array of y component data */
|
||||
const h5part_int32_t *zval, /*!< array of z component data */
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dWrite3dVectorFieldInt32 (
|
||||
filehandle, field_name2, xval, yval, zval );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_3d_read_3dvector_field_i4 F77NAME ( \
|
||||
h5bl_3d_read_3dvector_field_i4_, \
|
||||
H5BL_3D_READ_3DVECTOR_FIELD_I4 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_3d_read_3dvector_field_i4 (
|
||||
h5part_int64_t *f, /*!< file handle */
|
||||
const char *field_name, /*!< name of the data set */
|
||||
h5part_int32_t *xval, /*!< array of x component data */
|
||||
h5part_int32_t *yval, /*!< array of y component data */
|
||||
h5part_int32_t *zval, /*!< array of z component data */
|
||||
const int l_field_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
|
||||
h5part_int64_t herr = H5Block3dRead3dVectorFieldInt32 (
|
||||
filehandle, field_name2, xval, yval, zval );
|
||||
|
||||
free ( field_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_writefieldattrib_r8 F77NAME ( \
|
||||
h5bl_writefieldattrib_r8_, \
|
||||
H5BL_WRITEFIELDATTRIB_R8 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_writefieldattrib_r8 (
|
||||
h5part_int64_t *f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
const h5part_float64_t *attrib_value,
|
||||
const h5part_int64_t *attrib_nelem,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
char *attrib_name2 =_H5Part_strdupfor2c ( attrib_name, l_attrib_name );
|
||||
|
||||
h5part_int64_t herr = H5BlockWriteFieldAttribFloat64 (
|
||||
filehandle, field_name2, attrib_name2,
|
||||
attrib_value, *attrib_nelem );
|
||||
|
||||
free ( field_name2 );
|
||||
free ( attrib_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_writefieldattrib_r4 F77NAME ( \
|
||||
h5bl_writefieldattrib_r4_, \
|
||||
H5BL_WRITEFIELDATTRIB_R4 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_writefieldattrib_r4 (
|
||||
h5part_int64_t *f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
const h5part_float32_t *attrib_value,
|
||||
const h5part_int64_t *attrib_nelem,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
char *attrib_name2 =_H5Part_strdupfor2c ( attrib_name, l_attrib_name );
|
||||
|
||||
h5part_int64_t herr = H5BlockWriteFieldAttribFloat32 (
|
||||
filehandle, field_name2, attrib_name2,
|
||||
attrib_value, *attrib_nelem );
|
||||
|
||||
free ( field_name2 );
|
||||
free ( attrib_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_writefieldattrib_i8 F77NAME ( \
|
||||
h5bl_writefieldattrib_i8_, \
|
||||
H5BL_WRITEFIELDATTRIB_I8 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_writefieldattrib_i8 (
|
||||
h5part_int64_t *f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
const h5part_int64_t *attrib_value,
|
||||
const h5part_int64_t *attrib_nelem,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
char *attrib_name2 =_H5Part_strdupfor2c ( attrib_name, l_attrib_name );
|
||||
|
||||
h5part_int64_t herr = H5BlockWriteFieldAttribInt64 (
|
||||
filehandle, field_name2, attrib_name2,
|
||||
attrib_value, *attrib_nelem );
|
||||
|
||||
free ( field_name2 );
|
||||
free ( attrib_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_writefieldattrib_i4 F77NAME ( \
|
||||
h5bl_writefieldattrib_i4_, \
|
||||
H5BL_WRITEFIELDATTRIB_I4 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5bl_writefieldattrib_i4 (
|
||||
h5part_int64_t *f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
const h5part_int32_t *attrib_value,
|
||||
const h5part_int64_t *attrib_nelem,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
|
||||
char *attrib_name2 =_H5Part_strdupfor2c ( attrib_name, l_attrib_name );
|
||||
|
||||
h5part_int64_t herr = H5BlockWriteFieldAttribInt32 (
|
||||
filehandle, field_name2, attrib_name2,
|
||||
attrib_value, *attrib_nelem );
|
||||
|
||||
free ( field_name2 );
|
||||
free ( attrib_name2 );
|
||||
return herr;
|
||||
}
|
||||
@@ -0,0 +1,247 @@
|
||||
#include <string.h>
|
||||
#include <hdf5.h>
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "Underscore.h"
|
||||
|
||||
#if defined(F77_SINGLE_UNDERSCORE)
|
||||
#define F77NAME(a,b) a
|
||||
#elif defined(F77_CRAY_UNDERSCORE)
|
||||
#define F77NAME(a,b) b
|
||||
#elif defined(F77_NO_UNDERSCORE)
|
||||
#else
|
||||
#error Error, no way to determine how to construct fortran bindings
|
||||
#endif
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
|
||||
#define h5_openr F77NAME ( \
|
||||
h5_openr_, \
|
||||
H5_OPENR )
|
||||
#define h5_openw F77NAME ( \
|
||||
h5_openw_, \
|
||||
H5_OPENW )
|
||||
#define h5_opena F77NAME ( \
|
||||
h5_opena_, \
|
||||
H5_OPENA )
|
||||
#define h5_openr_par F77NAME ( \
|
||||
h5_openr_par_, \
|
||||
H5_OPENR_PAR )
|
||||
#define h5_openw_par F77NAME ( \
|
||||
h5_openw_par_, \
|
||||
H5_OPENW_PAR )
|
||||
#define h5_opena_par F77NAME ( \
|
||||
h5_opena_par_, \
|
||||
H5_OPENA_PAR )
|
||||
#define h5_close F77NAME ( \
|
||||
h5_close_, \
|
||||
H5_CLOSE)
|
||||
#define h5_check F77NAME ( \
|
||||
h5_check_, \
|
||||
H5_CHECK)
|
||||
#define h5_setstep F77NAME ( \
|
||||
h5_setstep_, \
|
||||
H5_SETSTEP )
|
||||
#define h5_getnsteps F77NAME ( \
|
||||
h5_getnsteps_, \
|
||||
H5_GETNSTEPS )
|
||||
#define h5_set_verbosity_level F77NAME ( \
|
||||
h5_set_verbosity_level_, \
|
||||
H5_SET_VERBOSITY_LEVEL )
|
||||
|
||||
#endif
|
||||
|
||||
static char *
|
||||
_H5Part_strdupfor2c (
|
||||
const char *s,
|
||||
const ssize_t len
|
||||
) {
|
||||
|
||||
char *dup = (char*)malloc ( len + 1 );
|
||||
strncpy ( dup, s, len );
|
||||
char *p = dup + len;
|
||||
do {
|
||||
*p-- = '\0';
|
||||
} while ( *p == ' ' );
|
||||
return dup;
|
||||
}
|
||||
|
||||
static char *
|
||||
_H5Part_strc2for (
|
||||
char * const str,
|
||||
const ssize_t l_str
|
||||
) {
|
||||
|
||||
size_t len = strlen ( str );
|
||||
memset ( str+len, ' ', l_str-len );
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
static h5_int32_t
|
||||
_H5Part_flagsfor2c (
|
||||
char * flags
|
||||
) {
|
||||
|
||||
h5_int32_t fbits = 0x00;
|
||||
|
||||
flags = strtok ( flags, "," );
|
||||
while ( flags != NULL ) {
|
||||
if ( strcmp ( flags, "vfd_mpiposix" ) == 0 )
|
||||
fbits |= H5_VFD_MPIPOSIX;
|
||||
else if ( strcmp ( flags, "vfd_independent" ) == 0 )
|
||||
fbits |= H5_VFD_INDEPENDENT;
|
||||
flags = strtok ( NULL, "," );
|
||||
}
|
||||
|
||||
return fbits;
|
||||
}
|
||||
|
||||
/* open/close interface */
|
||||
h5_int64_t
|
||||
h5_openr (
|
||||
const char *file_name,
|
||||
const int l_file_name
|
||||
) {
|
||||
|
||||
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
|
||||
|
||||
h5_file_t* f = H5OpenFile ( file_name2, H5_O_RDONLY, 0 );
|
||||
|
||||
free ( file_name2 );
|
||||
return (h5_int64_t)(size_t)f;
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
h5_openw (
|
||||
const char *file_name,
|
||||
const int l_file_name
|
||||
) {
|
||||
|
||||
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
|
||||
|
||||
h5_file_t* f = H5OpenFile ( file_name2, H5_O_WRONLY, 0 );
|
||||
|
||||
free ( file_name2 );
|
||||
return (h5_int64_t)(size_t)f;
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
h5pt_opena (
|
||||
const char *file_name,
|
||||
const int l_file_name
|
||||
) {
|
||||
|
||||
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
|
||||
|
||||
h5_file_t* f = H5OpenFile ( file_name2, H5_O_APPEND, 0 );
|
||||
|
||||
free ( file_name2 );
|
||||
return (h5_int64_t)(size_t)f;
|
||||
}
|
||||
|
||||
#ifdef PARALLEL_IO
|
||||
h5_int64_t
|
||||
h5_openr_par (
|
||||
const char *file_name,
|
||||
MPI_Fint *fcomm,
|
||||
const char *flags,
|
||||
const int l_file_name,
|
||||
const int l_flags
|
||||
) {
|
||||
|
||||
MPI_Comm ccomm = MPI_Comm_f2c (*fcomm);
|
||||
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
|
||||
char *flags2 = _H5Part_strdupfor2c ( flags, l_flags );
|
||||
|
||||
h5_int32_t fbits = H5_O_RDONLY | _H5Part_flagsfor2c ( flags2 );
|
||||
|
||||
h5_file_t* f = H5OpenFile ( file_name2, ccomm, fbits );
|
||||
|
||||
free ( file_name2 );
|
||||
free ( flags2 );
|
||||
return (h5_int64_t)(size_t)f;
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
h5_openw_par (
|
||||
const char *file_name,
|
||||
MPI_Fint *fcomm,
|
||||
const char *flags,
|
||||
const int l_file_name,
|
||||
const int l_flags
|
||||
) {
|
||||
|
||||
MPI_Comm ccomm = MPI_Comm_f2c (*fcomm);
|
||||
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
|
||||
char *flags2 = _H5Part_strdupfor2c ( flags, l_flags );
|
||||
|
||||
h5_int32_t fbits = H5_O_WRONLY | _H5Part_flagsfor2c ( flags2 );
|
||||
|
||||
h5_file_t* f = H5OpenFile ( file_name2, fbits, ccomm );
|
||||
|
||||
free ( file_name2 );
|
||||
free ( flags2 );
|
||||
return (h5_int64_t)(size_t)f;
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
h5pt_opena_par_align (
|
||||
const char *file_name,
|
||||
MPI_Fint *fcomm,
|
||||
const h5_int64_t *align,
|
||||
const char *flags,
|
||||
const int l_file_name,
|
||||
const int l_flags
|
||||
) {
|
||||
|
||||
MPI_Comm ccomm = MPI_Comm_f2c (*fcomm);
|
||||
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
|
||||
char *flags2 = _H5Part_strdupfor2c ( flags, l_flags );
|
||||
|
||||
h5_int32_t fbits = H5_O_APPEND | _H5Part_flagsfor2c ( flags2 );
|
||||
|
||||
h5_file_t* f = H5OpenFile( file_name2, fbits, ccomm );
|
||||
|
||||
free ( file_name2 );
|
||||
free ( flags2 );
|
||||
return (h5_int64_t)(size_t)f;
|
||||
}
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5_close (
|
||||
const h5_int64_t *f
|
||||
) {
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5CloseFile ( filehandle );
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
h5_setstep (
|
||||
const h5_int64_t *f,
|
||||
h5_int64_t *step ) {
|
||||
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5SetStep ( filehandle, (*step)-1 );
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
h5_getnsteps (
|
||||
const h5_int64_t *f
|
||||
) {
|
||||
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5GetNumSteps ( filehandle );
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
h5_set_verbosity_level (
|
||||
const h5_int64_t *level
|
||||
) {
|
||||
return H5SetVerbosityLevel ( *level );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,469 @@
|
||||
! Declaration of subroutines for Fortran Bindings
|
||||
|
||||
!> \defgroup h5part_f90_api H5Part F90 API
|
||||
|
||||
!> \ingroup h5part_f90_api
|
||||
!! \defgroup h5partf_open File Opening and Closing
|
||||
!<
|
||||
|
||||
!> \ingroup h5part_f90_api
|
||||
!! \defgroup h5partf_model Setting up the Data Model
|
||||
!<
|
||||
|
||||
!> \ingroup h5part_f90_api
|
||||
!! \defgroup h5partf_data Reading and Writing Datasets
|
||||
!<
|
||||
|
||||
!> \ingroup h5part_f90_api
|
||||
!! \defgroup h5partf_attrib Reading and Writing Attributes
|
||||
!<
|
||||
|
||||
|
||||
!!!!!!!! File Opening and Closing !!!!!!!!
|
||||
|
||||
!> \ingroup h5partf_open
|
||||
!! Opens a file for reading. See \ref H5PartOpenFile
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_openr ( filename )
|
||||
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for reading
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_open
|
||||
!! Opens a file for writing in truncate mode. See \ref H5PartOpenFile
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_openw ( filename )
|
||||
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for writing
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_open
|
||||
!! Opens a file for writing in append mode. See \ref H5PartOpenFile
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_opena ( filename )
|
||||
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for appending
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_open
|
||||
!! Opens a parallel file for reading.
|
||||
!! See \ref H5PartOpenFileParallel
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_openr_par ( filename, mpi_communicator )
|
||||
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for reading
|
||||
INTEGER, INTENT(IN) :: mpi_communicator !< the MPI communicator used by the program
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_open
|
||||
!! Opens a parallel file for writing in truncate mode.
|
||||
!! See \ref H5PartOpenFileParallel
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_openw_par ( filename, mpi_communicator )
|
||||
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for writing
|
||||
INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_open
|
||||
!! Opens a parallel file for writing in append mode.
|
||||
!! See \ref H5PartOpenFileParallel
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_opena_par ( filename, mpi_communicator )
|
||||
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for appending
|
||||
INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_open
|
||||
!! Opens a file for reading and specifies an HDF5 alignment.
|
||||
!! See \ref H5PartOpenFileAlign
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_openr_align ( filename, align )
|
||||
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for reading
|
||||
INTEGER*8, INTENT(IN) :: align !< alignment value in bytes
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_open
|
||||
!! Opens a file for writing in truncate mode and specifies an HDF5 alignment.
|
||||
!! See \ref H5PartOpenFileAlign
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_openw_align ( filename, align )
|
||||
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for writing
|
||||
INTEGER*8, INTENT(IN) :: align !< alignment value in bytes
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_open
|
||||
!! Opens a file for writing in append mode and specifies an HDF5 alignment.
|
||||
!! See \ref H5PartOpenFileAlign
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_opena_align ( filename, align )
|
||||
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for appending
|
||||
INTEGER*8, INTENT(IN) :: align !< alignment value in bytes
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_open
|
||||
!! Opens a parallel file for reading and specifies an HDF5 alignment.
|
||||
!! See \ref H5PartOpenFileParallelAlign
|
||||
!!
|
||||
!! Flags are specified as a comma separated string that can include:
|
||||
!!
|
||||
!! - \c fs_lustre - enable optimizations for the Lustre file system
|
||||
!! - \c vfd_mpiposix - use the HDF5 MPI-POSIX virtual file driver
|
||||
!! - \c vfd_mpio_ind - use MPI-IO in indepedent mode
|
||||
!!
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_openr_par_align ( filename, mpi_communicator, align )
|
||||
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for reading
|
||||
INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program
|
||||
INTEGER*8, INTENT(IN) :: align !< alignment value in bytes
|
||||
CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_open
|
||||
!! Opens a parallel file for writing in truncate mode and specifies
|
||||
!! an HDF5 alignment.
|
||||
!!
|
||||
!! Flags are specified as a comma separated string that can include:
|
||||
!!
|
||||
!! - \c fs_lustre - enable optimizations for the Lustre file system
|
||||
!! - \c vfd_mpiposix - use the HDF5 MPI-POSIX virtual file driver
|
||||
!! - \c vfd_mpio_ind - use MPI-IO in indepedent mode
|
||||
!!
|
||||
!! See \ref H5PartOpenFileParallelAlign
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_openw_par_align ( filename, mpi_communicator, align, flags )
|
||||
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for writing
|
||||
INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program
|
||||
INTEGER*8, INTENT(IN) :: align !< alignment value in bytes
|
||||
CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_open
|
||||
!! Opens a parallel file for writing in append mode and specifies
|
||||
!! an HDF5 alignment.
|
||||
!!
|
||||
!! Flags are specified as a comma separated string that can include:
|
||||
!!
|
||||
!! - \c fs_lustre - enable optimizations for the Lustre file system
|
||||
!! - \c vfd_mpiposix - use the HDF5 MPI-POSIX virtual file driver
|
||||
!! - \c vfd_mpio_ind - use MPI-IO in indepedent mode
|
||||
!!
|
||||
!! See \ref H5PartOpenFileParallelAlign
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_opena_par_align ( filename, mpi_communicator, align, flags )
|
||||
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for appending
|
||||
INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program
|
||||
INTEGER*8, INTENT(IN) :: align !< alignment value in bytes
|
||||
CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_open
|
||||
!! Closes a file. See \ref H5PartCloseFile
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_close ( filehandle )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_open
|
||||
!! See \ref H5PartSetVerbosityLevel
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_set_verbosity_level ( level )
|
||||
INTEGER*8, INTENT(IN) :: level !< the level from 0 (no output) to 5 (most detailed)
|
||||
END FUNCTION
|
||||
|
||||
|
||||
!!!!!!!! Setting up the Data Model !!!!!!!!
|
||||
|
||||
!> \ingroup h5partf_model
|
||||
!! See \ref H5PartSetNumParticles
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_setnpoints ( filehandle, npoints )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
INTEGER*8, INTENT(IN) :: npoints !< the number of particles on *this* processor
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_model
|
||||
!! See \ref H5PartSetNumParticlesStrided
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_setnpoints_strided ( filehandle, npoints, stride )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
INTEGER*8, INTENT(IN) :: npoints !< the number of particles on *this* processor
|
||||
INTEGER*8, INTENT(IN) :: stride !< the stride value (e.g. the number of fields in the particle data array)
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_model
|
||||
!! See \ref H5PartSetStep
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_setstep (filehandle,step)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
INTEGER*8, INTENT(IN) :: step !< a timestep value >= 1
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_model
|
||||
!! See \ref H5PartGetNumSteps
|
||||
!! \return the number of steps or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_getnsteps (filehandle)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_model
|
||||
!! See \ref H5PartGetNumDatasets
|
||||
!! \return the number of datasets or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_getndatasets (filehandle)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_model
|
||||
!! See \ref H5PartGetNumParticles
|
||||
!! \return the number of particles or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_getnpoints (filehandle)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_model
|
||||
!! See \ref H5PartGetDatasetName
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_getdatasetname (filehandle,index,name)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
INTEGER*8, INTENT(IN) :: index !< index of dataset to query (starting from 0)
|
||||
CHARACTER(LEN=*), INTENT(OUT) :: name !< buffer to read the dataset name into
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_model
|
||||
!! See \ref H5PartSetView
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_setview (filehandle,start,end)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
INTEGER*8, INTENT(IN) :: start !< offset of the first particle in the view
|
||||
INTEGER*8, INTENT(IN) :: end !< offset of the last particle in the view (inclusive)
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_model
|
||||
!! See \ref H5PartSetViewIndices
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_setview_indices (filehandle,indices,nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
INTEGER*8, INTENT(IN) :: indices(*) !< list of indicies to select in this view
|
||||
INTEGER*8, INTENT(IN) :: nelem !< number of particles in the list
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_model
|
||||
!! See \ref H5PartSetViewEmpty
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_setview_empty (filehandle)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_model
|
||||
!! See \ref H5PartResetView
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_resetview (filehandle)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_model
|
||||
!! See \ref H5PartResetView
|
||||
!! \return 1 if true, 0 if false, or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_hasview (filehandle)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_model
|
||||
!! See \ref H5PartGetView
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_getview (filehandle,start,end)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
INTEGER*8, INTENT(OUT) :: start !< buffer to store the offset of the first particle in the view
|
||||
INTEGER*8, INTENT(OUT) :: end !< buffer to store the offset of the last particle in the view (inclusive)
|
||||
END FUNCTION
|
||||
|
||||
|
||||
!!!!!!!! Reading and Writing Datasets !!!!!!!!
|
||||
|
||||
!> \ingroup h5partf_data
|
||||
!! See \ref H5PartWriteDataFloat64
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_writedata_r8 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
REAL*8, INTENT(IN) :: data(*) !< the array of float64 data to write
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_data
|
||||
!! See \ref H5PartWriteDataFloat32
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_writedata_r4 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
REAL, INTENT(IN) :: data(*) !< the array of float32 data to write
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_data
|
||||
!! See \ref H5PartWriteDataInt64
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_writedata_i8 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
INTEGER*8, INTENT(IN) :: data(*) !< the array of int64 data to write
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_data
|
||||
!! See \ref H5PartWriteDataInt32
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_writedata_i4 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
INTEGER, INTENT(IN) :: data(*) !< the array of int32 data to write
|
||||
END FUNCTION
|
||||
|
||||
|
||||
!> \ingroup h5partf_data
|
||||
!! See \ref H5PartReadDataFloat64
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_readdata_r8 (filehandle,name,data)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
REAL*8, INTENT(OUT) :: data(*) !< array to read float64 data into
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_data
|
||||
!! See \ref H5PartReadDataFloat32
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_readdata_r4 (filehandle,name,data)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
REAL, INTENT(OUT) :: data(*) !< array to read float32 data into
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_data
|
||||
!! See \ref H5PartReadDataInt64
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_readdata_i8 (filehandle,name,data)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
INTEGER*8, INTENT(OUT) :: data(*) !< array to read int64 data into
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_data
|
||||
!! See \ref H5PartReadDataInt32
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_readdata_i4 (filehandle,name,data)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
INTEGER, INTENT(OUT) :: data(*) !< array to read int32 data into
|
||||
END FUNCTION
|
||||
|
||||
|
||||
!!!!!!!! Reading and Writing Attributes !!!!!!!!
|
||||
|
||||
!> \ingroup h5partf_attrib
|
||||
!! See \ref H5PartWriteFileAttribString
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_writefileattrib_string (filehandle,attrib_name,attrib_value)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
CHARACTER(LEN=*), INTENT(IN) :: value !< the string value to store
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_attrib
|
||||
!! See \ref H5PartWriteStepAttribString
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_writestepattrib_string (filehandle,attrib_name,attrib_value)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
CHARACTER(LEN=*), INTENT(IN) :: value !< the string value to store
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_attrib
|
||||
!! Reads the attribute \c name in the file root ("/")
|
||||
!! into the string buffer \c value.
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_readfileattrib_string (filehandle,attrib_name,attrib_value)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
CHARACTER(LEN=*), INTENT(OUT) :: value !< buffer to read the string value into
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_attrib
|
||||
!! Reads the attribute \c name in the current step
|
||||
!! into the string buffer \c value.
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_readstepattrib_string (filehandle,attrib_name,attrib_value)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
CHARACTER(LEN=*), INTENT(OUT) :: value !< buffer to read the string value into
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_attrib
|
||||
!! See \ref H5PartGetNumStepAttribs
|
||||
!! \return number of attributes or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_getnstepattribs (filehandle)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_attrib
|
||||
!! See \ref H5PartGetNumFileAttribs
|
||||
!! \return number of attributes or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_getnfileattribs (filehandle)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_attrib
|
||||
!! See \ref H5PartGetStepAttribInfo
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_getstepattribinfo (filehandle,idx,attrib_name,attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
INTEGER*8, INTENT(IN) :: index !< index of the attribute to query (starting from 0)
|
||||
CHARACTER(LEN=*), INTENT(OUT) :: name !< buffer to read the attribute name into
|
||||
INTEGER*8, INTENT(OUT) :: nelem !< number of elements in the attribute's array
|
||||
END FUNCTION
|
||||
|
||||
!> \ingroup h5partf_attrib
|
||||
!! See \ref H5PartGetFileAttribInfo
|
||||
!! \return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5pt_getfileattribinfo (filehandle,idx,attrib_name,attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
|
||||
INTEGER*8, INTENT(IN) :: index !< index of the attribute to query (starting from 0)
|
||||
CHARACTER(LEN=*), INTENT(OUT) :: name !< buffer to read the attribute name into
|
||||
INTEGER*8, INTENT(OUT) :: nelem !< number of elements in the attribute's array
|
||||
END FUNCTION
|
||||
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
|
||||
!< \ingroup h5partf_attrib
|
||||
!! See \ref H5PartWritefileAttribFloat64
|
||||
!! \return 0 on success or error code
|
||||
!>
|
||||
INTEGER*8 FUNCTION h5pt_writefileattrib_r8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
REAL*8, INTENT(IN) :: data(*) !< the array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array
|
||||
END FUNCTION
|
||||
|
||||
!< \ingroup h5partf_attrib
|
||||
!! Read the attribute \c name into the buffer \c data.
|
||||
!! \return 0 on success or error code
|
||||
!>
|
||||
INTEGER*8 FUNCTION h5pt_readfileattrib_r8 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
REAL*8, INTENT(OUT) :: data(*) !< buffer to read value into
|
||||
END FUNCTION
|
||||
|
||||
!< \ingroup h5partf_attrib
|
||||
!! See \ref H5PartWritefileAttribFloat32
|
||||
!! \return 0 on success or error code
|
||||
!>
|
||||
INTEGER*8 FUNCTION h5pt_writefileattrib_r4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
REAL*4, INTENT(IN) :: data(*) !< the array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array
|
||||
END FUNCTION
|
||||
|
||||
!< \ingroup h5partf_attrib
|
||||
!! Read the attribute \c name into the buffer \c data.
|
||||
!! \return 0 on success or error code
|
||||
!>
|
||||
INTEGER*8 FUNCTION h5pt_readfileattrib_r4 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
REAL*4, INTENT(OUT) :: data(*) !< buffer to read value into
|
||||
END FUNCTION
|
||||
|
||||
!< \ingroup h5partf_attrib
|
||||
!! See \ref H5PartWritefileAttribInt64
|
||||
!! \return 0 on success or error code
|
||||
!>
|
||||
INTEGER*8 FUNCTION h5pt_writefileattrib_i8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
INTEGER*8, INTENT(IN) :: data(*) !< the array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array
|
||||
END FUNCTION
|
||||
|
||||
!< \ingroup h5partf_attrib
|
||||
!! Read the attribute \c name into the buffer \c data.
|
||||
!! \return 0 on success or error code
|
||||
!>
|
||||
INTEGER*8 FUNCTION h5pt_readfileattrib_i8 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
INTEGER*8, INTENT(OUT) :: data(*) !< buffer to read value into
|
||||
END FUNCTION
|
||||
|
||||
!< \ingroup h5partf_attrib
|
||||
!! See \ref H5PartWritefileAttribInt32
|
||||
!! \return 0 on success or error code
|
||||
!>
|
||||
INTEGER*8 FUNCTION h5pt_writefileattrib_i4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
INTEGER*4, INTENT(IN) :: data(*) !< the array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array
|
||||
END FUNCTION
|
||||
|
||||
!< \ingroup h5partf_attrib
|
||||
!! Read the attribute \c name into the buffer \c data.
|
||||
!! \return 0 on success or error code
|
||||
!>
|
||||
INTEGER*8 FUNCTION h5pt_readfileattrib_i4 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
INTEGER*4, INTENT(OUT) :: data(*) !< buffer to read value into
|
||||
END FUNCTION
|
||||
|
||||
!< \ingroup h5partf_attrib
|
||||
!! See \ref H5PartWritestepAttribFloat64
|
||||
!! \return 0 on success or error code
|
||||
!>
|
||||
INTEGER*8 FUNCTION h5pt_writestepattrib_r8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
REAL*8, INTENT(IN) :: data(*) !< the array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array
|
||||
END FUNCTION
|
||||
|
||||
!< \ingroup h5partf_attrib
|
||||
!! Read the attribute \c name into the buffer \c data.
|
||||
!! \return 0 on success or error code
|
||||
!>
|
||||
INTEGER*8 FUNCTION h5pt_readstepattrib_r8 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
REAL*8, INTENT(OUT) :: data(*) !< buffer to read value into
|
||||
END FUNCTION
|
||||
|
||||
!< \ingroup h5partf_attrib
|
||||
!! See \ref H5PartWritestepAttribFloat32
|
||||
!! \return 0 on success or error code
|
||||
!>
|
||||
INTEGER*8 FUNCTION h5pt_writestepattrib_r4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
REAL*4, INTENT(IN) :: data(*) !< the array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array
|
||||
END FUNCTION
|
||||
|
||||
!< \ingroup h5partf_attrib
|
||||
!! Read the attribute \c name into the buffer \c data.
|
||||
!! \return 0 on success or error code
|
||||
!>
|
||||
INTEGER*8 FUNCTION h5pt_readstepattrib_r4 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
REAL*4, INTENT(OUT) :: data(*) !< buffer to read value into
|
||||
END FUNCTION
|
||||
|
||||
!< \ingroup h5partf_attrib
|
||||
!! See \ref H5PartWritestepAttribInt64
|
||||
!! \return 0 on success or error code
|
||||
!>
|
||||
INTEGER*8 FUNCTION h5pt_writestepattrib_i8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
INTEGER*8, INTENT(IN) :: data(*) !< the array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array
|
||||
END FUNCTION
|
||||
|
||||
!< \ingroup h5partf_attrib
|
||||
!! Read the attribute \c name into the buffer \c data.
|
||||
!! \return 0 on success or error code
|
||||
!>
|
||||
INTEGER*8 FUNCTION h5pt_readstepattrib_i8 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
INTEGER*8, INTENT(OUT) :: data(*) !< buffer to read value into
|
||||
END FUNCTION
|
||||
|
||||
!< \ingroup h5partf_attrib
|
||||
!! See \ref H5PartWritestepAttribInt32
|
||||
!! \return 0 on success or error code
|
||||
!>
|
||||
INTEGER*8 FUNCTION h5pt_writestepattrib_i4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
INTEGER*4, INTENT(IN) :: data(*) !< the array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array
|
||||
END FUNCTION
|
||||
|
||||
!< \ingroup h5partf_attrib
|
||||
!! Read the attribute \c name into the buffer \c data.
|
||||
!! \return 0 on success or error code
|
||||
!>
|
||||
INTEGER*8 FUNCTION h5pt_readstepattrib_i4 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
|
||||
INTEGER*4, INTENT(OUT) :: data(*) !< buffer to read value into
|
||||
END FUNCTION
|
||||
@@ -0,0 +1,600 @@
|
||||
#include "H5hut.h"
|
||||
#include "Underscore.h"
|
||||
|
||||
#if defined(F77_SINGLE_UNDERSCORE)
|
||||
#define F77NAME(a,b) a
|
||||
#elif defined(F77_CRAY_UNDERSCORE)
|
||||
#define F77NAME(a,b) b
|
||||
#elif defined(F77_NO_UNDERSCORE)
|
||||
#else
|
||||
#error Error, no way to determine how to construct fortran bindings
|
||||
#endif
|
||||
|
||||
/* Writing attributes */
|
||||
#define h5_writefileattrib_string F77NAME ( \
|
||||
h5pt_writefileattrib_string_, \
|
||||
H5PT_writefileattrib_string )
|
||||
#define h5_writestepattrib_string F77NAME ( \
|
||||
h5pt_writestepattrib_string_, \
|
||||
H5PT_WRITESTEPATTRIB_STRING )
|
||||
|
||||
h5_int64_t
|
||||
h5pt_writefileattrib_string (
|
||||
const h5_int64_t *f,
|
||||
const char *attrib_name,
|
||||
const char *attrib_value,
|
||||
const int l_attrib_name,
|
||||
const int l_attrib_value
|
||||
) {
|
||||
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
char *attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name);
|
||||
char *attrib_value2= _H5Part_strdupfor2c (attrib_value,l_attrib_value);
|
||||
|
||||
h5_int64_t herr = H5PartWriteFileAttribString (
|
||||
filehandle, attrib_name2, attrib_value2 );
|
||||
|
||||
free ( attrib_name2 );
|
||||
free ( attrib_value2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
h5pt_writestepattrib_string (
|
||||
const h5_int64_t *f,
|
||||
const char *attrib_name,
|
||||
const char *attrib_value,
|
||||
const int l_attrib_name,
|
||||
const int l_attrib_value
|
||||
) {
|
||||
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
char *attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name);
|
||||
char *attrib_value2= _H5Part_strdupfor2c (attrib_value,l_attrib_value);
|
||||
|
||||
h5_int64_t herr = H5PartWriteStepAttribString (
|
||||
filehandle, attrib_name2, attrib_value2 );
|
||||
|
||||
free ( attrib_name2 );
|
||||
free ( attrib_value2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Reading attributes */
|
||||
#define h5pt_getnstepattribs F77NAME ( \
|
||||
h5pt_getnstepattribs_, \
|
||||
H5PT_GETNSTEPATTRIBS )
|
||||
#define h5pt_getnfileattribs F77NAME ( \
|
||||
h5pt_getnfileattribs_, \
|
||||
H5PT_GETNFILEATTRIBS )
|
||||
#define h5pt_getstepattribinfo F77NAME ( \
|
||||
h5pt_getstepattribinfo_, \
|
||||
H5PT_GETSTEPATTRIBINFO )
|
||||
#define h5pt_getfileattribinfo F77NAME ( \
|
||||
h5pt_getfileattribinfo_, \
|
||||
H5PT_GETFILEATTRIBINFO )
|
||||
#define h5pt_readstepattrib_string F77NAME ( \
|
||||
h5pt_readstepattrib_string_, \
|
||||
H5PT_READSTEPATTRIB_STRING )
|
||||
#define h5pt_readfileattrib_string F77NAME ( \
|
||||
h5pt_readfileattrib_string_, \
|
||||
H5PT_READFILEATTRIB_STRING )
|
||||
|
||||
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5pt_writefileattrib_r8 F77NAME ( \
|
||||
h5pt_writefileattrib_r8_, \
|
||||
H5PT_WRITEFILEATTRIB_R8 )
|
||||
#endif
|
||||
|
||||
h5_int64_t
|
||||
h5pt_readstepattrib_string (
|
||||
const h5_int64_t *f,
|
||||
const char *attrib_name,
|
||||
char *attrib_value,
|
||||
const int l_attrib_name,
|
||||
const int l_attrib_value
|
||||
) {
|
||||
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
char * attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name);
|
||||
|
||||
h5_int64_t herr = H5PartReadStepAttrib (
|
||||
filehandle, attrib_name2, attrib_value );
|
||||
|
||||
_H5Part_strc2for ( attrib_value, l_attrib_value );
|
||||
|
||||
free ( attrib_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
h5pt_readfileattrib_string (
|
||||
const h5_int64_t *f,
|
||||
const char *attrib_name,
|
||||
char *attrib_value,
|
||||
const int l_attrib_name,
|
||||
const int l_attrib_value
|
||||
) {
|
||||
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
char * attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name);
|
||||
|
||||
h5_int64_t herr = H5PartReadFileAttrib (
|
||||
filehandle, attrib_name2, attrib_value );
|
||||
|
||||
_H5Part_strc2for ( attrib_value, l_attrib_value );
|
||||
|
||||
free ( attrib_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_writefileattrib_r8 (
|
||||
h5part_int64_t *f,
|
||||
const char *name,
|
||||
const h5part_float64_t *data,
|
||||
const h5part_float64_t *nelem,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *name2 =_H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartWriteFileAttrib (
|
||||
filehandle, name2, H5PART_FLOAT64, data, *nelem);
|
||||
|
||||
free ( name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5pt_writefileattrib_r8 F77NAME ( \
|
||||
h5pt_writefileattrib_r8_, \
|
||||
H5PT_WRITEFILEATTRIB_R8 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_readfileattrib_r8 (
|
||||
h5part_int64_t *f,
|
||||
const char *name,
|
||||
const h5part_float64_t *data,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *name2 =_H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartReadFileAttrib (
|
||||
filehandle, name2, (void*)data);
|
||||
|
||||
free ( name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5pt_writefileattrib_r4 F77NAME ( \
|
||||
h5pt_writefileattrib_r4_, \
|
||||
H5PT_WRITEFILEATTRIB_R4 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_writefileattrib_r4 (
|
||||
h5part_int64_t *f,
|
||||
const char *name,
|
||||
const h5part_float32_t *data,
|
||||
const h5part_float32_t *nelem,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *name2 =_H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartWriteFileAttrib (
|
||||
filehandle, name2, H5PART_FLOAT32, data, *nelem);
|
||||
|
||||
free ( name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5pt_writefileattrib_r4 F77NAME ( \
|
||||
h5pt_writefileattrib_r4_, \
|
||||
H5PT_WRITEFILEATTRIB_R4 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_readfileattrib_r4 (
|
||||
h5part_int64_t *f,
|
||||
const char *name,
|
||||
const h5part_float32_t *data,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *name2 =_H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartReadFileAttrib (
|
||||
filehandle, name2, (void*)data);
|
||||
|
||||
free ( name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5pt_writefileattrib_i8 F77NAME ( \
|
||||
h5pt_writefileattrib_i8_, \
|
||||
H5PT_WRITEFILEATTRIB_I8 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_writefileattrib_i8 (
|
||||
h5part_int64_t *f,
|
||||
const char *name,
|
||||
const h5part_int64_t *data,
|
||||
const h5part_int64_t *nelem,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *name2 =_H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartWriteFileAttrib (
|
||||
filehandle, name2, H5PART_INT64, data, *nelem);
|
||||
|
||||
free ( name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5pt_writefileattrib_i8 F77NAME ( \
|
||||
h5pt_writefileattrib_i8_, \
|
||||
H5PT_WRITEFILEATTRIB_I8 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_readfileattrib_i8 (
|
||||
h5part_int64_t *f,
|
||||
const char *name,
|
||||
const h5part_int64_t *data,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *name2 =_H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartReadFileAttrib (
|
||||
filehandle, name2, (void*)data);
|
||||
|
||||
free ( name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5pt_writefileattrib_i4 F77NAME ( \
|
||||
h5pt_writefileattrib_i4_, \
|
||||
H5PT_WRITEFILEATTRIB_I4 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_writefileattrib_i4 (
|
||||
h5part_int64_t *f,
|
||||
const char *name,
|
||||
const h5part_int32_t *data,
|
||||
const h5part_int32_t *nelem,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *name2 =_H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartWriteFileAttrib (
|
||||
filehandle, name2, H5PART_INT32, data, *nelem);
|
||||
|
||||
free ( name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5pt_writefileattrib_i4 F77NAME ( \
|
||||
h5pt_writefileattrib_i4_, \
|
||||
H5PT_WRITEFILEATTRIB_I4 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_readfileattrib_i4 (
|
||||
h5part_int64_t *f,
|
||||
const char *name,
|
||||
const h5part_int32_t *data,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *name2 =_H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartReadFileAttrib (
|
||||
filehandle, name2, (void*)data);
|
||||
|
||||
free ( name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5pt_writestepattrib_r8 F77NAME ( \
|
||||
h5pt_writestepattrib_r8_, \
|
||||
H5PT_WRITESTEPATTRIB_R8 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_writestepattrib_r8 (
|
||||
h5part_int64_t *f,
|
||||
const char *name,
|
||||
const h5part_float64_t *data,
|
||||
const h5part_float64_t *nelem,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *name2 =_H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartWriteStepAttrib (
|
||||
filehandle, name2, H5PART_FLOAT64, data, *nelem);
|
||||
|
||||
free ( name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5pt_writestepattrib_r8 F77NAME ( \
|
||||
h5pt_writestepattrib_r8_, \
|
||||
H5PT_WRITESTEPATTRIB_R8 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_readstepattrib_r8 (
|
||||
h5part_int64_t *f,
|
||||
const char *name,
|
||||
const h5part_float64_t *data,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *name2 =_H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartReadStepAttrib (
|
||||
filehandle, name2, (void*)data);
|
||||
|
||||
free ( name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5pt_writestepattrib_r4 F77NAME ( \
|
||||
h5pt_writestepattrib_r4_, \
|
||||
H5PT_WRITESTEPATTRIB_R4 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_writestepattrib_r4 (
|
||||
h5part_int64_t *f,
|
||||
const char *name,
|
||||
const h5part_float32_t *data,
|
||||
const h5part_float32_t *nelem,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *name2 =_H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartWriteStepAttrib (
|
||||
filehandle, name2, H5PART_FLOAT32, data, *nelem);
|
||||
|
||||
free ( name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5pt_writestepattrib_r4 F77NAME ( \
|
||||
h5pt_writestepattrib_r4_, \
|
||||
H5PT_WRITESTEPATTRIB_R4 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_readstepattrib_r4 (
|
||||
h5part_int64_t *f,
|
||||
const char *name,
|
||||
const h5part_float32_t *data,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *name2 =_H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartReadStepAttrib (
|
||||
filehandle, name2, (void*)data);
|
||||
|
||||
free ( name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5pt_writestepattrib_i8 F77NAME ( \
|
||||
h5pt_writestepattrib_i8_, \
|
||||
H5PT_WRITESTEPATTRIB_I8 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_writestepattrib_i8 (
|
||||
h5part_int64_t *f,
|
||||
const char *name,
|
||||
const h5part_int64_t *data,
|
||||
const h5part_int64_t *nelem,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *name2 =_H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartWriteStepAttrib (
|
||||
filehandle, name2, H5PART_INT64, data, *nelem);
|
||||
|
||||
free ( name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5pt_writestepattrib_i8 F77NAME ( \
|
||||
h5pt_writestepattrib_i8_, \
|
||||
H5PT_WRITESTEPATTRIB_I8 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_readstepattrib_i8 (
|
||||
h5part_int64_t *f,
|
||||
const char *name,
|
||||
const h5part_int64_t *data,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *name2 =_H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartReadStepAttrib (
|
||||
filehandle, name2, (void*)data);
|
||||
|
||||
free ( name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5pt_writestepattrib_i4 F77NAME ( \
|
||||
h5pt_writestepattrib_i4_, \
|
||||
H5PT_WRITESTEPATTRIB_I4 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_writestepattrib_i4 (
|
||||
h5part_int64_t *f,
|
||||
const char *name,
|
||||
const h5part_int32_t *data,
|
||||
const h5part_int32_t *nelem,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *name2 =_H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartWriteStepAttrib (
|
||||
filehandle, name2, H5PART_INT32, data, *nelem);
|
||||
|
||||
free ( name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5pt_writestepattrib_i4 F77NAME ( \
|
||||
h5pt_writestepattrib_i4_, \
|
||||
H5PT_WRITESTEPATTRIB_I4 )
|
||||
#endif
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_readstepattrib_i4 (
|
||||
h5part_int64_t *f,
|
||||
const char *name,
|
||||
const h5part_int32_t *data,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
|
||||
|
||||
char *name2 =_H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartReadStepAttrib (
|
||||
filehandle, name2, (void*)data);
|
||||
|
||||
free ( name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
/*** QUERY ***/
|
||||
|
||||
h5_int64_t
|
||||
h5pt_getnstepattribs (
|
||||
const h5_int64_t *f
|
||||
) {
|
||||
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5PartGetNumStepAttribs ( filehandle );
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
h5pt_getnfileattribs (
|
||||
const h5_int64_t *f
|
||||
) {
|
||||
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5PartGetNumFileAttribs ( filehandle );
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
h5pt_getstepattribinfo (
|
||||
const h5_int64_t *f,
|
||||
const h5_int64_t *idx,
|
||||
char *name,
|
||||
h5_int64_t *nelem,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
h5_int64_t type;
|
||||
|
||||
h5_int64_t herr = H5PartGetStepAttribInfo (
|
||||
filehandle, *idx, name, l_name, &type, nelem);
|
||||
|
||||
_H5Part_strc2for( name, l_name );
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
h5pt_getfileattribinfo (
|
||||
const h5_int64_t *f,
|
||||
const h5_int64_t *idx,
|
||||
char *name,
|
||||
h5_int64_t *nelem,
|
||||
const int l_name ) {
|
||||
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
h5_int64_t type;
|
||||
|
||||
h5_int64_t herr = H5PartGetFileAttribInfo (
|
||||
filehandle, *idx, name, l_name, &type, nelem);
|
||||
|
||||
_H5Part_strc2for( name, l_name );
|
||||
return herr;
|
||||
}
|
||||
|
||||
|
||||
+347
-259
@@ -1,7 +1,9 @@
|
||||
#include "H5Part.h"
|
||||
#include "Underscore.h"
|
||||
#include <string.h>
|
||||
#include <hdf5.h>
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "Underscore.h"
|
||||
|
||||
#if defined(F77_SINGLE_UNDERSCORE)
|
||||
#define F77NAME(a,b) a
|
||||
#elif defined(F77_CRAY_UNDERSCORE)
|
||||
@@ -32,6 +34,25 @@
|
||||
#define h5pt_opena_par F77NAME ( \
|
||||
h5pt_opena_par_, \
|
||||
H5PT_OPENA_PAR )
|
||||
#define h5pt_openr_align F77NAME ( \
|
||||
h5pt_openr_align_, \
|
||||
H5PT_OPENR_ALIGN )
|
||||
#define h5pt_openw_align F77NAME ( \
|
||||
h5pt_openw_align_, \
|
||||
H5PT_OPENW_ALIGN )
|
||||
#define h5pt_opena_align F77NAME ( \
|
||||
h5pt_opena_align_, \
|
||||
H5PT_OPENA_ALIGN )
|
||||
#define h5pt_openr_par_align F77NAME ( \
|
||||
h5pt_openr_par_align_, \
|
||||
H5PT_OPENR_PAR_ALIGN )
|
||||
#define h5pt_openw_par_align F77NAME ( \
|
||||
h5pt_openw_par_align_, \
|
||||
H5PT_OPENW_PAR_ALIGN )
|
||||
#define h5pt_opena_par_align F77NAME ( \
|
||||
h5pt_opena_par_align_, \
|
||||
H5PT_OPENA_PAR_ALIGN )
|
||||
|
||||
#define h5pt_close F77NAME ( \
|
||||
h5pt_close_, \
|
||||
H5PT_CLOSE)
|
||||
@@ -40,15 +61,24 @@
|
||||
#define h5pt_setnpoints F77NAME ( \
|
||||
h5pt_setnpoints_, \
|
||||
H5PT_SETNPOINTS )
|
||||
#define h5pt_setnpoints_strided F77NAME ( \
|
||||
h5pt_setnpoints_strided_, \
|
||||
H5PT_SETNPOINTS_STRIDED )
|
||||
#define h5pt_setstep F77NAME ( \
|
||||
h5pt_setstep_, \
|
||||
H5PT_SETSTEP )
|
||||
#define h5pt_writedata_r8 F77NAME ( \
|
||||
h5pt_writedata_r8_, \
|
||||
H5PT_WRITEDATA_R8 )
|
||||
#define h5pt_writedata_r4 F77NAME ( \
|
||||
h5pt_writedata_r4_, \
|
||||
H5PT_WRITEDATA_R4 )
|
||||
#define h5pt_writedata_i8 F77NAME ( \
|
||||
h5pt_writedata_i8_, \
|
||||
H5PT_WRITEDATA_I8 )
|
||||
#define h5pt_writedata_i4 F77NAME ( \
|
||||
h5pt_writedata_i4_, \
|
||||
H5PT_WRITEDATA_I4 )
|
||||
|
||||
/* Reading interface (define dataset, step, particles, attributes) */
|
||||
#define h5pt_getnsteps F77NAME ( \
|
||||
@@ -63,14 +93,17 @@
|
||||
#define h5pt_getdatasetname F77NAME ( \
|
||||
h5pt_getdatasetname_, \
|
||||
H5PT_GETDATASETNAME )
|
||||
#define h5pt_getnumpoints F77NAME ( \
|
||||
h5pt_getnumpoints_, \
|
||||
H5PT_GETNUMPOINTS )
|
||||
|
||||
/* Views and parallelism */
|
||||
#define h5pt_setview F77NAME ( \
|
||||
h5pt_setview_, \
|
||||
H5PT_SETVIEW )
|
||||
#define h5pt_setview_indices F77NAME ( \
|
||||
h5pt_setview_indices_, \
|
||||
H5PT_SETVIEW_INDICES )
|
||||
#define h5pt_setview_empty F77NAME ( \
|
||||
h5pt_setview_empty_, \
|
||||
H5PT_SETVIEW_EMPTY )
|
||||
#define h5pt_resetview F77NAME ( \
|
||||
h5pt_resetview_, \
|
||||
H5PT_RESETVIEW )
|
||||
@@ -85,29 +118,20 @@
|
||||
#define h5pt_readdata_r8 F77NAME ( \
|
||||
h5pt_readdata_r8_, \
|
||||
H5PT_READDATA_R8 )
|
||||
#define h5pt_readdata_r4 F77NAME ( \
|
||||
h5pt_readdata_r4_, \
|
||||
H5PT_READDATA_R4 )
|
||||
#define h5pt_readdata_i8 F77NAME ( \
|
||||
h5pt_readdata_i8_, \
|
||||
H5PT_READDATA_I8 )
|
||||
#define h5pt_readdata F77NAME ( \
|
||||
h5pt_readdata_, \
|
||||
H5PT_READDATA )
|
||||
#define h5pt_readdata_i4 F77NAME ( \
|
||||
h5pt_readdata_i4_, \
|
||||
H5PT_READDATA_I4 )
|
||||
|
||||
/* Writing attributes */
|
||||
#define h5pt_writefileattrib_r8 F77NAME ( \
|
||||
h5pt_writefileattrib_r8_, \
|
||||
H5PT_WRITEFILEATTRIB_R8 )
|
||||
#define h5pt_writefileattrib_i8 F77NAME ( \
|
||||
h5pt_writefileattrib_i8_, \
|
||||
H5PT_WRITEFILEATTRIB_I8 )
|
||||
#define h5pt_writefileattrib_string F77NAME ( \
|
||||
h5pt_writefileattrib_string_, \
|
||||
H5PT_writefileattrib_string )
|
||||
#define h5pt_writestepattrib_r8 F77NAME ( \
|
||||
h5pt_writestepattrib_r8_, \
|
||||
H5PT_WRITESTEPATTRIB_R8 )
|
||||
#define h5pt_writestepattrib_i8 F77NAME ( \
|
||||
h5pt_writestepattrib_i8_, \
|
||||
H5PT_WRITESTEPATTRIB_I8 )
|
||||
#define h5pt_writestepattrib_string F77NAME ( \
|
||||
h5pt_writestepattrib_string_, \
|
||||
H5PT_WRITESTEPATTRIB_STRING )
|
||||
@@ -125,27 +149,9 @@
|
||||
#define h5pt_getfileattribinfo F77NAME ( \
|
||||
h5pt_getfileattribinfo_, \
|
||||
H5PT_GETFILEATTRIBINFO )
|
||||
#define h5pt_readstepattrib F77NAME ( \
|
||||
h5pt_readstepattrib_, \
|
||||
H5PT_READSTEPATTRIB )
|
||||
#define h5pt_readstepattrib_r8 F77NAME ( \
|
||||
h5pt_readstepattrib_r8_, \
|
||||
H5PT_READSTEPATTRIB_R8 )
|
||||
#define h5pt_readstepattrib_i8 F77NAME ( \
|
||||
h5pt_readstepattrib_i8_, \
|
||||
H5PT_READSTEPATTRIB_I8 )
|
||||
#define h5pt_readstepattrib_string F77NAME ( \
|
||||
h5pt_readstepattrib_string_, \
|
||||
H5PT_READSTEPATTRIB_STRING )
|
||||
#define h5pt_readfileattrib F77NAME ( \
|
||||
h5pt_readfileattrib_, \
|
||||
H5PT_READFILEATTRIB )
|
||||
#define h5pt_readfileattrib_r8 F77NAME ( \
|
||||
h5pt_readfileattrib_r8_, \
|
||||
H5PT_READFILEATTRIB_R8 )
|
||||
#define h5pt_readfileattrib_i8 F77NAME ( \
|
||||
h5pt_readfileattrib_i8_, \
|
||||
H5PT_READFILEATTRIB_I8 )
|
||||
#define h5pt_readfileattrib_string F77NAME ( \
|
||||
h5pt_readfileattrib_string_, \
|
||||
H5PT_READFILEATTRIB_STRING )
|
||||
@@ -157,7 +163,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
char *
|
||||
static char *
|
||||
_H5Part_strdupfor2c (
|
||||
const char *s,
|
||||
const ssize_t len
|
||||
@@ -172,7 +178,7 @@ _H5Part_strdupfor2c (
|
||||
return dup;
|
||||
}
|
||||
|
||||
char *
|
||||
static char *
|
||||
_H5Part_strc2for (
|
||||
char * const str,
|
||||
const ssize_t l_str
|
||||
@@ -184,8 +190,27 @@ _H5Part_strc2for (
|
||||
return str;
|
||||
}
|
||||
|
||||
static char
|
||||
_H5Part_flagsfor2c (
|
||||
char * flags
|
||||
) {
|
||||
|
||||
char fbits = 0x00;
|
||||
|
||||
flags = strtok ( flags, "," );
|
||||
while ( flags != NULL ) {
|
||||
if ( strcmp ( flags, "vfd_mpiposix" ) == 0 )
|
||||
fbits |= H5_VFD_MPIPOSIX;
|
||||
else if ( strcmp ( flags, "vfd_independent" ) == 0 )
|
||||
fbits |= H5_VFD_INDEPENDENT;
|
||||
flags = strtok ( NULL, "," );
|
||||
}
|
||||
|
||||
return fbits;
|
||||
}
|
||||
|
||||
/* open/close interface */
|
||||
h5part_int64_t
|
||||
h5_err_t
|
||||
h5pt_openr (
|
||||
const char *file_name,
|
||||
const int l_file_name
|
||||
@@ -193,13 +218,13 @@ h5pt_openr (
|
||||
|
||||
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
|
||||
|
||||
h5_file* f = H5PartOpenFile ( file_name2, H5PART_READ );
|
||||
h5_file_t* f = H5OpenFile ( file_name2, H5PART_READ );
|
||||
|
||||
free ( file_name2 );
|
||||
return (h5part_int64_t)(size_t)f;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5_err_t
|
||||
h5pt_openw (
|
||||
const char *file_name,
|
||||
const int l_file_name
|
||||
@@ -207,7 +232,7 @@ h5pt_openw (
|
||||
|
||||
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
|
||||
|
||||
h5_file* f = H5PartOpenFile ( file_name2, H5PART_WRITE );
|
||||
h5_file_t* f = H5OpenFile ( file_name2, H5PART_WRITE );
|
||||
|
||||
free ( file_name2 );
|
||||
return (h5part_int64_t)(size_t)f;
|
||||
@@ -221,7 +246,52 @@ h5pt_opena (
|
||||
|
||||
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
|
||||
|
||||
h5_file* f = H5PartOpenFile ( file_name2, H5PART_APPEND );
|
||||
h5_file_t* f = H5OpenFile ( file_name2, H5PART_APPEND );
|
||||
|
||||
free ( file_name2 );
|
||||
return (h5part_int64_t)(size_t)f;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_openr_align (
|
||||
const char *file_name,
|
||||
const h5part_int64_t *align,
|
||||
const int l_file_name
|
||||
) {
|
||||
|
||||
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
|
||||
|
||||
h5_file_t* f = H5OpenFileAlign ( file_name2, H5PART_READ, *align );
|
||||
|
||||
free ( file_name2 );
|
||||
return (h5part_int64_t)(size_t)f;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_openw_align (
|
||||
const char *file_name,
|
||||
const h5part_int64_t *align,
|
||||
const int l_file_name
|
||||
) {
|
||||
|
||||
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
|
||||
|
||||
h5_file_t* f = H5OpenFileAlign ( file_name2, H5PART_WRITE, *align );
|
||||
|
||||
free ( file_name2 );
|
||||
return (h5part_int64_t)(size_t)f;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_opena_align (
|
||||
const char *file_name,
|
||||
const h5part_int64_t *align,
|
||||
const int l_file_name
|
||||
) {
|
||||
|
||||
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
|
||||
|
||||
h5_file_t* f = H5OpenFileAlign ( file_name2, H5PART_APPEND, *align );
|
||||
|
||||
free ( file_name2 );
|
||||
return (h5part_int64_t)(size_t)f;
|
||||
@@ -231,14 +301,16 @@ h5pt_opena (
|
||||
h5part_int64_t
|
||||
h5pt_openr_par (
|
||||
const char *file_name,
|
||||
MPI_Comm *comm,
|
||||
MPI_Fint *fcomm,
|
||||
const int l_file_name
|
||||
) {
|
||||
|
||||
MPI_Comm ccomm = MPI_Comm_f2c (*fcomm);
|
||||
|
||||
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
|
||||
|
||||
h5_file* f = H5PartOpenFileParallel (
|
||||
file_name2, H5PART_READ, *comm );
|
||||
h5_file_t* f = H5OpenFileParallel (
|
||||
file_name2, H5PART_READ, ccomm );
|
||||
|
||||
free ( file_name2 );
|
||||
return (h5part_int64_t)(size_t)f;
|
||||
@@ -247,14 +319,15 @@ h5pt_openr_par (
|
||||
h5part_int64_t
|
||||
h5pt_openw_par (
|
||||
const char *file_name,
|
||||
MPI_Comm *comm,
|
||||
MPI_Fint *fcomm,
|
||||
const int l_file_name
|
||||
) {
|
||||
|
||||
MPI_Comm ccomm = MPI_Comm_f2c (*fcomm);
|
||||
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
|
||||
|
||||
h5_file* f = H5PartOpenFileParallel (
|
||||
file_name2, H5PART_WRITE, *comm );
|
||||
h5_file_t* f = H5OpenFileParallel (
|
||||
file_name2, H5PART_WRITE, ccomm );
|
||||
|
||||
free ( file_name2 );
|
||||
return (h5part_int64_t)(size_t)f;
|
||||
@@ -263,17 +336,90 @@ h5pt_openw_par (
|
||||
h5part_int64_t
|
||||
h5pt_opena_par (
|
||||
const char *file_name,
|
||||
MPI_Comm *comm,
|
||||
MPI_Fint *fcomm,
|
||||
const int l_file_name
|
||||
) {
|
||||
|
||||
MPI_Comm ccomm = MPI_Comm_f2c (*fcomm);
|
||||
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
|
||||
|
||||
h5_file* f = H5PartOpenFileParallel (
|
||||
file_name2, H5PART_APPEND, *comm );
|
||||
h5_file_t* f = H5OpenFileParallel (
|
||||
file_name2, H5PART_APPEND, ccomm );
|
||||
|
||||
free ( file_name2 );
|
||||
return (h5part_int64_t)(size_t)f;
|
||||
free ( file_name2 );
|
||||
return (h5part_int64_t)(size_t)f;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_openr_par_align (
|
||||
const char *file_name,
|
||||
MPI_Fint *fcomm,
|
||||
const h5part_int64_t *align,
|
||||
const char *flags,
|
||||
const int l_file_name,
|
||||
const int l_flags
|
||||
) {
|
||||
|
||||
MPI_Comm ccomm = MPI_Comm_f2c (*fcomm);
|
||||
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
|
||||
char *flags2 = _H5Part_strdupfor2c ( flags, l_flags );
|
||||
|
||||
char fbits = H5PART_READ | _H5Part_flagsfor2c ( flags2 );
|
||||
|
||||
h5_file_t* f = H5OpenFileParallelAlign (
|
||||
file_name2, fbits, ccomm, *align );
|
||||
|
||||
free ( file_name2 );
|
||||
free ( flags2 );
|
||||
return (h5part_int64_t)(size_t)f;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_openw_par_align (
|
||||
const char *file_name,
|
||||
MPI_Fint *fcomm,
|
||||
const h5part_int64_t *align,
|
||||
const char *flags,
|
||||
const int l_file_name,
|
||||
const int l_flags
|
||||
) {
|
||||
|
||||
MPI_Comm ccomm = MPI_Comm_f2c (*fcomm);
|
||||
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
|
||||
char *flags2 = _H5Part_strdupfor2c ( flags, l_flags );
|
||||
|
||||
char fbits = H5PART_WRITE | _H5Part_flagsfor2c ( flags2 );
|
||||
|
||||
h5_file_t* f = H5OpenFileParallelAlign (
|
||||
file_name2, fbits, ccomm, *align );
|
||||
|
||||
free ( file_name2 );
|
||||
free ( flags2 );
|
||||
return (h5part_int64_t)(size_t)f;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_opena_par_align (
|
||||
const char *file_name,
|
||||
MPI_Fint *fcomm,
|
||||
const h5part_int64_t *align,
|
||||
const char *flags,
|
||||
const int l_file_name,
|
||||
const int l_flags
|
||||
) {
|
||||
|
||||
MPI_Comm ccomm = MPI_Comm_f2c (*fcomm);
|
||||
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
|
||||
char *flags2 = _H5Part_strdupfor2c ( flags, l_flags );
|
||||
|
||||
char fbits = H5PART_APPEND | _H5Part_flagsfor2c ( flags2 );
|
||||
|
||||
h5_file_t* f = H5OpenFileParallelAlign (
|
||||
file_name2, fbits, ccomm, *align );
|
||||
|
||||
free ( file_name2 );
|
||||
free ( flags2 );
|
||||
return (h5part_int64_t)(size_t)f;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -281,7 +427,7 @@ h5part_int64_t
|
||||
h5pt_close (
|
||||
const h5part_int64_t *f
|
||||
) {
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5PartCloseFile ( filehandle );
|
||||
}
|
||||
@@ -301,7 +447,7 @@ h5pt_readstep (
|
||||
h5part_int64_t *id
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5PartReadParticleStep (
|
||||
filehandle,(*step)-1,x,y,z,px,py,pz,id);
|
||||
@@ -314,17 +460,29 @@ h5pt_setnpoints (
|
||||
h5part_int64_t *np
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5PartSetNumParticles ( filehandle, *np );
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_setnpoints_strided (
|
||||
const h5part_int64_t *f,
|
||||
h5part_int64_t *np,
|
||||
h5part_int64_t *stride
|
||||
) {
|
||||
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5PartSetNumParticlesStrided ( filehandle, *np, *stride );
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_setstep (
|
||||
const h5part_int64_t *f,
|
||||
h5part_int64_t *step ) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5PartSetStep ( filehandle, (*step)-1 );
|
||||
}
|
||||
@@ -336,7 +494,7 @@ h5pt_writedata_r8 (
|
||||
const h5part_float64_t *data,
|
||||
const int l_name ) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
char *name2 = _H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
@@ -348,6 +506,25 @@ h5pt_writedata_r8 (
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_writedata_r4 (
|
||||
const h5part_int64_t *f,
|
||||
const char *name,
|
||||
const h5part_float32_t *data,
|
||||
const int l_name ) {
|
||||
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
char *name2 = _H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartWriteDataFloat32 (
|
||||
filehandle, name2, data );
|
||||
|
||||
free ( name2 );
|
||||
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_writedata_i8 (
|
||||
const h5part_int64_t *f,
|
||||
@@ -355,7 +532,7 @@ h5pt_writedata_i8 (
|
||||
const h5part_int64_t *data,
|
||||
const int l_name ) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
char *name2 = _H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
@@ -367,6 +544,25 @@ h5pt_writedata_i8 (
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_writedata_i4 (
|
||||
const h5part_int64_t *f,
|
||||
const char *name,
|
||||
const h5part_int32_t *data,
|
||||
const int l_name ) {
|
||||
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
char *name2 = _H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartWriteDataInt32 (
|
||||
filehandle, name2, data );
|
||||
|
||||
free ( name2 );
|
||||
|
||||
return herr;
|
||||
}
|
||||
|
||||
/*==============Reading Data Characteristics============*/
|
||||
|
||||
h5part_int64_t
|
||||
@@ -374,7 +570,7 @@ h5pt_getnsteps (
|
||||
const h5part_int64_t *f
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5PartGetNumSteps ( filehandle );
|
||||
}
|
||||
@@ -384,7 +580,7 @@ h5pt_getndatasets (
|
||||
const h5part_int64_t *f
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5PartGetNumDatasets ( filehandle );
|
||||
}
|
||||
@@ -394,7 +590,7 @@ h5pt_getnpoints (
|
||||
const h5part_int64_t *f
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5PartGetNumParticles ( filehandle );
|
||||
}
|
||||
@@ -407,7 +603,7 @@ h5pt_getdatasetname (
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
h5part_int64_t herr = H5PartGetDatasetName (
|
||||
filehandle, *index, name, l_name );
|
||||
@@ -416,16 +612,6 @@ h5pt_getdatasetname (
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_getnumpoints (
|
||||
const h5part_int64_t *f
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
|
||||
return H5PartGetNumParticles( filehandle );
|
||||
}
|
||||
|
||||
/*=============Setting and getting views================*/
|
||||
|
||||
h5part_int64_t
|
||||
@@ -435,17 +621,39 @@ h5pt_setview (
|
||||
const h5part_int64_t *end
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5PartSetView ( filehandle, *start, *end );
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_setview_indices (
|
||||
const h5part_int64_t *f,
|
||||
const h5part_int64_t *indices,
|
||||
const h5part_int64_t *nelem
|
||||
) {
|
||||
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5PartSetViewIndices ( filehandle, indices, *nelem );
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_setview_empty (
|
||||
const h5part_int64_t *f
|
||||
) {
|
||||
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5PartSetViewEmpty ( filehandle );
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_resetview (
|
||||
const h5part_int64_t *f
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5PartResetView ( filehandle );
|
||||
}
|
||||
@@ -455,7 +663,7 @@ h5pt_hasview (
|
||||
const h5part_int64_t *f
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5PartHasView ( filehandle );
|
||||
}
|
||||
@@ -467,7 +675,7 @@ h5pt_getview (
|
||||
h5part_int64_t *end
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5PartGetView ( filehandle, start, end);
|
||||
}
|
||||
@@ -480,7 +688,7 @@ h5pt_readdata_r8 (
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
char *name2 = _H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
@@ -491,6 +699,25 @@ h5pt_readdata_r8 (
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_readdata_r4 (
|
||||
const h5part_int64_t *f,
|
||||
const char *name,
|
||||
h5part_float32_t *array,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
char *name2 = _H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartReadDataFloat32 (
|
||||
filehandle, name2, array );
|
||||
|
||||
free ( name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_readdata_i8 (
|
||||
const h5part_int64_t *f,
|
||||
@@ -499,7 +726,7 @@ h5pt_readdata_i8 (
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
char *name2 = _H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
@@ -510,51 +737,27 @@ h5pt_readdata_i8 (
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_readdata_i4 (
|
||||
const h5part_int64_t *f,
|
||||
const char *name,
|
||||
h5part_int32_t *array,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
char *name2 = _H5Part_strdupfor2c ( name, l_name );
|
||||
|
||||
h5part_int64_t herr = H5PartReadDataInt32 (
|
||||
filehandle, name2, array );
|
||||
|
||||
free ( name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
/*=================== Attributes ================*/
|
||||
|
||||
/* Writeing attributes */
|
||||
h5part_int64_t
|
||||
h5pt_writefileattrib_r8 (
|
||||
const h5part_int64_t *f,
|
||||
const char *attrib_name,
|
||||
const h5part_float64_t *attrib_value,
|
||||
const h5part_int64_t *attrib_nelem,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
|
||||
char *attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name);
|
||||
|
||||
h5part_int64_t herr = H5PartWriteFileAttrib (
|
||||
filehandle,
|
||||
attrib_name2, H5T_NATIVE_DOUBLE, attrib_value, *attrib_nelem );
|
||||
|
||||
free ( attrib_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_writefileattrib_i8 (
|
||||
const h5part_int64_t *f,
|
||||
const char *attrib_name,
|
||||
const h5part_int64_t *attrib_value,
|
||||
const h5part_int64_t *attrib_nelem,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
|
||||
char *attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name);
|
||||
|
||||
h5part_int64_t herr = H5PartWriteFileAttrib (
|
||||
filehandle,
|
||||
attrib_name2, H5T_NATIVE_INT64, attrib_value, *attrib_nelem );
|
||||
|
||||
free ( attrib_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_writefileattrib_string (
|
||||
const h5part_int64_t *f,
|
||||
@@ -564,7 +767,7 @@ h5pt_writefileattrib_string (
|
||||
const int l_attrib_value
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
char *attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name);
|
||||
char *attrib_value2= _H5Part_strdupfor2c (attrib_value,l_attrib_value);
|
||||
@@ -577,48 +780,6 @@ h5pt_writefileattrib_string (
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_writestepattrib_r8 (
|
||||
const h5part_int64_t *f,
|
||||
const char *attrib_name,
|
||||
const h5part_float64_t *attrib_value,
|
||||
const h5part_int64_t *attrib_nelem,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
|
||||
char *attrib_name2 = _H5Part_strdupfor2c ( attrib_name, l_attrib_name );
|
||||
|
||||
h5part_int64_t herr = H5PartWriteStepAttrib (
|
||||
filehandle,
|
||||
attrib_name2, H5T_NATIVE_DOUBLE, attrib_value, *attrib_nelem );
|
||||
|
||||
free ( attrib_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_writestepattrib_i8 (
|
||||
const h5part_int64_t *f,
|
||||
const char *attrib_name,
|
||||
const h5part_int64_t *attrib_value,
|
||||
const h5part_int64_t *attrib_nelem,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
|
||||
char *attrib_name2 = _H5Part_strdupfor2c ( attrib_name, l_attrib_name );
|
||||
|
||||
h5part_int64_t herr = H5PartWriteStepAttrib (
|
||||
filehandle,
|
||||
attrib_name2, H5T_NATIVE_INT64, attrib_value, *attrib_nelem );
|
||||
|
||||
free ( attrib_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_writestepattrib_string (
|
||||
const h5part_int64_t *f,
|
||||
@@ -628,7 +789,7 @@ h5pt_writestepattrib_string (
|
||||
const int l_attrib_value
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
char *attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name);
|
||||
char *attrib_value2= _H5Part_strdupfor2c (attrib_value,l_attrib_value);
|
||||
@@ -648,7 +809,7 @@ h5pt_getnstepattribs (
|
||||
const h5part_int64_t *f
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5PartGetNumStepAttribs ( filehandle );
|
||||
}
|
||||
@@ -658,7 +819,7 @@ h5pt_getnfileattribs (
|
||||
const h5part_int64_t *f
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
return H5PartGetNumFileAttribs ( filehandle );
|
||||
}
|
||||
@@ -672,7 +833,7 @@ h5pt_getstepattribinfo (
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
h5part_int64_t type;
|
||||
|
||||
h5part_int64_t herr = H5PartGetStepAttribInfo (
|
||||
@@ -690,7 +851,7 @@ h5pt_getfileattribinfo (
|
||||
h5part_int64_t *nelem,
|
||||
const int l_name ) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
h5part_int64_t type;
|
||||
|
||||
h5part_int64_t herr = H5PartGetFileAttribInfo (
|
||||
@@ -700,49 +861,6 @@ h5pt_getfileattribinfo (
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_readstepattrib (
|
||||
const h5part_int64_t *f,
|
||||
const char *attrib_name,
|
||||
void *attrib_value,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
|
||||
char * attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name);
|
||||
|
||||
h5part_int64_t herr = H5PartReadStepAttrib (
|
||||
filehandle, attrib_name2, attrib_value );
|
||||
|
||||
free ( attrib_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_readstepattrib_r8 (
|
||||
const h5part_int64_t *f,
|
||||
const char *attrib_name,
|
||||
h5part_float64_t *attrib_value,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
return h5pt_readstepattrib (
|
||||
f, attrib_name, attrib_value, l_attrib_name );
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_readstepattrib_i8 (
|
||||
const h5part_int64_t *f,
|
||||
const char *attrib_name,
|
||||
h5part_int64_t *attrib_value,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
return h5pt_readstepattrib (
|
||||
f, attrib_name, attrib_value, l_attrib_name );
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_readstepattrib_string (
|
||||
const h5part_int64_t *f,
|
||||
@@ -751,56 +869,20 @@ h5pt_readstepattrib_string (
|
||||
const int l_attrib_name,
|
||||
const int l_attrib_value
|
||||
) {
|
||||
|
||||
h5part_int64_t herr = h5pt_readstepattrib (
|
||||
f, attrib_name, attrib_value, l_attrib_name );
|
||||
|
||||
_H5Part_strc2for ( attrib_value, l_attrib_value );
|
||||
return herr;
|
||||
}
|
||||
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_readfileattrib (
|
||||
const h5part_int64_t *f,
|
||||
const char *attrib_name,
|
||||
void *attrib_value,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
h5_file *filehandle = (h5_file*)(size_t)*f;
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
char * attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name);
|
||||
|
||||
h5part_int64_t herr = H5PartReadFileAttrib (
|
||||
h5part_int64_t herr = H5PartReadStepAttrib (
|
||||
filehandle, attrib_name2, attrib_value );
|
||||
|
||||
_H5Part_strc2for ( attrib_value, l_attrib_value );
|
||||
|
||||
free ( attrib_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_readfileattrib_r8 (
|
||||
const h5part_int64_t *f,
|
||||
const char *attrib_name,
|
||||
h5part_float64_t *attrib_value,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
return h5pt_readfileattrib (
|
||||
f, attrib_name, attrib_value, l_attrib_name );
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_readfileattrib_i8 (
|
||||
const h5part_int64_t *f,
|
||||
const char *attrib_name,
|
||||
h5part_int64_t *attrib_value,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
return h5pt_readfileattrib (
|
||||
f, attrib_name, attrib_value, l_attrib_name );
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
h5pt_readfileattrib_string (
|
||||
const h5part_int64_t *f,
|
||||
@@ -809,11 +891,17 @@ h5pt_readfileattrib_string (
|
||||
const int l_attrib_name,
|
||||
const int l_attrib_value
|
||||
) {
|
||||
|
||||
h5part_int64_t herr = h5pt_readfileattrib (
|
||||
f, attrib_name, attrib_value, l_attrib_name );
|
||||
|
||||
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
|
||||
|
||||
char * attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name);
|
||||
|
||||
h5part_int64_t herr = H5PartReadFileAttrib (
|
||||
filehandle, attrib_name2, attrib_value );
|
||||
|
||||
_H5Part_strc2for ( attrib_value, l_attrib_value );
|
||||
|
||||
free ( attrib_name2 );
|
||||
return herr;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,223 +0,0 @@
|
||||
! Declaration of subroutines for Fortran Bindings
|
||||
! open/close interface
|
||||
|
||||
INTERFACE
|
||||
INTEGER*8 FUNCTION h5pt_openr ( filename )
|
||||
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for reading
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_openw ( filename )
|
||||
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for writing
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_opena ( filename )
|
||||
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for appending
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_openr_par ( filename, mpi_communicator )
|
||||
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for reading
|
||||
INTEGER, INTENT(IN) :: mpi_communicator ! the MPI_Communicator used by the program
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_openw_par ( filename, mpi_communicator )
|
||||
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for writing
|
||||
INTEGER, INTENT(IN) :: mpi_communicator ! the MPI_Communicator used by the program
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_opena_par ( filename, mpi_communicator )
|
||||
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for appending
|
||||
INTEGER, INTENT(IN) :: mpi_communicator ! the MPI_Communicator used by the program
|
||||
END FUNCTION
|
||||
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_close ( filehandle )
|
||||
INTEGER*8, INTENT(IN) :: filehandle ! close this open filehandle
|
||||
END FUNCTION
|
||||
|
||||
!==============Writing and Setting Dataset info========
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_setnpoints ( filehandle, npoints )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
INTEGER*8, INTENT(IN) :: npoints ! The number of particles on *this* processor
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_setstep (filehandle,step)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
INTEGER*8, INTENT(IN) :: step ! Set the current timestep in the file to this
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_writedata_r8 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name ! The name of the data we are writing
|
||||
REAL*8, INTENT(IN) :: data(*) ! The dataarray to write. The number of
|
||||
! elements is presumably set earlier with
|
||||
! h5pt_setnpoints(f,npoints)
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_writedata_i8 ( filehandle, name, data )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name ! The name of the data we are writing
|
||||
INTEGER*8, INTENT(IN) :: data(*)
|
||||
END FUNCTION
|
||||
|
||||
!==============Reading Data Characteristics============
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_getnsteps (filehandle)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_getndatasets (filehandle)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
END FUNCTION
|
||||
|
||||
! returns total number of points in this timestep
|
||||
! If a "view" has been set using h5pt_setview()
|
||||
! then it returns the number of points that are
|
||||
! in the current view.
|
||||
INTEGER*8 FUNCTION h5pt_getnpoints (filehandle)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_getdatasetname (filehandle,index,name)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
INTEGER*8, INTENT(IN) :: index ! Index for a given dataset name
|
||||
CHARACTER(LEN=*), INTENT(OUT) :: name ! returns the name of the dataset at that index
|
||||
END FUNCTION
|
||||
|
||||
!=============Setting and getting views================
|
||||
INTEGER*8 FUNCTION h5pt_setview (filehandle,start,end)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
INTEGER*8, INTENT(IN) :: start ! offset of the first particle in the view
|
||||
INTEGER*8, INTENT(IN) :: end ! offset of the first particle after the end of the view
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_resetview (filehandle)
|
||||
INTEGER*8, INTENT(IN) :: filehandle ! reset the view on this filehandle to default
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_hasview (filehandle)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_getview (filehandle,start,end)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
INTEGER*8, INTENT(OUT) :: start ! offset of first particle in the view
|
||||
INTEGER*8, INTENT(OUT) :: end ! offset of first particle beyond the current view
|
||||
END FUNCTION
|
||||
|
||||
!==============Reading Data=========================
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_readdata_r8 (filehandle,name,data)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name ! The name of the data we are writing
|
||||
REAL*8, INTENT(OUT) :: data(*) ! The dataarray to read. Number of points
|
||||
! read is either the number within the view set
|
||||
! by h5pt_setview() or the default (the total
|
||||
! number of particles in the file.
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_readdata_i8 (filehandle,name,data)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name ! The name of the data we are writing
|
||||
INTEGER*8, INTENT(OUT) :: data(*) ! The dataarray to read. Number of points
|
||||
! read is either the number within the view set
|
||||
! by h5pt_setview() or the default (the total
|
||||
! number of particles in the file.
|
||||
END FUNCTION
|
||||
|
||||
|
||||
!=================== Attributes ================
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_writefileattrib_r8 (filehandle,attrib_name,attrib_value,attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
|
||||
REAL*8, INTENT(IN) :: attrib_value(*) ! The array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: attrib_nelem ! Number of elements in the attrib array
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_writefileattrib_i8 (filehandle,attrib_name,attrib_value,attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
|
||||
INTEGER*8, INTENT(IN) :: attrib_value(*) ! The array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: attrib_nelem ! Number of elements in the attrib array
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_writefileattrib_string (filehandle,attrib_name,attrib_value)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_value ! The array of data to write into the attribute
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_writestepattrib_r8 (filehandle,attrib_name,attrib_value,attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
|
||||
REAL*8, INTENT(IN) :: attrib_value(*) ! The array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: attrib_nelem ! Number of elements in the attrib array
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_writestepattrib_i8 (filehandle,attrib_name,attrib_value,attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
|
||||
INTEGER*8, INTENT(IN) :: attrib_value(*) ! The array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: attrib_nelem ! Number of elements in the attrib array
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_writestepattrib_string (filehandle,attrib_name,attrib_value)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_value ! The array of data to write into the attribute
|
||||
END FUNCTION
|
||||
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_getnstepattribs (filehandle)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_getnfileattribs (filehandle)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_getstepattribinfo (filehandle,idx,attrib_name,attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
INTEGER*8, INTENT(IN) :: idx ! index of the attribute being queried
|
||||
CHARACTER(LEN=*), INTENT(OUT) :: attrib_name ! The name of the attribute
|
||||
INTEGER*8, INTENT(OUT) :: attrib_nelem ! Number of elements in the attrib array
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_getfileattribinfo (filehandle,idx,attrib_name,attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
INTEGER*8, INTENT(IN) :: idx ! index of the attribute being queried
|
||||
CHARACTER(LEN=*), INTENT(OUT) :: attrib_name ! The name of the attribute
|
||||
INTEGER*8, INTENT(OUT) :: attrib_nelem ! Number of elements in the attrib array
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_readstepattrib_i8 ( filehandle, attrib_name, attrib_value )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
|
||||
INTEGER*8, INTENT(OUT) :: attrib_value(*) ! the attribute data will be read into this array
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_readstepattrib_r8 ( filehandle, attrib_name, attrib_value )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
|
||||
REAL*8, INTENT(OUT) :: attrib_value(*) ! the attribute data will be read into this array
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_readfileattrib_i8 (filehandle, attrib_name, attrib_value )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
|
||||
INTEGER*8, INTENT(OUT) :: attrib_value(*) ! the attribute data will be read into this array
|
||||
END FUNCTION
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_readfileattrib_r8 (filehandle, attrib_name, attrib_value )
|
||||
INTEGER*8, INTENT(IN) :: filehandle
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
|
||||
REAL*8, INTENT(OUT) :: attrib_value(*) ! the attribute data will be read into this array
|
||||
END FUNCTION
|
||||
|
||||
|
||||
INTEGER*8 FUNCTION h5pt_set_verbosity_level ( level )
|
||||
INTEGER*8, INTENT(IN) :: level
|
||||
END FUNCTION
|
||||
|
||||
END INTERFACE
|
||||
@@ -0,0 +1,60 @@
|
||||
# src/Fortran level Makefile.am
|
||||
|
||||
OBJEXT=o
|
||||
|
||||
HDFLIB = -L@HDF5ROOT@/lib -lhdf5 -lz @SZLIB@
|
||||
LIBS = $(HDFLIB) @MPILIB@
|
||||
|
||||
INCLUDES = -I../include -I@HDF5ROOT@/include @MPIINC@
|
||||
|
||||
INCLUDES = -I@HDF5ROOT@/include @MPIINC@
|
||||
|
||||
EXTRA_HEADERS = H5PartPrivate.h \
|
||||
H5BlockPrivate.h \
|
||||
H5MultiBlockPrivate.h \
|
||||
H5PartAttrib.h
|
||||
|
||||
# Extra files that I wish to include in the dist tar ball.
|
||||
EXTRA_DIST = TestUnderscoreC.c \
|
||||
TestUnderscore.f \
|
||||
H5Part.f90 \
|
||||
H5PartAttrib.f90 \
|
||||
H5Block.f90 \
|
||||
H5BlockReadWrite.f90 \
|
||||
$(EXTRA_HEADERS)
|
||||
|
||||
# Files that I don't want to include in the dist tar ball
|
||||
nodist_include_HEADERS = ../include/H5PartF.h @UNDERSCORE_H@
|
||||
|
||||
# What to build... Will be determined by configure script.
|
||||
lib_LIBRARIES = @FORTRAN_LIB@
|
||||
|
||||
# Listing of all possible targets that I may build.
|
||||
EXTRA_LIBRARIES = libH5hutF.a
|
||||
|
||||
# Header files that I wish to install in $(prefix)/include
|
||||
include_HEADERS = \
|
||||
../include/H5hut.h \
|
||||
../include/H5.h \
|
||||
../include/H5_inquiry.h \
|
||||
../include/H5_attribs.h \
|
||||
../include/H5Block.h \
|
||||
../include/H5Fed.h \
|
||||
../include/H5Fed_store.h \
|
||||
../include/H5Fed_tags.h \
|
||||
../include/H5Part.h
|
||||
|
||||
libH5hutF_a_SOURCES = $(libH5Part_a_SOURCES) \
|
||||
H5PartF.c \
|
||||
H5PartAttribF.c \
|
||||
H5BlockF.c \
|
||||
H5BlockReadWriteF.c
|
||||
|
||||
all: ../include/H5PartF.h ./lib/libH5hutF.a
|
||||
|
||||
../include/H5PartF.h: H5Part.f90 H5PartAttrib.f90 H5Block.f90 H5BlockReadWrite.f90
|
||||
awk '/INTEGER\*8 FUNCTION/{print "\t" $$1 " " $$3}' $^ >$@
|
||||
|
||||
../lib/libH5hutF.a: libH5hutF.a
|
||||
-cp $^ $@
|
||||
|
||||
+18
-19
@@ -1,10 +1,11 @@
|
||||
# src level Makefile.am
|
||||
|
||||
# COMPILERS
|
||||
CC = @CC@
|
||||
OBJEXT=o
|
||||
|
||||
AM_CPPFLAGS = -I@HDF5ROOT@/include @MPIINC@ -I. -I../include -I../include/h5core
|
||||
AM_CFLAGS = @CFLAGS@
|
||||
HDFLIB = -L@HDF5ROOT@/lib -lhdf5 -lz @SZLIB@
|
||||
LIBS = $(HDFLIB) @MPILIB@
|
||||
|
||||
INCLUDES = -I../include -I@HDF5ROOT@/include @MPIINC@
|
||||
|
||||
EXTRA_HEADERS = \
|
||||
../include/h5core/h5_attribs.h \
|
||||
@@ -15,6 +16,10 @@ EXTRA_HEADERS = \
|
||||
../include/h5core/h5_openclose.h \
|
||||
../include/h5core/h5_readwrite.h \
|
||||
../include/h5core/h5_types.h \
|
||||
../include/h5core/h5u_readwrite.h \
|
||||
../include/h5core/h5u_model.h \
|
||||
../include/h5core/h5b_model.h \
|
||||
../include/h5core/h5b_attribs.h \
|
||||
../include/h5core/h5t_adjacencies.h \
|
||||
../include/h5core/h5t_inquiry.h \
|
||||
../include/h5core/h5t_map.h \
|
||||
@@ -24,7 +29,6 @@ EXTRA_HEADERS = \
|
||||
../include/h5core/h5t_retrieve.h \
|
||||
../include/h5core/h5t_storemesh.h \
|
||||
../include/h5core/h5t_tags.h \
|
||||
../include/h5core/h5u_readwrite.h \
|
||||
h5_errorhandling_private.h \
|
||||
h5_fcmp_private.h \
|
||||
h5_hdf5_private.h \
|
||||
@@ -33,7 +37,9 @@ EXTRA_HEADERS = \
|
||||
h5_qsort_private.h \
|
||||
h5_readwrite_private.h \
|
||||
h5_syscall_private.h \
|
||||
h5u_errorhandling_private.h \
|
||||
h5b_errorhandling_private.h \
|
||||
h5b_model_private.h \
|
||||
h5t_adjacencies_tetm_private.h \
|
||||
h5t_adjacencies_trim_private.h \
|
||||
h5t_consts_private.h \
|
||||
@@ -47,8 +53,7 @@ EXTRA_HEADERS = \
|
||||
h5t_store_private.h \
|
||||
h5t_store_tetm_private.h \
|
||||
h5t_store_trim_private.h \
|
||||
h5t_tags_private.h \
|
||||
h5u_errorhandling_private.h
|
||||
h5t_tags_private.h
|
||||
|
||||
# Extra files that I wish to include in the dist tar ball.
|
||||
EXTRA_DIST = $(EXTRA_HEADERS)
|
||||
@@ -56,7 +61,7 @@ EXTRA_DIST = $(EXTRA_HEADERS)
|
||||
# Files that I don't want to include in the dist tar ball
|
||||
nodist_include_HEADERS =
|
||||
|
||||
OBJEXT = o
|
||||
#OBJEXT = o
|
||||
# What to build... Will be determined by configure script.
|
||||
lib_LIBRARIES = libH5Core.a
|
||||
|
||||
@@ -80,6 +85,10 @@ libH5Core_a_SOURCES = \
|
||||
h5_qsort_r.c \
|
||||
h5_readwrite.c \
|
||||
h5_syscall.c \
|
||||
h5u_readwrite.c \
|
||||
h5u_model.c \
|
||||
h5b_model.c \
|
||||
h5b_attribs.c \
|
||||
h5t_adjacencies.c \
|
||||
h5t_adjacencies_tetm.c \
|
||||
h5t_adjacencies_trim.c \
|
||||
@@ -97,9 +106,7 @@ libH5Core_a_SOURCES = \
|
||||
h5t_store.c \
|
||||
h5t_store_tetm.c \
|
||||
h5t_store_trim.c \
|
||||
h5t_tags.c \
|
||||
h5u_model.c \
|
||||
h5u_readwrite.c
|
||||
h5t_tags.c
|
||||
|
||||
libH5Core_a_DEPENDENCIES = $(EXTRA_HEADERS)
|
||||
|
||||
@@ -110,11 +117,3 @@ all: ../lib/libH5Core.a
|
||||
|
||||
$(libH5Core_a_OBJECTS): $(libH5Core_a_DEPENDENCIES)
|
||||
|
||||
clean:
|
||||
$(RM) -f *~ *.o *.a *.so
|
||||
|
||||
distclean: clean
|
||||
$(RM) -f *.a
|
||||
$(RM) -rf .deps
|
||||
$(RM) -rf .libs
|
||||
$(RM) -f Makefile
|
||||
|
||||
+50
-25
@@ -1,14 +1,15 @@
|
||||
#include "h5_core.h"
|
||||
#include "h5core/h5_core.h"
|
||||
#include "h5_core_private.h"
|
||||
|
||||
static h5_err_t
|
||||
_get_hdf5_obj_id(
|
||||
h5_file_t *const f,
|
||||
const char type,
|
||||
const char mode,
|
||||
hid_t *id
|
||||
) {
|
||||
if (type == H5_ATTRIB_FILE) *id = f->root_gid;
|
||||
else if (type == H5_ATTRIB_STEP) *id = f->step_gid;
|
||||
if (mode == H5_ATTRIB_FILE) *id = f->root_gid;
|
||||
else if (mode == H5_ATTRIB_STEP) *id = f->step_gid;
|
||||
else if (mode == H5_ATTRIB_FIELD) *id = f->b->field_gid;
|
||||
else h5_error(f, H5_ERR_INVAL, "Attibute flag not recognized");
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
@@ -25,24 +26,34 @@ _get_hdf5_obj_id(
|
||||
h5_err_t
|
||||
h5_read_attrib (
|
||||
h5_file_t* const f, /*!< handle to open file */
|
||||
const char type, /*!< FILE or STEP flag */
|
||||
const char mode, /*!< FILE or STEP flag */
|
||||
const char* attrib_name, /*!< name of HDF5 attribute to read */
|
||||
const hid_t attrib_type, /*!< HDF5 type of attribute */
|
||||
void* const attrib_value /*!< OUT: attribute value */
|
||||
) {
|
||||
hid_t attrib_id;
|
||||
hid_t space_id;
|
||||
hid_t type_id;
|
||||
hid_t mytype;
|
||||
hsize_t nelem;
|
||||
|
||||
hid_t id;
|
||||
TRY( _get_hdf5_obj_id(f, type, &id) );
|
||||
TRY( _get_hdf5_obj_id(f, mode, &id) );
|
||||
|
||||
TRY( attrib_id = h5priv_open_hdf5_attribute (f, id, attrib_name) );
|
||||
TRY( mytype = h5priv_get_hdf5_attribute_type (f, attrib_id) );
|
||||
TRY( type_id = h5priv_get_hdf5_attribute_type (f, attrib_id) );
|
||||
|
||||
hid_t h5type_id;
|
||||
TRY( h5type_id = h5_normalize_h5_type(f, type_id) );
|
||||
if ( h5type_id != attrib_type )
|
||||
return h5_error (
|
||||
f,
|
||||
H5_ERR_HDF5,
|
||||
"Attribute '%s' has type '%s' but was requested as '%s'.",
|
||||
attrib_name,
|
||||
h5priv_get_base_type_name(f, h5type_id),
|
||||
h5priv_get_base_type_name(f, attrib_type) );
|
||||
|
||||
TRY( space_id = h5priv_get_hdf5_attribute_dataspace (f, attrib_id) );
|
||||
TRY( nelem = h5priv_get_npoints_of_hdf5_dataspace (f, space_id) );
|
||||
TRY( type_id = h5_normalize_h5_type (f, mytype) );
|
||||
TRY( h5priv_read_hdf5_attribute (f, attrib_id, type_id, attrib_value) );
|
||||
TRY( h5priv_close_hdf5_dataspace(f, space_id) );
|
||||
TRY( h5priv_close_hdf5_type(f, mytype) );
|
||||
@@ -61,7 +72,7 @@ h5_read_attrib (
|
||||
h5_err_t
|
||||
h5_write_attrib (
|
||||
h5_file_t* const f, /*!< handle to open file */
|
||||
const char type, /*!< FILE or STEP flag */
|
||||
const char mode, /*!< FILE or STEP flag */
|
||||
const char* attrib_name, /*!< name of HDF5 attribute to write */
|
||||
const hid_t attrib_type, /*!< HDF5 type of attribute */
|
||||
const void* attrib_value, /*!< value of attribute */
|
||||
@@ -69,23 +80,37 @@ h5_write_attrib (
|
||||
) {
|
||||
hid_t space_id;
|
||||
hid_t attrib_id;
|
||||
hid_t type_id;
|
||||
|
||||
hid_t id;
|
||||
TRY( _get_hdf5_obj_id(f, type, &id) );
|
||||
TRY( _get_hdf5_obj_id(f, mode, &id) );
|
||||
|
||||
if ( attrib_type == H5T_NATIVE_CHAR ) {
|
||||
TRY( type_id = h5priv_create_hdf5_string_type(f,
|
||||
attrib_nelem) );
|
||||
TRY( space_id = h5priv_create_hdf5_dataspace_scalar(f) );
|
||||
} else {
|
||||
type_id = attrib_type;
|
||||
TRY( space_id = h5priv_create_hdf5_dataspace (f,
|
||||
1, &attrib_nelem, NULL) );
|
||||
}
|
||||
|
||||
TRY( space_id = h5priv_create_hdf5_dataspace (f, 1, &attrib_nelem, NULL) );
|
||||
TRY( attrib_id = h5priv_create_hdf5_attribute (
|
||||
f,
|
||||
id,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
type_id,
|
||||
space_id,
|
||||
H5P_DEFAULT, H5P_DEFAULT) );
|
||||
|
||||
TRY( h5priv_write_hdf5_attribute (f, attrib_id, attrib_type, attrib_value) );
|
||||
TRY( h5priv_write_hdf5_attribute (f,
|
||||
attrib_id, type_id, attrib_value) );
|
||||
TRY( h5priv_close_hdf5_attribute (f, attrib_id) );
|
||||
TRY( h5priv_close_hdf5_dataspace (f, space_id) );
|
||||
|
||||
if ( attrib_type == H5T_NATIVE_CHAR )
|
||||
TRY( h5priv_close_hdf5_type(f, type_id) );
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -98,20 +123,20 @@ h5_write_attrib (
|
||||
*/
|
||||
h5_err_t
|
||||
h5_get_attrib_info (
|
||||
h5_file_t* const f, /*!< handle to open file */
|
||||
const char type, /*!< FILE or STEP flag */
|
||||
const h5_int64_t attrib_idx, /*!< index of attribute */
|
||||
char* attrib_name, /*!< OUT: name of attribute */
|
||||
const h5_int64_t len_attrib_name, /*!< buffer length */
|
||||
h5_int64_t* attrib_type, /*!< OUT: H5 type of attribute */
|
||||
h5_int64_t* attrib_nelem /*!< OUT: number of elements (dimension) */
|
||||
h5_file_t* const f, /*!< handle to open file */
|
||||
const char mode, /*!< FILE or STEP flag */
|
||||
const h5_size_t attrib_idx, /*!< index of attribute */
|
||||
char* attrib_name, /*!< OUT: name of attribute */
|
||||
const h5_size_t len_attrib_name, /*!< buffer length */
|
||||
h5_int64_t* attrib_type, /*!< OUT: H5 type of attribute */
|
||||
h5_size_t* attrib_nelem /*!< OUT: number of elements */
|
||||
) {
|
||||
hid_t attrib_id;
|
||||
hid_t mytype;
|
||||
hid_t space_id;
|
||||
|
||||
hid_t id;
|
||||
TRY( _get_hdf5_obj_id(f, type, &id) );
|
||||
TRY( _get_hdf5_obj_id(f, mode, &id) );
|
||||
|
||||
TRY( attrib_id = h5priv_open_hdf5_attribute_idx (
|
||||
f,
|
||||
@@ -151,11 +176,11 @@ h5_get_attrib_info (
|
||||
h5_ssize_t
|
||||
h5_get_num_attribs (
|
||||
h5_file_t *const f, /*!< handle to open file */
|
||||
const char type /*!< FILE or STEP flag */
|
||||
const char mode /*!< FILE or STEP flag */
|
||||
) {
|
||||
CHECK_FILEHANDLE (f);
|
||||
hid_t id;
|
||||
TRY( _get_hdf5_obj_id(f, type, &id) );
|
||||
TRY( _get_hdf5_obj_id(f, mode, &id) );
|
||||
return h5priv_get_num_hdf5_attribute (f, id);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
#define H5_STEPNAME "Step"
|
||||
#define H5_STEPWIDTH 1
|
||||
#define H5_BLOCKNAME "Block"
|
||||
#define H5_BLOCKNAME_X "0"
|
||||
#define H5_BLOCKNAME_Y "0"
|
||||
#define H5_BLOCKNAME_Z "0"
|
||||
|
||||
#include "h5_types_private.h"
|
||||
|
||||
@@ -22,6 +25,7 @@
|
||||
#include "h5u_types_private.h"
|
||||
|
||||
#include "h5b_errorhandling_private.h"
|
||||
#include "h5b_model_private.h"
|
||||
|
||||
#include "h5t_core_private.h"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <stdarg.h> /* va_arg - System dependent ?! */
|
||||
#include <string.h>
|
||||
|
||||
#include "h5_core.h"
|
||||
#include "h5core/h5_core.h"
|
||||
#include "h5_core_private.h"
|
||||
|
||||
static h5_errorhandler_t h5priv_errhandler = h5_report_errorhandler;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "h5_core.h"
|
||||
#include "h5core/h5_core.h"
|
||||
|
||||
/*!
|
||||
Compare two floating point numbers using integers. See
|
||||
|
||||
+99
-26
@@ -116,7 +116,7 @@ h5priv_close_hdf5_group (
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
hsize_t
|
||||
h5_ssize_t
|
||||
h5priv_get_num_objs_in_hdf5_group (
|
||||
h5_file_t* const f,
|
||||
const hid_t group_id
|
||||
@@ -129,7 +129,7 @@ h5priv_get_num_objs_in_hdf5_group (
|
||||
"Cannot get number of objects in group %s.",
|
||||
h5_get_objname(group_id));
|
||||
}
|
||||
return group_info.nlinks;
|
||||
return (h5_ssize_t)group_info.nlinks;
|
||||
}
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ h5priv_get_num_objs_in_hdf5_group (
|
||||
Get name of object given by index \c idx in group \c loc_id. If name is \c NULL,
|
||||
return size of name.
|
||||
*/
|
||||
ssize_t
|
||||
h5_ssize_t
|
||||
h5priv_get_hdf5_objname_by_idx (
|
||||
h5_file_t* const f,
|
||||
hid_t loc_id,
|
||||
@@ -244,7 +244,7 @@ h5priv_create_hdf5_dataset (
|
||||
\param[in] f file handle
|
||||
\param[in] dataset_id id of dataset to close
|
||||
*/
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_close_hdf5_dataset (
|
||||
h5_file_t* const f,
|
||||
const hid_t dset_id
|
||||
@@ -296,7 +296,7 @@ h5priv_get_hdf5_dataset_space (
|
||||
\param[in] buf buffer with date to write
|
||||
|
||||
*/
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_write_hdf5_dataset (
|
||||
h5_file_t* const f,
|
||||
const hid_t dataset_id,
|
||||
@@ -381,7 +381,7 @@ h5priv_get_hdf5_dataset_type (
|
||||
}
|
||||
|
||||
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_set_hdf5_dataset_extent (
|
||||
h5_file_t* const f,
|
||||
hid_t dset_id,
|
||||
@@ -397,7 +397,7 @@ h5priv_set_hdf5_dataset_extent (
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
hssize_t
|
||||
h5_ssize_t
|
||||
h5priv_get_npoints_of_hdf5_dataset (
|
||||
h5_file_t* const f,
|
||||
hid_t dset_id
|
||||
@@ -410,7 +410,7 @@ h5priv_get_npoints_of_hdf5_dataset (
|
||||
return size;
|
||||
}
|
||||
|
||||
hssize_t
|
||||
h5_ssize_t
|
||||
h5priv_get_npoints_of_hdf5_dataset_by_name (
|
||||
h5_file_t* const f,
|
||||
hid_t loc_id,
|
||||
@@ -452,7 +452,20 @@ h5priv_create_hdf5_dataspace (
|
||||
return dataspace_id;
|
||||
}
|
||||
|
||||
herr_t
|
||||
hid_t
|
||||
h5priv_create_hdf5_dataspace_scalar (
|
||||
h5_file_t* const f
|
||||
) {
|
||||
hid_t dataspace_id = H5Screate (H5S_SCALAR);
|
||||
if (dataspace_id < 0)
|
||||
h5_error (
|
||||
f,
|
||||
H5_ERR_HDF5,
|
||||
"Cannot create scalar dataspace.");
|
||||
return dataspace_id;
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5priv_select_hyperslab_of_hdf5_dataspace (
|
||||
h5_file_t* const f,
|
||||
hid_t space_id,
|
||||
@@ -478,7 +491,7 @@ h5priv_select_hyperslab_of_hdf5_dataspace (
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_select_elements_of_hdf5_dataspace (
|
||||
h5_file_t* const f,
|
||||
hid_t space_id,
|
||||
@@ -505,7 +518,7 @@ h5priv_select_elements_of_hdf5_dataspace (
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
hssize_t
|
||||
h5_ssize_t
|
||||
h5priv_get_selected_npoints_of_hdf5_dataspace (
|
||||
h5_file_t* const f,
|
||||
hid_t space_id
|
||||
@@ -519,7 +532,7 @@ h5priv_get_selected_npoints_of_hdf5_dataspace (
|
||||
return size;
|
||||
}
|
||||
|
||||
hssize_t
|
||||
h5_ssize_t
|
||||
h5priv_get_npoints_of_hdf5_dataspace (
|
||||
h5_file_t* const f,
|
||||
hid_t space_id
|
||||
@@ -556,7 +569,7 @@ h5priv_get_dims_of_hdf5_dataspace (
|
||||
\param[in] f file handle
|
||||
\param[in] dataspace_id id of space to close
|
||||
*/
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_close_hdf5_dataspace (
|
||||
h5_file_t* const f,
|
||||
const hid_t dataspace_id
|
||||
@@ -577,8 +590,8 @@ h5priv_close_hdf5_dataspace (
|
||||
|
||||
/****** D a t a t y p e ******************************************************/
|
||||
|
||||
static const char*
|
||||
get_base_type_name (
|
||||
const char*
|
||||
h5priv_get_base_type_name (
|
||||
h5_file_t* const f,
|
||||
hid_t base_type_id
|
||||
) {
|
||||
@@ -586,6 +599,7 @@ get_base_type_name (
|
||||
if (base_type_id == H5_INT64_T) return "H5_INT64_T";
|
||||
if (base_type_id == H5_FLOAT32_T) return "H5_FLOAT32_T";
|
||||
if (base_type_id == H5_FLOAT64_T) return "H5_FLOAT64_T";
|
||||
if (base_type_id == H5_STRING_T) return "H5_STRING_T";
|
||||
|
||||
return "[unknown]";
|
||||
}
|
||||
@@ -622,7 +636,7 @@ h5priv_create_hdf5_array_type (
|
||||
H5_ERR_HDF5,
|
||||
"Can't create array datatype object with base "
|
||||
"type %s and rank %d",
|
||||
get_base_type_name (f, base_type_id),
|
||||
h5priv_get_base_type_name (f, base_type_id),
|
||||
rank);
|
||||
}
|
||||
return type_id;
|
||||
@@ -646,7 +660,28 @@ h5priv_create_hdf5_type (
|
||||
return type_id;
|
||||
}
|
||||
|
||||
herr_t
|
||||
hid_t
|
||||
h5priv_create_hdf5_string_type(
|
||||
h5_file_t *const f,
|
||||
const hsize_t len
|
||||
) {
|
||||
hid_t type_id = H5Tcopy ( H5T_C_S1 );
|
||||
if (type_id < 0)
|
||||
return h5_error(
|
||||
f,
|
||||
H5_ERR_HDF5,
|
||||
"Can't duplicate C string type.");
|
||||
|
||||
herr_t herr = H5Tset_size ( type_id, len );
|
||||
if (herr < 0)
|
||||
return h5_error(
|
||||
f,
|
||||
H5_ERR_HDF5,
|
||||
"Can't set length of C string type.");
|
||||
return type_id;
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5priv_insert_hdf5_type (
|
||||
h5_file_t* const f,
|
||||
hid_t dtype_id,
|
||||
@@ -664,7 +699,7 @@ h5priv_insert_hdf5_type (
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_close_hdf5_type (
|
||||
h5_file_t* const f,
|
||||
hid_t dtype_id
|
||||
@@ -694,7 +729,29 @@ h5priv_create_hdf5_property (
|
||||
return prop_id;
|
||||
}
|
||||
|
||||
herr_t
|
||||
/*!
|
||||
Get create properties of existing dataset
|
||||
|
||||
\param[in] f file handle
|
||||
\param[in] dataset_id id of dataset
|
||||
|
||||
*/
|
||||
hid_t
|
||||
h5priv_get_hdf5_dataset_create_plist (
|
||||
h5_file_t* const f,
|
||||
const hid_t dataset_id
|
||||
) {
|
||||
hid_t plist_id = H5Dget_create_plist (dataset_id);
|
||||
if (plist_id < 0)
|
||||
return h5_error (
|
||||
f,
|
||||
H5_ERR_HDF5,
|
||||
"Cannot get create properties for dataset \"%s\".",
|
||||
h5_get_objname (dataset_id) );
|
||||
return plist_id;
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5priv_set_hdf5_chunk_property (
|
||||
h5_file_t* const f,
|
||||
hid_t plist,
|
||||
@@ -710,7 +767,23 @@ h5priv_set_hdf5_chunk_property (
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_get_hdf5_chunk_property (
|
||||
h5_file_t* const f,
|
||||
hid_t plist,
|
||||
int rank,
|
||||
hsize_t* dims
|
||||
) {
|
||||
if (H5Pget_chunk (plist, rank, dims) < 0)
|
||||
return h5_error (
|
||||
f,
|
||||
H5_ERR_HDF5,
|
||||
"Cannot get chunking property from list.");
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5priv_set_hdf5_layout_property (
|
||||
h5_file_t* const f,
|
||||
hid_t plist,
|
||||
@@ -858,7 +931,7 @@ h5priv_close_hdf5_property (
|
||||
|
||||
/****** F i l e **************************************************************/
|
||||
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_close_hdf5_file (
|
||||
h5_file_t* const f,
|
||||
hid_t fileid
|
||||
@@ -874,7 +947,7 @@ h5priv_close_hdf5_file (
|
||||
|
||||
/****** E r r o r h a n d l i n g ********************************************/
|
||||
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_set_hdf5_errorhandler (
|
||||
h5_file_t* const f,
|
||||
hid_t estack_id,
|
||||
@@ -975,7 +1048,7 @@ h5priv_create_hdf5_attribute (
|
||||
return attr_id;
|
||||
}
|
||||
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_read_hdf5_attribute (
|
||||
h5_file_t* const f,
|
||||
hid_t attr_id,
|
||||
@@ -996,7 +1069,7 @@ h5priv_read_hdf5_attribute (
|
||||
/*
|
||||
Wrapper for H5Awrite.
|
||||
*/
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_write_hdf5_attribute (
|
||||
h5_file_t* const f,
|
||||
hid_t attr_id,
|
||||
@@ -1076,7 +1149,7 @@ h5priv_get_num_hdf5_attribute (
|
||||
}
|
||||
|
||||
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_close_hdf5_attribute (
|
||||
h5_file_t* const f,
|
||||
hid_t attr_id
|
||||
@@ -1093,7 +1166,7 @@ h5priv_close_hdf5_attribute (
|
||||
}
|
||||
|
||||
/****** L i n k **************************************************************/
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_delete_hdf5_link (
|
||||
h5_file_t* const f,
|
||||
hid_t loc_id,
|
||||
|
||||
@@ -29,13 +29,13 @@ h5priv_close_hdf5_group (
|
||||
const hid_t group_id
|
||||
);
|
||||
|
||||
hsize_t
|
||||
h5_ssize_t
|
||||
h5priv_get_num_objs_in_hdf5_group (
|
||||
h5_file_t* const f,
|
||||
const hid_t group_id
|
||||
);
|
||||
|
||||
ssize_t
|
||||
h5_ssize_t
|
||||
h5priv_get_hdf5_objname_by_idx (
|
||||
h5_file_t* const f,
|
||||
hid_t loc_id,
|
||||
@@ -62,14 +62,14 @@ h5priv_create_hdf5_dataset (
|
||||
const hid_t create_proplist
|
||||
);
|
||||
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_close_hdf5_dataset (
|
||||
h5_file_t* const f,
|
||||
const hid_t dataset_id
|
||||
);
|
||||
|
||||
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_write_hdf5_dataset (
|
||||
h5_file_t* const f,
|
||||
const hid_t dataset_id,
|
||||
@@ -96,20 +96,20 @@ h5priv_get_hdf5_dataset_type (
|
||||
const hid_t dataset_id
|
||||
);
|
||||
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_set_hdf5_dataset_extent (
|
||||
h5_file_t* const f,
|
||||
hid_t dset_id,
|
||||
const hsize_t* size
|
||||
);
|
||||
|
||||
hssize_t
|
||||
h5_ssize_t
|
||||
h5priv_get_npoints_of_hdf5_dataset (
|
||||
h5_file_t* const f,
|
||||
hid_t dset_id
|
||||
);
|
||||
|
||||
hssize_t
|
||||
h5_ssize_t
|
||||
h5priv_get_npoints_of_hdf5_dataset_by_name (
|
||||
h5_file_t* const f,
|
||||
hid_t loc_id,
|
||||
@@ -125,13 +125,18 @@ h5priv_create_hdf5_dataspace (
|
||||
const hsize_t* maxdims
|
||||
);
|
||||
|
||||
hid_t
|
||||
h5priv_create_hdf5_dataspace_scalar (
|
||||
h5_file_t* const f
|
||||
);
|
||||
|
||||
hid_t
|
||||
h5priv_get_hdf5_dataset_space (
|
||||
h5_file_t* const f,
|
||||
const hid_t dataset_id
|
||||
);
|
||||
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_select_hyperslab_of_hdf5_dataspace (
|
||||
h5_file_t* const f,
|
||||
hid_t space_id,
|
||||
@@ -142,7 +147,7 @@ h5priv_select_hyperslab_of_hdf5_dataspace (
|
||||
const hsize_t* block
|
||||
);
|
||||
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_select_elements_of_hdf5_dataspace (
|
||||
h5_file_t* const f,
|
||||
hid_t space_id,
|
||||
@@ -151,19 +156,19 @@ h5priv_select_elements_of_hdf5_dataspace (
|
||||
const hsize_t* indices
|
||||
);
|
||||
|
||||
hssize_t
|
||||
h5_ssize_t
|
||||
h5priv_get_selected_npoints_of_hdf5_dataspace (
|
||||
h5_file_t* const f,
|
||||
hid_t space_id
|
||||
);
|
||||
|
||||
hssize_t
|
||||
h5_ssize_t
|
||||
h5priv_get_npoints_of_hdf5_dataspace (
|
||||
h5_file_t* const f,
|
||||
hid_t space_id
|
||||
);
|
||||
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_close_hdf5_dataspace (
|
||||
h5_file_t* const f,
|
||||
const hid_t dataspace_id
|
||||
@@ -193,7 +198,13 @@ h5priv_create_hdf5_type (
|
||||
const size_t size
|
||||
);
|
||||
|
||||
herr_t
|
||||
hid_t
|
||||
h5priv_create_hdf5_string_type(
|
||||
h5_file_t *const f,
|
||||
const hsize_t len
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5priv_insert_hdf5_type (
|
||||
h5_file_t* const f,
|
||||
hid_t dtype_id,
|
||||
@@ -202,7 +213,7 @@ h5priv_insert_hdf5_type (
|
||||
hid_t field_id
|
||||
);
|
||||
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_close_hdf5_type (
|
||||
h5_file_t* const f,
|
||||
hid_t dtype_id
|
||||
@@ -215,15 +226,29 @@ h5priv_create_hdf5_property (
|
||||
hid_t cls_id
|
||||
);
|
||||
|
||||
herr_t
|
||||
hid_t
|
||||
h5priv_get_hdf5_dataset_create_plist (
|
||||
h5_file_t* const f,
|
||||
const hid_t dataset_id
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5priv_set_hdf5_chunk_property (
|
||||
h5_file_t* const f,
|
||||
hid_t plist,
|
||||
int ndims,
|
||||
hsize_t* dim
|
||||
int rank,
|
||||
hsize_t* dims
|
||||
);
|
||||
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_get_hdf5_chunk_property (
|
||||
h5_file_t* const f,
|
||||
hid_t plist,
|
||||
int rank,
|
||||
hsize_t* dims
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5priv_set_hdf5_layout_property (
|
||||
h5_file_t* const f,
|
||||
hid_t plist,
|
||||
@@ -291,14 +316,14 @@ h5priv_close_hdf5_property (
|
||||
);
|
||||
|
||||
/*** file ***/
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_close_hdf5_file (
|
||||
h5_file_t* const f,
|
||||
hid_t fileid
|
||||
);
|
||||
|
||||
/*** error handling ***/
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_set_hdf5_errorhandler (
|
||||
h5_file_t* const f,
|
||||
hid_t estack_id,
|
||||
@@ -340,7 +365,7 @@ h5priv_create_hdf5_attribute (
|
||||
hid_t aapl_id
|
||||
);
|
||||
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_read_hdf5_attribute (
|
||||
h5_file_t* const f,
|
||||
hid_t attr_id,
|
||||
@@ -348,7 +373,7 @@ h5priv_read_hdf5_attribute (
|
||||
void* buf
|
||||
);
|
||||
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_write_hdf5_attribute (
|
||||
h5_file_t* const f,
|
||||
hid_t attr_id,
|
||||
@@ -356,7 +381,7 @@ h5priv_write_hdf5_attribute (
|
||||
const void* buf
|
||||
);
|
||||
|
||||
ssize_t
|
||||
h5_ssize_t
|
||||
h5priv_get_hdf5_attribute_name (
|
||||
h5_file_t* const f,
|
||||
hid_t attr_id,
|
||||
@@ -382,14 +407,20 @@ h5priv_get_num_hdf5_attribute (
|
||||
hid_t loc_id
|
||||
);
|
||||
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_close_hdf5_attribute (
|
||||
h5_file_t* const f,
|
||||
hid_t attr_id
|
||||
);
|
||||
|
||||
const char*
|
||||
h5priv_get_base_type_name (
|
||||
h5_file_t* const f,
|
||||
hid_t base_type_id
|
||||
);
|
||||
|
||||
/*** link ***/
|
||||
herr_t
|
||||
h5_err_t
|
||||
h5priv_delete_hdf5_link (
|
||||
h5_file_t* const f,
|
||||
hid_t loc_id,
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "h5_core.h"
|
||||
#include "h5core/h5_core.h"
|
||||
#include "h5_core_private.h"
|
||||
|
||||
/* [Aho,Sethi,Ullman] Compilers: Principles, Techniques and Tools, 1986
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "h5_core.h"
|
||||
#include "h5core/h5_core.h"
|
||||
#include "h5_core_private.h"
|
||||
|
||||
h5_err_t
|
||||
|
||||
@@ -143,5 +143,33 @@ h5priv_mpi_comm_rank (
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5priv_mpi_type_contiguous (
|
||||
h5_file_t* const f,
|
||||
const size_t nelems,
|
||||
const MPI_Datatype oldtype,
|
||||
MPI_Datatype *const newtype
|
||||
) {
|
||||
int err;
|
||||
err = MPI_Type_contiguous ( nelems, oldtype, newtype );
|
||||
if (err != MPI_SUCCESS)
|
||||
return h5_error (f, H5_ERR_MPI, "Cannot create new MPI type");
|
||||
err = MPI_Type_commit ( newtype );
|
||||
if (err != MPI_SUCCESS)
|
||||
return h5_error (f, H5_ERR_MPI, "Cannot commit new MPI type");
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5priv_mpi_type_free (
|
||||
h5_file_t* const f,
|
||||
MPI_Datatype *type
|
||||
) {
|
||||
int err = MPI_Type_free ( type );
|
||||
if (err != MPI_SUCCESS)
|
||||
return h5_error (f, H5_ERR_MPI, "Cannot free MPI type");
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
#endif // PARALLEL_IO
|
||||
|
||||
|
||||
@@ -69,5 +69,20 @@ h5priv_mpi_comm_rank (
|
||||
MPI_Comm comm,
|
||||
int* rank
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5priv_mpi_type_contiguous (
|
||||
h5_file_t* const f,
|
||||
const size_t nelems,
|
||||
const MPI_Datatype oldtype,
|
||||
MPI_Datatype *newtype
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5priv_mpi_type_free (
|
||||
h5_file_t* const f,
|
||||
MPI_Datatype *type
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <lustre/liblustreapi.h>
|
||||
#endif
|
||||
|
||||
#include "h5_core.h"
|
||||
#include "h5core/h5_core.h"
|
||||
#include "h5_core_private.h"
|
||||
|
||||
/*!
|
||||
@@ -27,7 +27,7 @@ h5_check_filehandle (
|
||||
h5_file_t* const f /*!< filehandle to check validity of */
|
||||
) {
|
||||
|
||||
if (f == NULL || f->file == 0) {
|
||||
if (f == NULL || f->file == 0 || f->u == NULL || f->b == NULL || f->t == NULL) {
|
||||
return h5_error (
|
||||
f,
|
||||
H5_ERR_BADFD,
|
||||
@@ -70,7 +70,7 @@ h5upriv_open_file (
|
||||
u->memshape = H5S_ALL;
|
||||
u->viewstart = -1;
|
||||
u->viewend = -1;
|
||||
u->viewindexed = 0;
|
||||
u->viewindexed = 0;
|
||||
|
||||
TRY( u->dcreate_prop = h5priv_create_hdf5_property(f, H5P_DATASET_CREATE) );
|
||||
|
||||
@@ -104,14 +104,19 @@ h5bpriv_open_file (
|
||||
size = f->nprocs * sizeof (b->write_layout[0]);
|
||||
TRY( b->write_layout = h5priv_alloc (f, NULL, size) );
|
||||
|
||||
b->step_idx = -1;
|
||||
b->blockgroup = -1;
|
||||
size_t n = sizeof (struct h5b_partition) / sizeof (h5_int64_t);
|
||||
TRY( h5priv_mpi_type_contiguous(f,
|
||||
n, MPI_LONG_LONG, &b->partition_mpi_t) );
|
||||
|
||||
b->shape = -1;
|
||||
b->diskshape = -1;
|
||||
b->memshape = -1;
|
||||
b->field_group_id = -1;
|
||||
b->block_gid = -1;
|
||||
b->field_gid = -1;
|
||||
b->have_layout = 0;
|
||||
|
||||
TRY( b->dcreate_prop = h5priv_create_hdf5_property(f, H5P_DATASET_CREATE) );
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -315,6 +320,9 @@ h5upriv_close_file (
|
||||
u->memshape = 0;
|
||||
}
|
||||
TRY( h5priv_close_hdf5_property (f, u->dcreate_prop) );
|
||||
free (f->u);
|
||||
f->u = NULL;
|
||||
|
||||
return f->__errno;
|
||||
}
|
||||
|
||||
@@ -329,15 +337,17 @@ h5upriv_close_file (
|
||||
\return H5_SUCCESS or error code
|
||||
*/
|
||||
static h5_int64_t
|
||||
h5bpriv_close_block (
|
||||
h5bpriv_close_file (
|
||||
h5_file_t* const f /*!< IN: file handle */
|
||||
) {
|
||||
struct h5b_fdata* b = f->b;
|
||||
|
||||
TRY( h5priv_close_hdf5_group (f, b->blockgroup) );
|
||||
TRY( h5priv_close_hdf5_group (f, b->block_gid) );
|
||||
TRY( h5priv_close_hdf5_dataspace (f, b->shape) );
|
||||
TRY( h5priv_close_hdf5_dataspace (f, b->diskshape) );
|
||||
TRY( h5priv_close_hdf5_dataspace (f, b->memshape) );
|
||||
TRY( h5priv_close_hdf5_property (f, b->dcreate_prop) );
|
||||
TRY( h5priv_mpi_type_free (f, b->partition_mpi_t) );
|
||||
free (f->b);
|
||||
f->b = NULL;
|
||||
|
||||
@@ -363,7 +373,7 @@ h5_close_file (
|
||||
|
||||
TRY( h5priv_close_step (f) );
|
||||
TRY( h5upriv_close_file (f) );
|
||||
TRY( h5bpriv_close_block (f) );
|
||||
TRY( h5bpriv_close_file (f) );
|
||||
TRY( h5tpriv_close_file (f) );
|
||||
TRY( h5priv_close_hdf5_group (f, f->step_gid) );
|
||||
TRY( h5priv_close_hdf5_property (f, f->xfer_prop) );
|
||||
@@ -449,6 +459,20 @@ h5_get_num_procs (
|
||||
return f->nprocs;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_filehandling
|
||||
|
||||
Provides access to the underlying HDF5 file handle.
|
||||
|
||||
\return Number of steps or error code
|
||||
*/
|
||||
hid_t
|
||||
h5_get_hdf5_file(
|
||||
h5_file_t* const f /*!< file handle */
|
||||
) {
|
||||
return f->file;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_filehandling
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <string.h>
|
||||
#include "h5_core.h"
|
||||
|
||||
#include "h5core/h5_core.h"
|
||||
#include "h5_core_private.h"
|
||||
|
||||
/*
|
||||
@@ -234,7 +235,7 @@ h5_set_step (
|
||||
/*!
|
||||
Normalize HDF5 type
|
||||
*/
|
||||
hid_t
|
||||
h5_int64_t
|
||||
h5_normalize_h5_type (
|
||||
h5_file_t* const f,
|
||||
hid_t type
|
||||
@@ -245,14 +246,22 @@ h5_normalize_h5_type (
|
||||
switch (tclass){
|
||||
case H5T_INTEGER:
|
||||
if (size==8) {
|
||||
return H5T_NATIVE_INT64;
|
||||
return H5_INT64_T;
|
||||
}
|
||||
else if (size==1) {
|
||||
return H5T_NATIVE_CHAR;
|
||||
else if (size==4) {
|
||||
return H5_INT32_T;
|
||||
}
|
||||
break;
|
||||
case H5T_FLOAT:
|
||||
return H5T_NATIVE_DOUBLE;
|
||||
if ( size==8 ) {
|
||||
return H5_FLOAT64_T;
|
||||
}
|
||||
else if ( size==4 ) {
|
||||
return H5_FLOAT32_T;
|
||||
}
|
||||
break;
|
||||
case H5T_STRING:
|
||||
return H5_STRING_T;
|
||||
default:
|
||||
; /* NOP */
|
||||
}
|
||||
@@ -273,7 +282,7 @@ h5_get_dataset_type(
|
||||
|
||||
TRY( dset_id = h5priv_open_hdf5_dataset (f, group_id, dset_name) );
|
||||
TRY( hdf5_type = h5priv_get_hdf5_dataset_type (f, dset_id) );
|
||||
h5_int64_t type = (h5_int64_t)h5_normalize_h5_type (f, hdf5_type);
|
||||
h5_int64_t type = h5_normalize_h5_type (f, hdf5_type);
|
||||
TRY( h5priv_close_hdf5_type (f, hdf5_type) );
|
||||
TRY( h5priv_close_hdf5_dataset (f, dset_id) );
|
||||
|
||||
@@ -294,6 +303,7 @@ h5_has_index (
|
||||
|
||||
h5_err_t
|
||||
h5_normalize_dataset_name (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
char *name2
|
||||
) {
|
||||
@@ -305,6 +315,14 @@ h5_normalize_dataset_name (
|
||||
strcpy ( name2, name );
|
||||
}
|
||||
|
||||
if ( strcmp( name2, H5_BLOCKNAME ) == 0 ) {
|
||||
h5_error (f,
|
||||
H5_ERR_INVAL,
|
||||
"Can't create dataset or field with name '%s' because it is "
|
||||
"reserved by H5Block.",
|
||||
H5_BLOCKNAME);
|
||||
}
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <search.h>
|
||||
|
||||
#include "h5_core.h"
|
||||
#include "h5core/h5_core.h"
|
||||
#include "h5_core_private.h"
|
||||
|
||||
void*
|
||||
@@ -10,7 +10,7 @@ h5priv_alloc (
|
||||
void* ptr,
|
||||
const size_t size
|
||||
) {
|
||||
h5_debug (f, "Allocating %ld bytes.", size);
|
||||
h5_debug (f, "Allocating %lu bytes.", size);
|
||||
ptr = realloc (ptr, size);
|
||||
if (ptr == NULL) {
|
||||
h5_error (f, H5_ERR_NOMEM, "Out of memory.");
|
||||
@@ -25,7 +25,7 @@ h5priv_calloc (
|
||||
const size_t count,
|
||||
const size_t size
|
||||
) {
|
||||
h5_debug (f, "Allocating %ld * %ld bytes.", count, size);
|
||||
h5_debug (f, "Allocating %lu * %lu bytes.", count, size);
|
||||
void* ptr = calloc (count, size);
|
||||
if (ptr == NULL) {
|
||||
h5_error (f, H5_ERR_NOMEM, "Out of memory.");
|
||||
@@ -42,7 +42,7 @@ h5priv_free (
|
||||
if (ptr) free (ptr);
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
h5priv_tsearch (
|
||||
h5_file_t* const f,
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
#include "h5core/h5_core.h"
|
||||
#include "h5_core_private.h"
|
||||
|
||||
h5_err_t
|
||||
h5_write_field_attrib (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const hid_t attrib_type, /*!< IN: attribute type */
|
||||
const void *attrib_value, /*!< IN: attribute value */
|
||||
const h5_int64_t attrib_nelem /*!< IN: number of elements */
|
||||
) {
|
||||
|
||||
TRY( h5bpriv_open_field_group(f, field_name) );
|
||||
|
||||
TRY( h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FIELD,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value,
|
||||
attrib_nelem) );
|
||||
|
||||
return h5bpriv_close_field_group(f);
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
h5b_get_num_field_attribs (
|
||||
h5_file_t *const f, /*<! IN: file handle */
|
||||
const char *field_name /*<! IN: field name */
|
||||
) {
|
||||
|
||||
h5_ssize_t n;
|
||||
|
||||
TRY( h5bpriv_open_field_group(f, field_name) );
|
||||
TRY( n = h5priv_get_num_hdf5_attribute(f, f->b->field_gid ) );
|
||||
TRY( h5bpriv_close_field_group(f) );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Query information about a attribute given by index \c attrib_idx and
|
||||
field name \c field_name. The function returns the name of the attribute,
|
||||
the type of the attribute and the number of elements of this type.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
h5b_get_field_attrib_info (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const h5_size_t attrib_idx, /*!< IN: attribute index */
|
||||
char *attrib_name, /*!< OUT: attribute name */
|
||||
const h5_size_t len_attrib_name, /*!< IN: buffer size */
|
||||
h5_int64_t *attrib_type, /*!< OUT: attribute type */
|
||||
h5_size_t *attrib_nelem /*!< OUT: number of elements */
|
||||
) {
|
||||
|
||||
TRY( h5bpriv_open_field_group(f, field_name) );
|
||||
|
||||
return h5_get_attrib_info (
|
||||
f,
|
||||
H5_ATTRIB_FIELD,
|
||||
attrib_idx,
|
||||
attrib_name,
|
||||
len_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,781 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "h5core/h5_core.h"
|
||||
#include "h5_core_private.h"
|
||||
|
||||
/*!
|
||||
\note
|
||||
A partition must not be part of another partition.
|
||||
|
||||
A partition must not divide another partition into two pieces.
|
||||
|
||||
After handling the ghost zones, the partition must not be empty
|
||||
|
||||
We must track the overall size somewhere. This is a good place to do it. (?)
|
||||
*/
|
||||
|
||||
static void
|
||||
_normalize_partition (
|
||||
struct h5b_partition *p /*!< IN/OUT: partition */
|
||||
) {
|
||||
h5_int64_t x;
|
||||
|
||||
if ( p->i_start > p->i_end ) {
|
||||
x = p->i_start;
|
||||
p->i_start = p->i_end;
|
||||
p->i_end = x;
|
||||
}
|
||||
if ( p->j_start > p->j_end ) {
|
||||
x = p->j_start;
|
||||
p->j_start = p->j_end;
|
||||
p->j_end = x;
|
||||
}
|
||||
if ( p->k_start > p->k_end ) {
|
||||
x = p->k_start;
|
||||
p->k_start = p->k_end;
|
||||
p->k_end = x;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_private
|
||||
|
||||
\internal
|
||||
|
||||
Gather layout to all processors
|
||||
|
||||
\return H5_SUCCESS or error code
|
||||
*/
|
||||
static h5_err_t
|
||||
_allgather (
|
||||
h5_file_t *const f /*!< IN: file handle */
|
||||
) {
|
||||
#ifdef PARALLEL_IO
|
||||
struct h5b_partition *partition = &f->b->user_layout[f->myproc];
|
||||
struct h5b_partition *layout = f->b->user_layout;
|
||||
|
||||
TRY( h5priv_mpi_allgather(f,
|
||||
partition, 1, f->b->partition_mpi_t,
|
||||
layout, 1, f->b->partition_mpi_t, f->comm) );
|
||||
#endif
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_private
|
||||
|
||||
\internal
|
||||
|
||||
Get dimension sizes of block. These informations are stored inside the
|
||||
block structure.
|
||||
*/
|
||||
static void
|
||||
_get_dimension_sizes (
|
||||
h5_file_t *const f /*!< IN: file handle */
|
||||
) {
|
||||
int proc;
|
||||
struct h5b_fdata *b = f->b;
|
||||
struct h5b_partition *partition = b->user_layout;
|
||||
|
||||
b->i_max = 0;
|
||||
b->j_max = 0;
|
||||
b->k_max = 0;
|
||||
|
||||
for ( proc = 0; proc < f->nprocs; proc++, partition++ ) {
|
||||
if ( partition->i_end > b->i_max ) b->i_max = partition->i_end;
|
||||
if ( partition->j_end > b->j_max ) b->j_max = partition->j_end;
|
||||
if ( partition->k_end > b->k_max ) b->k_max = partition->k_end;
|
||||
}
|
||||
}
|
||||
|
||||
#define _NO_GHOSTZONE(p,q) ( (p->i_end < q->i_start) \
|
||||
|| (p->j_end < q->j_start) \
|
||||
|| (p->k_end < q->k_start) )
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5block_private
|
||||
|
||||
\internal
|
||||
|
||||
Check whether two partitions have a common ghost-zone.
|
||||
|
||||
\return value != \c 0 if yes otherwise \c 0
|
||||
*/
|
||||
static int
|
||||
_have_ghostzone (
|
||||
const struct h5b_partition *p, /*!< IN: partition \c p */
|
||||
const struct h5b_partition *q /*!< IN: partition \c q */
|
||||
) {
|
||||
return ( ! ( _NO_GHOSTZONE ( p, q ) || _NO_GHOSTZONE ( q, p ) ) );
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_private
|
||||
|
||||
\internal
|
||||
|
||||
Calculate volume of partition.
|
||||
|
||||
\return volume
|
||||
*/
|
||||
static h5_int64_t
|
||||
_volume_of_partition (
|
||||
const struct h5b_partition *p /*!< IN: partition */
|
||||
) {
|
||||
return (p->i_end - p->i_start)
|
||||
* (p->j_end - p->j_start)
|
||||
* (p->k_end - p->k_start);
|
||||
|
||||
}
|
||||
|
||||
#define MIN( x, y ) ( (x) <= (y) ? (x) : (y) )
|
||||
#define MAX( x, y ) ( (x) >= (y) ? (x) : (y) )
|
||||
|
||||
/*!
|
||||
\ingroup h5block_private
|
||||
|
||||
\internal
|
||||
|
||||
Calc volume of ghost-zone.
|
||||
|
||||
\return volume
|
||||
*/
|
||||
static h5_int64_t
|
||||
_volume_of_ghostzone (
|
||||
const struct h5b_partition *p, /*!< IN: ptr to first partition */
|
||||
const struct h5b_partition *q /*!< IN: ptr to second partition */
|
||||
) {
|
||||
|
||||
h5_int64_t dx = MIN ( p->i_end, q->i_end )
|
||||
- MAX ( p->i_start, q->i_start ) + 1;
|
||||
h5_int64_t dy = MIN ( p->j_end, q->j_end )
|
||||
- MAX ( p->j_start, q->j_start ) + 1;
|
||||
h5_int64_t dz = MIN ( p->k_end, q->k_end )
|
||||
- MAX ( p->k_start, q->k_start ) + 1;
|
||||
|
||||
return dx * dy * dz;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_private
|
||||
|
||||
\internal
|
||||
|
||||
Dissolve ghost-zone by moving the X coordinates. Nothing will be changed
|
||||
if \c { p->i_start <= q->i_end <= p->i_end }. In this case \c -1 will be
|
||||
returned.
|
||||
|
||||
\return H5_SUCCESS or -1
|
||||
*/
|
||||
static h5_int64_t
|
||||
_dissolve_X_ghostzone (
|
||||
struct h5b_partition *p, /*!< IN/OUT: ptr to first partition */
|
||||
struct h5b_partition *q /*!< IN/OUT: ptr to second partition */
|
||||
) {
|
||||
|
||||
if ( p->i_start > q->i_start )
|
||||
return _dissolve_X_ghostzone( q, p );
|
||||
|
||||
if ( q->i_end <= p->i_end ) /* no dissolving */
|
||||
return -1;
|
||||
|
||||
p->i_end = ( p->i_end + q->i_start ) >> 1;
|
||||
q->i_start = p->i_end + 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_private
|
||||
|
||||
\internal
|
||||
|
||||
Dissolve ghost-zone by moving the Y coordinates. Nothing will be changed
|
||||
if \c { p->j_start <= q->j_end <= p->j_end }. In this case \c -1 will be
|
||||
returned.
|
||||
|
||||
\return H5_SUCCESS or -1
|
||||
*/
|
||||
static h5_int64_t
|
||||
_dissolve_Y_ghostzone (
|
||||
struct h5b_partition *p, /*!< IN/OUT: ptr to first partition */
|
||||
struct h5b_partition *q /*!< IN/OUT: ptr to second partition */
|
||||
) {
|
||||
|
||||
if ( p->j_start > q->j_start )
|
||||
return _dissolve_Y_ghostzone( q, p );
|
||||
|
||||
if ( q->j_end <= p->j_end ) /* no dissolving */
|
||||
return -1;
|
||||
|
||||
p->j_end = ( p->j_end + q->j_start ) >> 1;
|
||||
q->j_start = p->j_end + 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_private
|
||||
|
||||
\internal
|
||||
|
||||
Dissolve ghost-zone by moving the Z coordinates. Nothing will be changed
|
||||
if \c { p->k_start <= q->k_end <= p->k_end }. In this case \c -1 will be
|
||||
returned.
|
||||
|
||||
\return H5_SUCCESS or -1
|
||||
*/
|
||||
static h5_int64_t
|
||||
_dissolve_Z_ghostzone (
|
||||
struct h5b_partition *p, /*!< IN/OUT: ptr to first partition */
|
||||
struct h5b_partition *q /*!< IN/OUT: ptr to second partition */
|
||||
) {
|
||||
|
||||
if ( p->k_start > q->k_start )
|
||||
return _dissolve_Z_ghostzone( q, p );
|
||||
|
||||
if ( q->k_end <= p->k_end ) /* no dissolving */
|
||||
return -1;
|
||||
|
||||
p->k_end = ( p->k_end + q->k_start ) >> 1;
|
||||
q->k_start = p->k_end + 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_private
|
||||
|
||||
\internal
|
||||
|
||||
Dissolve ghost-zone for partitions \p and \q.
|
||||
|
||||
Dissolving is done by moving either the X, Y or Z plane. We never move
|
||||
more than one plane per partition. Thus we always have three possibilities
|
||||
to dissolve the ghost-zone. The "best" is the one with the largest
|
||||
remaining volume of the partitions.
|
||||
|
||||
\return H5_SUCCESS or error code.
|
||||
*/
|
||||
static h5_int64_t
|
||||
_dissolve_ghostzone (
|
||||
h5_file_t *const f,
|
||||
struct h5b_partition *p, /*!< IN/OUT: ptr to first partition */
|
||||
struct h5b_partition *q /*!< IN/OUT: ptr to second partition */
|
||||
) {
|
||||
|
||||
struct h5b_partition p_;
|
||||
struct h5b_partition q_;
|
||||
struct h5b_partition p_best;
|
||||
struct h5b_partition q_best;
|
||||
h5_int64_t vol;
|
||||
h5_int64_t max_vol = 0;
|
||||
|
||||
p_ = *p;
|
||||
q_ = *q;
|
||||
if ( _dissolve_X_ghostzone ( &p_, &q_ ) == 0 ) {
|
||||
vol = _volume_of_partition ( &p_ )
|
||||
+ _volume_of_partition ( &q_ );
|
||||
if ( vol > max_vol ) {
|
||||
max_vol = vol;
|
||||
p_best = p_;
|
||||
q_best = q_;
|
||||
}
|
||||
}
|
||||
|
||||
p_ = *p;
|
||||
q_ = *q;
|
||||
if ( _dissolve_Y_ghostzone ( &p_, &q_ ) == 0 ) {
|
||||
vol = _volume_of_partition ( &p_ )
|
||||
+ _volume_of_partition ( &q_ );
|
||||
if ( vol > max_vol ) {
|
||||
max_vol = vol;
|
||||
p_best = p_;
|
||||
q_best = q_;
|
||||
}
|
||||
}
|
||||
p_ = *p;
|
||||
q_ = *q;
|
||||
|
||||
if ( _dissolve_Z_ghostzone ( &p_, &q_ ) == 0 ) {
|
||||
vol = _volume_of_partition ( &p_ )
|
||||
+ _volume_of_partition ( &q_ );
|
||||
if ( vol > max_vol ) {
|
||||
max_vol = vol;
|
||||
p_best = p_;
|
||||
q_best = q_;
|
||||
}
|
||||
}
|
||||
if ( max_vol <= 0 ) {
|
||||
return h5_error (f,
|
||||
H5_ERR_LAYOUT,
|
||||
"Cannot dissolve ghostzones in specified layout!" );
|
||||
}
|
||||
*p = p_best;
|
||||
*q = q_best;
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_private
|
||||
|
||||
\internal
|
||||
|
||||
Dissolve all ghost-zones.
|
||||
|
||||
Ghost-zone are dissolved in the order of their magnitude, largest first.
|
||||
|
||||
\note
|
||||
Dissolving ghost-zones automaticaly is not trivial! The implemented
|
||||
algorithmn garanties, that there are no ghost-zones left and that we
|
||||
have the same result on all processors.
|
||||
But there may be zones which are not assigned to a partition any more.
|
||||
May be we should check this and return an error in this case. Then
|
||||
the user have to decide to continue or to abort.
|
||||
|
||||
\b {Error Codes}
|
||||
\b H5PART_NOMEM_ERR
|
||||
|
||||
\return H5_SUCCESS or error code.
|
||||
*/
|
||||
static h5_int64_t
|
||||
_dissolve_ghostzones (
|
||||
h5_file_t *const f /*!< IN: file handle */
|
||||
) {
|
||||
|
||||
struct h5b_fdata *b = f->b;
|
||||
struct h5b_partition *p;
|
||||
struct h5b_partition *q;
|
||||
int proc_p, proc_q;
|
||||
|
||||
struct list {
|
||||
struct list *prev;
|
||||
struct list *next;
|
||||
struct h5b_partition *p;
|
||||
struct h5b_partition *q;
|
||||
h5_int64_t vol;
|
||||
} *p_begin, *p_el, *p_max, *p_end, *p_save;
|
||||
|
||||
memcpy ( b->write_layout, b->user_layout,
|
||||
f->nprocs * sizeof (*f->b->user_layout) );
|
||||
|
||||
TRY( p_begin = (struct list*)h5priv_alloc(f, NULL, sizeof(*p_begin)) );
|
||||
p_max = p_end = p_begin;
|
||||
|
||||
memset ( p_begin, 0, sizeof ( *p_begin ) );
|
||||
|
||||
for ( proc_p = 0, p = b->write_layout;
|
||||
proc_p < f->nprocs-1;
|
||||
proc_p++, p++ ) {
|
||||
for ( proc_q = proc_p+1, q = &b->write_layout[proc_q];
|
||||
proc_q < f->nprocs;
|
||||
proc_q++, q++ ) {
|
||||
|
||||
if ( _have_ghostzone ( p, q ) ) {
|
||||
TRY( p_el = (struct list*)h5priv_alloc(f, NULL, sizeof(*p_el)) );
|
||||
|
||||
p_el->p = p;
|
||||
p_el->q = q;
|
||||
p_el->vol = _volume_of_ghostzone ( p, q );
|
||||
p_el->prev = p_end;
|
||||
p_el->next = NULL;
|
||||
|
||||
if ( p_el->vol > p_max->vol )
|
||||
p_max = p_el;
|
||||
|
||||
p_end->next = p_el;
|
||||
p_end = p_el;
|
||||
}
|
||||
}
|
||||
}
|
||||
while ( p_begin->next ) {
|
||||
if ( p_max->next ) p_max->next->prev = p_max->prev;
|
||||
p_max->prev->next = p_max->next;
|
||||
|
||||
_dissolve_ghostzone ( f, p_max->p, p_max->q );
|
||||
|
||||
free ( p_max );
|
||||
p_el = p_max = p_begin->next;
|
||||
|
||||
while ( p_el ) {
|
||||
if ( _have_ghostzone ( p_el->p, p_el->q ) ) {
|
||||
p_el->vol = _volume_of_ghostzone ( p_el->p, p_el->q );
|
||||
if ( p_el->vol > p_max->vol )
|
||||
p_max = p_el;
|
||||
p_el = p_el->next;
|
||||
} else {
|
||||
if ( p_el->next )
|
||||
p_el->next->prev = p_el->prev;
|
||||
p_el->prev->next = p_el->next;
|
||||
p_save = p_el->next;
|
||||
free ( p_el );
|
||||
p_el = p_save;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
free ( p_begin );
|
||||
|
||||
p = &b->user_layout[f->myproc];
|
||||
h5_debug (f,
|
||||
"PROC[%d]: User layout: %lld:%lld, %lld:%lld, %lld:%lld",
|
||||
f->myproc,
|
||||
(long long)p->i_start, (long long)p->i_end,
|
||||
(long long)p->j_start, (long long)p->j_end,
|
||||
(long long)p->k_start, (long long)p->k_end );
|
||||
/* more detailed debug output: all procs report their view
|
||||
of all other procs */
|
||||
for ( proc_p = 0, p = b->user_layout;
|
||||
proc_p < f->nprocs;
|
||||
proc_p++, p++ ) {
|
||||
h5_debug (f,
|
||||
"PROC[%d]: proc[%d]: User layout: %lld:%lld, %lld:%lld, %lld:%lld ",
|
||||
f->myproc, proc_p,
|
||||
(long long)p->i_start, (long long)p->i_end,
|
||||
(long long)p->j_start, (long long)p->j_end,
|
||||
(long long)p->k_start, (long long)p->k_end );
|
||||
}
|
||||
|
||||
p = &b->write_layout[f->myproc];
|
||||
h5_debug (f,
|
||||
"PROC[%d]: Ghost-zone layout: %lld:%lld, %lld:%lld, %lld:%lld",
|
||||
f->myproc,
|
||||
(long long)p->i_start, (long long)p->i_end,
|
||||
(long long)p->j_start, (long long)p->j_end,
|
||||
(long long)p->k_start, (long long)p->k_end );
|
||||
/* more detailed debug output: all procs report their view
|
||||
of all other procs */
|
||||
for ( proc_p = 0, p = b->write_layout;
|
||||
proc_p < f->nprocs;
|
||||
proc_p++, p++ ) {
|
||||
h5_debug (f,
|
||||
"PROC[%d]: proc[%d]: Ghost-zone layout: %lld:%lld, %lld:%lld, %lld:%lld ",
|
||||
f->myproc, proc_p,
|
||||
(long long)p->i_start, (long long)p->i_end,
|
||||
(long long)p->j_start, (long long)p->j_end,
|
||||
(long long)p->k_start, (long long)p->k_end );
|
||||
}
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_private
|
||||
|
||||
\internal
|
||||
|
||||
*/
|
||||
static h5_err_t
|
||||
_release_hyperslab (
|
||||
h5_file_t *const f /*!< IN: file handle */
|
||||
) {
|
||||
if ( f->b->shape > 0 ) {
|
||||
TRY( h5priv_close_hdf5_dataspace(f, f->b->shape) );
|
||||
f->b->shape = -1;
|
||||
}
|
||||
if ( f->b->diskshape > 0 ) {
|
||||
TRY( h5priv_close_hdf5_dataspace(f, f->b->diskshape) );
|
||||
f->b->diskshape = -1;
|
||||
}
|
||||
if ( f->b->memshape > 0 ) {
|
||||
TRY( h5priv_close_hdf5_dataspace(f, f->b->memshape) );
|
||||
f->b->memshape = -1;
|
||||
}
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
_open_block_group (
|
||||
h5_file_t *const f /*!< IN: file handle */
|
||||
) {
|
||||
|
||||
struct h5b_fdata *b = f->b;
|
||||
|
||||
if ( b->block_gid >= 0) {
|
||||
TRY( h5priv_close_hdf5_group(f, b->block_gid) );
|
||||
b->block_gid = -1;
|
||||
}
|
||||
|
||||
if ( b->block_gid < 0 ) {
|
||||
TRY( b->block_gid = h5priv_open_hdf5_group(f,
|
||||
f->step_gid, H5_BLOCKNAME) );
|
||||
}
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5bpriv_open_field_group (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name
|
||||
) {
|
||||
|
||||
char name2[H5_DATANAME_LEN];
|
||||
h5_normalize_dataset_name(f, name, name2);
|
||||
|
||||
TRY( _open_block_group ( f ) );
|
||||
TRY( f->b->field_gid = h5priv_open_hdf5_group(f, f->b->block_gid, name2) );
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5bpriv_close_field_group (
|
||||
h5_file_t *const f /*!< IN: file handle */
|
||||
) {
|
||||
|
||||
if ( f->b->field_gid >= 0 ) {
|
||||
TRY( h5priv_close_hdf5_group(f, f->b->field_gid) );
|
||||
}
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_set_view (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const h5_size_t i_start, /*!< IN: start index of \c i */
|
||||
const h5_size_t i_end, /*!< IN: end index of \c i */
|
||||
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 */
|
||||
) {
|
||||
|
||||
struct h5b_fdata *b = f->b;
|
||||
struct h5b_partition *p = &b->user_layout[f->myproc];
|
||||
p->i_start = i_start;
|
||||
p->i_end = i_end;
|
||||
p->j_start = j_start;
|
||||
p->j_end = j_end;
|
||||
p->k_start = k_start;
|
||||
p->k_end = k_end;
|
||||
|
||||
_normalize_partition ( p );
|
||||
TRY( _allgather( f ) );
|
||||
_get_dimension_sizes ( f );
|
||||
TRY( _dissolve_ghostzones ( f ) );
|
||||
TRY( _release_hyperslab ( f ) );
|
||||
b->have_layout = 1;
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_set_chunk (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const h5_size_t i, /*!< IN: size of \c i */
|
||||
const h5_size_t j, /*!< IN: size of \c j */
|
||||
const h5_size_t k /*!< IN: size of \c k */
|
||||
) {
|
||||
|
||||
if ( i == 0 || j == 0 || k == 0 )
|
||||
{
|
||||
h5_info(f, "Disabling chunking" );
|
||||
TRY( h5priv_set_hdf5_layout_property(f,
|
||||
f->b->dcreate_prop, H5D_CONTIGUOUS) );
|
||||
} else
|
||||
{
|
||||
h5_info(f, "Setting chunk to (%lld,%lld,%lld)",
|
||||
(long long)i, (long long)j, (long long)k);
|
||||
hsize_t dims[3] = { k, j, i };
|
||||
TRY( h5priv_set_hdf5_chunk_property(f,
|
||||
f->b->dcreate_prop, 1, dims) );
|
||||
}
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_get_chunk (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const char *field_name, /*!< IN: name of dataset */
|
||||
h5_size_t *dims /*!< OUT: array containing the chunk dimensions */
|
||||
) {
|
||||
|
||||
CHECK_TIMEGROUP ( f );
|
||||
|
||||
struct h5b_fdata *b = f->b;
|
||||
|
||||
TRY( h5bpriv_open_field_group ( f, field_name ) );
|
||||
|
||||
hid_t dataset_id;
|
||||
hid_t plist_id;
|
||||
hsize_t hdims[3];
|
||||
|
||||
TRY( dataset_id = h5priv_open_hdf5_dataset(f, b->field_gid, H5_BLOCKNAME_X) );
|
||||
TRY( plist_id = h5priv_get_hdf5_dataset_create_plist(f, dataset_id) );
|
||||
TRY( h5priv_get_hdf5_chunk_property(f, plist_id, 3, hdims) );
|
||||
TRY( h5priv_close_hdf5_property(f, plist_id) );
|
||||
TRY( h5priv_close_hdf5_dataset(f, dataset_id) );
|
||||
|
||||
dims[0] = hdims[2];
|
||||
dims[1] = hdims[1];
|
||||
dims[2] = hdims[0];
|
||||
|
||||
h5_info(f,
|
||||
"Found chunk dimensions (%lld,%lld,%lld)",
|
||||
(long long)dims[0],
|
||||
(long long)dims[1],
|
||||
(long long)dims[2] );
|
||||
|
||||
TRY( h5bpriv_close_field_group( f ) );
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_get_view (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const int proc, /*!< IN: Processor to get partition from */
|
||||
h5_size_t *i_start, /*!< OUT: start index of \c i */
|
||||
h5_size_t *i_end, /*!< OUT: end index of \c i */
|
||||
h5_size_t *j_start, /*!< OUT: start index of \c j */
|
||||
h5_size_t *j_end, /*!< OUT: end index of \c j */
|
||||
h5_size_t *k_start, /*!< OUT: start index of \c k */
|
||||
h5_size_t *k_end /*!< OUT: end index of \c k */
|
||||
) {
|
||||
|
||||
if ( ( proc < 0 ) || ( proc >= f->nprocs ) )
|
||||
return h5_error(f, H5_ERR_INVAL, "Invalid processor id %d!", proc);
|
||||
|
||||
struct h5b_partition *p = &f->b->user_layout[(size_t)proc];
|
||||
|
||||
*i_start = p->i_start;
|
||||
*i_end = p->i_end;
|
||||
*j_start = p->j_start;
|
||||
*j_end = p->j_end;
|
||||
*k_start = p->k_start;
|
||||
*k_end = p->k_end;
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_get_reduced_view (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const int proc, /*!< IN: Processor to get partition from */
|
||||
h5_size_t *i_start, /*!< OUT: start index of \c i */
|
||||
h5_size_t *i_end, /*!< OUT: end index of \c i */
|
||||
h5_size_t *j_start, /*!< OUT: start index of \c j */
|
||||
h5_size_t *j_end, /*!< OUT: end index of \c j */
|
||||
h5_size_t *k_start, /*!< OUT: start index of \c k */
|
||||
h5_size_t *k_end /*!< OUT: end index of \c k */
|
||||
) {
|
||||
|
||||
if ( ( proc < 0 ) || ( proc >= f->nprocs ) )
|
||||
return h5_error(f, H5_ERR_INVAL, "Invalid processor id %d!", proc);
|
||||
|
||||
struct h5b_partition *p = &f->b->write_layout[(size_t)proc];
|
||||
|
||||
*i_start = p->i_start;
|
||||
*i_end = p->i_end;
|
||||
*j_start = p->j_start;
|
||||
*j_end = p->j_end;
|
||||
*k_start = p->k_start;
|
||||
*k_end = p->k_end;
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
h5b_3d_get_proc (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const h5_int64_t i, /*!< IN: \c i coordinate */
|
||||
const h5_int64_t j, /*!< IN: \c j coordinate */
|
||||
const h5_int64_t k /*!< IN: \c k coordinate */
|
||||
) {
|
||||
|
||||
struct h5b_partition *layout = f->b->write_layout;
|
||||
int proc;
|
||||
|
||||
for ( proc = 0; proc < f->nprocs; proc++, layout++ ) {
|
||||
if ( (layout->i_start <= i) && (i <= layout->i_end) &&
|
||||
(layout->j_start <= j) && (j <= layout->j_end) &&
|
||||
(layout->k_start <= k) && (k <= layout->k_end) )
|
||||
return proc;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
h5b_get_num_fields (
|
||||
h5_file_t *const f /*!< IN: File handle */
|
||||
) {
|
||||
|
||||
TRY( _open_block_group(f) );
|
||||
return h5priv_get_num_objs_in_hdf5_group( f, f->b->block_gid );
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5b_get_field_info_by_name (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< OUT: field name */
|
||||
h5_size_t *grid_rank, /*!< OUT: grid rank */
|
||||
h5_size_t *grid_dims, /*!< OUT: grid dimensions */
|
||||
h5_size_t *field_rank, /*!< OUT: field rank */
|
||||
h5_int64_t *type /*!< OUT: datatype */
|
||||
) {
|
||||
|
||||
hsize_t dims[16]; /* give it plenty of space even though we don't expect rank > 3 */
|
||||
hsize_t _grid_rank, _field_rank;
|
||||
h5_size_t i, j;
|
||||
|
||||
TRY( h5bpriv_open_field_group(f, name) );
|
||||
|
||||
hid_t dataset_id;
|
||||
hid_t dataspace_id;
|
||||
|
||||
TRY( dataset_id = h5priv_open_hdf5_dataset(f,
|
||||
f->b->field_gid, H5_BLOCKNAME_X) );
|
||||
TRY( dataspace_id = h5priv_get_hdf5_dataset_space(f, dataset_id) );
|
||||
|
||||
TRY( _grid_rank = h5priv_get_dims_of_hdf5_dataspace(f,
|
||||
dataspace_id, dims, NULL) );
|
||||
if ( grid_rank ) *grid_rank = (h5_size_t) _grid_rank;
|
||||
|
||||
if ( grid_dims ) {
|
||||
for ( i = 0, j = _grid_rank-1; i < _grid_rank; i++, j-- )
|
||||
grid_dims[i] = (h5_size_t)dims[j];
|
||||
}
|
||||
|
||||
TRY( _field_rank = h5priv_get_num_objs_in_hdf5_group(f,
|
||||
f->b->block_gid) );
|
||||
if ( field_rank ) *field_rank = (h5_size_t) _field_rank;
|
||||
|
||||
hid_t h5type;
|
||||
TRY( h5type = h5priv_get_hdf5_dataset_type(f, dataset_id) );
|
||||
|
||||
if ( type )
|
||||
TRY( *type = h5_normalize_h5_type(f, h5type) );
|
||||
|
||||
TRY( h5priv_close_hdf5_dataspace(f, dataspace_id) );
|
||||
TRY( h5priv_close_hdf5_dataset(f, dataset_id) );
|
||||
|
||||
return h5bpriv_close_field_group(f);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5b_get_field_info (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const h5_size_t idx, /*!< IN: index of field */
|
||||
char *name, /*!< OUT: field name */
|
||||
const h5_size_t len_name, /*!< IN: buffer size */
|
||||
h5_size_t *grid_rank, /*!< OUT: grid rank */
|
||||
h5_size_t *grid_dims, /*!< OUT: grid dimensions */
|
||||
h5_size_t *field_rank, /*!< OUT: field rank */
|
||||
h5_int64_t *type /*!< OUT: datatype */
|
||||
) {
|
||||
|
||||
TRY( _open_block_group(f) );
|
||||
TRY( h5priv_get_hdf5_objname_by_idx(
|
||||
f,
|
||||
f->b->block_gid,
|
||||
(hsize_t)idx,
|
||||
name,
|
||||
(size_t)len_name) );
|
||||
|
||||
return h5b_get_field_info_by_name(f,
|
||||
name, grid_rank, grid_dims, field_rank, type);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef __H5B_MODEL_PRIVATE_H
|
||||
#define __H5B_MODEL_PRIVATE_H
|
||||
|
||||
h5_err_t
|
||||
h5bpriv_open_field_group (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5bpriv_close_field_group (
|
||||
h5_file_t *const f /*!< IN: file handle */
|
||||
);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,394 @@
|
||||
static h5_err_t
|
||||
_create_block_group (
|
||||
const h5_file_t *const f /*!< IN: file handle */
|
||||
) {
|
||||
|
||||
herr_t herr;
|
||||
struct h5b_fdata *b = f->b;
|
||||
|
||||
if ( b->blockgroup > 0 ) {
|
||||
herr = H5Gclose ( b->blockgroup );
|
||||
if ( herr < 0 ) return HANDLE_H5G_CLOSE_ERR;
|
||||
f->b->blockgroup = -1;
|
||||
}
|
||||
|
||||
herr = H5Gcreate (
|
||||
f->timegroup,
|
||||
H5BLOCK_GROUPNAME_BLOCK,
|
||||
#ifndef H5_USE_16_API
|
||||
H5P_DEFAULT,
|
||||
H5P_DEFAULT,
|
||||
H5P_DEFAULT
|
||||
#else
|
||||
0
|
||||
#endif
|
||||
);
|
||||
if ( herr < 0 ) return HANDLE_H5G_CREATE_ERR ( H5BLOCK_GROUPNAME_BLOCK );
|
||||
|
||||
f->b->blockgroup = herr;
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_private
|
||||
|
||||
\internal
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_int64_t
|
||||
_H5Block_create_field_group (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name /*!< IN: name of field group to create */
|
||||
) {
|
||||
|
||||
h5_int64_t h5err;
|
||||
struct h5b_fdata *b = f->b;
|
||||
|
||||
|
||||
if ( ! _H5Part_have_group ( f->timegroup, H5BLOCK_GROUPNAME_BLOCK ) ) {
|
||||
h5err = _create_block_group ( f );
|
||||
} else {
|
||||
h5err = _open_block_group ( f );
|
||||
}
|
||||
if ( h5err < 0 ) return h5err;
|
||||
|
||||
h5err = _select_hyperslab_for_writing ( f );
|
||||
if ( h5err < 0 ) return h5err;
|
||||
|
||||
if ( _H5Part_have_group ( b->blockgroup, name ) )
|
||||
return HANDLE_H5PART_GROUP_EXISTS_ERR ( name );
|
||||
|
||||
herr_t herr = H5Gcreate (
|
||||
b->blockgroup,
|
||||
name,
|
||||
#ifndef H5_USE_16_API
|
||||
H5P_DEFAULT,
|
||||
H5P_DEFAULT,
|
||||
H5P_DEFAULT
|
||||
#else
|
||||
0
|
||||
#endif
|
||||
);
|
||||
if ( herr < 0 ) return HANDLE_H5G_CREATE_ERR ( name );
|
||||
b->field_group_id = herr;
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
h5_int64_t
|
||||
_H5Block_select_hyperslab_for_reading (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
hid_t dataset
|
||||
) {
|
||||
|
||||
struct h5b_fdata *b = f->b;
|
||||
struct h5b_partition *p = &b->user_layout[f->myproc];
|
||||
int rank;
|
||||
hsize_t field_dims[3];
|
||||
hsize_t start[3] = {
|
||||
p->k_start,
|
||||
p->j_start,
|
||||
p->i_start };
|
||||
hsize_t stride[3] = { 1, 1, 1 };
|
||||
hsize_t part_dims[3] = {
|
||||
p->k_end - p->k_start + 1,
|
||||
p->j_end - p->j_start + 1,
|
||||
p->i_end - p->i_start + 1 };
|
||||
|
||||
h5_int64_t herr = _release_hyperslab ( f );
|
||||
if ( herr < 0 ) return HANDLE_H5S_CLOSE_ERR;
|
||||
|
||||
b->diskshape = H5Dget_space ( dataset );
|
||||
if ( b->diskshape < 0 ) return HANDLE_H5D_GET_SPACE_ERR;
|
||||
|
||||
rank = H5Sget_simple_extent_dims ( b->diskshape, NULL, NULL );
|
||||
if ( rank < 0 ) return HANDLE_H5S_GET_SIMPLE_EXTENT_DIMS_ERR;
|
||||
if ( rank != 3 ) return HANDLE_H5PART_DATASET_RANK_ERR ( rank, 3 );
|
||||
|
||||
rank = H5Sget_simple_extent_dims ( b->diskshape, field_dims, NULL );
|
||||
if ( rank < 0 ) return HANDLE_H5S_GET_SIMPLE_EXTENT_DIMS_ERR;
|
||||
|
||||
if ( (field_dims[0] < (hsize_t)b->k_max) ||
|
||||
(field_dims[1] < (hsize_t)b->j_max) ||
|
||||
(field_dims[2] < (hsize_t)b->i_max) ) return HANDLE_H5PART_LAYOUT_ERR;
|
||||
|
||||
_H5Part_print_debug (
|
||||
"PROC[%d]: field_dims: (%lld,%lld,%lld)",
|
||||
f->myproc,
|
||||
(long long)field_dims[2],
|
||||
(long long)field_dims[1],
|
||||
(long long)field_dims[0] );
|
||||
|
||||
b->diskshape = H5Screate_simple ( rank, field_dims,field_dims );
|
||||
if ( b->diskshape < 0 )
|
||||
return HANDLE_H5S_CREATE_SIMPLE_3D_ERR ( field_dims );
|
||||
|
||||
f->b->memshape = H5Screate_simple ( rank, part_dims, part_dims );
|
||||
if ( b->memshape < 0 )
|
||||
return HANDLE_H5S_CREATE_SIMPLE_3D_ERR ( part_dims );
|
||||
|
||||
herr = H5Sselect_hyperslab (
|
||||
b->diskshape,
|
||||
H5S_SELECT_SET,
|
||||
start,
|
||||
stride,
|
||||
part_dims,
|
||||
NULL );
|
||||
if ( herr < 0 ) return HANDLE_H5S_SELECT_HYPERSLAB_ERR;
|
||||
|
||||
_H5Part_print_debug (
|
||||
"PROC[%d]: Select hyperslab: \n"
|
||||
"\tstart: (%lld,%lld,%lld)\n"
|
||||
"\tstride: (%lld,%lld,%lld)\n"
|
||||
"\tdims: (%lld,%lld,%lld)",
|
||||
f->myproc,
|
||||
(long long)start[2],
|
||||
(long long)start[1],
|
||||
(long long)start[0],
|
||||
(long long)stride[2],
|
||||
(long long)stride[1],
|
||||
(long long)stride[0],
|
||||
(long long)part_dims[2],
|
||||
(long long)part_dims[1],
|
||||
(long long)part_dims[0] );
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_private
|
||||
|
||||
\internal
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_int64_t
|
||||
_H5Block_read_data (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to read */
|
||||
void *data, /*!< OUT: ptr to read buffer */
|
||||
hid_t type /*!< IN: data type */
|
||||
) {
|
||||
|
||||
h5_int64_t herr;
|
||||
struct h5b_fdata *b = f->b;
|
||||
|
||||
hid_t dataset_id = H5Dopen ( b->field_group_id, name
|
||||
#ifndef H5_USE_16_API
|
||||
, H5P_DEFAULT
|
||||
#endif
|
||||
);
|
||||
if ( dataset_id < 0 ) return HANDLE_H5D_OPEN_ERR ( name );
|
||||
|
||||
herr = _H5Block_select_hyperslab_for_reading ( f, dataset_id );
|
||||
if ( herr < 0 ) return herr;
|
||||
|
||||
#ifdef PARALLEL_IO
|
||||
herr = _H5Part_start_throttle ( f );
|
||||
if ( herr < 0 ) return herr;
|
||||
#endif
|
||||
|
||||
herr = H5Dread (
|
||||
dataset_id,
|
||||
type,
|
||||
f->b->memshape,
|
||||
f->b->diskshape,
|
||||
f->xfer_prop,
|
||||
data );
|
||||
if ( herr < 0 ) return HANDLE_H5D_READ_ERR ( name, f->timestep );
|
||||
|
||||
#ifdef PARALLEL_IO
|
||||
herr = _H5Part_end_throttle ( f );
|
||||
if ( herr < 0 ) return herr;
|
||||
#endif
|
||||
|
||||
herr = H5Dclose ( dataset_id );
|
||||
if ( herr < 0 ) return HANDLE_H5D_CLOSE_ERR;
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
/********************** functions for writing ********************************/
|
||||
|
||||
/*!
|
||||
\ingroup h5block_private
|
||||
|
||||
\internal
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static h5_int64_t
|
||||
_select_hyperslab_for_writing (
|
||||
h5_file_t *const f /*!< IN: file handle */
|
||||
) {
|
||||
|
||||
/*
|
||||
re-use existing hyperslab
|
||||
*/
|
||||
if ( f->b->shape >= 0 ) return H5_SUCCESS;
|
||||
|
||||
herr_t herr;
|
||||
struct h5b_fdata *b = f->b;
|
||||
struct h5b_partition *p = &b->write_layout[f->myproc];
|
||||
struct h5b_partition *q = &b->user_layout[f->myproc];
|
||||
|
||||
int rank = 3;
|
||||
|
||||
hsize_t field_dims[3] = {
|
||||
b->k_max+1,
|
||||
b->j_max+1,
|
||||
b->i_max+1
|
||||
};
|
||||
|
||||
hsize_t start[3] = {
|
||||
p->k_start,
|
||||
p->j_start,
|
||||
p->i_start
|
||||
};
|
||||
hsize_t stride[3] = { 1, 1, 1 };
|
||||
hsize_t part_dims[3] = {
|
||||
p->k_end - p->k_start + 1,
|
||||
p->j_end - p->j_start + 1,
|
||||
p->i_end - p->i_start + 1
|
||||
};
|
||||
|
||||
|
||||
b->shape = H5Screate_simple ( rank, field_dims, field_dims );
|
||||
if ( b->shape < 0 )
|
||||
return HANDLE_H5S_CREATE_SIMPLE_3D_ERR ( field_dims );
|
||||
|
||||
b->diskshape = H5Screate_simple ( rank, field_dims,field_dims );
|
||||
if ( b->diskshape < 0 )
|
||||
return HANDLE_H5S_CREATE_SIMPLE_3D_ERR ( field_dims );
|
||||
|
||||
_H5Part_print_debug (
|
||||
"PROC[%d]: Select hyperslab on diskshape: \n"
|
||||
"\tstart: (%lld,%lld,%lld)\n"
|
||||
"\tstride: (%lld,%lld,%lld)\n"
|
||||
"\tdims: (%lld,%lld,%lld)",
|
||||
f->myproc,
|
||||
(long long)start[2],
|
||||
(long long)start[1],
|
||||
(long long)start[0],
|
||||
(long long)stride[2],
|
||||
(long long)stride[1],
|
||||
(long long)stride[0],
|
||||
(long long)part_dims[2],
|
||||
(long long)part_dims[1],
|
||||
(long long)part_dims[0] );
|
||||
|
||||
herr = H5Sselect_hyperslab (
|
||||
b->diskshape,
|
||||
H5S_SELECT_SET,
|
||||
start,
|
||||
stride,
|
||||
part_dims,
|
||||
NULL );
|
||||
if ( herr < 0 ) return HANDLE_H5S_SELECT_HYPERSLAB_ERR;
|
||||
|
||||
field_dims[0] = q->k_end - q->k_start + 1;
|
||||
field_dims[1] = q->j_end - q->j_start + 1;
|
||||
field_dims[2] = q->i_end - q->i_start + 1;
|
||||
|
||||
f->b->memshape = H5Screate_simple ( rank, field_dims, field_dims );
|
||||
if ( b->memshape < 0 )
|
||||
return HANDLE_H5S_CREATE_SIMPLE_3D_ERR ( part_dims );
|
||||
|
||||
start[0] = p->k_start - q->k_start;
|
||||
start[1] = p->j_start - q->j_start;
|
||||
start[2] = p->i_start - q->i_start;
|
||||
|
||||
_H5Part_print_debug (
|
||||
"PROC[%d]: Select hyperslab on memshape: \n"
|
||||
"\tstart: (%lld,%lld,%lld)\n"
|
||||
"\tstride: (%lld,%lld,%lld)\n"
|
||||
"\tdims: (%lld,%lld,%lld)",
|
||||
f->myproc,
|
||||
(long long)start[2],
|
||||
(long long)start[1],
|
||||
(long long)start[0],
|
||||
(long long)stride[2],
|
||||
(long long)stride[1],
|
||||
(long long)stride[0],
|
||||
(long long)part_dims[2],
|
||||
(long long)part_dims[1],
|
||||
(long long)part_dims[0] );
|
||||
|
||||
herr = H5Sselect_hyperslab (
|
||||
b->memshape,
|
||||
H5S_SELECT_SET,
|
||||
start,
|
||||
stride,
|
||||
part_dims,
|
||||
NULL );
|
||||
if ( herr < 0 ) return HANDLE_H5S_SELECT_HYPERSLAB_ERR;
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_private
|
||||
|
||||
\internal
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_int64_t
|
||||
_H5Block_write_data (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const void *data, /*!< IN: data to write */
|
||||
const hid_t type /*!< IN: data type */
|
||||
) {
|
||||
|
||||
herr_t herr;
|
||||
hid_t dataset;
|
||||
struct h5b_fdata *b = f->b;
|
||||
|
||||
#ifndef H5_USE_16_API
|
||||
htri_t exists = H5Lexists ( b->field_group_id, name, H5P_DEFAULT );
|
||||
if ( exists > 0 ) return HANDLE_H5D_EXISTS_ERR ( name, f->timestep );
|
||||
#endif
|
||||
|
||||
dataset = H5Dcreate (
|
||||
b->field_group_id,
|
||||
name,
|
||||
type,
|
||||
b->shape,
|
||||
#ifndef H5_USE_16_API
|
||||
H5P_DEFAULT,
|
||||
b->create_prop,
|
||||
H5P_DEFAULT
|
||||
#else
|
||||
b->create_prop
|
||||
#endif
|
||||
);
|
||||
if ( dataset < 0 ) return HANDLE_H5D_CREATE_ERR ( name, f->timestep );
|
||||
|
||||
#ifdef PARALLEL_IO
|
||||
herr = _H5Part_start_throttle ( f );
|
||||
if ( herr < 0 ) return herr;
|
||||
#endif
|
||||
|
||||
herr = H5Dwrite (
|
||||
dataset,
|
||||
type,
|
||||
b->memshape,
|
||||
b->diskshape,
|
||||
f->xfer_prop,
|
||||
data );
|
||||
if ( herr < 0 ) return HANDLE_H5D_WRITE_ERR ( name, f->timestep );
|
||||
|
||||
#ifdef PARALLEL_IO
|
||||
herr = _H5Part_end_throttle ( f );
|
||||
if ( herr < 0 ) return herr;
|
||||
#endif
|
||||
|
||||
herr = H5Dclose ( dataset );
|
||||
if ( herr < 0 ) return HANDLE_H5D_CLOSE_ERR;
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
#define __H5B_TYPES_PRIVATE_H
|
||||
|
||||
struct h5b_partition {
|
||||
h5_int64_t i_start;
|
||||
h5_int64_t i_end;
|
||||
h5_int64_t j_start;
|
||||
h5_int64_t j_end;
|
||||
h5_int64_t k_start;
|
||||
h5_int64_t k_end;
|
||||
h5_size_t i_start;
|
||||
h5_size_t i_end;
|
||||
h5_size_t j_start;
|
||||
h5_size_t j_end;
|
||||
h5_size_t k_start;
|
||||
h5_size_t k_end;
|
||||
};
|
||||
|
||||
struct h5b_fdata {
|
||||
@@ -18,13 +18,15 @@ struct h5b_fdata {
|
||||
struct h5b_partition* user_layout;
|
||||
struct h5b_partition* write_layout;
|
||||
int have_layout;
|
||||
h5_size_t chunk[3];
|
||||
|
||||
hid_t shape;
|
||||
hid_t memshape;
|
||||
hid_t diskshape;
|
||||
hid_t blockgroup;
|
||||
hid_t field_group_id;
|
||||
hid_t block_gid;
|
||||
hid_t field_gid;
|
||||
hid_t dcreate_prop;
|
||||
|
||||
MPI_Datatype partition_mpi_t;
|
||||
};
|
||||
typedef struct h5b_fdata h5b_fdata_t;
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "h5_core.h"
|
||||
#include "h5core/h5_core.h"
|
||||
#include "h5_core_private.h"
|
||||
|
||||
const char*
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h> /* va_arg - System dependent ?! */
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include "h5_core.h"
|
||||
|
||||
#include "h5core/h5_core.h"
|
||||
#include "h5_core_private.h"
|
||||
|
||||
const char* ERR_ELEM_NEXIST = "Element with local vertex IDs (%s) doesn't exist!";
|
||||
@@ -31,4 +29,4 @@ h5tpriv_error_local_elem_nexist (
|
||||
|
||||
return h5_error (f, H5_ERR_NOENTRY, ERR_ELEM_NEXIST, s);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "h5_core.h"
|
||||
#include "h5core/h5_core.h"
|
||||
|
||||
const h5t_ref_element_t h5t_tri_ref_element = {
|
||||
2,
|
||||
|
||||
+24
-5
@@ -495,11 +495,6 @@ h5u_set_chunk (
|
||||
const h5_size_t size
|
||||
) {
|
||||
|
||||
if ( f->u->dcreate_prop == H5P_DEFAULT ) {
|
||||
TRY( f->u->dcreate_prop = h5priv_create_hdf5_property(f,
|
||||
H5P_DATASET_CREATE) );
|
||||
}
|
||||
|
||||
if ( size == 0 )
|
||||
{
|
||||
h5_info(f, "Disabling chunking" );
|
||||
@@ -515,3 +510,27 @@ h5u_set_chunk (
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5u_get_chunk (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const char *name, /*!< IN: name of dataset */
|
||||
h5_size_t *size /*!< OUT: chunk size in particles */
|
||||
) {
|
||||
|
||||
hid_t dataset_id;
|
||||
hid_t plist_id;
|
||||
hsize_t hsize;
|
||||
|
||||
TRY( dataset_id = h5priv_open_hdf5_dataset(f, f->step_gid, name) );
|
||||
TRY( plist_id = h5priv_get_hdf5_dataset_create_plist(f, dataset_id) );
|
||||
TRY( h5priv_get_hdf5_chunk_property(f, plist_id, 1, &hsize) );
|
||||
TRY( h5priv_close_hdf5_property(f, plist_id) );
|
||||
TRY( h5priv_close_hdf5_dataset(f, dataset_id) );
|
||||
|
||||
*size = (h5_size_t)hsize;
|
||||
|
||||
h5_info(f, "Found chunk size of %lld particles", (long long)*size);
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ h5u_read_data (
|
||||
}
|
||||
|
||||
char name2[H5_DATANAME_LEN];
|
||||
TRY ( h5_normalize_dataset_name ( name, name2 ) );
|
||||
TRY ( h5_normalize_dataset_name (f, name, name2) );
|
||||
|
||||
TRY( (dataset_id = h5priv_open_hdf5_dataset ( f, f->step_gid, name2 ) ) );
|
||||
|
||||
@@ -114,7 +114,7 @@ h5u_write_data (
|
||||
hid_t dset_id;
|
||||
|
||||
char name2[H5_DATANAME_LEN];
|
||||
TRY ( h5_normalize_dataset_name ( name, name2 ) );
|
||||
TRY ( h5_normalize_dataset_name (f, name, name2) );
|
||||
|
||||
if ( u->shape == H5S_ALL )
|
||||
h5_warn(f, "The view is unset or invalid.");
|
||||
|
||||
+5
-2
@@ -16,8 +16,6 @@
|
||||
#ifndef __H5_H
|
||||
#define __H5_H
|
||||
|
||||
#include "H5_inquiry.h"
|
||||
|
||||
h5_file_t *
|
||||
H5OpenFile (
|
||||
const char * filename,
|
||||
@@ -30,6 +28,11 @@ H5CloseFile (
|
||||
h5_file_t * f
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5CheckFile (
|
||||
h5_file_t * f
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5SetStepNameFormat (
|
||||
h5_file_t *f,
|
||||
|
||||
+110
-133
@@ -1,172 +1,149 @@
|
||||
/*
|
||||
Header file for declaring the H5Fed application programming
|
||||
interface (API) in the C language.
|
||||
|
||||
Copyright 2006-2007
|
||||
Paul Scherrer Institut, Villigen, Switzerland;
|
||||
Benedikt Oswald;
|
||||
Achim Gsell
|
||||
All rights reserved.
|
||||
|
||||
Authors
|
||||
Achim Gsell
|
||||
|
||||
Warning
|
||||
This code is under development.
|
||||
|
||||
*/
|
||||
#ifndef __H5Part_H
|
||||
#define __H5Part_H
|
||||
#ifndef __H5PART_H
|
||||
#define __H5PART_H
|
||||
|
||||
#include <hdf5.h>
|
||||
h5_err_t
|
||||
H5PartSetNumParticles (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
h5_int64_t nparticles /*!< [in] Number of particles */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
h5_err_t
|
||||
H5PartSetNumParticlesStrided (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
h5_int64_t nparticles, /*!< [in] Number of particles */
|
||||
h5_int64_t stride /*!< [in] Stride value (e.g. number of fields in the particle array) */
|
||||
);
|
||||
|
||||
#include "h5core/h5_core.h"
|
||||
#include "H5.h"
|
||||
#ifdef PARALLEL_IO
|
||||
#include <mpi.h>
|
||||
#endif
|
||||
|
||||
// #define H5PART_SUCCESS H5_SUCCESS
|
||||
#define H5PART_ERR_NOMEM H5_ERR_NOMEM
|
||||
#define H5PART_ERR_INVAL H5_ERR_INVAL
|
||||
#define H5PART_ERR_BADFD H5_ERR_BADFD
|
||||
#define H5PART_ERR_LAYOUT H5_ERR_LAYOUT
|
||||
#define H5PART_ERR_NOENT H5_ERR_NOENT
|
||||
#define H5PART_ERR_NOENTRY H5_ERR_NOENTRY
|
||||
|
||||
#define H5PART_ERR_MPI H5_ERR_MPI
|
||||
#define H5PART_ERR_HDF5 H5_ERR_HDF5
|
||||
|
||||
#define H5PART_READ H5_O_RDONLY
|
||||
#define H5PART_WRITE H5_O_WRONLY
|
||||
#define H5PART_APPEND H5_O_APPEND
|
||||
|
||||
#define H5PART_INT64 ((h5_int64_t)H5T_NATIVE_INT64)
|
||||
#define H5PART_FLOAT64 ((h5_int64_t)H5T_NATIVE_DOUBLE)
|
||||
#define H5PART_CHAR ((h5_int64_t)H5T_NATIVE_CHAR)
|
||||
|
||||
|
||||
/*============== File Writing Functions ==================== */
|
||||
h5_int64_t
|
||||
H5PartDefineStepName (
|
||||
h5_err_t
|
||||
H5PartSetChunkSize (
|
||||
h5_file_t *f,
|
||||
const char *name,
|
||||
const h5_int64_t width
|
||||
h5_int64_t size
|
||||
);
|
||||
|
||||
h5_int64_t
|
||||
H5PartSetNumParticles (
|
||||
h5_file_t *f,
|
||||
const h5_int64_t nparticles
|
||||
);
|
||||
|
||||
h5_int64_t
|
||||
h5_err_t
|
||||
H5PartWriteDataFloat64 (
|
||||
h5_file_t *f,
|
||||
const char *name,
|
||||
const h5_float64_t *array
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name to associate array with */
|
||||
const h5_float64_t *data /*!< [in] Array to commit to disk */
|
||||
);
|
||||
|
||||
h5_int64_t
|
||||
h5_err_t
|
||||
H5PartWriteDataFloat32 (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name to associate array with */
|
||||
const h5_float32_t *data /*!< [in] Array to commit to disk */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5PartWriteDataInt64 (
|
||||
h5_file_t *f,
|
||||
const char *name,
|
||||
const h5_int64_t *array
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name to associate array with */
|
||||
const h5_int64_t *data /*!< [in] Array to commit to disk */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5PartWriteDataInt32 (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name to associate array with */
|
||||
const h5_int32_t *data /*!< [in] Array to commit to disk */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5PartReadDataFloat64 (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name to associate dataset with */
|
||||
h5_float64_t *data /*!< [out] Array of data */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5PartReadDataFloat32 (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name to associate dataset with */
|
||||
h5_float32_t *data /*!< [out] Array of data */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5PartReadDataInt64 (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name to associate dataset with */
|
||||
h5_int64_t *data /*!< [out] Array of data */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5PartReadDataInt32 (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name to associate dataset with */
|
||||
h5_int32_t *data /*!< [out] Array of data */
|
||||
);
|
||||
|
||||
/*================== File Reading Routines =================*/
|
||||
h5_int64_t
|
||||
H5PartGetNumDatasets (
|
||||
h5_file_t *f
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
);
|
||||
|
||||
h5_int64_t
|
||||
H5PartGetDatasetName (
|
||||
h5_file_t *f,
|
||||
const h5_int64_t idx,
|
||||
char *name,
|
||||
const h5_int64_t maxlen
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const h5_int64_t idx, /*!< [in] Index of the dataset */
|
||||
char *name, /*!< [out] Name of dataset */
|
||||
const h5_int64_t len /*!< [in] Size of buffer \c name */
|
||||
);
|
||||
|
||||
h5_int64_t
|
||||
H5PartGetDatasetInfo (
|
||||
h5_file_t *f,
|
||||
const h5_int64_t idx,
|
||||
char *name,
|
||||
const h5_int64_t maxlen,
|
||||
h5_int64_t *type,
|
||||
h5_int64_t *nelem);
|
||||
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const h5_int64_t idx,/*!< [in] Index of the dataset */
|
||||
char *dataset_name, /*!< [out] Name of dataset */
|
||||
const h5_int64_t len_dataset_name,
|
||||
/*!< [in] Size of buffer \c dataset_name */
|
||||
h5_int64_t *type, /*!< [out] Type of data in dataset */
|
||||
h5_int64_t *nelem /*!< [out] Number of elements. */
|
||||
);
|
||||
|
||||
h5_int64_t
|
||||
H5PartGetNumParticles (
|
||||
h5_file_t *f
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
);
|
||||
|
||||
h5_int64_t
|
||||
H5PartSetView (
|
||||
h5_file_t *f,
|
||||
const h5_int64_t start,
|
||||
const h5_int64_t end
|
||||
);
|
||||
|
||||
|
||||
h5_int64_t
|
||||
H5PartGetView (
|
||||
h5_file_t *f,
|
||||
h5_int64_t *start,
|
||||
h5_int64_t *end
|
||||
h5_err_t
|
||||
H5PartResetView (
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
);
|
||||
|
||||
h5_int64_t
|
||||
H5PartHasView (
|
||||
h5_file_t *f
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
);
|
||||
|
||||
h5_int64_t
|
||||
H5PartResetView (
|
||||
h5_file_t *f
|
||||
h5_err_t
|
||||
H5PartSetView (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
h5_int64_t start, /*!< [in] Start particle */
|
||||
h5_int64_t end /*!< [in] End particle */
|
||||
);
|
||||
|
||||
h5_int64_t
|
||||
h5_err_t
|
||||
H5PartSetViewIndices (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const h5_int64_t *indices, /*!< [in] List of indices */
|
||||
h5_int64_t nelems /*!< [in] Size of list */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5PartSetViewEmpty (
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5PartGetView (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
h5_int64_t *start, /*!< [out] Start particle */
|
||||
h5_int64_t *end /*!< [out] End particle */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5PartSetCanonicalView (
|
||||
h5_file_t *f
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
);
|
||||
|
||||
h5_int64_t
|
||||
H5PartReadDataFloat64(
|
||||
h5_file_t *f,
|
||||
const char *name,
|
||||
h5_float64_t *array
|
||||
);
|
||||
|
||||
h5_int64_t
|
||||
H5PartReadDataInt64 (
|
||||
h5_file_t *f,
|
||||
const char *name,
|
||||
h5_int64_t *array
|
||||
);
|
||||
|
||||
h5_int64_t
|
||||
H5PartReadParticleStep (
|
||||
h5_file_t *f,
|
||||
const h5_int64_t step,
|
||||
h5_float64_t *x, /* particle positions */
|
||||
h5_float64_t *y,
|
||||
h5_float64_t *z,
|
||||
h5_float64_t *px, /* particle momenta */
|
||||
h5_float64_t *py,
|
||||
h5_float64_t *pz,
|
||||
h5_int64_t *id /* and phase */
|
||||
);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
+145
-6
@@ -1,3 +1,6 @@
|
||||
#ifndef __H5_ATTRIBS_H
|
||||
#define __H5_ATTRIBS_H
|
||||
|
||||
h5_err_t
|
||||
H5WriteFileAttribString (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
@@ -12,6 +15,140 @@ H5WriteStepAttribString (
|
||||
const char *value /*!< [in] Value of attribute */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5WriteFileAttribFloat32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_float32_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5WriteStepAttribFloat32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_float32_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5WriteFileAttribFloat64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_float64_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5WriteStepAttribFloat64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_float64_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5WriteFileAttribInt32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_int32_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5WriteStepAttribInt32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_int32_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5WriteFileAttribInt64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_int64_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5WriteStepAttribInt64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_int64_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5ReadFileAttribString (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
char *buffer /*!< [out] Value of attribute */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5ReadStepAttribString (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
char *buffer /*!< [out] Value of attribute */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5ReadFileAttribInt32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_int32_t *buffer /*!< [out] Values of attribute */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5ReadStepAttribInt32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_int32_t *buffer /*!< [out] Values of attribute */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5ReadFileAttribInt64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_int64_t *buffer /*!< [out] Values of attribute */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5ReadStepAttribInt64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_int64_t *buffer /*!< [out] Values of attribute */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5ReadFileAttribFloat32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_float32_t *buffer /*!< [out] Values of attribute */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5ReadStepAttribFloat32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_float32_t *buffer /*!< [out] Values of attribute */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5ReadFileAttribFloat64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_float64_t *buffer /*!< [out] Values of attribute */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
H5ReadStepAttribFloat64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_float64_t *buffer /*!< [out] Values of attribute */
|
||||
);
|
||||
|
||||
h5_int64_t
|
||||
H5GetNumFileAttribs (
|
||||
h5_file_t *const f /*!< [in] Handle to open file */
|
||||
@@ -25,24 +162,26 @@ H5GetNumStepAttribs (
|
||||
h5_int64_t
|
||||
H5GetFileAttribInfo (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const h5_int64_t attrib_idx, /*!< [in] Index of attribute to get
|
||||
const h5_size_t attrib_idx, /*!< [in] Index of attribute to get
|
||||
infos about */
|
||||
char *attrib_name, /*!< [out] Name of attribute */
|
||||
const h5_int64_t len_of_attrib_name,
|
||||
const h5_size_t len_of_attrib_name,
|
||||
/*!< [in] length of buffer \c name */
|
||||
h5_int64_t *attrib_type, /*!< [out] Type of value. */
|
||||
h5_int64_t *attrib_nelem /*!< [out] Number of elements */
|
||||
h5_size_t *attrib_nelem /*!< [out] Number of elements */
|
||||
);
|
||||
|
||||
h5_int64_t
|
||||
H5GetStepAttribInfo (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const h5_int64_t attrib_idx, /*!< [in] Index of attribute to
|
||||
const h5_size_t attrib_idx, /*!< [in] Index of attribute to
|
||||
get infos about */
|
||||
char *attrib_name, /*!< [out] Name of attribute */
|
||||
const h5_int64_t len_of_attrib_name,
|
||||
const h5_size_t len_of_attrib_name,
|
||||
/*!< [in] length of buffer \c name */
|
||||
h5_int64_t *attrib_type, /*!< [out] Type of value. */
|
||||
h5_int64_t *attrib_nelem /*!< [out] Number of elements */
|
||||
h5_size_t *attrib_nelem /*!< [out] Number of elements */
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,4 +16,6 @@ H5HasStep (
|
||||
h5_file_t * const f,
|
||||
h5_id_t step
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,10 +1,20 @@
|
||||
#ifndef __H5HUT_H
|
||||
#define __H5HUT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "h5core/h5_core.h"
|
||||
#include "H5.h"
|
||||
#include "H5_inquiry.h"
|
||||
#include "H5_attribs.h"
|
||||
#include "H5Part.h"
|
||||
#include "H5Block.h"
|
||||
#include "H5Fed.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "#ifndef __H5_H"
|
||||
echo "#define __H5_H"
|
||||
echo ""
|
||||
grep -P "(?s)^\w+\n[Hh]5\w+\s*\(.*?\)" $1 | sed 's/ {/;\n/'
|
||||
echo ""
|
||||
echo "#endif"
|
||||
@@ -3,40 +3,42 @@
|
||||
|
||||
#define H5_ATTRIB_FILE 0
|
||||
#define H5_ATTRIB_STEP 1
|
||||
#define H5_ATTRIB_FIELD 2
|
||||
|
||||
h5_int64_t
|
||||
h5_err_t
|
||||
h5_read_attrib (
|
||||
h5_file_t * const f,
|
||||
const char type,
|
||||
const char mode,
|
||||
const char *attrib_name,
|
||||
const hid_t attrib_type,
|
||||
void *attrib_value
|
||||
);
|
||||
|
||||
h5_int64_t
|
||||
h5_err_t
|
||||
h5_write_attrib (
|
||||
h5_file_t * const f,
|
||||
const char type,
|
||||
const char mode,
|
||||
const char *attrib_name,
|
||||
const hid_t attrib_type,
|
||||
const void *attrib_value,
|
||||
const hsize_t attrib_nelem
|
||||
);
|
||||
|
||||
h5_int64_t
|
||||
h5_err_t
|
||||
h5_get_attrib_info (
|
||||
h5_file_t *const f,
|
||||
const char type,
|
||||
const h5_int64_t attrib_idx,
|
||||
const char mode,
|
||||
const h5_size_t attrib_idx,
|
||||
char *attrib_name,
|
||||
const h5_int64_t len_attrib_name,
|
||||
const h5_size_t len_attrib_name,
|
||||
h5_int64_t *attrib_type,
|
||||
h5_int64_t *attrib_nelem
|
||||
h5_size_t *attrib_nelem
|
||||
);
|
||||
|
||||
h5_ssize_t
|
||||
h5_get_num_attribs (
|
||||
h5_file_t *const f,
|
||||
const char type
|
||||
const char mode
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,9 +10,13 @@
|
||||
#include "h5_maps.h"
|
||||
#include "h5_openclose.h"
|
||||
#include "h5_readwrite.h"
|
||||
|
||||
#include "h5u_readwrite.h"
|
||||
#include "h5u_model.h"
|
||||
|
||||
#include "h5b_model.h"
|
||||
#include "h5b_attribs.h"
|
||||
|
||||
#include "h5t_core.h"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -44,6 +44,11 @@ h5_get_num_procs (
|
||||
h5_file_t* const f
|
||||
);
|
||||
|
||||
hid_t
|
||||
h5_get_hdf5_file(
|
||||
h5_file_t* const f
|
||||
);
|
||||
|
||||
h5_size_t
|
||||
h5_get_num_steps (
|
||||
h5_file_t* const f
|
||||
|
||||
@@ -18,7 +18,7 @@ h5_set_step (
|
||||
const h5_int64_t step /*!< [in] Time-step to set. */
|
||||
);
|
||||
|
||||
hid_t
|
||||
h5_int64_t
|
||||
h5_normalize_h5_type (
|
||||
h5_file_t * const f,
|
||||
hid_t type
|
||||
@@ -39,6 +39,7 @@ h5_has_index (
|
||||
|
||||
h5_err_t
|
||||
h5_normalize_dataset_name (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
char *name2
|
||||
);
|
||||
|
||||
@@ -25,8 +25,11 @@
|
||||
#define H5_FLOAT32_T H5T_NATIVE_FLOAT
|
||||
#define H5_INT64_T H5T_NATIVE_INT64
|
||||
#define H5_INT32_T H5T_NATIVE_INT32
|
||||
#define H5_STRING_T H5T_NATIVE_CHAR
|
||||
#define H5_COMPOUND_T H5T_COMPOUND
|
||||
|
||||
#define H5_VER_STRING "2.0.0"
|
||||
|
||||
extern const char * const H5_O_MODES[];
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef __H5B_ATTRIBS_H
|
||||
#define __H5B_ATTRIBS_H
|
||||
|
||||
h5_err_t
|
||||
h5_write_field_attrib (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const hid_t attrib_type, /*!< IN: attribute type */
|
||||
const void *attrib_value, /*!< IN: attribute value */
|
||||
const h5_int64_t attrib_nelem /*!< IN: number of elements */
|
||||
);
|
||||
|
||||
h5_ssize_t
|
||||
h5b_get_num_field_attribs (
|
||||
h5_file_t *const f, /*<! IN: file handle */
|
||||
const char *field_name /*<! IN: field name */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5b_get_field_attrib_info (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const h5_size_t attrib_idx, /*!< IN: attribute index */
|
||||
char *attrib_name, /*!< OUT: attribute name */
|
||||
const h5_size_t len_attrib_name, /*!< IN: buffer size */
|
||||
h5_int64_t *attrib_type, /*!< OUT: attribute type */
|
||||
h5_size_t *attrib_nelem /*!< OUT: number of elements */
|
||||
);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,90 @@
|
||||
#ifndef __H5B_MODEL_H
|
||||
#define __H5B_MODEL_H
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_set_view (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const h5_size_t i_start, /*!< IN: start index of \c i */
|
||||
const h5_size_t i_end, /*!< IN: end index of \c i */
|
||||
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 */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_set_chunk (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const h5_size_t i, /*!< IN: size of \c i */
|
||||
const h5_size_t j, /*!< IN: size of \c j */
|
||||
const h5_size_t k /*!< IN: size of \c k */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_get_chunk (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const char *field_name, /*!< IN: name of dataset */
|
||||
h5_size_t *dims /*!< OUT: array containing the chunk dimensions */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_get_view (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const int proc, /*!< IN: Processor to get partition from */
|
||||
h5_size_t *i_start, /*!< OUT: start index of \c i */
|
||||
h5_size_t *i_end, /*!< OUT: end index of \c i */
|
||||
h5_size_t *j_start, /*!< OUT: start index of \c j */
|
||||
h5_size_t *j_end, /*!< OUT: end index of \c j */
|
||||
h5_size_t *k_start, /*!< OUT: start index of \c k */
|
||||
h5_size_t *k_end /*!< OUT: end index of \c k */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_get_reduced_view (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const int proc, /*!< IN: Processor to get partition from */
|
||||
h5_size_t *i_start, /*!< OUT: start index of \c i */
|
||||
h5_size_t *i_end, /*!< OUT: end index of \c i */
|
||||
h5_size_t *j_start, /*!< OUT: start index of \c j */
|
||||
h5_size_t *j_end, /*!< OUT: end index of \c j */
|
||||
h5_size_t *k_start, /*!< OUT: start index of \c k */
|
||||
h5_size_t *k_end /*!< OUT: end index of \c k */
|
||||
);
|
||||
|
||||
int
|
||||
h5b_3d_get_proc (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const h5_int64_t i, /*!< IN: \c i coordinate */
|
||||
const h5_int64_t j, /*!< IN: \c j coordinate */
|
||||
const h5_int64_t k /*!< IN: \c k coordinate */
|
||||
);
|
||||
|
||||
h5_ssize_t
|
||||
h5b_get_num_fields (
|
||||
h5_file_t *const f /*!< IN: File handle */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5b_get_field_info_by_name (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< OUT: field name */
|
||||
h5_size_t *grid_rank, /*!< OUT: grid rank */
|
||||
h5_size_t *grid_dims, /*!< OUT: grid dimensions */
|
||||
h5_size_t *field_rank, /*!< OUT: field rank */
|
||||
h5_int64_t *type /*!< OUT: datatype */
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5b_get_field_info (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const h5_size_t idx, /*!< IN: index of field */
|
||||
char *name, /*!< OUT: field name */
|
||||
const h5_size_t len_name, /*!< IN: buffer size */
|
||||
h5_size_t *grid_rank, /*!< OUT: grid rank */
|
||||
h5_size_t *grid_dims, /*!< OUT: grid dimensions */
|
||||
h5_size_t *field_rank, /*!< OUT: field rank */
|
||||
h5_int64_t *type /*!< OUT: datatype */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -70,5 +70,12 @@ h5u_set_chunk (
|
||||
const h5_size_t size
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5u_get_chunk (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
h5_size_t *size
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+28
-1
@@ -1,3 +1,30 @@
|
||||
# test level Makefile.am
|
||||
|
||||
SUBDIRS = H5Block H5Fed H5Part
|
||||
#SUBDIRS = H5Block H5Fed H5Part
|
||||
|
||||
OBJEXT=o
|
||||
|
||||
HDFLIB = -L@HDF5ROOT@/lib -lhdf5 -lz @SZLIB@
|
||||
H5LIB = -L../src/lib -lH5hutC -lH5core
|
||||
LIBS = $(H5LIB) $(HDFLIB) @MPILIB@
|
||||
|
||||
INCLUDES = -I../src/include -I@HDF5ROOT@/include @MPIINC@
|
||||
|
||||
noinst_PROGRAMS = h5u_test
|
||||
|
||||
TESTS_ENVIRONMENT = env LD_LIBRARY_PATH=@HDF5ROOT@/lib:$(LD_LIBRARY_PATH)
|
||||
TESTS = h5u_test
|
||||
|
||||
EXTRA_PROGRAMS = h5u_test
|
||||
|
||||
h5u_test_SOURCES = \
|
||||
h5u_test.c \
|
||||
h5u_write.c \
|
||||
h5u_read.c \
|
||||
testframe.c \
|
||||
testframe.h \
|
||||
params.h
|
||||
|
||||
clean: clean-am
|
||||
rm -f *.h5
|
||||
|
||||
|
||||
+517
@@ -0,0 +1,517 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "testframe.h"
|
||||
#include "params.h"
|
||||
|
||||
static void
|
||||
test_read_file_attribs(h5_file_t *file, int position)
|
||||
{
|
||||
h5_err_t status;
|
||||
char name[ATTR_NAME_SIZE];
|
||||
char str[ATTR_NAME_SIZE];
|
||||
h5_int32_t i32;
|
||||
h5_int64_t i64;
|
||||
h5_float32_t f32;
|
||||
h5_float64_t f64;
|
||||
|
||||
TEST("Reading file attributes");
|
||||
|
||||
i64 = H5GetNumFileAttribs(file);
|
||||
VALUE(i64 % 5, 0, "file attribute count");
|
||||
|
||||
get_attr_name(name, "str", position);
|
||||
status = H5ReadFileAttribString(file, name, str);
|
||||
RETURN(status, H5_SUCCESS, "H5ReadFileAttribString");
|
||||
SVALUE(str, ATTR_STR_VAL, "string attribute");
|
||||
|
||||
get_attr_name(name, "i32", position);
|
||||
status = H5ReadFileAttribInt32(file, name, &i32);
|
||||
RETURN(status, H5_SUCCESS, "H5ReadFileAttribInt32");
|
||||
IVALUE(i32, ATTR_INT32_VAL, "int32 attribute");
|
||||
|
||||
get_attr_name(name, "i64", position);
|
||||
status = H5ReadFileAttribInt64(file, name, &i64);
|
||||
RETURN(status, H5_SUCCESS, "H5ReadFileAttribInt64");
|
||||
IVALUE(i64, ATTR_INT64_VAL, "int64 attribute");
|
||||
|
||||
get_attr_name(name, "f32", position);
|
||||
status = H5ReadFileAttribFloat32(file, name, &f32);
|
||||
RETURN(status, H5_SUCCESS, "H5ReadFileAttribFloat32");
|
||||
FVALUE(f32, ATTR_FLOAT_VAL, "float32 attribute");
|
||||
|
||||
get_attr_name(name, "f64", position);
|
||||
status = H5ReadFileAttribFloat64(file, name, &f64);
|
||||
RETURN(status, H5_SUCCESS, "H5ReadFileAttribFloat64");
|
||||
FVALUE(f64, ATTR_FLOAT_VAL, "float64 attribute");
|
||||
}
|
||||
|
||||
static void
|
||||
test_read_step_attribs(h5_file_t *file, int position)
|
||||
{
|
||||
h5_err_t status;
|
||||
char name[ATTR_NAME_SIZE];
|
||||
char str[ATTR_NAME_SIZE];
|
||||
h5_int32_t i32;
|
||||
h5_int64_t i64;
|
||||
h5_float32_t f32;
|
||||
h5_float64_t f64;
|
||||
|
||||
TEST("Reading file attributes");
|
||||
|
||||
i64 = H5GetNumStepAttribs(file);
|
||||
VALUE(i64 % 5, 0, "step attribute count");
|
||||
|
||||
get_attr_name(name, "str", position);
|
||||
status = H5ReadStepAttribString(file, name, str);
|
||||
RETURN(status, H5_SUCCESS, "H5ReadStepAttribString");
|
||||
SVALUE(str, ATTR_STR_VAL, "string attribute");
|
||||
|
||||
get_attr_name(name, "i32", position);
|
||||
status = H5ReadStepAttribInt32(file, name, &i32);
|
||||
RETURN(status, H5_SUCCESS, "H5ReadStepAttribInt32");
|
||||
IVALUE(i32, ATTR_INT32_VAL, "int32 attribute");
|
||||
|
||||
get_attr_name(name, "i64", position);
|
||||
status = H5ReadStepAttribInt64(file, name, &i64);
|
||||
RETURN(status, H5_SUCCESS, "H5ReadStepAttribInt64");
|
||||
IVALUE(i64, ATTR_INT64_VAL, "int64 attribute");
|
||||
|
||||
get_attr_name(name, "f32", position);
|
||||
status = H5ReadStepAttribFloat32(file, name, &f32);
|
||||
RETURN(status, H5_SUCCESS, "H5ReadStepAttribFloat32");
|
||||
FVALUE(f32, ATTR_FLOAT_VAL, "float32 attribute");
|
||||
|
||||
get_attr_name(name, "f64", position);
|
||||
status = H5ReadStepAttribFloat64(file, name, &f64);
|
||||
RETURN(status, H5_SUCCESS, "H5ReadStepAttribFloat64");
|
||||
FVALUE(f64, ATTR_FLOAT_VAL, "float64 attribute");
|
||||
}
|
||||
|
||||
static void
|
||||
test_read_data64(h5_file_t *file, int nparticles, int step)
|
||||
{
|
||||
int i,t;
|
||||
int rank, nprocs;
|
||||
h5_int64_t status, val, start, end, type, size;
|
||||
char name1[4];
|
||||
char name2[8];
|
||||
h5_int64_t indices[8];
|
||||
|
||||
double *x,*y,*z;
|
||||
double *px,*py,*pz;
|
||||
h5_int64_t *id;
|
||||
|
||||
x=(double*)malloc(nparticles*sizeof(double));
|
||||
y=(double*)malloc(nparticles*sizeof(double));
|
||||
z=(double*)malloc(nparticles*sizeof(double));
|
||||
px=(double*)malloc(nparticles*sizeof(double));
|
||||
py=(double*)malloc(nparticles*sizeof(double));
|
||||
pz=(double*)malloc(nparticles*sizeof(double));
|
||||
id=(h5_int64_t*)malloc(nparticles*sizeof(h5_int64_t));
|
||||
|
||||
TEST("Verifying dataset info");
|
||||
|
||||
#if PARALLEL_IO
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
|
||||
#else
|
||||
nprocs = 1;
|
||||
rank = 2;
|
||||
#endif
|
||||
|
||||
val = H5PartGetNumParticles(file);
|
||||
IVALUE(val, nprocs*nparticles, "particle count");
|
||||
|
||||
val = H5PartGetNumDatasets(file);
|
||||
IVALUE(val, 7, "dataset count");
|
||||
|
||||
for (i=0; i<7; i++) {
|
||||
status = H5PartGetDatasetName(file, i, name1, 2);
|
||||
RETURN(status, H5_SUCCESS, "H5PartGetDatasetName");
|
||||
|
||||
status = H5PartGetDatasetInfo(
|
||||
file, i, name2, 4, &type, &size);
|
||||
RETURN(status, H5_SUCCESS, "H5PartGetDatasetInfo");
|
||||
CVALUE(name1[0], name2[0], "dataset name");
|
||||
|
||||
status = H5PartGetDatasetName(file, i, name1, 4);
|
||||
RETURN(status, H5_SUCCESS, "H5PartGetDatasetName");
|
||||
CVALUE(name1[1], name2[1], "dataset name");
|
||||
|
||||
IVALUE(size, nprocs*nparticles, "dataset size");
|
||||
if (name1[0] == 'i') IVALUE(type, H5_INT64_T, "dataset type");
|
||||
else IVALUE(type, H5_FLOAT64_T, "dataset type");
|
||||
}
|
||||
|
||||
#if PARALLEL_IO
|
||||
TEST("Setting throttle");
|
||||
status = H5SetThrottle(file, 3);
|
||||
RETURN(status, H5_SUCCESS, "H5SetThrottle");
|
||||
#endif
|
||||
|
||||
TEST("Reading 64-bit data");
|
||||
|
||||
for (t=step; t<step+NTIMESTEPS; t++)
|
||||
{
|
||||
val = H5HasStep(file, t);
|
||||
IVALUE(val, 1, "has step");
|
||||
|
||||
status = H5SetStep(file, t);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStep");
|
||||
|
||||
test_read_step_attribs(file, t);
|
||||
|
||||
status = H5PartSetNumParticles(file, nparticles);
|
||||
RETURN(status, H5_SUCCESS, "H5PartSetNumParticles");
|
||||
|
||||
status = H5PartResetView(file);
|
||||
RETURN(status, H5_SUCCESS, "H5PartResetView");
|
||||
|
||||
start = rank;
|
||||
end = -1;
|
||||
|
||||
status = H5PartSetView(file, start, end);
|
||||
RETURN(status, H5_SUCCESS, "H5PartSetView");
|
||||
|
||||
status = H5PartReadDataFloat64(file, "x", x);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat64");
|
||||
FVALUE(x[rank], (double)(start+rank+nparticles*t), "x data");
|
||||
|
||||
val = H5PartGetView(file, &start, &end);
|
||||
IVALUE(val, nprocs*nparticles-start, "particle count");
|
||||
IVALUE(start, rank, "view start");
|
||||
IVALUE(end, nprocs*nparticles-1, "view end");
|
||||
|
||||
status = H5PartSetView(file, -1, -1);
|
||||
RETURN(status, H5_SUCCESS, "H5PartSetView");
|
||||
|
||||
status = H5PartReadDataFloat64(file, "x", x);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat64");
|
||||
IVALUE(x[rank], (double)(rank+nparticles*t), "x data");
|
||||
|
||||
indices[0] = rank*2 + 0;
|
||||
indices[1] = rank*2 + 3;
|
||||
indices[2] = rank*2 + 9;
|
||||
indices[3] = rank*2 + 7;
|
||||
|
||||
status = H5PartSetViewIndices(file, indices, -1);
|
||||
RETURN(status, H5_SUCCESS, "H5PartSetViewIndices");
|
||||
|
||||
status = H5PartReadDataFloat64(file, "x", x);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat64");
|
||||
FVALUE(x[2*rank], (double)(2*rank+nparticles*t), "x data");
|
||||
|
||||
status = H5PartResetView(file);
|
||||
RETURN(status, H5_SUCCESS, "H5PartResetView");
|
||||
|
||||
status = H5PartSetViewIndices(file, indices, 4);
|
||||
RETURN(status, H5_SUCCESS, "H5PartSetViewIndices");
|
||||
|
||||
val = H5PartGetNumParticles(file);
|
||||
IVALUE(val, 4, "particle count");
|
||||
|
||||
status = H5PartReadDataFloat64(file, "x", x);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat64");
|
||||
FVALUE(x[2], (double)(rank*2+9+nparticles*t), "x data");
|
||||
|
||||
val = H5PartGetNumParticles(file);
|
||||
IVALUE(val, 4, "particle count");
|
||||
|
||||
status = H5PartSetViewIndices(file, NULL, 4);
|
||||
RETURN(status, H5_SUCCESS, "H5PartSetViewIndices");
|
||||
|
||||
status = H5PartReadDataFloat64(file, "x", x);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat64");
|
||||
|
||||
status = H5PartSetCanonicalView(file);
|
||||
RETURN(status, H5_SUCCESS, "H5PartSetCanonicalView");
|
||||
|
||||
status = H5PartReadParticleStep (
|
||||
file, t, x, y, z, px, py, pz, id);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadParticleStep");
|
||||
|
||||
for (i=0; i<nparticles; i++)
|
||||
{
|
||||
FVALUE(x[i] , 0.0 + (double)(i+nparticles*t), " x data");
|
||||
FVALUE(y[i] , 0.1 + (double)(i+nparticles*t), " y data");
|
||||
FVALUE(z[i] , 0.2 + (double)(i+nparticles*t), " z data");
|
||||
FVALUE(px[i], 0.3 + (double)(i+nparticles*t), " px data");
|
||||
FVALUE(py[i], 0.4 + (double)(i+nparticles*t), " py data");
|
||||
FVALUE(pz[i], 0.5 + (double)(i+nparticles*t), " pz data");
|
||||
IVALUE(id[i], (i+nparticles*t), " id data");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
test_read_strided_data64(h5_file_t *file, int nparticles, int step)
|
||||
{
|
||||
int i,t;
|
||||
h5_int64_t status;
|
||||
|
||||
double *data;
|
||||
|
||||
data=(double*)malloc(6*nparticles*sizeof(double));
|
||||
|
||||
TEST("Reading 64-bit strided data");
|
||||
|
||||
for (t=step; t<step+NTIMESTEPS; t++)
|
||||
{
|
||||
status = H5SetStep(file, t);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStep");
|
||||
|
||||
status = H5PartSetNumParticlesStrided(file, nparticles, 6);
|
||||
RETURN(status, H5_SUCCESS, "H5PartSetNumParticlesStrided");
|
||||
|
||||
status = H5PartReadDataFloat64(file, "x", data+0);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat64");
|
||||
|
||||
status = H5PartReadDataFloat64(file, "y", data+1);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat64");
|
||||
|
||||
status = H5PartReadDataFloat64(file, "z", data+2);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat64");
|
||||
|
||||
status = H5PartReadDataFloat64(file, "px", data+3);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat64");
|
||||
|
||||
test_read_step_attribs(file, t);
|
||||
|
||||
status = H5PartReadDataFloat64(file, "py", data+4);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat64");
|
||||
|
||||
status = H5PartReadDataFloat64(file, "pz", data+5);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat64");
|
||||
|
||||
for (i=0; i<nparticles; i++)
|
||||
{
|
||||
FVALUE(data[6*i] , 0.0 + (double)(i+nparticles*t), "x data");
|
||||
FVALUE(data[6*i+1], 0.1 + (double)(i+nparticles*t), "y data");
|
||||
FVALUE(data[6*i+2], 0.2 + (double)(i+nparticles*t), "z data");
|
||||
FVALUE(data[6*i+3], 0.3 + (double)(i+nparticles*t), "px data");
|
||||
FVALUE(data[6*i+4], 0.4 + (double)(i+nparticles*t), "py data");
|
||||
FVALUE(data[6*i+5], 0.5 + (double)(i+nparticles*t), "pz data");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
test_read_data32(h5_file_t *file, int nparticles, int step)
|
||||
{
|
||||
int i,t;
|
||||
h5_int64_t status, val;
|
||||
|
||||
float *x,*y,*z;
|
||||
float *px,*py,*pz;
|
||||
int *id;
|
||||
|
||||
x=(float*)malloc(nparticles*sizeof(float));
|
||||
y=(float*)malloc(nparticles*sizeof(float));
|
||||
z=(float*)malloc(nparticles*sizeof(float));
|
||||
px=(float*)malloc(nparticles*sizeof(float));
|
||||
py=(float*)malloc(nparticles*sizeof(float));
|
||||
pz=(float*)malloc(nparticles*sizeof(float));
|
||||
id=(int*)malloc(nparticles*sizeof(int));
|
||||
|
||||
TEST("Reading 32-bit data");
|
||||
|
||||
for (t=step; t<step+NTIMESTEPS; t++)
|
||||
{
|
||||
val = H5HasStep(file, t);
|
||||
IVALUE(val, 1, "has step");
|
||||
|
||||
status = H5SetStep(file, t);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStep");
|
||||
|
||||
status = H5PartSetCanonicalView(file);
|
||||
RETURN(status, H5_SUCCESS, "H5PartSetCanonicalView");
|
||||
|
||||
test_read_step_attribs(file, t);
|
||||
|
||||
status = H5PartReadDataFloat32(file, "x", x);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat32");
|
||||
|
||||
status = H5PartReadDataFloat32(file, "y", y);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat32");
|
||||
|
||||
status = H5PartReadDataFloat32(file, "z", z);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat32");
|
||||
|
||||
status = H5PartReadDataFloat32(file, "px", px);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat32");
|
||||
|
||||
status = H5PartReadDataFloat32(file, "py", py);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat32");
|
||||
|
||||
status = H5PartReadDataFloat32(file, "pz", pz);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat32");
|
||||
|
||||
status = H5PartReadDataInt32(file, LONGNAME, id);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataInt32");
|
||||
|
||||
for (i=0; i<nparticles; i++)
|
||||
{
|
||||
FVALUE(x[i] , 0.0F + (float)(i+nparticles*t), " x data");
|
||||
FVALUE(y[i] , 0.1F + (float)(i+nparticles*t), " y data");
|
||||
FVALUE(z[i] , 0.2F + (float)(i+nparticles*t), " z data");
|
||||
FVALUE(px[i], 0.3F + (float)(i+nparticles*t), " px data");
|
||||
FVALUE(py[i], 0.4F + (float)(i+nparticles*t), " py data");
|
||||
FVALUE(pz[i], 0.5F + (float)(i+nparticles*t), " pz data");
|
||||
IVALUE(id[i], (i+nparticles*t), " id data");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
test_read_strided_data32(h5_file_t *file, int nparticles, int step)
|
||||
{
|
||||
int i,t;
|
||||
h5_int64_t status;
|
||||
|
||||
float *data;
|
||||
|
||||
data=(float*)malloc(6*nparticles*sizeof(float));
|
||||
|
||||
TEST("Reading 32-bit strided data");
|
||||
|
||||
for (t=step; t<step+NTIMESTEPS; t++)
|
||||
{
|
||||
status = H5SetStep(file, t);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStep");
|
||||
|
||||
status = H5PartSetNumParticlesStrided(file, nparticles, 6);
|
||||
RETURN(status, H5_SUCCESS, "H5PartSetNumParticlesStrided");
|
||||
|
||||
status = H5PartReadDataFloat32(file, "x", data+0);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat32");
|
||||
|
||||
status = H5PartReadDataFloat32(file, "y", data+1);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat32");
|
||||
|
||||
status = H5PartReadDataFloat32(file, "z", data+2);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat32");
|
||||
|
||||
status = H5PartReadDataFloat32(file, "px", data+3);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat32");
|
||||
|
||||
status = H5PartReadDataFloat32(file, "py", data+4);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat32");
|
||||
|
||||
status = H5PartReadDataFloat32(file, "pz", data+5);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat32");
|
||||
|
||||
for (i=0; i<nparticles; i++)
|
||||
{
|
||||
FVALUE(data[6*i] , 0.0F + (float)(i+nparticles*t), "x data");
|
||||
FVALUE(data[6*i+1], 0.1F + (float)(i+nparticles*t), "y data");
|
||||
FVALUE(data[6*i+2], 0.2F + (float)(i+nparticles*t), "z data");
|
||||
FVALUE(data[6*i+3], 0.3F + (float)(i+nparticles*t), "px data");
|
||||
FVALUE(data[6*i+4], 0.4F + (float)(i+nparticles*t), "py data");
|
||||
FVALUE(data[6*i+5], 0.5F + (float)(i+nparticles*t), "pz data");
|
||||
}
|
||||
|
||||
test_read_step_attribs(file, t);
|
||||
}
|
||||
}
|
||||
|
||||
void h5u_test_read1(void)
|
||||
{
|
||||
h5_file_t *file1;
|
||||
|
||||
h5_int64_t status;
|
||||
|
||||
TEST("Opening file once, read-only");
|
||||
file1 = H5OpenFile(FILENAME, H5_O_RDONLY, MPI_COMM_WORLD);
|
||||
status = H5CheckFile(file1);
|
||||
RETURN(status, H5_SUCCESS, "H5CheckFile");
|
||||
|
||||
test_read_file_attribs(file1, 0);
|
||||
test_read_data32(file1, NPARTICLES, 1);
|
||||
|
||||
status = H5CloseFile(file1);
|
||||
RETURN(status, H5_SUCCESS, "H5CloseFile");
|
||||
}
|
||||
|
||||
void h5u_test_read2(void)
|
||||
{
|
||||
h5_file_t *file1;
|
||||
h5_file_t *file2;
|
||||
|
||||
h5_int64_t status;
|
||||
|
||||
TEST("Opening file twice, read-only");
|
||||
file1 = H5OpenFile(FILENAME, H5_O_RDONLY, MPI_COMM_WORLD);
|
||||
status = H5CheckFile(file1);
|
||||
RETURN(status, H5_SUCCESS, "H5CheckFile");
|
||||
|
||||
file2 = H5OpenFile(FILENAME, H5_O_RDONLY, MPI_COMM_WORLD);
|
||||
status = H5CheckFile(file2);
|
||||
RETURN(status, H5_SUCCESS, "H5CheckFile");
|
||||
|
||||
test_read_strided_data32(file1, NPARTICLES, NTIMESTEPS+1);
|
||||
test_read_file_attribs(file2, 1);
|
||||
|
||||
status = H5CloseFile(file1);
|
||||
RETURN(status, H5_SUCCESS, "H5CloseFile");
|
||||
status = H5CloseFile(file2);
|
||||
RETURN(status, H5_SUCCESS, "H5CloseFile");
|
||||
}
|
||||
|
||||
void h5u_test_read3(void)
|
||||
{
|
||||
h5_file_t *file1;
|
||||
|
||||
h5_int64_t status;
|
||||
|
||||
TEST("Opening file once, read-only, MPI-POSIX VFD");
|
||||
file1 = H5OpenFile(FILENAME, H5_O_RDONLY | H5_VFD_MPIPOSIX, MPI_COMM_WORLD);
|
||||
status = H5CheckFile(file1);
|
||||
RETURN(status, H5_SUCCESS, "H5CheckFile");
|
||||
|
||||
TEST("Redefining step name");
|
||||
status = H5SetStepNameFormat(file1, LONGNAME, 16);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStepNameFormat");
|
||||
|
||||
test_read_strided_data64(file1, NPARTICLES, 0);
|
||||
test_read_file_attribs(file1, 0);
|
||||
|
||||
status = H5CloseFile(file1);
|
||||
RETURN(status, H5_SUCCESS, "H5CloseFile");
|
||||
}
|
||||
|
||||
void h5u_test_read4(void)
|
||||
{
|
||||
h5_file_t *file1;
|
||||
h5_file_t *file2;
|
||||
|
||||
h5_err_t status;
|
||||
|
||||
TEST("Opening file twice, read-only, MPI-IO Independent VFD");
|
||||
file1 = H5OpenFile(FILENAME, H5_O_RDONLY | H5_VFD_INDEPENDENT, MPI_COMM_WORLD);
|
||||
status = H5CheckFile(file1);
|
||||
RETURN(status, H5_SUCCESS, "H5CheckFile");
|
||||
|
||||
file2 = H5OpenFile(FILENAME, H5_O_RDONLY | H5_VFD_INDEPENDENT, MPI_COMM_WORLD);
|
||||
status = H5CheckFile(file2);
|
||||
RETURN(status, H5_SUCCESS, "H5CheckFile");
|
||||
|
||||
TEST("Redefining step name");
|
||||
status = H5SetStepNameFormat(file1, LONGNAME, 16);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStepNameFormat");
|
||||
|
||||
status = H5SetStepNameFormat(file2, LONGNAME, 16);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStepNameFormat");
|
||||
|
||||
test_read_file_attribs(file1, 1);
|
||||
|
||||
status = H5SetStep(file2, NTIMESTEPS);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStep");
|
||||
|
||||
test_read_data64(file2, NPARTICLES, NTIMESTEPS-2);
|
||||
|
||||
status = H5CloseFile(file1);
|
||||
RETURN(status, H5_SUCCESS, "H5CloseFile");
|
||||
status = H5CloseFile(file2);
|
||||
RETURN(status, H5_SUCCESS, "H5CloseFile");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
#include <stdlib.h>
|
||||
#include <H5hut.h>
|
||||
|
||||
#include "testframe.h"
|
||||
#include "params.h"
|
||||
|
||||
/* from write.c */
|
||||
void h5u_test_write1(void);
|
||||
void h5u_test_write2(void);
|
||||
void h5u_test_write3(void);
|
||||
void h5u_test_write4(void);
|
||||
|
||||
/* from read.c */
|
||||
void h5u_test_read1(void);
|
||||
void h5u_test_read2(void);
|
||||
void h5u_test_read3(void);
|
||||
void h5u_test_read4(void);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#ifdef PARALLEL_IO
|
||||
MPI_Init(&argc, &argv);
|
||||
int procs;
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &procs);
|
||||
if (procs > MAX_MPI_TASKS) {
|
||||
fprintf(stderr,
|
||||
"ERROR: please use <= %d MPI tasks for the test.\n",
|
||||
MAX_MPI_TASKS);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize testing framework */
|
||||
TestInit(argv[0], NULL, NULL);
|
||||
|
||||
/* Tests are generally arranged from least to most complexity... */
|
||||
AddTest("write1", h5u_test_write1, NULL, "Write 32-bit data", NULL);
|
||||
AddTest("read1", h5u_test_read1, NULL, "Read 32-bit data", NULL);
|
||||
AddTest("write2", h5u_test_write2, NULL, "Write 32-bit strided data", NULL);
|
||||
AddTest("read2", h5u_test_read2, NULL, "Read 32-bit strided data", NULL);
|
||||
AddTest("write3", h5u_test_write3, NULL, "Write 64-bit strided data", NULL);
|
||||
AddTest("read3", h5u_test_read3, NULL, "Read 64-bit strided data", NULL);
|
||||
AddTest("write4", h5u_test_write4, NULL, "Write 64-bit data", NULL);
|
||||
AddTest("read4", h5u_test_read4, NULL, "Read 64-bit data", NULL);
|
||||
|
||||
/* Display testing information */
|
||||
TestInfo(argv[0]);
|
||||
|
||||
/* Parse command line arguments */
|
||||
TestParseCmdLine(argc, argv);
|
||||
|
||||
H5SetVerbosityLevel(GetTestVerbosity());
|
||||
|
||||
/* Perform requested testing */
|
||||
PerformTests();
|
||||
|
||||
/* Display test summary, if requested */
|
||||
if (GetTestSummary())
|
||||
TestSummary();
|
||||
|
||||
/* Clean up test files, if allowed */
|
||||
//if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP"))
|
||||
// TestCleanup();
|
||||
|
||||
#ifdef PARALLEL_IO
|
||||
TestPrintf ("reached end\n");
|
||||
fflush(stdout);
|
||||
MPI_Finalize();
|
||||
#endif
|
||||
return GetTestNumErrs();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,472 @@
|
||||
#include <stdlib.h>
|
||||
#include "testframe.h"
|
||||
#include "params.h"
|
||||
|
||||
static void
|
||||
test_write_file_attribs(h5_file_t *file, int position)
|
||||
{
|
||||
h5_err_t status;
|
||||
char name[ATTR_NAME_SIZE];
|
||||
|
||||
TEST("Writing file attributes");
|
||||
|
||||
get_attr_name(name, "str", position);
|
||||
status = H5WriteFileAttribString(file, name, ATTR_STR_VAL);
|
||||
RETURN(status, H5_SUCCESS, "H5WriteFileAttribString");
|
||||
|
||||
get_attr_name(name, "i32", position);
|
||||
h5_int32_t i32 = ATTR_INT32_VAL;
|
||||
status = H5WriteFileAttribInt32(file, name, &i32, 1);
|
||||
RETURN(status, H5_SUCCESS, "H5WriteFileAttribInt32");
|
||||
|
||||
get_attr_name(name, "i64", position);
|
||||
h5_int64_t i64 = ATTR_INT64_VAL;
|
||||
status = H5WriteFileAttribInt64(file, name, &i64, 1);
|
||||
RETURN(status, H5_SUCCESS, "H5WriteFileAttribInt64");
|
||||
|
||||
get_attr_name(name, "f32", position);
|
||||
h5_float32_t f32 = ATTR_FLOAT_VAL;
|
||||
status = H5WriteFileAttribFloat32(file, name, &f32, 1);
|
||||
RETURN(status, H5_SUCCESS, "H5WriteFileAttribFloat32");
|
||||
|
||||
get_attr_name(name, "f64", position);
|
||||
h5_float64_t f64 = ATTR_FLOAT_VAL;
|
||||
status = H5WriteFileAttribFloat64(file, name, &f64, 1);
|
||||
RETURN(status, H5_SUCCESS, "H5WriteFileAttribFloat64");
|
||||
}
|
||||
|
||||
static void
|
||||
test_write_step_attribs(h5_file_t *file, int position)
|
||||
{
|
||||
h5_err_t status;
|
||||
char name[ATTR_NAME_SIZE];
|
||||
|
||||
TEST("Writing step attributes");
|
||||
|
||||
get_attr_name(name, "str", position);
|
||||
status = H5WriteStepAttribString(file, name, ATTR_STR_VAL);
|
||||
RETURN(status, H5_SUCCESS, "H5WriteStepAttribString");
|
||||
|
||||
get_attr_name(name, "i32", position);
|
||||
status = H5WriteStepAttribInt32(file, name, ATTR_INT32_VAL, 1);
|
||||
RETURN(status, H5_SUCCESS, "H5WriteStepAttribInt32");
|
||||
|
||||
get_attr_name(name, "i64", position);
|
||||
status = H5WriteStepAttribInt64(file, name, ATTR_INT64_VAL, 1);
|
||||
RETURN(status, H5_SUCCESS, "H5WriteStepAttribInt64");
|
||||
|
||||
get_attr_name(name, "f32", position);
|
||||
status = H5WriteStepAttribFloat32(file, name, ATTR_FLOAT_VAL, 1);
|
||||
RETURN(status, H5_SUCCESS, "H5WriteStepAttribFloat32");
|
||||
|
||||
get_attr_name(name, "f64", position);
|
||||
status = H5WriteStepAttribFloat64(file, name, ATTR_FLOAT_VAL, 1);
|
||||
RETURN(status, H5_SUCCESS, "H5WriteStepAttribFloat64");
|
||||
}
|
||||
|
||||
static void
|
||||
test_write_data64(h5_file_t *file, int nparticles, int step)
|
||||
{
|
||||
int i,t;
|
||||
h5_int64_t status, val;
|
||||
|
||||
double *x,*y,*z;
|
||||
double *px,*py,*pz;
|
||||
h5_int64_t *id;
|
||||
|
||||
x=(double*)malloc(nparticles*sizeof(double));
|
||||
y=(double*)malloc(nparticles*sizeof(double));
|
||||
z=(double*)malloc(nparticles*sizeof(double));
|
||||
px=(double*)malloc(nparticles*sizeof(double));
|
||||
py=(double*)malloc(nparticles*sizeof(double));
|
||||
pz=(double*)malloc(nparticles*sizeof(double));
|
||||
id=(h5_int64_t*)malloc(nparticles*sizeof(h5_int64_t));
|
||||
|
||||
/* invalid stride will produce a warning */
|
||||
status = H5PartSetNumParticlesStrided(file, nparticles, -1);
|
||||
RETURN(status, H5_SUCCESS, "H5PartSetNumParticlesStrided");
|
||||
|
||||
/* invalid nparticles will produce an error */
|
||||
status = H5PartSetNumParticlesStrided(file, -1, 2);
|
||||
RETURN(status, H5_ERR_INVAL, "H5PartSetNumParticlesStrided");
|
||||
|
||||
#if PARALLEL_IO
|
||||
TEST("Setting throttle");
|
||||
status = H5SetThrottle(file, 2);
|
||||
RETURN(status, H5_SUCCESS, "H5SetThrottle");
|
||||
#endif
|
||||
|
||||
TEST("Writing 64-bit data");
|
||||
|
||||
for (t=step; t<step+NTIMESTEPS; t++)
|
||||
{
|
||||
for (i=0; i<nparticles; i++)
|
||||
{
|
||||
x[i] = 0.0 + (double)(i+nparticles*t);
|
||||
y[i] = 0.1 + (double)(i+nparticles*t);
|
||||
z[i] = 0.2 + (double)(i+nparticles*t);
|
||||
px[i] = 0.3 + (double)(i+nparticles*t);
|
||||
py[i] = 0.4 + (double)(i+nparticles*t);
|
||||
pz[i] = 0.5 + (double)(i+nparticles*t);
|
||||
id[i] = i + nparticles*t;
|
||||
}
|
||||
|
||||
val = H5HasStep(file, t);
|
||||
|
||||
status = H5SetStep(file, t);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStep");
|
||||
|
||||
if (val == 0) test_write_step_attribs(file, t);
|
||||
|
||||
status = H5PartSetNumParticles(file, nparticles);
|
||||
RETURN(status, H5_SUCCESS, "H5PartSetNumParticles");
|
||||
|
||||
status = H5PartWriteDataFloat64(file, "x", x);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat64");
|
||||
|
||||
status = H5PartWriteDataFloat64(file, "y", y);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat64");
|
||||
|
||||
status = H5PartWriteDataFloat64(file, "z", z);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat64");
|
||||
|
||||
status = H5PartWriteDataFloat64(file, "px", px);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat64");
|
||||
|
||||
status = H5PartWriteDataFloat64(file, "py", py);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat64");
|
||||
|
||||
status = H5PartWriteDataFloat64(file, "pz", pz);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat64");
|
||||
|
||||
status = H5PartWriteDataInt64(file, "id", id);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataInt64");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
test_write_strided_data64(h5_file_t *file, int nparticles, int step)
|
||||
{
|
||||
int i,t;
|
||||
h5_int64_t status;
|
||||
|
||||
double *data;
|
||||
|
||||
data=(double*)malloc(6*nparticles*sizeof(double));
|
||||
|
||||
status = H5PartSetNumParticlesStrided(file, nparticles, 6);
|
||||
RETURN(status, H5_SUCCESS, "H5PartSetNumParticlesStrided");
|
||||
|
||||
TEST("Writing 64-bit strided data");
|
||||
|
||||
for (t=step; t<step+NTIMESTEPS; t++)
|
||||
{
|
||||
for (i=0; i<nparticles; i++)
|
||||
{
|
||||
data[6*i] = 0.0 + (double)(i+nparticles*t);
|
||||
data[6*i+1] = 0.1 + (double)(i+nparticles*t);
|
||||
data[6*i+2] = 0.2 + (double)(i+nparticles*t);
|
||||
data[6*i+3] = 0.3 + (double)(i+nparticles*t);
|
||||
data[6*i+4] = 0.4 + (double)(i+nparticles*t);
|
||||
data[6*i+5] = 0.5 + (double)(i+nparticles*t);
|
||||
}
|
||||
|
||||
status = H5SetStep(file, t);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStep");
|
||||
|
||||
status = H5PartSetNumParticlesStrided(file, nparticles, 6);
|
||||
RETURN(status, H5_SUCCESS, "H5PartSetNumParticlesStrided");
|
||||
|
||||
status = H5PartWriteDataFloat64(file, "x", data+0);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat64");
|
||||
|
||||
status = H5PartWriteDataFloat64(file, "y", data+1);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat64");
|
||||
|
||||
status = H5PartWriteDataFloat64(file, "z", data+2);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat64");
|
||||
|
||||
status = H5PartWriteDataFloat64(file, "px", data+3);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat64");
|
||||
|
||||
status = H5PartWriteDataFloat64(file, "py", data+4);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat64");
|
||||
|
||||
status = H5PartWriteDataFloat64(file, "pz", data+5);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat64");
|
||||
|
||||
test_write_step_attribs(file, t);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
test_write_data32(h5_file_t *file, int nparticles, int step)
|
||||
{
|
||||
int i,t;
|
||||
h5_err_t status;
|
||||
h5_size_t val;
|
||||
int rank, nprocs;
|
||||
|
||||
float *x,*y,*z;
|
||||
float *px,*py,*pz;
|
||||
int *id;
|
||||
|
||||
x=(float*)malloc(nparticles*sizeof(float));
|
||||
y=(float*)malloc(nparticles*sizeof(float));
|
||||
z=(float*)malloc(nparticles*sizeof(float));
|
||||
px=(float*)malloc(nparticles*sizeof(float));
|
||||
py=(float*)malloc(nparticles*sizeof(float));
|
||||
pz=(float*)malloc(nparticles*sizeof(float));
|
||||
id=(int*)malloc(nparticles*sizeof(int));
|
||||
|
||||
status = H5PartSetNumParticles(file, nparticles);
|
||||
RETURN(status, H5_SUCCESS, "H5PartSetNumParticles");
|
||||
|
||||
#if PARALLEL_IO
|
||||
/* will generate a warning since we are in MPI-IO Collective mode */
|
||||
TEST("Setting throttle");
|
||||
status = H5SetThrottle(file, 2);
|
||||
RETURN(status, H5_SUCCESS, "H5SetThrottle");
|
||||
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
|
||||
#else
|
||||
rank = 0;
|
||||
nprocs = 1;
|
||||
#endif
|
||||
|
||||
TEST("Writing 32-bit data");
|
||||
|
||||
for (t=step; t<step+NTIMESTEPS; t++)
|
||||
{
|
||||
for (i=0; i<nparticles; i++)
|
||||
{
|
||||
x[i] = 0.0F + (float)(i+nparticles*t);
|
||||
y[i] = 0.1F + (float)(i+nparticles*t);
|
||||
z[i] = 0.2F + (float)(i+nparticles*t);
|
||||
px[i] = 0.3F + (float)(i+nparticles*t);
|
||||
py[i] = 0.4F + (float)(i+nparticles*t);
|
||||
pz[i] = 0.5F + (float)(i+nparticles*t);
|
||||
id[i] = i + nparticles*t;
|
||||
}
|
||||
|
||||
val = H5HasStep(file, t);
|
||||
if (val == 0) {
|
||||
status = H5SetStep(file, t);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStep");
|
||||
}
|
||||
|
||||
/* test a two-part write using views */
|
||||
status = H5PartSetView(file,
|
||||
rank*nparticles,
|
||||
rank*nparticles + 31);
|
||||
RETURN(status, H5_SUCCESS, "H5PartSetView");
|
||||
|
||||
status = H5PartWriteDataFloat32(file, "x", x);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
|
||||
test_write_step_attribs(file, t);
|
||||
|
||||
status = H5PartWriteDataFloat32(file, "y", y);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
|
||||
status = H5PartWriteDataFloat32(file, "z", z);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
|
||||
status = H5PartWriteDataFloat32(file, "px", px);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
|
||||
status = H5PartWriteDataFloat32(file, "py", py);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
|
||||
status = H5PartWriteDataFloat32(file, "pz", pz);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
|
||||
status = H5PartWriteDataInt32(file, LONGNAME, id);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataInt32");
|
||||
|
||||
/* the second write phase... */
|
||||
status = H5PartSetView(file,
|
||||
rank*nparticles + 32,
|
||||
rank*nparticles + nparticles - 1);
|
||||
RETURN(status, H5_SUCCESS, "H5PartSetView");
|
||||
/* offset the input arrays */
|
||||
status = H5PartWriteDataFloat32(file, "x", x+32);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
|
||||
status = H5PartWriteDataFloat32(file, "y", y+32);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
|
||||
status = H5PartWriteDataFloat32(file, "z", z+32);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
|
||||
status = H5PartWriteDataFloat32(file, "px", px+32);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
|
||||
status = H5PartWriteDataFloat32(file, "py", py+32);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
|
||||
status = H5PartWriteDataFloat32(file, "pz", pz+32);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
|
||||
status = H5PartWriteDataInt32(file, LONGNAME, id+32);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataInt32");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
test_write_strided_data32(h5_file_t *file, int nparticles, int step)
|
||||
{
|
||||
int i,t;
|
||||
h5_int64_t status;
|
||||
|
||||
float *data;
|
||||
|
||||
data=(float*)malloc(6*nparticles*sizeof(float));
|
||||
|
||||
TEST("Writing 32-bit strided data");
|
||||
|
||||
for (t=step; t<step+NTIMESTEPS; t++)
|
||||
{
|
||||
for (i=0; i<nparticles; i++)
|
||||
{
|
||||
data[6*i] = 0.0F + (float)(i+nparticles*t);
|
||||
data[6*i+1] = 0.1F + (float)(i+nparticles*t);
|
||||
data[6*i+2] = 0.2F + (float)(i+nparticles*t);
|
||||
data[6*i+3] = 0.3F + (float)(i+nparticles*t);
|
||||
data[6*i+4] = 0.4F + (float)(i+nparticles*t);
|
||||
data[6*i+5] = 0.5F + (float)(i+nparticles*t);
|
||||
}
|
||||
|
||||
status = H5SetStep(file, t);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStep");
|
||||
|
||||
test_write_step_attribs(file, t);
|
||||
|
||||
status = H5PartSetNumParticlesStrided(file, nparticles, 6);
|
||||
RETURN(status, H5_SUCCESS, "H5PartSetNumParticlesStrided");
|
||||
|
||||
status = H5PartWriteDataFloat32(file, "x", data+0);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
|
||||
status = H5PartWriteDataFloat32(file, "y", data+1);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
|
||||
status = H5PartWriteDataFloat32(file, "z", data+2);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
|
||||
status = H5PartWriteDataFloat32(file, "px", data+3);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
|
||||
status = H5PartWriteDataFloat32(file, "py", data+4);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
|
||||
status = H5PartWriteDataFloat32(file, "pz", data+5);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
}
|
||||
}
|
||||
|
||||
void h5u_test_write1(void)
|
||||
{
|
||||
h5_file_t *file1;
|
||||
|
||||
h5_err_t status;
|
||||
|
||||
TEST("Opening file once, write-truncate");
|
||||
file1 = H5OpenFile(FILENAME, H5_O_WRONLY, MPI_COMM_WORLD);
|
||||
|
||||
status = H5CheckFile(file1);
|
||||
RETURN(status, H5_SUCCESS, "H5CheckFile");
|
||||
|
||||
test_write_data32(file1, NPARTICLES, 1);
|
||||
test_write_file_attribs(file1, 0);
|
||||
|
||||
status = H5CloseFile(file1);
|
||||
RETURN(status, H5_SUCCESS, "H5CloseFile");
|
||||
}
|
||||
|
||||
void h5u_test_write2(void)
|
||||
{
|
||||
h5_file_t *file1;
|
||||
h5_file_t *file2;
|
||||
|
||||
h5_err_t status;
|
||||
|
||||
TEST("Opening file twice, write-append + read-only");
|
||||
file1 = H5OpenFile(FILENAME, H5_O_APPEND, MPI_COMM_WORLD);
|
||||
|
||||
status = H5CheckFile(file1);
|
||||
RETURN(status, H5_SUCCESS, "H5CheckFile");
|
||||
|
||||
file2 = H5OpenFile(FILENAME, H5_O_RDONLY, MPI_COMM_WORLD);
|
||||
|
||||
status = H5CheckFile(file2);
|
||||
RETURN(status, H5_SUCCESS, "H5CheckFile");
|
||||
|
||||
test_write_strided_data32(file1, NPARTICLES, NTIMESTEPS+1);
|
||||
test_write_file_attribs(file1, 1);
|
||||
|
||||
status = H5CloseFile(file1);
|
||||
RETURN(status, H5_SUCCESS, "H5CloseFile");
|
||||
status = H5CloseFile(file2);
|
||||
RETURN(status, H5_SUCCESS, "H5CloseFile");
|
||||
}
|
||||
|
||||
void h5u_test_write3(void)
|
||||
{
|
||||
h5_file_t *file1;
|
||||
|
||||
h5_err_t status;
|
||||
|
||||
TEST("Opening file once, write-truncate, MPI-POSIX VFD");
|
||||
file1 = H5OpenFile(FILENAME, H5_O_WRONLY | H5_VFD_MPIPOSIX, MPI_COMM_WORLD);
|
||||
|
||||
status = H5CheckFile(file1);
|
||||
RETURN(status, H5_SUCCESS, "H5CheckFile");
|
||||
|
||||
TEST("Redefining step name");
|
||||
status = H5SetStepNameFormat(file1, LONGNAME, 16);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStepNameFormat");
|
||||
|
||||
test_write_strided_data64(file1, NPARTICLES, 0);
|
||||
test_write_file_attribs(file1, 0);
|
||||
|
||||
status = H5CloseFile(file1);
|
||||
RETURN(status, H5_SUCCESS, "H5CloseFile");
|
||||
}
|
||||
|
||||
void h5u_test_write4(void)
|
||||
{
|
||||
h5_file_t *file1;
|
||||
h5_file_t *file2;
|
||||
|
||||
h5_err_t status;
|
||||
|
||||
TEST("Opening file twice, write-append + read-only, MPI-IO Independent VFD");
|
||||
file1 = H5OpenFile(FILENAME, H5_O_APPEND | H5_VFD_INDEPENDENT, MPI_COMM_WORLD);
|
||||
status = H5CheckFile(file1);
|
||||
RETURN(status, H5_SUCCESS, "H5CheckFile");
|
||||
|
||||
file2 = H5OpenFile(FILENAME, H5_O_RDONLY | H5_VFD_INDEPENDENT, MPI_COMM_WORLD);
|
||||
status = H5CheckFile(file2);
|
||||
RETURN(status, H5_SUCCESS, "H5CheckFile");
|
||||
|
||||
TEST("Redefining step name");
|
||||
status = H5SetStepNameFormat(file1, LONGNAME, 16);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStepNameFormat");
|
||||
|
||||
status = H5SetStepNameFormat(file2, LONGNAME, 16);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStepNameFormat");
|
||||
|
||||
status = H5PartSetChunkSize(file1, NPARTICLES);
|
||||
RETURN(status, H5_SUCCESS, "H5PartSetChunkSize");
|
||||
|
||||
test_write_data64(file1, NPARTICLES, NTIMESTEPS-2);
|
||||
test_write_file_attribs(file1, 1);
|
||||
|
||||
status = H5CloseFile(file1);
|
||||
RETURN(status, H5_SUCCESS, "H5CloseFile");
|
||||
status = H5CloseFile(file2);
|
||||
RETURN(status, H5_SUCCESS, "H5CloseFile");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef _H5HUT_TEST_PARAMS_H_
|
||||
#define _H5HUT_TEST_PARAMS_H_
|
||||
|
||||
#define FILENAME "test.h5"
|
||||
#define LONGNAME "thisisaverylongnamethatshouldexceedthelimitof64charcausingawarningtoprint"
|
||||
#define NTIMESTEPS 10
|
||||
|
||||
/* do not decrease this value below 99, or it will break assumptions
|
||||
* made in the read tests! */
|
||||
#define NPARTICLES 99
|
||||
|
||||
/* do not increase this value past 32! */
|
||||
#define MAX_MPI_TASKS 32
|
||||
|
||||
#define ATTR_NAME_SIZE 16
|
||||
#define ATTR_STR_VAL "test"
|
||||
#define ATTR_INT32_VAL -2147483648
|
||||
#define ATTR_INT64_VAL 2147483648
|
||||
#define ATTR_FLOAT_VAL 3.14159265F
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,679 @@
|
||||
/* Test framework borrowed from HDF5 1.8.3:
|
||||
* test/testframe.c
|
||||
*/
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
* terms governing use, modification, and redistribution, is contained in *
|
||||
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
||||
* of the source code distribution tree; Copyright.html can be found at the *
|
||||
* root level of an installed copy of the electronic HDF5 document set and *
|
||||
* is linked from the top-level documents page. It can also be found at *
|
||||
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
|
||||
* Tuesday, January 6, 2004
|
||||
*
|
||||
* Purpose: Provides support functions for the testing framework.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include "testframe.h"
|
||||
|
||||
/*
|
||||
* Definitions for the testing structure.
|
||||
*/
|
||||
#define MAXNUMOFTESTS 64
|
||||
#define MAXTESTNAME 16
|
||||
#define MAXTESTDESC 64
|
||||
|
||||
typedef struct TestStruct {
|
||||
int NumErrors;
|
||||
char Description[MAXTESTDESC];
|
||||
int SkipFlag;
|
||||
char Name[MAXTESTNAME];
|
||||
void (*Call)(void);
|
||||
void (*Cleanup)(void);
|
||||
const void *Parameters;
|
||||
} TestStruct;
|
||||
|
||||
|
||||
/*
|
||||
* Variables used by testing framework.
|
||||
*/
|
||||
static int num_errs = 0; /* Total number of errors during testing */
|
||||
static int Verbosity = VERBO_DEF; /* Default Verbosity is Low */
|
||||
static int Summary = 0; /* Show test summary. Default is no. */
|
||||
static int CleanUp = 1; /* Do cleanup or not. Default is yes. */
|
||||
static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */
|
||||
static TestStruct Test[MAXNUMOFTESTS];
|
||||
static int Index = 0;
|
||||
static const void *Test_parameters = NULL;
|
||||
static const char *TestProgName = NULL;
|
||||
static void (*TestPrivateUsage)(void) = NULL;
|
||||
static int (*TestPrivateParser)(int ac, char *av[]) = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* Setup a test function and add it to the list of tests.
|
||||
* It must have no parameters and returns void.
|
||||
* TheName--short test name.
|
||||
* If the name starts with '-', do not run it by default.
|
||||
* TheCall--the test routine.
|
||||
* Cleanup--the cleanup routine for the test.
|
||||
* TheDescr--Long description of the test.
|
||||
* Parameters--pointer to extra parameters. Use NULL if none used.
|
||||
* Since only the pointer is copied, the contents should not change.
|
||||
*/
|
||||
void
|
||||
AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), const char *TheDescr, const void *Parameters)
|
||||
{
|
||||
/* Sanity checking */
|
||||
if (Index >= MAXNUMOFTESTS) {
|
||||
printf("Too many tests added, increase MAXNUMOFTEST(%d).\n",
|
||||
MAXNUMOFTESTS);
|
||||
exit(-1);
|
||||
} /* end if */
|
||||
if (strlen(TheDescr) >= MAXTESTDESC) {
|
||||
printf("Test description too long, increase MAXTESTDESC(%d).\n",
|
||||
MAXTESTDESC);
|
||||
exit(-1);
|
||||
} /* end if */
|
||||
if (strlen(TheName) >= MAXTESTNAME) {
|
||||
printf("Test name too long, increase MAXTESTNAME(%d).\n",
|
||||
MAXTESTNAME);
|
||||
exit(-1);
|
||||
} /* end if */
|
||||
|
||||
/* Set up test function */
|
||||
strcpy(Test[Index].Description, TheDescr);
|
||||
if (*TheName != '-'){
|
||||
strcpy(Test[Index].Name, TheName);
|
||||
Test[Index].SkipFlag = 0;
|
||||
}
|
||||
else { /* skip test by default */
|
||||
strcpy(Test[Index].Name, TheName+1);
|
||||
Test[Index].SkipFlag = 1;
|
||||
}
|
||||
Test[Index].Call = TheCall;
|
||||
Test[Index].Cleanup = Cleanup;
|
||||
Test[Index].NumErrors = -1;
|
||||
Test[Index].Parameters = Parameters;
|
||||
|
||||
/* Increment test count */
|
||||
Index++;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize testing framework
|
||||
*
|
||||
* ProgName: Name of test program.
|
||||
* private_usage: Optional routine provided by test program to print the
|
||||
* private portion of usage page. Default to NULL which means none is
|
||||
* provided.
|
||||
* private_parser: Optional routine provided by test program to parse the
|
||||
* private options. Default to NULL which means none is provided.
|
||||
*
|
||||
* Modifications:
|
||||
* Albert Cheng 2004/08/17
|
||||
* Added the ProgName, private_usage and private_parser arguments.
|
||||
*/
|
||||
void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[]))
|
||||
{
|
||||
#if !(defined MAC || defined SYMANTEC_C)
|
||||
/* Un-buffer the stdout and stderr */
|
||||
setbuf(stderr, NULL);
|
||||
setbuf(stdout, NULL);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Turn off automatic error reporting since we do it ourselves. Besides,
|
||||
* half the functions this test calls are private, so automatic error
|
||||
* reporting wouldn't do much good since it's triggered at the API layer.
|
||||
*/
|
||||
//H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
|
||||
|
||||
/*
|
||||
* Record the program name and private routines if provided.
|
||||
*/
|
||||
TestProgName = ProgName;
|
||||
if (NULL != private_usage)
|
||||
TestPrivateUsage = private_usage;
|
||||
if (NULL != private_parser)
|
||||
TestPrivateParser = private_parser;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print test usage.
|
||||
* First print the common test options, then the extra options if provided.
|
||||
*
|
||||
* Modification:
|
||||
* 2004/08/18 Albert Cheng. Add TestPrivateUsage feature.
|
||||
*/
|
||||
void TestUsage(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n",
|
||||
TestProgName, (TestPrivateUsage ? "<extra options>" : ""));
|
||||
printf(" [-[e]x[clude] name+] \n");
|
||||
printf(" [-o[nly] name+] \n");
|
||||
printf(" [-b[egin] name] \n");
|
||||
printf(" [-s[ummary]] \n");
|
||||
printf(" [-c[leanoff]] \n");
|
||||
printf(" [-h[elp]] \n");
|
||||
printf("\n\n");
|
||||
printf("verbose controls the amount of information displayed\n");
|
||||
printf("exclude to exclude tests by name\n");
|
||||
printf("only to name tests which should be run\n");
|
||||
printf("begin start at the name of the test givin\n");
|
||||
printf("summary prints a summary of test results at the end\n");
|
||||
printf("cleanoff does not delete *.hdf files after execution of tests\n");
|
||||
printf("help print out this information\n");
|
||||
if (TestPrivateUsage){
|
||||
printf("\nExtra options\n");
|
||||
TestPrivateUsage();
|
||||
}
|
||||
printf("\n\n");
|
||||
printf("This program currently tests the following: \n\n");
|
||||
printf("%16s %s\n", "Name", "Description");
|
||||
printf("%16s %s\n", "----", "-----------");
|
||||
|
||||
for (i = 0; i < Index; i++)
|
||||
printf("%16s %s\n", Test[i].Name, Test[i].Description);
|
||||
|
||||
printf("\n\n");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print test info.
|
||||
*/
|
||||
void TestInfo(const char *ProgName)
|
||||
{
|
||||
unsigned major, minor, release;
|
||||
|
||||
H5get_libversion(&major, &minor, &release);
|
||||
|
||||
printf("\nFor help use: %s -help\n",ProgName);
|
||||
printf("Linked with HDF5 version %u.%u release %u\n", major, minor, release);
|
||||
printf("Linked with H5hut version %s\n", H5_VER_STRING);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Parse command line information.
|
||||
* argc, argv: the usual command line argument count and strings
|
||||
*
|
||||
* Modification:
|
||||
* 2004/08/18 Albert Cheng. Add extra_parse feature.
|
||||
*/
|
||||
void TestParseCmdLine(int argc, char *argv[])
|
||||
{
|
||||
int ret_code;
|
||||
|
||||
while (argv++, --argc > 0){
|
||||
if ((strcmp(*argv, "-verbose") == 0) ||
|
||||
(strcmp(*argv, "-v") == 0)) {
|
||||
if (argc > 0){
|
||||
--argc; ++argv;
|
||||
ParseTestVerbosity(*argv);
|
||||
}else{
|
||||
TestUsage();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else if (((strcmp(*argv, "-exclude") == 0) ||
|
||||
(strcmp(*argv, "-x") == 0))) {
|
||||
if (argc > 0){
|
||||
--argc; ++argv;
|
||||
SetTest(*argv, SKIPTEST);
|
||||
}else{
|
||||
TestUsage();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else if (((strcmp(*argv, "-begin") == 0) ||
|
||||
(strcmp(*argv, "-b") == 0))) {
|
||||
if (argc > 0){
|
||||
--argc; ++argv;
|
||||
SetTest(*argv, BEGINTEST);
|
||||
}else{
|
||||
TestUsage();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else if (((strcmp(*argv, "-only") == 0) ||
|
||||
(strcmp(*argv, "-o") == 0))) {
|
||||
if (argc > 0){
|
||||
int Loop;
|
||||
--argc; ++argv;
|
||||
/* Skip all tests, then activate only one. */
|
||||
for (Loop = 0; Loop < Index; Loop++)
|
||||
Test[Loop].SkipFlag = 1;
|
||||
SetTest(*argv, ONLYTEST);
|
||||
}else{
|
||||
TestUsage();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else if ((strcmp(*argv, "-summary") == 0) || (strcmp(*argv, "-s") == 0))
|
||||
Summary = 1;
|
||||
else if ((strcmp(*argv, "-help") == 0) || (strcmp(*argv, "-h") == 0)) {
|
||||
TestUsage();
|
||||
exit(0);
|
||||
}
|
||||
else if ((strcmp(*argv, "-cleanoff") == 0) || (strcmp(*argv, "-c") == 0))
|
||||
SetTestNoCleanup();
|
||||
else {
|
||||
/* non-standard option. Break out. */
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Call extra parsing function if provided. */
|
||||
if (NULL != TestPrivateParser){
|
||||
ret_code=TestPrivateParser(argc+1, argv-1);
|
||||
if (ret_code != 0)
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Perform Tests.
|
||||
*/
|
||||
void PerformTests(void)
|
||||
{
|
||||
int Loop;
|
||||
|
||||
for (Loop = 0; Loop < Index; Loop++)
|
||||
if (Test[Loop].SkipFlag) {
|
||||
MESSAGE(2, ("Skipping -- %s (%s) \n", Test[Loop].Description, Test[Loop].Name));
|
||||
} else {
|
||||
MESSAGE(2, ("Testing -- %s (%s) \n", Test[Loop].Description, Test[Loop].Name));
|
||||
MESSAGE(5, ("===============================================\n"));
|
||||
Test[Loop].NumErrors = num_errs;
|
||||
Test_parameters = Test[Loop].Parameters;
|
||||
//ALARM_ON;
|
||||
Test[Loop].Call();
|
||||
//ALARM_OFF;
|
||||
Test[Loop].NumErrors = num_errs - Test[Loop].NumErrors;
|
||||
MESSAGE(5, ("===============================================\n"));
|
||||
MESSAGE(5, ("There were %d errors detected.\n\n", (int)Test[Loop].NumErrors));
|
||||
}
|
||||
|
||||
Test_parameters = NULL; /* clear it. */
|
||||
MESSAGE(2, ("\n\n"));
|
||||
|
||||
if (num_errs)
|
||||
printf("!!! %d Error(s) were detected !!!\n\n", (int) num_errs);
|
||||
else
|
||||
printf("All tests were successful. \n\n");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Display test summary.
|
||||
*/
|
||||
void TestSummary(void)
|
||||
{
|
||||
int Loop;
|
||||
|
||||
printf("Summary of Test Results:\n");
|
||||
printf("Name of Test Errors Description of Test\n");
|
||||
printf("---------------- ------ --------------------------------------\n");
|
||||
|
||||
for (Loop = 0; Loop < Index; Loop++) {
|
||||
if (Test[Loop].NumErrors == -1)
|
||||
printf("%16s %6s %s\n", Test[Loop].Name, "N/A", Test[Loop].Description);
|
||||
else
|
||||
printf("%16s %6d %s\n", Test[Loop].Name, (int)Test[Loop].NumErrors, Test[Loop].Description);
|
||||
}
|
||||
|
||||
printf("\n\n");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Cleanup files from testing
|
||||
*/
|
||||
void TestCleanup(void)
|
||||
{
|
||||
int Loop;
|
||||
|
||||
MESSAGE(2, ("\nCleaning Up temp files...\n\n"));
|
||||
|
||||
/* call individual cleanup routines in each source module */
|
||||
for (Loop = 0; Loop < Index; Loop++)
|
||||
if (!Test[Loop].SkipFlag && Test[Loop].Cleanup!=NULL)
|
||||
Test[Loop].Cleanup();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Retrieve the verbosity level for the testing framework
|
||||
*/
|
||||
int GetTestVerbosity(void)
|
||||
{
|
||||
return(Verbosity);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the verbosity level for the testing framework.
|
||||
* Return previous verbosity level.
|
||||
*/
|
||||
int SetTestVerbosity(int newval)
|
||||
{
|
||||
int oldval;
|
||||
|
||||
oldval = Verbosity;
|
||||
Verbosity = newval;
|
||||
return(oldval);
|
||||
}
|
||||
|
||||
/*
|
||||
* Retrieve the TestExpress mode for the testing framework
|
||||
Values:
|
||||
0: Exhaustive run
|
||||
Tests should take as long as necessary
|
||||
1: Full run. Default if HDF5TestExpress is not defined
|
||||
Tests should take no more than 30 minutes
|
||||
2: Quick run
|
||||
Tests should take no more than 10 minutes
|
||||
3: Smoke test. Default if HDF5TestExpress is set to a value other than 0-3
|
||||
Tests should take less than 1 minute
|
||||
|
||||
Design:
|
||||
If the environment variable $HDF5TestExpress is defined,
|
||||
then test programs should skip some tests so that they
|
||||
complete sooner.
|
||||
|
||||
Terms:
|
||||
A "test" is a single executable, even if it contains multiple
|
||||
sub-tests.
|
||||
The standard system for test times is a Linux machine running in
|
||||
NFS space (to catch tests that involve a great deal of disk I/O).
|
||||
|
||||
Implementation:
|
||||
I think this can be easily implemented in the test library (libh5test.a)
|
||||
so that all tests can just call it to check the status of $HDF5TestExpress.
|
||||
*/
|
||||
int GetTestExpress(void)
|
||||
{
|
||||
char * env_val;
|
||||
|
||||
/* set it here for now. Should be done in something like h5test_init(). */
|
||||
if(TestExpress==-1)
|
||||
{
|
||||
env_val = getenv("HDF5TestExpress");
|
||||
|
||||
if(env_val == NULL)
|
||||
SetTestExpress(1);
|
||||
else if(strcmp(env_val, "0") == 0)
|
||||
SetTestExpress(0);
|
||||
else if(strcmp(env_val, "1") == 0)
|
||||
SetTestExpress(1);
|
||||
else if(strcmp(env_val, "2") == 0)
|
||||
SetTestExpress(2);
|
||||
else
|
||||
SetTestExpress(3);
|
||||
}
|
||||
|
||||
return(TestExpress);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the TestExpress mode for the testing framework.
|
||||
* Return previous TestExpress mode.
|
||||
* Values: non-zero means TestExpress mode is on, 0 means off.
|
||||
*/
|
||||
int SetTestExpress(int newval)
|
||||
{
|
||||
int oldval;
|
||||
|
||||
oldval = TestExpress;
|
||||
TestExpress = newval;
|
||||
return(oldval);
|
||||
}
|
||||
|
||||
/*
|
||||
* Retrieve Summary request value.
|
||||
* 0 means no summary, 1 means yes.
|
||||
*/
|
||||
int GetTestSummary(void)
|
||||
{
|
||||
return(Summary);
|
||||
}
|
||||
|
||||
/*
|
||||
* Retrieve Cleanup request value.
|
||||
* 0 means no Cleanup, 1 means yes.
|
||||
*/
|
||||
int GetTestCleanup(void)
|
||||
{
|
||||
return(CleanUp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set cleanup to no.
|
||||
* Return previous cleanup value.
|
||||
*/
|
||||
int SetTestNoCleanup(void)
|
||||
{
|
||||
int oldval;
|
||||
|
||||
oldval = CleanUp;
|
||||
CleanUp = 0;
|
||||
return(oldval);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse an argument string for verbosity level and set it.
|
||||
*/
|
||||
void ParseTestVerbosity(char *argv)
|
||||
{
|
||||
if (*argv == 'l')
|
||||
SetTestVerbosity(VERBO_LO);
|
||||
else if (*argv == 'm')
|
||||
SetTestVerbosity(VERBO_MED);
|
||||
else if (*argv == 'h')
|
||||
SetTestVerbosity(VERBO_HI);
|
||||
else
|
||||
SetTestVerbosity(atoi(argv));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Retrieve the number of testing errors for the testing framework
|
||||
*/
|
||||
int GetTestNumErrs(void)
|
||||
{
|
||||
return(num_errs);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Increment the number of testing errors
|
||||
*/
|
||||
void IncTestNumErrs(void)
|
||||
{
|
||||
num_errs++;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Retrieve the current Test Parameters pointer.
|
||||
*/
|
||||
const void *GetTestParameters(void)
|
||||
{
|
||||
return(Test_parameters);
|
||||
}
|
||||
|
||||
int
|
||||
TestPrintf(const char *format, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
int ret_value;
|
||||
|
||||
#if PARALLEL_IO
|
||||
int nproc;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &nproc);
|
||||
if ( nproc == 0 || VERBOSE_HI ) {
|
||||
char *format2 = malloc(strlen(format)+8);
|
||||
sprintf(format2, "[%d] %s", nproc, format);
|
||||
va_start(arglist, format);
|
||||
ret_value = vprintf(format2, arglist);
|
||||
va_end(arglist);
|
||||
}
|
||||
#else
|
||||
va_start(arglist, format);
|
||||
ret_value = vprintf(format, arglist);
|
||||
va_end(arglist);
|
||||
#endif
|
||||
|
||||
/* Return the length of the string produced (like printf() does) */
|
||||
return ret_value;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This routine is designed to provide equivalent functionality to 'printf'
|
||||
* and also increment the error count for the testing framework.
|
||||
*/
|
||||
int
|
||||
TestErrPrintf(const char *format, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
int ret_value;
|
||||
|
||||
/* Increment the error count */
|
||||
num_errs++;
|
||||
|
||||
#if PARALLEL_IO
|
||||
int nproc;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &nproc);
|
||||
if ( nproc == 0 || VERBOSE_HI ) {
|
||||
char *format2 = malloc(strlen(format)+8);
|
||||
sprintf(format2, "[%d] %s", nproc, format);
|
||||
va_start(arglist, format);
|
||||
ret_value = vfprintf(stderr, format2, arglist);
|
||||
va_end(arglist);
|
||||
}
|
||||
#else
|
||||
va_start(arglist, format);
|
||||
ret_value = vfprintf(stderr, format, arglist);
|
||||
va_end(arglist);
|
||||
#endif
|
||||
|
||||
/* Return the length of the string produced (like printf() does) */
|
||||
return ret_value;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set (control) which test will be tested.
|
||||
* SKIPTEST: skip this test
|
||||
* ONLYTEST: do only this test
|
||||
* BEGINETEST: skip all tests before this test
|
||||
*
|
||||
*/
|
||||
void SetTest(const char *testname, int action)
|
||||
{
|
||||
int Loop;
|
||||
switch (action){
|
||||
case SKIPTEST:
|
||||
for (Loop = 0; Loop < Index; Loop++)
|
||||
if (strcmp(testname, Test[Loop].Name) == 0){
|
||||
Test[Loop].SkipFlag = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case BEGINTEST:
|
||||
for (Loop = 0; Loop < Index; Loop++) {
|
||||
if (strcmp(testname, Test[Loop].Name) != 0)
|
||||
Test[Loop].SkipFlag = 1;
|
||||
else{
|
||||
/* Found it. Set it to run. Done. */
|
||||
Test[Loop].SkipFlag = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ONLYTEST:
|
||||
for (Loop = 0; Loop < Index; Loop++) {
|
||||
if (strcmp(testname, Test[Loop].Name) != 0)
|
||||
Test[Loop].SkipFlag = 1;
|
||||
else {
|
||||
/* Found it. Set it to run. Break to skip the rest. */
|
||||
Test[Loop].SkipFlag = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* skip the rest */
|
||||
while (++Loop < Index)
|
||||
Test[Loop].SkipFlag = 1;
|
||||
break;
|
||||
default:
|
||||
/* error */
|
||||
printf("*** ERROR: Unknown action (%d) for SetTest\n", action);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
get_attr_name(char *name, char *tag, int id)
|
||||
{
|
||||
sprintf(name, "Attr%d%s", id, tag);
|
||||
}
|
||||
|
||||
void
|
||||
test_open_objects(h5_file_t *file, int max_objects)
|
||||
{
|
||||
hid_t hfile = h5_get_hdf5_file(file);
|
||||
ssize_t nopen = H5Fget_obj_count(hfile, H5F_OBJ_ALL);
|
||||
if (nopen > max_objects)
|
||||
{
|
||||
TestErrPrintf( "*** TOO MANY OBJECTS OPEN: %d > %d "
|
||||
"at line %4d in %s\n", nopen, max_objects,
|
||||
(int)__LINE__, __FILE__ );
|
||||
|
||||
hid_t *list = malloc(sizeof(hid_t)*nopen);
|
||||
H5Fget_obj_ids(hfile, H5F_OBJ_ALL, nopen, list);
|
||||
|
||||
H5O_info_t info;
|
||||
int i;
|
||||
for (i=0; i<nopen; i++) {
|
||||
H5Oget_info(list[i], &info);
|
||||
switch (info.type) {
|
||||
case H5O_TYPE_GROUP:
|
||||
TestErrPrintf("obj%d has type GROUP\n", i);
|
||||
break;
|
||||
case H5O_TYPE_DATASET:
|
||||
TestErrPrintf("obj%d has type DATASET\n", i);
|
||||
break;
|
||||
case H5O_TYPE_NAMED_DATATYPE:
|
||||
TestErrPrintf("obj%d has type NAMED_DATATYPE\n", i);
|
||||
break;
|
||||
default:
|
||||
TestErrPrintf("obj%d has unknown type\n", i);
|
||||
}
|
||||
}
|
||||
free(list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
/* Test framework borrowed from HDF5 1.8.3:
|
||||
* test/h5test.h
|
||||
* test/testhdf5.h
|
||||
*/
|
||||
|
||||
#ifndef _H5HUT_TESTFRAME_H_
|
||||
#define _H5HUT_TESTFRAME_H_
|
||||
|
||||
#include <H5hut.h>
|
||||
|
||||
#ifndef PARALLEL_IO
|
||||
#define MPI_COMM_WORLD 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Predefined test verbosity levels.
|
||||
*
|
||||
* Convention:
|
||||
*
|
||||
* The higher the verbosity value, the more information printed.
|
||||
* So, output for higher verbosity also include output of all lower
|
||||
* verbosity.
|
||||
*
|
||||
* Value Description
|
||||
* 0 None: No informational message.
|
||||
* 1 "All tests passed"
|
||||
* 2 Header of overall test
|
||||
* 3 Default: header and results of individual test
|
||||
* 4
|
||||
* 5 Low: Major category of tests.
|
||||
* 6
|
||||
* 7 Medium: Minor category of tests such as functions called.
|
||||
* 8
|
||||
* 9 High: Highest level. All information.
|
||||
*/
|
||||
#define VERBO_DEF 0 /* Default */
|
||||
#define VERBO_LO 2 /* Low */
|
||||
#define VERBO_MED 3 /* Medium */
|
||||
#define VERBO_HI 4 /* High */
|
||||
|
||||
/*
|
||||
* Verbose queries
|
||||
* Only None needs an exact match. The rest are at least as much.
|
||||
*/
|
||||
#define VERBOSE_DEF (GetTestVerbosity()>=VERBO_DEF)
|
||||
#define VERBOSE_LO (GetTestVerbosity()>=VERBO_LO)
|
||||
#define VERBOSE_MED (GetTestVerbosity()>=VERBO_MED)
|
||||
#define VERBOSE_HI (GetTestVerbosity()>=VERBO_HI)
|
||||
|
||||
#define SKIPTEST 1
|
||||
#define ONLYTEST 2
|
||||
#define BEGINTEST 3
|
||||
|
||||
/*
|
||||
* Print the current location on the standard output stream.
|
||||
*/
|
||||
#define AT() TestPrintf (" at %s:%d in %s()...\n", \
|
||||
__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
/*
|
||||
* The name of the test is printed by saying TESTING("something") which will
|
||||
* result in the string `Testing something' being flushed to standard output.
|
||||
* If a test passes, fails, or is skipped then the PASSED(), H5_FAILED(), or
|
||||
* SKIPPED() macro should be called. After H5_FAILED() or SKIPPED() the caller
|
||||
* should print additional information to stdout indented by at least four
|
||||
* spaces. If the h5_errors() is used for automatic error handling then
|
||||
* the H5_FAILED() macro is invoked automatically when an API function fails.
|
||||
*/
|
||||
#define TESTING(WHAT) {TestPrintf("Testing %-62s",WHAT); fflush(stdout);}
|
||||
#define TESTING_2(WHAT) {TestPrintf(" Testing %-62s",WHAT); fflush(stdout);}
|
||||
#define PASSED() {TestPrintf(" PASSED");fflush(stdout);}
|
||||
#define H5_FAILED() {TestPrintf("*FAILED*");fflush(stdout);}
|
||||
#define H5_WARNING() {TestPrintf("*WARNING*");fflush(stdout);}
|
||||
#define SKIPPED() {TestPrintf(" -SKIP-");fflush(stdout);}
|
||||
#define TEST_ERROR {H5_FAILED(); AT(); goto error;}
|
||||
#define FAIL_PUTS_ERROR(s) {H5_FAILED(); AT(); TestPrintf(s); goto error;}
|
||||
|
||||
/* Use %ld to print the value because long should cover most cases. */
|
||||
/* Used to make certain a return value _is_not_ a value */
|
||||
#define RETURN(ret, val, where) do { \
|
||||
if (VERBOSE_HI) TestPrintf( " Call to routine %15s at line %4d " \
|
||||
"in %s returned %ld \n", \
|
||||
where, (int)__LINE__, __FILE__, \
|
||||
(long)(ret)); \
|
||||
if ((ret) != (val)) { \
|
||||
TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
|
||||
"in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define VALUE(val, expected, what) do { \
|
||||
if ((val) != (expected)) { \
|
||||
TestErrPrintf( "*** INCORRECT VALUE of %s at line " \
|
||||
"%d in %s\n", what, (int)__LINE__, \
|
||||
__FILE__); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define IVALUE(val, expected, what) do { \
|
||||
if (VERBOSE_HI) TestPrintf( " Value of int %15s at line %4d " \
|
||||
"in %s is %ld =? %ld\n", what, \
|
||||
(int)__LINE__, __FILE__, \
|
||||
(long)(val), (long)(expected)); \
|
||||
VALUE(val, expected, what); \
|
||||
} while(0)
|
||||
|
||||
#define FVALUE(val, expected, what) do { \
|
||||
if (VERBOSE_HI) TestPrintf( " Value of float %15s at line %4d " \
|
||||
"in %s is %g =? %g\n", what, \
|
||||
(int)__LINE__, __FILE__, \
|
||||
(val), (expected)); \
|
||||
VALUE(val, expected, what); \
|
||||
} while(0)
|
||||
|
||||
#define CVALUE(val, expected, what) do { \
|
||||
if (VERBOSE_HI) TestPrintf( " Value of char %15s at line %4d " \
|
||||
"in %s is %c =? %c\n", what, \
|
||||
(int)__LINE__, __FILE__, \
|
||||
(val), (expected)); \
|
||||
VALUE(val, expected, what); \
|
||||
} while(0)
|
||||
|
||||
|
||||
#define SVALUE(val, expected, what) do { \
|
||||
if (VERBOSE_HI) TestPrintf( " Value of string %15s at line %4d " \
|
||||
"in %s is %s =? %s\n", what, \
|
||||
(int)__LINE__, __FILE__, \
|
||||
(val), (expected)); \
|
||||
if (strcmp(val,expected) != 0) { \
|
||||
TestErrPrintf( "*** INCORRECT VALUE of %d at line " \
|
||||
"%4d in %s\n", what, (int)__LINE__, \
|
||||
__FILE__); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/* Used to document process through a test */
|
||||
#define MESSAGE(V,A) do { \
|
||||
if (V) TestPrintf A; \
|
||||
} while(0)
|
||||
|
||||
#define TEST(WHAT) MESSAGE(VERBOSE_DEF,(WHAT "\n"))
|
||||
|
||||
/* definitions for command strings */
|
||||
#define VERBOSITY_STR "Verbosity"
|
||||
#define SKIP_STR "Skip"
|
||||
#define TEST_STR "Test"
|
||||
#define CLEAN_STR "Cleanup"
|
||||
|
||||
void TestUsage(void);
|
||||
void AddTest(const char *TheName, void (*TheCall) (void),
|
||||
void (*Cleanup) (void), const char *TheDescr,
|
||||
const void *Parameters);
|
||||
void TestInfo(const char *ProgName);
|
||||
void TestParseCmdLine(int argc, char *argv[]);
|
||||
void PerformTests(void);
|
||||
void TestSummary(void);
|
||||
void TestCleanup(void);
|
||||
void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[]));
|
||||
int GetTestVerbosity(void);
|
||||
int SetTestVerbosity(int newval);
|
||||
int GetTestSummary(void);
|
||||
int GetTestCleanup(void);
|
||||
int SetTestNoCleanup(void);
|
||||
int GetTestExpress(void);
|
||||
int SetTestExpress(int newval);
|
||||
void ParseTestVerbosity(char *argv);
|
||||
int GetTestNumErrs(void);
|
||||
void IncTestNumErrs(void);
|
||||
const void *GetTestParameters(void);
|
||||
int TestPrintf(const char *format, ...);
|
||||
int TestErrPrintf(const char *format, ...);
|
||||
void SetTest(const char *testname, int action);
|
||||
|
||||
void
|
||||
get_attr_name(char *name, char *tag, int id);
|
||||
|
||||
void
|
||||
test_open_objects(h5_file_t *file, int max_objects);
|
||||
|
||||
#endif
|
||||
|
||||
+5
-62
@@ -1,33 +1,12 @@
|
||||
# tools level Makefile.am
|
||||
|
||||
# PATH SETTING
|
||||
HDF5ROOT = @HDF5ROOT@
|
||||
OBJEXT=o
|
||||
|
||||
# COMPILER SETTING
|
||||
CXX = @CXX@
|
||||
TOOLS_CXX = @TOOLS_CXX@
|
||||
HDFLIB = -L@HDF5ROOT@/lib -lhdf5 -lz @SZLIB@
|
||||
H5LIB = -L../src/lib -lH5hutC -lH5core
|
||||
LIBS = $(H5LIB) $(HDFLIB) @MPILIB@
|
||||
|
||||
# COMPILER FLAG SETTING
|
||||
CFLAGS = @CFLAGS@
|
||||
|
||||
# # -L$(HDF5ROOT)/lib -lhdf5
|
||||
|
||||
# LIBRARIES
|
||||
SZLIB = @SZLIB@
|
||||
HDFLIB = @TOOLS_HDFLIB@ -lz $(SZLIB)
|
||||
LIBS = $(HDFLIB) $(MPILIB) -lm @STDCXX@ @LDFLAGS@
|
||||
|
||||
# H5Part compiled library location
|
||||
# H5PLIB = -L@prefix@/lib
|
||||
H5PLIB = -L${abs_top_builddir}/src/lib @TOOLS_H5PART_LIB@
|
||||
|
||||
# INCLUDES
|
||||
HDFINC = -I$(HDF5ROOT)/include
|
||||
INC = $(HDFINC) $(H5PINC) $(MPIINC)
|
||||
|
||||
# H5Part header file location
|
||||
# H5PINC = -I@prefix@/include
|
||||
H5PINC = -I${abs_top_builddir}/src/include
|
||||
INCLUDES = -I../src/include -I@HDF5ROOT@/include @MPIINC@
|
||||
|
||||
# What to build... make install will place these files in the $(prefix)/bin directory.
|
||||
bin_PROGRAMS = @BUILD_TOOLS@
|
||||
@@ -45,39 +24,3 @@ h5pToGNUplot_SOURCES = h5pToGNUplot.cc
|
||||
|
||||
#homdynToH5p_SOURCES = homdynToH5p.cc
|
||||
|
||||
# Specific building instruction (What compilers to use...)
|
||||
# ------------ Build Tools ------------
|
||||
|
||||
h5pAttrib: h5pAttrib.o
|
||||
$(TOOLS_CXX) -o h5pAttrib h5pAttrib.o $(H5PLIB) $(LIBS)
|
||||
|
||||
h5pAttrib.o: h5pAttrib.cc
|
||||
$(TOOLS_CXX) $(CFLAGS) $(INC) -g -c h5pAttrib.cc
|
||||
|
||||
|
||||
h5pToGNUplot: h5pToGNUplot.o
|
||||
$(TOOLS_CXX) -o h5pToGNUplot h5pToGNUplot.o $(H5PLIB) $(LIBS)
|
||||
|
||||
h5pToGNUplot.o: h5pToGNUplot.cc
|
||||
$(TOOLS_CXX) $(CFLAGS) $(INC) -g -c $<
|
||||
|
||||
homdynToH5p : homdynToH5p.o
|
||||
$(TOOLS_CXX) -o $@ $< $(H5PLIB) $(LIBS)
|
||||
|
||||
homdynToH5p.o: homdynToH5p.cc
|
||||
$(TOOLS_CXX) $(CFLAGS) $(INC) -g -c $<
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o h5pAttrib h5pToGNUplot
|
||||
|
||||
distclean: clean
|
||||
rm -rf .deps
|
||||
rm -rf Makefile
|
||||
|
||||
|
||||
# # bash-3.00$ /usr/bin/mpcc_r -g -O2 -I/scratch/scratchdirs/cristina/hdf5/hdf5_par/include -I/u2/antino/trunk/src -c h5pAttrib.cc
|
||||
# # bash-3.00$ /usr/bin/mpcc_r -o h5pAttrib h5pAttrib.o -L/u2/antino/trunk/src -lpH5Part -L/scratch/scratchdirs/cristina/hdf5/hdf5_par/lib -lhdf5 -lz -lm
|
||||
|
||||
|
||||
#####################################################################################################################
|
||||
|
||||
Reference in New Issue
Block a user