outside source build now possible, C API with inline functions, examples moved from 'test' directory to new 'example' directory
This commit is contained in:
+33
-43
@@ -359,18 +359,41 @@ doc/tetrahedron_refinements/6-edges/edge_01-12-20-23-30-31_refined/buildlatex.ba
|
||||
doc/tetrahedron_refinements/6-edges/edge_01-12-20-23-30-31_refined/output_file.jpg -text
|
||||
doc/tetrahedron_refinements/README -text
|
||||
doc/tetrahedron_refinements/text2vtk.py -text
|
||||
examples/H5Block/BlockTestSpecs.txt -text
|
||||
examples/H5Block/H5BlockDissolveGhosts.c -text
|
||||
examples/H5Block/H5BlockParTestScalarField.c -text
|
||||
examples/H5Block/H5BlockParTestScalarField.pbs -text
|
||||
examples/H5Block/H5BlockParTestScalarFieldF.f90 -text
|
||||
examples/H5Block/H5BlockTestAttributes.c -text
|
||||
examples/H5Block/H5BlockTestAttributesF.f90 -text
|
||||
examples/H5Block/Makefile.am -text
|
||||
examples/H5Fed/Makefile.am -text
|
||||
examples/H5Fed/map_tet2globalid.c -text
|
||||
examples/H5Fed/map_triangle2globalid.c -text
|
||||
examples/H5Fed/tetmesh_adjacencies.c -text
|
||||
examples/H5Fed/tetmesh_read.c -text
|
||||
examples/H5Fed/tetmesh_read_tags.c -text
|
||||
examples/H5Fed/tetmesh_write.c -text
|
||||
examples/H5Fed/tetmesh_write1.c -text
|
||||
examples/H5Fed/tetmesh_write2.c -text
|
||||
examples/H5Fed/tetmesh_write_tags.c -text
|
||||
examples/H5Fed/trimesh_2gnuplot.c -text
|
||||
examples/H5Fed/trimesh_adjacencies.c -text
|
||||
examples/H5Fed/trimesh_read.c -text
|
||||
examples/H5Fed/trimesh_write.c -text
|
||||
examples/H5Fed/trimesh_write_dunetest.c -text
|
||||
examples/H5Fed/write_boundary.c -text
|
||||
examples/H5Part/Bench.c -text
|
||||
examples/H5Part/H5ParallelTest.cc -text
|
||||
examples/H5Part/H5PartAndreasTest.cc -text
|
||||
examples/H5Part/H5PartTest.cc -text
|
||||
examples/H5Part/H5PartTestParallel.cc -text
|
||||
examples/H5Part/H5test.cc -text
|
||||
examples/H5Part/H5testF.f -text
|
||||
examples/H5Part/H5testFpar.f90 -text
|
||||
examples/H5Part/Makefile.am -text
|
||||
/license.txt -text
|
||||
src/C++/H5Fed.cc -text
|
||||
src/C++/H5Fed.hh -text
|
||||
src/C++/Makefile.am -text
|
||||
src/C/H5.c -text
|
||||
src/C/H5Block.c -text
|
||||
src/C/H5Block_readwrite.c -text
|
||||
src/C/H5Part.c -text
|
||||
src/C/H5_attachments.c -text
|
||||
src/C/H5_attribs.c -text
|
||||
src/C/Makefile.am -text
|
||||
src/C/generate-h5b-readwrite.py -text
|
||||
src/Fortran/H5.f90 -text
|
||||
src/Fortran/H5Block.f90 -text
|
||||
src/Fortran/H5Block_F.c -text
|
||||
@@ -502,39 +525,6 @@ src/include/h5core/h5t_storemesh.h -text
|
||||
src/include/h5core/h5t_tags.h -text
|
||||
src/include/h5core/h5u_model.h -text
|
||||
src/include/h5core/h5u_readwrite.h -text
|
||||
test/H5Block/BlockTestSpecs.txt -text
|
||||
test/H5Block/H5BlockDissolveGhosts.c -text
|
||||
test/H5Block/H5BlockParTestScalarField.c -text
|
||||
test/H5Block/H5BlockParTestScalarField.pbs -text
|
||||
test/H5Block/H5BlockParTestScalarFieldF.f90 -text
|
||||
test/H5Block/H5BlockTestAttributes.c -text
|
||||
test/H5Block/H5BlockTestAttributesF.f90 -text
|
||||
test/H5Block/Makefile.am -text
|
||||
test/H5Fed/Makefile.am -text
|
||||
test/H5Fed/map_tet2globalid.c -text
|
||||
test/H5Fed/map_triangle2globalid.c -text
|
||||
test/H5Fed/tetmesh_adjacencies.c -text
|
||||
test/H5Fed/tetmesh_read.c -text
|
||||
test/H5Fed/tetmesh_read_tags.c -text
|
||||
test/H5Fed/tetmesh_write.c -text
|
||||
test/H5Fed/tetmesh_write1.c -text
|
||||
test/H5Fed/tetmesh_write2.c -text
|
||||
test/H5Fed/tetmesh_write_tags.c -text
|
||||
test/H5Fed/trimesh_2gnuplot.c -text
|
||||
test/H5Fed/trimesh_adjacencies.c -text
|
||||
test/H5Fed/trimesh_read.c -text
|
||||
test/H5Fed/trimesh_write.c -text
|
||||
test/H5Fed/trimesh_write_dunetest.c -text
|
||||
test/H5Fed/write_boundary.c -text
|
||||
test/H5Part/Bench.c -text
|
||||
test/H5Part/H5ParallelTest.cc -text
|
||||
test/H5Part/H5PartAndreasTest.cc -text
|
||||
test/H5Part/H5PartTest.cc -text
|
||||
test/H5Part/H5PartTestParallel.cc -text
|
||||
test/H5Part/H5test.cc -text
|
||||
test/H5Part/H5testF.f -text
|
||||
test/H5Part/H5testFpar.f90 -text
|
||||
test/H5Part/Makefile.am -text
|
||||
test/Makefile.am -text
|
||||
test/h5_attach_test.c -text
|
||||
test/h5b_read.c -text
|
||||
|
||||
+27
-29
@@ -15,14 +15,39 @@
|
||||
/depcomp
|
||||
doc/Makefile
|
||||
doc/Makefile.in
|
||||
examples/H5Block/H5BlockParTestScalarField
|
||||
examples/H5Block/H5BlockTestAttributes
|
||||
examples/H5Block/Makefile
|
||||
examples/H5Block/Makefile.in
|
||||
examples/H5Fed/.deps
|
||||
examples/H5Fed/Makefile
|
||||
examples/H5Fed/Makefile.in
|
||||
examples/H5Fed/large_tet.h5
|
||||
examples/H5Fed/simple_tet.h5
|
||||
examples/H5Fed/simple_triangle.h5
|
||||
examples/H5Fed/small_tet.h5
|
||||
examples/H5Fed/tetmesh_adjacencies
|
||||
examples/H5Fed/tetmesh_read
|
||||
examples/H5Fed/tetmesh_read_tags
|
||||
examples/H5Fed/tetmesh_write
|
||||
examples/H5Fed/tetmesh_write2
|
||||
examples/H5Fed/tetmesh_write_tags
|
||||
examples/H5Fed/trimesh_adjacencies
|
||||
examples/H5Fed/trimesh_read
|
||||
examples/H5Fed/trimesh_write
|
||||
examples/H5Fed/trimesh_write_dunetest
|
||||
examples/H5Part/Bench
|
||||
examples/H5Part/H5PartAndreasTest
|
||||
examples/H5Part/H5PartTestP
|
||||
examples/H5Part/H5test
|
||||
examples/H5Part/Makefile
|
||||
examples/H5Part/Makefile.in
|
||||
/install-sh
|
||||
/libtool
|
||||
/ltmain.sh
|
||||
/m4
|
||||
/missing
|
||||
src/.deps
|
||||
src/C++/Makefile
|
||||
src/C++/Makefile.in
|
||||
src/C/.deps
|
||||
src/C/Makefile
|
||||
src/C/Makefile.in
|
||||
@@ -41,33 +66,6 @@ src/lib
|
||||
/stamp-h1
|
||||
/svn-prop.tmp
|
||||
test/.deps
|
||||
test/H5Block/H5BlockParTestScalarField
|
||||
test/H5Block/H5BlockTestAttributes
|
||||
test/H5Block/Makefile
|
||||
test/H5Block/Makefile.in
|
||||
test/H5Fed/.deps
|
||||
test/H5Fed/Makefile
|
||||
test/H5Fed/Makefile.in
|
||||
test/H5Fed/large_tet.h5
|
||||
test/H5Fed/simple_tet.h5
|
||||
test/H5Fed/simple_triangle.h5
|
||||
test/H5Fed/small_tet.h5
|
||||
test/H5Fed/tetmesh_adjacencies
|
||||
test/H5Fed/tetmesh_read
|
||||
test/H5Fed/tetmesh_read_tags
|
||||
test/H5Fed/tetmesh_write
|
||||
test/H5Fed/tetmesh_write2
|
||||
test/H5Fed/tetmesh_write_tags
|
||||
test/H5Fed/trimesh_adjacencies
|
||||
test/H5Fed/trimesh_read
|
||||
test/H5Fed/trimesh_write
|
||||
test/H5Fed/trimesh_write_dunetest
|
||||
test/H5Part/Bench
|
||||
test/H5Part/H5PartAndreasTest
|
||||
test/H5Part/H5PartTestP
|
||||
test/H5Part/H5test
|
||||
test/H5Part/Makefile
|
||||
test/H5Part/Makefile.in
|
||||
test/Makefile
|
||||
test/Makefile.in
|
||||
test/h5_attach.h5
|
||||
|
||||
+110
-181
@@ -1,53 +1,55 @@
|
||||
# Every configure script must call AC_INIT before doing anything else.
|
||||
# AC_INIT (package, version, [bug-report], [tarname])
|
||||
AC_INIT([H5hut], [1.99.6], [h5part@lists.psi.ch], H5hut)
|
||||
|
||||
|
||||
# Ensure that a recent enough version of Autoconf is being used.
|
||||
# If the version of Autoconf being used to create configure is earlier than version,
|
||||
# print an error message to the standard error output and do not create configure.
|
||||
AC_INIT([H5hut], [1.99-trunk], [h5part@lists.psi.ch], H5hut)
|
||||
AC_PREREQ(2.60)
|
||||
|
||||
# should be called right after AC_INIT.
|
||||
# configure scripts can create a C header file containing `#define' directives.
|
||||
# The AC_CONFIG_HEADERS macro selects this kind of output.
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
# AM_INIT_AUTOMAKE is required to use autoconf with automake
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
BUILD_LIBS='libH5hut'
|
||||
USE_C='yes'
|
||||
ENABLE_DEBUG='no'
|
||||
ENABLE_C='yes'
|
||||
ENABLE_FORTRAN='no'
|
||||
ENABLE_PARALLEL='no'
|
||||
|
||||
###############################################################################
|
||||
################# --enable-xxx and --with-xxx Argument ########################
|
||||
###############################################################################
|
||||
|
||||
# --enable-xxx and --with-xxx Arguments
|
||||
AC_ARG_ENABLE(
|
||||
[debug],
|
||||
[AC_HELP_STRING([--enable-debug],
|
||||
[Compile with debug flags [default=no]])],
|
||||
[USE_DEBUG=$enableval])
|
||||
[AS_HELP_STRING([--enable-debug], [Compile with debug flags [default=no]])],
|
||||
[ENABLE_DEBUG=$enableval])
|
||||
AM_CONDITIONAL([ENABLE_DEBUG], [test "$ENABLE_DEBUG" = "yes"])
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
[c],
|
||||
[AC_HELP_STRING([--enable-c],
|
||||
[AS_HELP_STRING([--enable-c],
|
||||
[Compile the C interface [default=yes]])],
|
||||
[USE_C=$enableval])
|
||||
[ENABLE_C=$enableval])
|
||||
AM_CONDITIONAL([ENABLE_C], [test "$ENABLE_C" = "yes"])
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
[fortran],
|
||||
[AC_HELP_STRING([--enable-fortran],
|
||||
[AS_HELP_STRING([--enable-fortran],
|
||||
[Compile the Fortran interface [default=no]])],
|
||||
[USE_FORTRAN=$enableval])
|
||||
[ENABLE_FORTRAN=$enableval])
|
||||
AM_CONDITIONAL([ENABLE_FORTRAN], [test "$ENABLE_FORTRAN" = "yes"])
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
[parallel],
|
||||
[AC_HELP_STRING([--enable-parallel],
|
||||
[AS_HELP_STRING([--enable-parallel],
|
||||
[Compile the MPI/IO interface [default=no]])],
|
||||
[USE_PARALLEL=$enableval])
|
||||
[ENABLE_PARALLEL=$enableval])
|
||||
AM_CONDITIONAL([ENABLE_PARALLEL], [test "$ENABLE_PARALLEL" = "yes"])
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
[large-indices],
|
||||
[AC_HELP_STRING([--enable-large-indices],
|
||||
[Compile with 64bit local IDs and indices [default=no]])],
|
||||
[USE_LARGE_INDICES=$enableval])
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
[experimental],
|
||||
[AS_HELP_STRING([--enable-experimental],
|
||||
[Compile experimental code [default=no]])],
|
||||
[ENABLE_EXPERIMENTAL=$enableval])
|
||||
AM_CONDITIONAL([ENABLE_EXPERIMENTAL], [test "$ENABLE_EXPERIMENTAL" = "yes"])
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
[vtkconverter],
|
||||
@@ -58,27 +60,28 @@ AM_CONDITIONAL([ENABLE_VTKCONVERTER], [test "$ENABLE_VTKCONVERTER" = "yes"])
|
||||
|
||||
AC_ARG_WITH(
|
||||
[hdf5],
|
||||
[AC_HELP_STRING([--with-hdf5],
|
||||
[AS_HELP_STRING([--with-hdf5],
|
||||
[path to HDF5 installation [default=""]])],
|
||||
[HDF5PATH=$withval], [HDF5PATH=""])
|
||||
[HDF5_PREFIX=$withval], [HDF5_PREFIX=""])
|
||||
|
||||
AC_ARG_WITH(
|
||||
[mpi],
|
||||
[AC_HELP_STRING([--with-mpi],
|
||||
[AS_HELP_STRING([--with-mpi],
|
||||
[path to MPI installation [default=""]])],
|
||||
[MPIPATH=$withval;PATH=$MPIPATH/bin:$PATH], [MPIPATH=""])
|
||||
[PATH=$MPI_PREFIX/bin:$PATH])
|
||||
|
||||
AC_ARG_WITH(
|
||||
[lustre],
|
||||
[AC_HELP_STRING([--with-lustre],
|
||||
[AS_HELP_STRING([--with-lustre],
|
||||
[path to lustre user API [default=""]])],
|
||||
[LUSTREPATH=$withval], [LUSTREPATH=""])
|
||||
|
||||
AC_ARG_WITH(
|
||||
[vtk],
|
||||
[AS_HELP_STRING([--with-vtk],
|
||||
[path to VTK installation [default=""]])],
|
||||
[VTK_PREFIX=$withval], [VTK_PREFIX=""])
|
||||
[parmetis],
|
||||
[AC_HELP_STRING([--with-parmetis],
|
||||
[path to ParMETIS API [default=""]])],
|
||||
[PARMETISPATH=$withval], [PARMETISPATH=""])
|
||||
|
||||
|
||||
###############################################################################
|
||||
############### PATH SERACH FUNCTION - to be used later... ####################
|
||||
@@ -111,33 +114,27 @@ PATH_Search() {
|
||||
return
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# MISC SETTINGS INCLUDING C & C++ COMPILER SETTING
|
||||
|
||||
###############################################################################
|
||||
############# MISC SETTINGS INCLUDING C & C++ COMPILER SETTING ################
|
||||
###############################################################################
|
||||
# Compute the canonical host-system type variable, host, and its three
|
||||
# individual parts host_cpu, host_vendor, and host_os.
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
# debug enabled?
|
||||
AC_MSG_CHECKING([if debug is enabled])
|
||||
|
||||
if test "X$USE_DEBUG" = "Xyes"; then
|
||||
if test "X$ENABLE_DEBUG" = "Xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
CFLAGS="$CFLAGS -g"
|
||||
CFLAGS="$CFLAGS -g -Wall"
|
||||
CXXFLAGS="$CFLAGS -g -Wall"
|
||||
FFLAGS="$FFLAGS -g"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
# Determine a C/C++ compiler to use.
|
||||
# If CC is not already set in the environment, check for gcc and cc, then
|
||||
# for other C compilers.
|
||||
# Set output variable CC to the name of the compiler found.
|
||||
if test "x$USE_PARALLEL" = "xyes"; then
|
||||
CCOMPILERS="mpicc cc"
|
||||
CXXCOMPILERS="mpic++ c++"
|
||||
if test "x$ENABLE_PARALLEL" = "xyes"; then
|
||||
CCOMPILERS="mpicc"
|
||||
CXXCOMPILERS="mpic++"
|
||||
else
|
||||
CCOMPILERS="pgcc pathcc icc gcc cc_r cc"
|
||||
CXXCOMPILERS="pgcc pathcc icc g++ cc_r c++"
|
||||
@@ -148,17 +145,12 @@ CC=`which $CC`
|
||||
AC_PROG_CXX($CXXCOMPILERS)
|
||||
CXX=`which $CXX`
|
||||
|
||||
# Use macro to set C99 mode instead of checking for gcc, which breaks with
|
||||
# parallel builds.
|
||||
AC_PROG_CC_C99
|
||||
if test "x$ac_cv_prog_cc_c99" = "xno"; then
|
||||
AC_MSG_ERROR([Cannot set C compiler to use C99 standard!])
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set output variable INSTALL to the path of a BSD-compatible install program,
|
||||
# if one is found in the current PATH.
|
||||
# Otherwise, set INSTALL to `dir/install-sh -c`
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_AWK
|
||||
|
||||
@@ -201,34 +193,27 @@ AC_DEFINE_UNQUOTED(MY_UNAME, "$uname", "")
|
||||
|
||||
|
||||
###############################################################################
|
||||
######################## CONFIGURE LINE OPTIONS ###############################
|
||||
###############################################################################
|
||||
# PROCESS ARGUMENTS
|
||||
|
||||
############################ fortran enabled ##################################
|
||||
# C enabled?
|
||||
AC_MSG_CHECKING([if C interface enabled])
|
||||
if test "X$USE_C" = "Xyes"; then
|
||||
if test "X$ENABLE_C" = "Xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
BINDINGS="$BINDINGS C"
|
||||
LIB_C="libH5hutC.la"
|
||||
BUILD_LIBS="$BUILD_LIBS libH5hutC"
|
||||
BUILD_TESTS="$BUILD_TESTS h5u_test h5b_test"
|
||||
BUILD_TOOLS="$BUILD_TOOLS h5hutcc"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
############################ fortran enabled ##################################
|
||||
# fortran enabled?
|
||||
AC_MSG_CHECKING([if fortran interface enabled])
|
||||
if test "X$USE_FORTRAN" = "Xyes"; then
|
||||
if test "X$ENABLE_FORTRAN" = "Xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
BINDINGS="$BINDINGS Fortran"
|
||||
LIB_FORTRAN="libH5hutF.la"
|
||||
BUILD_LIBS="$BUILD_LIBS libH5hutF"
|
||||
|
||||
if test "X$USE_PARALLEL" = "Xyes"; then
|
||||
if test "X$ENABLE_PARALLEL" = "Xyes"; then
|
||||
AC_PROG_FC(mpif90 mpif77)
|
||||
else
|
||||
AC_PROG_FC(pgf90 ifort xlf_r pathf90 g95 g90 ftn gfortran)
|
||||
fi
|
||||
|
||||
FC=`which $FC`
|
||||
if test -z "$FC" ; then
|
||||
AC_MSG_ERROR([Cannot find a Fortran compiler!])
|
||||
exit 1
|
||||
@@ -249,12 +234,11 @@ if test "X$USE_FORTRAN" = "Xyes"; then
|
||||
`cd src/Fortran && ${FC} ${FFLAGS} -o TestUnderscore TestUnderscore.o TestUnderscoreC.o`
|
||||
|
||||
if test -f src/Fortran/TestUnderscore ; then
|
||||
UNDERSCORE_H=Underscore.h
|
||||
`cd src/Fortran && ./TestUnderscore > Underscore.h`
|
||||
AC_MSG_RESULT([ok])
|
||||
else
|
||||
AC_MSG_RESULT([nok])
|
||||
AC_MSG_ERROR([Cannot determine the symbon convention for Fortran object files!])
|
||||
AC_MSG_ERROR([Cannot determine the symbol convention for Fortran object files!])
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -262,91 +246,54 @@ else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
######################## large indices enabled ###########################
|
||||
AC_MSG_CHECKING([if large indices are enabled])
|
||||
if test "X$USE_LARGE_INDICES" = "Xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
CFLAGS="${CFLAGS} -DUSE_LARGE_INDICES"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
######################## parallel interface enabled ###########################
|
||||
AC_MSG_CHECKING([if parallel interface enabled])
|
||||
if test "X$USE_PARALLEL" = "Xyes"; then
|
||||
if test "X$ENABLE_PARALLEL" = "Xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
AM_CPPFLAGS="${AM_CPPFLAGS} -DPARALLEL_IO -DMPICH_IGNORE_CXX_SEEK"
|
||||
|
||||
CFLAGS="${CFLAGS} -DPARALLEL_IO -DMPICH_IGNORE_CXX_SEEK"
|
||||
if test "X$ENABLE_EXPERIMENTAL" = "Xyes"; then
|
||||
AC_MSG_CHECKING([for ParMETIS])
|
||||
if test "X$PARMETISPATH" != "X"; then
|
||||
AM_CPPFLAGS="$AM_CPPFLAGS -I$PARMETISPATH/include"
|
||||
AM_LDFLAGS="$AM_LDFLAGS -L$PARMETISPATH/lib"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if we can compile MPI code without setting flags])
|
||||
AC_TRY_LINK([#include "mpi.h"], [
|
||||
MPI_Comm comm;
|
||||
int n;
|
||||
MPI_Comm_size( comm, &n ); ],
|
||||
[AC_MSG_RESULT([yes]); r='yes'], [AC_MSG_RESULT([no]); r='no'] )
|
||||
|
||||
if test "X$r" = "Xno"; then
|
||||
AC_MSG_ERROR([MPI wrapper can't compile or link MPI program! Please set the INCLUDE and LIBS variables manually.])
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TPTARGET="${TPTARGET} H5PartTestP H5PartAndreasTest Bench"
|
||||
TBTARGET="${TBTARGET} H5BlockTestAttributes"
|
||||
TBTARGET="${TBTARGET} H5BlockParTestScalarField"
|
||||
|
||||
# parallel + fortran
|
||||
if test "X$USE_FORTRAN" = "Xyes"; then
|
||||
TPTARGET="${TPTARGET} H5testFpar"
|
||||
TBTARGET="${TBTARGET} H5BlockParTestScalarFieldF"
|
||||
fi
|
||||
LIBS="$LIBS -lparmetis -lmetis"
|
||||
AC_TRY_LINK([#include <parmetis.h>], [
|
||||
ParMETIS_V3_PartGeom (NULL, NULL, NULL, NULL, NULL);],
|
||||
[AC_MSG_RESULT([yes]); r='yes'], [AC_MSG_RESULT([no]); r='no'] )
|
||||
|
||||
if test "X$r" = "Xno"; then
|
||||
AC_MSG_ERROR([ParMETIS])
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else # --enable-parallel=no
|
||||
AC_MSG_RESULT([no])
|
||||
|
||||
TPTARGET="${TPTARGET} H5test"
|
||||
TBTARGET="${TBTARGET} H5BlockTestAttributes"
|
||||
|
||||
if test "X$USE_FORTRAN" = "Xyes"; then
|
||||
TPTARGET="${TPTARGET} H5testF"
|
||||
TBTARGET="${TBTARGET} H5BlockTestAttributesF"
|
||||
fi
|
||||
fi
|
||||
|
||||
###############################################################################
|
||||
######################### PATH CHECKING & SETTING #############################
|
||||
###############################################################################
|
||||
|
||||
AC_MSG_CHECKING([for HDF5 root ])
|
||||
AC_MSG_RESULT([])
|
||||
if test -n "${HDF5PATH}" ; then
|
||||
P=${HDF5PATH}
|
||||
elif test -n "${HDF5ROOT}"; then
|
||||
P=${HDF5ROOT}
|
||||
elif test -n "${HDF5HOME}" ; then
|
||||
P=${HDF5HOME}
|
||||
elif test -n "${HDF5_DIR}" ; then
|
||||
P=${HDF5_DIR}
|
||||
else
|
||||
P=''
|
||||
P="$P /usr"
|
||||
P="$P /usr/local"
|
||||
P="$P /usr/local/hdf5"
|
||||
P="$P /usr/local/packages/hdf5"
|
||||
P="$P /apps/hdf5"
|
||||
P="$P /opt/hdf5"
|
||||
fi
|
||||
PATH_Search HDF5ROOT "$P" include/hdf5.h
|
||||
if test -z "$HDF5ROOT"; then
|
||||
AC_MSG_ERROR([Cannot find an HDF5 library!])
|
||||
exit 1
|
||||
# LIBRARY PATHS
|
||||
if test -n "${HDF5_PREFIX}" ; then
|
||||
AM_CPPFLAGS="$AM_CPPFLAGS -I$HDF5_PREFIX/include"
|
||||
AM_LDFLAGS="$AM_LDFLAGS -L$HDF5_PREFIX/lib"
|
||||
fi
|
||||
AC_CHECK_LIB([z], [compress2])
|
||||
AC_CHECK_LIB([hdf5], [H5open])
|
||||
AS_IF([test "x$ac_cv_lib_hdf5_H5open" != xyes],
|
||||
[AC_MSG_ERROR([Cannot compile and link a HDF5 program]);
|
||||
exit 1])
|
||||
|
||||
AM_CPPFLAGS="$AM_CPPFLAGS -I$HDF5ROOT/include"
|
||||
LDFLAGS="$LDFLAGS -L$HDF5ROOT/lib"
|
||||
LIBS="$LIBS -lhdf5"
|
||||
|
||||
AC_MSG_CHECKING([if we need to link to libsz ])
|
||||
if test -n "$HDF5ROOT"; then
|
||||
if test -f $HDF5ROOT/lib/libsz.a; then
|
||||
AC_MSG_RESULT([yes])
|
||||
LDFLAGS="$LDFLAGS -L$HDF5ROOT/lib"
|
||||
LIBS="$LIBS -lsz"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for lustre API ])
|
||||
AC_MSG_RESULT([])
|
||||
@@ -370,12 +317,12 @@ if test -z "$LUSTREROOT"; then
|
||||
AC_MSG_WARN([Couldn't locate the lustre API... building without support for lustre striping!])
|
||||
else
|
||||
CFLAGS="$CFLAGS -DH5_USE_LUSTRE"
|
||||
AM_CPPFLAGS=="$AM_CPPFLAGS -I$LUSTREROOT/usr/include"
|
||||
LDFLAGS="$LDFLAGS -L$LUSTREROOT/usr/lib"
|
||||
AM_CPPFLAGS="$AM_CPPFLAGS -I$LUSTREROOT/usr/include"
|
||||
AM_LDFLAGS="$AM_LDFLAGS -L$LUSTREROOT/usr/lib"
|
||||
LIBS="$LIBS -llustreapi"
|
||||
fi
|
||||
|
||||
LIBS="$LIBS -lz -lm"
|
||||
LIBS="$LIBS -lm"
|
||||
|
||||
###############################################################################
|
||||
# TOOLS
|
||||
@@ -388,39 +335,25 @@ else
|
||||
fi
|
||||
|
||||
###############################################################################
|
||||
############## EXPORTING VARIABLES & CREATING OUTPUT FILES ####################
|
||||
###############################################################################
|
||||
# AC_SUBST (variable, [value])
|
||||
# Create an output variable from a shell variable. Make AC_OUTPUT substitute
|
||||
# the variable variable into output files (typically one or more `Makefile's).
|
||||
# This means that AC_OUTPUT will replace instances of `@variable@' in input
|
||||
# files with the value that the shell variable variable has when AC_OUTPUT is
|
||||
# called. This value of variable should not contain literal newlines. If
|
||||
# value is given, in addition assign it to variable.
|
||||
AC_SUBST(HDF5ROOT)
|
||||
AC_SUBST(LUSTREROOT)
|
||||
# EXPORTING VARIABLES & CREATING OUTPUT FILES
|
||||
AC_SUBST(HDF5_PREFIX)
|
||||
AC_SUBST(CFLAGS)
|
||||
AC_SUBST(FFLAGS)
|
||||
AC_SUBST(AM_CPPFLAGS)
|
||||
AC_SUBST(LDFLAGS)
|
||||
AC_SUBST(LIBS)
|
||||
AC_SUBST(UNDERSCORE_H)
|
||||
AC_SUBST(LIB_C)
|
||||
AC_SUBST(LIB_FORTRAN)
|
||||
AC_SUBST(BINDINGS)
|
||||
AC_SUBST(BUILD_TESTS)
|
||||
AC_SUBST(BUILD_TOOLS)
|
||||
AC_SUBST(AM_LDFLAGS)
|
||||
|
||||
# Make AC_OUTPUT create each `file' by copying an input file (by default `file.in'),
|
||||
# substituting the output variable values.
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
src/Makefile
|
||||
src/C/Makefile
|
||||
src/h5core/Makefile
|
||||
src/include/Makefile
|
||||
src/C/Makefile
|
||||
src/Fortran/Makefile
|
||||
test/Makefile
|
||||
test/H5Fed/Makefile
|
||||
doc/Makefile
|
||||
examples/H5Part/Makefile
|
||||
examples/H5Block/Makefile
|
||||
examples/H5Fed/Makefile
|
||||
tools/Makefile
|
||||
tools/h5hutcc
|
||||
tools/vtk2h5grid/Makefile
|
||||
@@ -429,25 +362,21 @@ AC_CONFIG_FILES([
|
||||
AC_OUTPUT
|
||||
|
||||
###############################################################################
|
||||
########################## PRINTING SUMMARY ###################################
|
||||
###############################################################################
|
||||
# PRINTING SUMMARY
|
||||
AC_MSG_RESULT([ ])
|
||||
AC_MSG_RESULT([Summary:])
|
||||
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: $BUILD_LIBS])
|
||||
AC_MSG_RESULT([Build test programs: $BUILD_TESTS])
|
||||
AC_MSG_RESULT([Build tools: $BUILD_TOOLS])
|
||||
AC_MSG_RESULT([CC = $CC])
|
||||
AC_MSG_RESULT([CXX = $CXX])
|
||||
AC_MSG_RESULT([FC = $FC])
|
||||
AC_MSG_RESULT([CFLAGS = $CFLAGS])
|
||||
AC_MSG_RESULT([FFLAGS = $FFLAGS])
|
||||
AC_MSG_RESULT([INCLUDES = $INCLUDES])
|
||||
AC_MSG_RESULT([LDFLAGS = $LDFLAGS])
|
||||
AC_MSG_RESULT([AM_CPPFLAGS = $AM_CPPFLAGS])
|
||||
AC_MSG_RESULT([AM_LDFLAGS = $AM_LDFLAGS])
|
||||
AC_MSG_RESULT([LIBS = $LIBS])
|
||||
AC_MSG_RESULT([HDF5ROOT = $HDF5ROOT])
|
||||
AC_MSG_RESULT([HDF5_PREFIX = $HDF5_PREFIX])
|
||||
AC_MSG_RESULT([LUSTREROOT = $LUSTREROOT])
|
||||
AC_MSG_RESULT([ ])
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
# test level Makefile.am
|
||||
|
||||
OBJEXT = o
|
||||
|
||||
AM_LDFLAGS = -L../../src/lib @LDFLAGS@
|
||||
LIBS = -lH5hutC -lH5hut @LIBS@
|
||||
AM_CPPFLAGS = -I../../src/include @AM_CPPFLAGS@
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/src/include
|
||||
|
||||
noinst_PROGRAMS = \
|
||||
tetmesh_write \
|
||||
@@ -1,193 +0,0 @@
|
||||
/*
|
||||
Implementation file for implementing 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
|
||||
Benedikt Oswald, Achim Gsell
|
||||
|
||||
Warning
|
||||
This code is under development.
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
Some conventions:
|
||||
Functions:
|
||||
Name:
|
||||
ThisIsAFunction()
|
||||
Return values:
|
||||
-1 or NULL signals an error
|
||||
|
||||
\note
|
||||
In function names we use the words \b get and \b store insteed of
|
||||
\b read and \b write, because no I/O is actually done in these
|
||||
functions.
|
||||
*/
|
||||
|
||||
|
||||
/** include proprietary header files */
|
||||
#include "H5Fed.hh"
|
||||
|
||||
/** \brief make the C API functions available so that
|
||||
* we can used them in the implementation of the H5Fed class
|
||||
* member functions implementations.
|
||||
*/
|
||||
//extern "C"
|
||||
//{
|
||||
// #include "../../H5Fed.h"
|
||||
//}
|
||||
|
||||
|
||||
|
||||
/** activate namespaces */
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace H5Fed
|
||||
{
|
||||
/*!
|
||||
\defgroup h5fed_cpp_api H5Fed CPP API
|
||||
*/
|
||||
|
||||
|
||||
/** \brief implement constructor without arguments */
|
||||
H5Fed::H5Fed()
|
||||
{
|
||||
/** initialize internal variables */
|
||||
filename_.erase();
|
||||
}
|
||||
|
||||
|
||||
/** \brief implement constructor without arguments */
|
||||
H5Fed::H5Fed(std::string filename)
|
||||
{
|
||||
/** initialize internal variables */
|
||||
filename_.erase();
|
||||
filename_.append(filename);
|
||||
}
|
||||
|
||||
|
||||
/** \brief implement constructor */
|
||||
H5Fed::~H5Fed()
|
||||
{
|
||||
/** initialize internal variables */
|
||||
filename_.erase();
|
||||
}
|
||||
|
||||
|
||||
/** \brief Set name of H5Fed file to be accessed */
|
||||
H5FED_RETURN_CODE H5Fed::filename(std::string filename)
|
||||
{
|
||||
/** initialize internal variables */
|
||||
filename_.erase();
|
||||
filename_.append(filename);
|
||||
|
||||
return(OKCODE);
|
||||
}
|
||||
|
||||
|
||||
/** \brief retrieve name of H5Fed file to be accessed */
|
||||
std::string H5Fed::filename()
|
||||
{
|
||||
return(filename_);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5fed_cpp_api
|
||||
|
||||
Open file. This function is available in the paralell
|
||||
and serial version. In the serial case \c comm may have any value.
|
||||
|
||||
\return
|
||||
\return
|
||||
|
||||
\note
|
||||
File is always opened in read/writer mode!
|
||||
|
||||
\note
|
||||
Implement as wrapper of \c H5_open_file()!
|
||||
*/
|
||||
H5FED_RETURN_CODE H5Fed::open_file()
|
||||
{
|
||||
return(OKCODE);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5fed_cpp_api
|
||||
|
||||
Close file. This function is available in the paralell
|
||||
and serial version. In the serial case \c comm may have
|
||||
any value.
|
||||
|
||||
\return
|
||||
\return
|
||||
|
||||
\note
|
||||
File is always opened in read/writer mode!
|
||||
|
||||
\note
|
||||
Implement as wrapper of \c H5_open_file()!
|
||||
*/
|
||||
H5FED_RETURN_CODE H5Fed::closeFile()
|
||||
{
|
||||
return(OKCODE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/****** STORE routines*****************************************************/
|
||||
|
||||
/*!
|
||||
\ingroup h5fed_c_api
|
||||
|
||||
Stores the the coordinates of a specific vertex at level \c level
|
||||
with id \c vertex_id of the tetrahedral mesh.
|
||||
|
||||
\return value \c >=0 on success
|
||||
\return \c -1 on error
|
||||
*/
|
||||
H5FED_RETURN_CODE H5Fed::storeVertexCoordinate(
|
||||
unsigned int level, /*!< mesh level */
|
||||
unsigned int vertex_id, /*!< global vertex id */
|
||||
std::vector<double> /*!< 3-tuple of coordinates */
|
||||
)
|
||||
{
|
||||
return(OKCODE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5fed_c_api
|
||||
|
||||
Stores the 4-tuple, that contains the specific indices describing
|
||||
a tetrahedron with id \c tet_id at level \c level of the tetrahedral
|
||||
mesh.
|
||||
|
||||
\return value \c >=0 on success
|
||||
\return \c -1 on error
|
||||
*/
|
||||
H5FED_RETURN_CODE H5Fed::H5FedStoreTetrahedron (
|
||||
const unsigned int level, /*!< mesh level */
|
||||
const unsigned int tet_id, /*!< global tetrahedron id */
|
||||
const unsigned int parent_id, /*!< parent id if level \c >0 else \x -1 */
|
||||
const std::vector<unsigned int> tet /*!< 4-tuple with vertex id's */
|
||||
)
|
||||
{
|
||||
return(OKCODE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,165 +0,0 @@
|
||||
/*
|
||||
Header file for declaring the H5Fed application programming
|
||||
interface (API) in the C++ language. The header files follows
|
||||
the declaration of the C application programming interface.
|
||||
|
||||
Copyright 2006-2007
|
||||
Paul Scherrer Institut, Villigen, Switzerland;
|
||||
Benedikt Oswald;
|
||||
Achim Gsell
|
||||
All rights reserved.
|
||||
|
||||
Authors
|
||||
Benedikt Oswald, Achim Gsell
|
||||
|
||||
Warning
|
||||
This code is under development.
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
Some conventions:
|
||||
Functions:
|
||||
Name:
|
||||
ThisIsAFunction()
|
||||
Return values:
|
||||
-1 or NULL signals an error
|
||||
|
||||
\note
|
||||
In function names we use the words \b get and \b store insteed of
|
||||
\b read and \b write, because no I/O is actually done in these
|
||||
functions.
|
||||
*/
|
||||
|
||||
|
||||
/** include standard header files */
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
#include <iterator>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <iomanip>
|
||||
#include <string>
|
||||
#include <complex>
|
||||
|
||||
/** include fundamental HDF5 header files */
|
||||
#include <hdf5.h>
|
||||
|
||||
|
||||
#ifndef H5FED_HH
|
||||
#define H5FED_HH
|
||||
|
||||
namespace H5Fed
|
||||
{
|
||||
/** \brief Define return codes */
|
||||
enum H5FED_RETURN_CODE{OKCODE=0,ERROR=-1};
|
||||
|
||||
|
||||
|
||||
class H5Fed
|
||||
{
|
||||
public:
|
||||
|
||||
/** \brief infrastructure routines */
|
||||
H5Fed(); /** \brief Constructor without argument */
|
||||
H5Fed(std::string filename); /** \brief Constructor without argument */
|
||||
~H5Fed(); /** \brief Class destructor */
|
||||
|
||||
H5FED_RETURN_CODE filename(std::string filename); /** \brief Set name of H5Fed file to be accessed */
|
||||
std::string filename(); /** \brief retrieve name of H5Fed file to be accessed */
|
||||
|
||||
/****** General routines *****************************************************/
|
||||
H5FED_RETURN_CODE open_file(); /** \brief open the file */
|
||||
H5FED_RETURN_CODE closeFile(); /** \brief close the file */
|
||||
|
||||
|
||||
/****** INQUIRY routines *****************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/****** STORE routines*****************************************************/
|
||||
|
||||
/*!
|
||||
\ingroup h5fed_c_api
|
||||
|
||||
Stores the the coordinates of a specific vertex at level \c level
|
||||
with id \c vertex_id of the tetrahedral mesh.
|
||||
|
||||
\return value \c >=0 on success
|
||||
\return \c -1 on error
|
||||
*/
|
||||
H5FED_RETURN_CODE storeVertexCoordinate(
|
||||
unsigned int level, /*!< mesh level */
|
||||
unsigned int vertex_id, /*!< global vertex id */
|
||||
std::vector<double> /*!< 3-tuple of coordinates */
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5fed_c_api
|
||||
|
||||
Stores the 4-tuple, that contains the specific indices describing
|
||||
a tetrahedron with id \c tet_id at level \c level of the tetrahedral
|
||||
mesh.
|
||||
|
||||
\return value \c >=0 on success
|
||||
\return \c -1 on error
|
||||
*/
|
||||
H5FED_RETURN_CODE H5FedStoreTetrahedron (
|
||||
const unsigned int level, /*!< mesh level */
|
||||
const unsigned int tet_id, /*!< global tetrahedron id */
|
||||
const unsigned int parent_id, /*!< parent id if level \c >0 else \x -1 */
|
||||
const std::vector<unsigned int> tet /*!< 4-tuple with vertex id's */
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/****** UPWARD ADJACENCY routines *********************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
/****** DOWNWARD ADJACENCY routines *********************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/****** routines for accessing degrees of freedom DoF *************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
private:
|
||||
/** book keeping */
|
||||
std::string filename_; /** \brief Name of H5Fed file to be accessed */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif /** H5FED_HH */
|
||||
@@ -1,18 +0,0 @@
|
||||
# COMPILERS
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
|
||||
LIBS = @LIBS@
|
||||
AM_CPPFLAGS = -I../include @AM_CPPFLAGS@
|
||||
|
||||
OBJEXT = o
|
||||
|
||||
lib_LIBRARIES = libH5XX.a
|
||||
include_HEADERS = H5Fed.hh
|
||||
libH5XX_a_SOURCES = H5Fed.cc
|
||||
|
||||
libH5XX.a: $(libH5XX_a_OBJECTS)
|
||||
${AR} rucs $@ $^
|
||||
|
||||
%.o : %.cc
|
||||
$(CXX) $(CFLAGS) $(INC) -c $<
|
||||
-379
@@ -1,379 +0,0 @@
|
||||
/*
|
||||
Copyright 2007-2008
|
||||
Paul Scherrer Institut, Villigen, Switzerland;
|
||||
Benedikt Oswald;
|
||||
Achim Gsell
|
||||
All rights reserved.
|
||||
|
||||
Authors
|
||||
Achim Gsell
|
||||
|
||||
Warning
|
||||
This code is under development.
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
Some conventions:
|
||||
Functions:
|
||||
Name:
|
||||
thisIsAFunction()
|
||||
Return values:
|
||||
negative value or NULL signals an error
|
||||
|
||||
|
||||
Macros:
|
||||
UPPERCASE_WITH_UNDERSCORE
|
||||
\note
|
||||
In function names we use the words \b get and \b store insteed of
|
||||
\b read and \b write, because no I/O is actually done in these
|
||||
functions.
|
||||
*/
|
||||
|
||||
#include "h5core/h5_core.h"
|
||||
#include "H5.h"
|
||||
|
||||
/****** General routines *****************************************************/
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
Open file with name \c filbename. This function is available in the parallel
|
||||
and serial version. In the serial case \c comm may have any value.
|
||||
|
||||
File mode flags are:
|
||||
- H5_O_RDONLY: only reading allowed
|
||||
- H5_O_WRONLY: create new file, dataset must not exist
|
||||
- H5_O_APPEND: allows to append a new datasets to an existing file
|
||||
- H5_O_RDWR: dataset may exist
|
||||
|
||||
You can also select a "virtual file driver" in the HDF5 layer using:
|
||||
- H5_VFD_INDEPENDENT: MPI-IO in independent (asynchronous) mode
|
||||
- H5_VFD_MPIPOSIX: parallel I/O implemented directly by HDF5, bypassing MPI-IO
|
||||
|
||||
\return File handle.
|
||||
\return NULL on error.
|
||||
*/
|
||||
h5_file_p
|
||||
H5OpenFile (
|
||||
const char* filename, /*!< file name */
|
||||
h5_int32_t flags, /*!< file open flags */
|
||||
MPI_Comm comm /*!< MPI communicator */
|
||||
) {
|
||||
H5_API_ENTER (h5_file_p, "filename='%s', flags=%d, ...",filename,flags);
|
||||
H5_API_RETURN (h5_open_file (filename, flags, comm, 0));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
Close file and free all memory associated with the file handle.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5CloseFile (
|
||||
h5_file_t* const f /*!< file handle */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_close_file (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
Verify that the file handle points to a valid H5hut file structure.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5CheckFile (
|
||||
h5_file_t* const f /*!< file handle */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_check_filehandle (f));
|
||||
}
|
||||
|
||||
|
||||
h5_err_t
|
||||
H5FlushStep (
|
||||
h5_file_t* const f /*!< file handle */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_flush_step (f));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
H5FlushFile (
|
||||
h5_file_t* const f /*!< file handle */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_flush_file (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Define format of the step names.
|
||||
|
||||
Example: ==H5SetStepNameFormat( f, "Step", 6 )== defines step names
|
||||
like ==Step#000042==.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5SetStepNameFormat (
|
||||
h5_file_t* const f, /*!< Handle to file */
|
||||
const char* name, /*!< Prefix */
|
||||
const h5_int64_t width /*!< Width of the number */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', width=%lld",
|
||||
f, name, (long long) width);
|
||||
H5_API_RETURN (h5_set_stepname_fmt (f, name, width));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Get format of the step names.
|
||||
|
||||
\return value \c >=0 on success
|
||||
\return -1 on error
|
||||
*/
|
||||
h5_err_t
|
||||
H5GetStepNameFormat (
|
||||
h5_file_t* const f, /*!< Handle to file */
|
||||
char* name, /*!< OUT: Prefix */
|
||||
const h5_size_t l_name, /*!< length of buffer name */
|
||||
int* width /*!< OUT: Width of the number */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name=%p, l_name=%llu, width=%p",
|
||||
f, name, (unsigned long long)l_name, width);
|
||||
H5_API_RETURN (h5_get_stepname_fmt (f, name, l_name, width));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Set the current step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5SetStep (
|
||||
h5_file_t* const f, /*!< [in] Handle to open file */
|
||||
const h5_id_t step /*!< [in] Step to set. */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, step=%lld", f, (long long)step);
|
||||
H5_API_RETURN (h5_set_step (f, step));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Get current step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_id_t
|
||||
H5GetStep (
|
||||
h5_file_t* const f /*!< Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_get_step (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
Get the number of processors.
|
||||
|
||||
\param[in] f File handle.
|
||||
|
||||
\return Number of processors.
|
||||
\return \c -1 on error.
|
||||
*/
|
||||
int
|
||||
H5GetNumProcs (
|
||||
h5_file_t* const f
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_get_num_procs(f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Get the number of time-steps that are currently stored in the file
|
||||
\c f.
|
||||
|
||||
It works for both reading and writing of files, but is probably
|
||||
only typically used when you are reading.
|
||||
|
||||
\param[in] f File handle.
|
||||
|
||||
\return number of time-steps or error code
|
||||
*/
|
||||
h5_ssize_t
|
||||
H5GetNumSteps (
|
||||
h5_file_t* const f
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_get_num_steps(f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_inquiry
|
||||
|
||||
Query whether a particular step already exists in the file.
|
||||
|
||||
\param[in] f File handle.
|
||||
\param[in] stepno Step number to query for existence
|
||||
|
||||
\return true or false
|
||||
*/
|
||||
h5_err_t
|
||||
H5HasStep (
|
||||
h5_file_t* const f,
|
||||
h5_id_t stepno
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, stepno=%lld",
|
||||
f, (long long)stepno);
|
||||
H5_API_RETURN (h5_has_step (f, stepno));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Start traversing steps.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5StartTraverseSteps (
|
||||
h5_file_t* const f /*!< Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_start_traverse_steps (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Traverse steps.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5TraverseSteps (
|
||||
h5_file_t* const f /*!< Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_traverse_steps (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
Set the `throttle` factor, which causes HDF5 write and read
|
||||
calls to be issued in that number of batches.
|
||||
|
||||
This can prevent large concurrency parallel applications that
|
||||
use independent writes from overwhelming the underlying
|
||||
parallel file system.
|
||||
|
||||
Throttling only works with the H5_VFD_MPIPOSIX or
|
||||
H5_VFD_INDEPENDENT drivers and is only available in
|
||||
the parallel library.
|
||||
|
||||
\return \c H5_SUCCESS
|
||||
*/
|
||||
#ifdef PARALLEL_IO
|
||||
h5_err_t
|
||||
H5SetThrottle (
|
||||
h5_file_t* f,
|
||||
int factor
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, factor=%d", f, factor);
|
||||
H5_API_RETURN (h5_set_throttle(f, factor));
|
||||
}
|
||||
#endif // PARALLEL_IO
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_error
|
||||
|
||||
Set verbosity level to \c level.
|
||||
|
||||
\return \c H5_SUCCESS
|
||||
*/
|
||||
h5_err_t
|
||||
H5SetVerbosityLevel (
|
||||
const h5_id_t level
|
||||
) {
|
||||
return h5_set_debuglevel (level);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_error
|
||||
|
||||
Set error handler to \c handler.
|
||||
|
||||
\return \c H5_SUCCESS
|
||||
*/
|
||||
h5_err_t
|
||||
H5SetErrorHandler (
|
||||
h5_errorhandler_t handler
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "handler=%p", handler);
|
||||
H5_API_RETURN (h5_set_errorhandler (handler));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_error
|
||||
|
||||
Get current error handler.
|
||||
|
||||
\return Pointer to error handler.
|
||||
*/
|
||||
h5_errorhandler_t
|
||||
H5GetErrorHandler (
|
||||
void
|
||||
) {
|
||||
H5_API_ENTER (h5_errorhandler_t, "%s", "void");
|
||||
H5_API_RETURN (h5_get_errorhandler());
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
H5ReportErrorhandler (
|
||||
const char* fmt,
|
||||
va_list ap
|
||||
) {
|
||||
return h5_report_errorhandler (fmt, ap);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
H5AbortErrorhandler (
|
||||
const char* fmt,
|
||||
va_list ap
|
||||
) {
|
||||
return h5_abort_errorhandler (fmt, ap);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_error
|
||||
|
||||
Get last error code.
|
||||
|
||||
\return error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5GetErrno (
|
||||
void
|
||||
) {
|
||||
return h5_get_errno ();
|
||||
}
|
||||
|
||||
|
||||
-676
@@ -1,676 +0,0 @@
|
||||
/*!
|
||||
\defgroup h5block_c_api H5Block C API
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
\defgroup h5block_kernel H5Block Kernel
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
\defgroup h5block_private H5Block Private
|
||||
*/
|
||||
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
\defgroup h5block_model Setting up the Data Model
|
||||
*/
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
\defgroup h5block_data Reading and Writing Datasets
|
||||
*/
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
\defgroup h5block_attrib Reading and Writing Attributes
|
||||
*/
|
||||
|
||||
/*!
|
||||
\note
|
||||
Different field sizes are allowed in the same time-step.
|
||||
|
||||
\note
|
||||
The same layout can be used, if the size of the field matches the
|
||||
size of the layout. If the size of the layout doesn't match the
|
||||
size of the field, an error will be indicated.
|
||||
|
||||
\note
|
||||
In write mode partitions are shrinked to make them non-overlaping. This
|
||||
process may shrink the partitions more than required.
|
||||
|
||||
\note
|
||||
In read-mode partitions may not cross boundaries. This means, if the grid
|
||||
size is (X, Y, Z), all partitions must fit into this grid.
|
||||
|
||||
|
||||
\todo
|
||||
check whether layout is reasonable
|
||||
|
||||
API function names
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "h5core/h5_core.h"
|
||||
|
||||
/********************** defining the layout **********************************/
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Tests whether a view has been set, either directly with
|
||||
\ref H5Block3dSetView or indirectly with \ref H5Block3dSetGrid.
|
||||
|
||||
\return 0 on false, 1 on true
|
||||
*/
|
||||
h5_int64_t
|
||||
H5Block3dHasView (
|
||||
h5_file_t *const f /*!< IN: File handle */
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", f);
|
||||
H5_API_RETURN (h5b_3d_has_view (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Defines the partition of the field that this processor owns, using
|
||||
Fortran ordering: the fastest moving index is \c i.
|
||||
|
||||
This routine uses an MPI_Allgather, so at large concurrency it should
|
||||
be called as infrequently as possible. For instance, if several timesteps
|
||||
use the same field dimensions, set the layout only once before the
|
||||
first timestep.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dSetView (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const h5_int64_t i_start, /*!< IN: start index of \c i */
|
||||
const h5_int64_t i_end, /*!< IN: end index of \c i */
|
||||
const h5_int64_t j_start, /*!< IN: start index of \c j */
|
||||
const h5_int64_t j_end, /*!< IN: end index of \c j */
|
||||
const h5_int64_t k_start, /*!< IN: start index of \c k */
|
||||
const h5_int64_t k_end /*!< IN: end index of \c k */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"i_start=%lld, i_end=%lld, "
|
||||
"j_start=%lld, j_end=%lld, "
|
||||
"k_start=%lld, k_end=%lld",
|
||||
f,
|
||||
(long long)i_start, (long long)i_end,
|
||||
(long long)j_start, (long long)j_end,
|
||||
(long long)k_start, (long long)k_end);
|
||||
H5_API_RETURN (h5b_3d_set_view(f, i_start, i_end, j_start, j_end, k_start, k_end));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Return the view of this processor.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dGetView (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
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_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"i_start=%p, i_end=%p, "
|
||||
"j_start=%p, j_end=%p, "
|
||||
"k_start=%p, k_end=%p",
|
||||
f,
|
||||
i_start, i_end,
|
||||
j_start, j_end,
|
||||
k_start, k_end);
|
||||
H5_API_RETURN (h5b_3d_get_view (f, i_start, i_end, j_start, j_end, k_start, k_end));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Return the reduced (ghost-zone free) view of this processor.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dGetReducedView (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
h5_size_t *const i_start, /*!< OUT: start index of \c i */
|
||||
h5_size_t *const i_end, /*!< OUT: end index of \c i */
|
||||
h5_size_t *const j_start, /*!< OUT: start index of \c j */
|
||||
h5_size_t *const j_end, /*!< OUT: end index of \c j */
|
||||
h5_size_t *const k_start, /*!< OUT: start index of \c j */
|
||||
h5_size_t *const k_end /*!< OUT: end index of \c j */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"i_start=%p, i_end=%p, "
|
||||
"j_start=%p, j_end=%p, "
|
||||
"k_start=%p, k_end=%p",
|
||||
f,
|
||||
i_start, i_end,
|
||||
j_start, j_end,
|
||||
k_start, k_end);
|
||||
H5_API_RETURN (h5b_3d_get_reduced_view(f, i_start, i_end, j_start, j_end, k_start, k_end));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Define the chunk dimensions and enable chunking in the underlying
|
||||
HDF5 dataset.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dSetChunk (
|
||||
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_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%llu, j=%llu, k=%llu",
|
||||
f,
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
H5_API_RETURN (h5b_3d_set_chunk(f, i, j, k));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Lookup the chunk dimensions of the underlying HDF5 dataset.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dGetChunk (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const char *field_name, /*!< IN: name of dataset */
|
||||
h5_size_t *const i, /*!< OUT: size of \c i */
|
||||
h5_size_t *const j, /*!< OUT: size of \c j */
|
||||
h5_size_t *const k /*!< OUT: size of \c k */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%p, j=%p, k=%p",
|
||||
f, i, j, k);
|
||||
H5_API_RETURN (h5b_3d_get_chunk(f, field_name, i, j, k));
|
||||
}
|
||||
|
||||
#ifdef PARALLEL_IO
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Define an underlying 3D Cartesian grid on the processors with dimensions
|
||||
(\c i,\c j,\c k). You can look up a processor's index into the grid
|
||||
using \ref H5Block3dGetGridCoords.
|
||||
|
||||
This function can be used in conjunction with \ref H5Block3dSetDims
|
||||
to setup the view for a regular grid.
|
||||
|
||||
The product of the dimensions must equal the size of the MPI communicator.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dSetGrid (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const h5_size_t i, /*!< IN: dimension in \c i */
|
||||
const h5_size_t j, /*!< IN: dimension in \c j */
|
||||
const h5_size_t k /*!< IN: dimension in \c k */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%llu, j=%llu, k=%llu",
|
||||
f,
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
H5_API_RETURN (h5b_3d_set_grid(f, i, j, k));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Look up the index (\c i, \c j, \c k) in the grid belonging to MPI processor
|
||||
\c proc.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dGetGridCoords (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const int proc, /*!< IN: MPI processor */
|
||||
h5_int64_t *i, /*!< OUT: index in \c i */
|
||||
h5_int64_t *j, /*!< OUT: index in \c j */
|
||||
h5_int64_t *k /*!< OUT: index in \c k */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, proc=%d, i=%p, j=%p, k=%p",
|
||||
f, proc, i, j, k);
|
||||
H5_API_RETURN (h5b_3d_get_grid_coords(f, proc, i, j, k));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Set the dimensions of each processor's block when the field is a regular
|
||||
grid.
|
||||
|
||||
A grid must be already set with \ref H5Block3dSetGrid, and all processors
|
||||
must specify the same dimensions.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dSetDims (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const h5_size_t i, /*!< IN: dimension in \c i */
|
||||
const h5_size_t j, /*!< IN: dimension in \c j */
|
||||
const h5_size_t k /*!< IN: dimension in \c k */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%llu, j=%llu, k=%llu",
|
||||
f,
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
H5_API_RETURN (h5b_3d_set_dims(f, i, j, k));
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Sets the additional cells (\c i, \c j, \c k) in each direction to use as
|
||||
the `halo` region (or `ghost zone`) that overlaps between neighboring
|
||||
processors on the grid.
|
||||
|
||||
A grid with dimensions must already be set with \ref H5Block3dSetGrid and
|
||||
\ref H5Block3dSetDims, and all processors must specify the same halo radii.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dSetHalo (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const h5_size_t i, /*!< IN: radius in \c i */
|
||||
const h5_size_t j, /*!< IN: radius in \c j */
|
||||
const h5_size_t k /*!< IN: radius in \c k */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%llu, j=%llu, k=%llu",
|
||||
f,
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
H5_API_RETURN (h5b_3d_set_halo(f, i, j, k));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Query number of fields in current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_ssize_t
|
||||
H5BlockGetNumFields (
|
||||
h5_file_t *const f /*!< IN: file handle */
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
H5_API_RETURN (h5b_get_num_fields(f));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Get the name, rank and dimensions of the field specified by the
|
||||
index \c idx.
|
||||
|
||||
\c elem_rank reports the rank of the elements in the field
|
||||
(e.g. scalar or vector).
|
||||
|
||||
This function can be used to retrieve all fields bound to the
|
||||
current time-step by looping from \c 0 to the number of fields
|
||||
minus one. The number of fields bound to the current time-step
|
||||
can be queried by calling the function \ref H5BlockGetNumFields.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockGetFieldInfo (
|
||||
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 *field_rank, /*!< OUT: field rank */
|
||||
h5_size_t *field_dims, /*!< OUT: field dimensions */
|
||||
h5_size_t *elem_rank, /*!< OUT: element rank */
|
||||
h5_int64_t *type /*!< OUT: datatype */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, idx=%llu, "
|
||||
"name=%p, len_name=%llu, "
|
||||
"field_rank=%p, field_dims=%p, elem_rank=%p, type=%p",
|
||||
f, (long long unsigned)idx,
|
||||
name, (long long unsigned)len_name,
|
||||
field_rank, field_dims, elem_rank,
|
||||
type);
|
||||
H5_API_RETURN (
|
||||
h5b_get_field_info (
|
||||
f,
|
||||
idx,
|
||||
name,
|
||||
len_name,
|
||||
field_rank,
|
||||
field_dims,
|
||||
elem_rank,
|
||||
type));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Get the rank and dimensions of the field specified by its name.
|
||||
See \ref H5BlockGetFieldInfo.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockGetFieldInfoByName (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: field name */
|
||||
h5_size_t *field_rank, /*!< OUT: field rank */
|
||||
h5_size_t *field_dims, /*!< OUT: field dimensions */
|
||||
h5_size_t *elem_rank, /*!< OUT: element rank */
|
||||
h5_int64_t *type /*!< OUT: datatype */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', "
|
||||
"field_rank=%p, field_dims=%p, elem_rank=%p, type=%p",
|
||||
f, name, field_rank, field_dims, elem_rank, type);
|
||||
H5_API_RETURN (
|
||||
h5b_get_field_info_by_name (
|
||||
f,
|
||||
name,
|
||||
field_rank,
|
||||
field_dims,
|
||||
elem_rank,
|
||||
type));
|
||||
}
|
||||
|
||||
/********************** reading and writing attribute ************************/
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Write the string \c value as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockWriteFieldAttribString (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const char *buffer /*!< IN: attribute value */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"field_name='%s', "
|
||||
"attrib_name='%s', "
|
||||
"buffer='%s'",
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
buffer);
|
||||
H5_API_RETURN (
|
||||
h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_CHAR,
|
||||
buffer,
|
||||
strlen(buffer) + 1));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Read the string value from attribute \c attrib_name of field
|
||||
\c field_name into a \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockReadFieldAttribString (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
char *buffer /*!< OUT: attribute value */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"field_name='%s', "
|
||||
"attrib_name='%s', "
|
||||
"buffer=%p",
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
buffer);
|
||||
H5_API_RETURN (
|
||||
h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5_STRING_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Query the number of attributes of field \c field_name.
|
||||
|
||||
\return number of attributes or error code
|
||||
*/
|
||||
h5_ssize_t
|
||||
H5BlockGetNumFieldAttribs (
|
||||
h5_file_t *const f, /*<! IN: file handle */
|
||||
const char *field_name /*<! IN: field name */
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "f=%p, field_name='%s'", f, field_name);
|
||||
H5_API_RETURN (h5b_get_num_field_attribs (f, field_name));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Gets the name, type and number of elements of the field attribute
|
||||
specified by its index.
|
||||
|
||||
This function can be used to retrieve all attributes bound to the
|
||||
specified field by looping from \c 0 to the number of attribute
|
||||
minus one. The number of attributes bound to the
|
||||
field can be queried by calling \ref H5BlockGetNumFieldAttribs.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockGetFieldAttribInfo (
|
||||
h5_file_t *const f, /*<! IN: Handle to open file */
|
||||
const char *field_name, /*<! IN: field name */
|
||||
const h5_size_t attrib_idx, /*<! IN: Index of attribute to
|
||||
get infos about */
|
||||
char *attrib_name, /*<! OUT: Name of attribute */
|
||||
const h5_size_t len_attrib_name,
|
||||
/*<! IN: length of buffer \c name */
|
||||
h5_int64_t *attrib_type, /*<! OUT: Type of value. */
|
||||
h5_size_t *attrib_nelem /*<! OUT: Number of elements */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p field_name='%s', "
|
||||
"attrib_idx=%llu, "
|
||||
"attrib_name=%p, len_attrib_name=%llu, "
|
||||
"attrib_type=%p, "
|
||||
"attrib_nelem=%p",
|
||||
f,
|
||||
field_name,
|
||||
(long long unsigned)attrib_idx,
|
||||
attrib_name, (long long unsigned)len_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem);
|
||||
H5_API_RETURN (
|
||||
h5b_get_field_attrib_info (
|
||||
f,
|
||||
field_name,
|
||||
attrib_idx,
|
||||
attrib_name,
|
||||
len_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem));
|
||||
}
|
||||
|
||||
#define H5BLOCK_FIELD_ORIGIN_NAME "__Origin__"
|
||||
#define H5BLOCK_FIELD_SPACING_NAME "__Spacing__"
|
||||
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
|
||||
Get field origin.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dGetFieldOrigin (
|
||||
h5_file_t *f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
h5_float64_t *x_origin, /*!< OUT: X origin */
|
||||
h5_float64_t *y_origin, /*!< OUT: Y origin */
|
||||
h5_float64_t *z_origin /*!< OUT: Z origin */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', x_origin=%p, y_origin=%p, z_origin=%p",
|
||||
f, field_name, x_origin, y_origin, z_origin);
|
||||
h5_float64_t origin[3];
|
||||
|
||||
TRY (h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_ORIGIN_NAME,
|
||||
H5_FLOAT64_T,
|
||||
origin));
|
||||
|
||||
*x_origin = origin[0];
|
||||
*y_origin = origin[1];
|
||||
*z_origin = origin[2];
|
||||
|
||||
H5_API_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
|
||||
Set field origin.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dSetFieldOrigin (
|
||||
h5_file_t *f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const h5_float64_t x_origin, /*!< IN: X origin */
|
||||
const h5_float64_t y_origin, /*!< IN: Y origin */
|
||||
const h5_float64_t z_origin /*!< IN: Z origin */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', x_origin=%g, y_origin=%g, z_origin=%g",
|
||||
f, field_name, x_origin, y_origin, z_origin);
|
||||
h5_float64_t origin[3] = { x_origin, y_origin, z_origin };
|
||||
H5_API_RETURN (h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_ORIGIN_NAME,
|
||||
(hid_t)H5_FLOAT64_T,
|
||||
origin,
|
||||
3));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
|
||||
Get field spacing for field \c field_name in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dGetFieldSpacing (
|
||||
h5_file_t *f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
h5_float64_t *x_spacing, /*!< OUT: X spacing */
|
||||
h5_float64_t *y_spacing, /*!< OUT: Y spacing */
|
||||
h5_float64_t *z_spacing /*!< OUT: Z spacing */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', x_spacing=%p, y_spacing=%p, z_spacing=%p",
|
||||
f, field_name, x_spacing, y_spacing, z_spacing);
|
||||
h5_float64_t spacing[3];
|
||||
TRY (h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_SPACING_NAME,
|
||||
H5_FLOAT64_T,
|
||||
spacing));
|
||||
*x_spacing = spacing[0];
|
||||
*y_spacing = spacing[1];
|
||||
*z_spacing = spacing[2];
|
||||
H5_API_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
|
||||
Set field spacing for field \c field_name in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dSetFieldSpacing (
|
||||
h5_file_t *f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const h5_float64_t x_spacing, /*!< IN: X spacing */
|
||||
const h5_float64_t y_spacing, /*!< IN: Y spacing */
|
||||
const h5_float64_t z_spacing /*!< IN: Z spacing */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', x_spacing=%g, y_spacing=%g, z_spacing=%g",
|
||||
f, field_name, x_spacing, y_spacing, z_spacing);
|
||||
h5_float64_t spacing[3] = { x_spacing, y_spacing, z_spacing };
|
||||
H5_API_RETURN (h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_SPACING_NAME,
|
||||
(hid_t)H5_FLOAT64_T,
|
||||
spacing,
|
||||
3));
|
||||
}
|
||||
|
||||
@@ -1,625 +0,0 @@
|
||||
|
||||
#include "h5core/h5_core.h"
|
||||
#include "H5Block_readwrite.h"
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Write a 3-dimensional field \c name from the buffer starting at \c data
|
||||
to the current time-step using the defined field layout. Values are
|
||||
floating points (64-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dWriteScalarFieldFloat64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_float64_t *buffer /*!< IN: pointer to write buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_write_scalar_data(f, name, (void*)buffer, H5T_NATIVE_DOUBLE ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Read a 3-dimensional field \c name into the buffer starting at \c data from
|
||||
the current time-step using the defined field layout. Values are
|
||||
floating points (64-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dReadScalarFieldFloat64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to read */
|
||||
h5_float64_t *buffer /*!< OUT: pointer to read buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_read_scalar_data(f, name, (void*)buffer, H5T_NATIVE_DOUBLE));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Write a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with floating points (64-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c x_buf.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dWriteVector3dFieldFloat64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_float64_t *x_buf, /*!< IN: pointer to X axis buffer */
|
||||
const h5_float64_t *y_buf, /*!< IN: pointer to Y axis buffer */
|
||||
const h5_float64_t *z_buf /*!< IN: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_write_vector3d_data(f, name,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_DOUBLE));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Read a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with floating points (64-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dReadVector3dFieldFloat64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
h5_float64_t *const x_buf, /*!< OUT: pointer to X axis buffer */
|
||||
h5_float64_t *const y_buf, /*!< OUT: pointer to Y axis buffer */
|
||||
h5_float64_t *const z_buf /*!< OUT: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_read_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_DOUBLE));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Write a 3-dimensional field \c name from the buffer starting at \c data
|
||||
to the current time-step using the defined field layout. Values are
|
||||
floating points (32-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dWriteScalarFieldFloat32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_float32_t *buffer /*!< IN: pointer to write buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_write_scalar_data(f, name, buffer, H5T_NATIVE_FLOAT ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Read a 3-dimensional field \c name into the buffer starting at \c data from
|
||||
the current time-step using the defined field layout. Values are
|
||||
floating points (32-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dReadScalarFieldFloat32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to read */
|
||||
h5_float32_t *const buffer /*!< OUT: pointer to read buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_read_scalar_data(f, name, buffer, H5T_NATIVE_FLOAT));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Write a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with floating points (32-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c x_buf.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dWriteVector3dFieldFloat32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_float32_t *x_buf, /*!< IN: pointer to X axis buffer */
|
||||
const h5_float32_t *y_buf, /*!< IN: pointer to Y axis buffer */
|
||||
const h5_float32_t *z_buf /*!< IN: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_write_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_FLOAT));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Read a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with floating points (32-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dReadVector3dFieldFloat32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
h5_float32_t *const x_buf, /*!< OUT: pointer to X axis buffer */
|
||||
h5_float32_t *const y_buf, /*!< OUT: pointer to Y axis buffer */
|
||||
h5_float32_t *const z_buf /*!< OUT: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_read_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_FLOAT));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Write a 3-dimensional field \c name from the buffer starting at \c data
|
||||
to the current time-step using the defined field layout. Values are
|
||||
integers (64-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dWriteScalarFieldInt64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_int64_t *buffer /*!< IN: pointer to write buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_write_scalar_data(f, name, buffer, H5T_NATIVE_INT64 ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Read a 3-dimensional field \c name into the buffer starting at \c data from
|
||||
the current time-step using the defined field layout. Values are
|
||||
integers (64-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dReadScalarFieldInt64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to read */
|
||||
h5_int64_t *const buffer /*!< OUT: pointer to read buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_read_scalar_data(f, name, buffer, H5T_NATIVE_INT64));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Write a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with integers (64-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c x_buf.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dWriteVector3dFieldInt64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_int64_t *x_buf, /*!< IN: pointer to X axis buffer */
|
||||
const h5_int64_t *y_buf, /*!< IN: pointer to Y axis buffer */
|
||||
const h5_int64_t *z_buf /*!< IN: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN (h5b_write_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_INT64));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Read a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with integers (64-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dReadVector3dFieldInt64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
h5_int64_t *const x_buf, /*!< OUT: pointer to X axis buffer */
|
||||
h5_int64_t *const y_buf, /*!< OUT: pointer to Y axis buffer */
|
||||
h5_int64_t *const z_buf /*!< OUT: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN (h5b_read_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_INT64));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Write a 3-dimensional field \c name from the buffer starting at \c data
|
||||
to the current time-step using the defined field layout. Values are
|
||||
integers (32-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dWriteScalarFieldInt32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_int32_t *buffer /*!< IN: pointer to write buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_write_scalar_data(f, name, buffer, H5T_NATIVE_INT32 ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Read a 3-dimensional field \c name into the buffer starting at \c data from
|
||||
the current time-step using the defined field layout. Values are
|
||||
integers (32-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dReadScalarFieldInt32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to read */
|
||||
h5_int32_t *const buffer /*!< OUT: pointer to read buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_read_scalar_data(f, name, buffer, H5T_NATIVE_INT32));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Write a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with integers (32-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c x_buf.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dWriteVector3dFieldInt32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_int32_t *x_buf, /*!< IN: pointer to X axis buffer */
|
||||
const h5_int32_t *y_buf, /*!< IN: pointer to Y axis buffer */
|
||||
const h5_int32_t *z_buf /*!< IN: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_write_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_INT32));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Read a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with integers (32-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dReadVector3dFieldInt32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
h5_int32_t *const x_buf, /*!< OUT: pointer to X axis buffer */
|
||||
h5_int32_t *const y_buf, /*!< OUT: pointer to Y axis buffer */
|
||||
h5_int32_t *const z_buf /*!< OUT: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_read_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_INT32));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Write float64 \c values as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockWriteFieldAttribFloat64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const h5_float64_t *buffer, /*!< IN: attribute values */
|
||||
const h5_size_t nelems /*!< IN: number of elements */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', "
|
||||
"buffer=%p, nelems=%lld",
|
||||
f, field_name, attrib_name, buffer, (long long)nelems);
|
||||
H5_API_RETURN (h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_DOUBLE,
|
||||
buffer,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Read float64 values from attribute \c attrib_name of field
|
||||
\c field_name into a \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockReadFieldAttribFloat64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
h5_float64_t *buffer /*!< OUT: attribute values */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, field_name='%s', attrib_name='%s', buffer=%p",
|
||||
f, field_name, attrib_name, buffer);
|
||||
H5_API_RETURN (h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_DOUBLE,
|
||||
(void*)buffer ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Write float32 \c values as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockWriteFieldAttribFloat32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const h5_float32_t *buffer, /*!< IN: attribute values */
|
||||
const h5_size_t nelems /*!< IN: number of elements */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', "
|
||||
"buffer=%p, nelems=%lld",
|
||||
f, field_name, attrib_name, buffer, (long long)nelems);
|
||||
H5_API_RETURN (h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_FLOAT,
|
||||
buffer,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Read float32 values from attribute \c attrib_name of field
|
||||
\c field_name into a \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockReadFieldAttribFloat32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
h5_float32_t *const buffer /*!< OUT: attribute values */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, field_name='%s', attrib_name='%s', buffer=%p",
|
||||
f, field_name, attrib_name, buffer);
|
||||
H5_API_RETURN (h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_FLOAT,
|
||||
buffer ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Write int64 \c values as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockWriteFieldAttribInt64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const h5_int64_t *buffer, /*!< IN: attribute values */
|
||||
const h5_size_t nelems /*!< IN: number of elements */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', buffer=%p, nelems=%lld",
|
||||
f, field_name, attrib_name, buffer, (long long)nelems);
|
||||
H5_API_RETURN (h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_INT64,
|
||||
buffer,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Read int64 values from attribute \c attrib_name of field
|
||||
\c field_name into a \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockReadFieldAttribInt64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
h5_int64_t *const buffer /*!< OUT: attribute values */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, field_name='%s', attrib_name='%s', buffer=%p",
|
||||
f, field_name, attrib_name, buffer);
|
||||
H5_API_RETURN (h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_INT64,
|
||||
buffer ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Write int32 \c values as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockWriteFieldAttribInt32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const h5_int32_t *buffer, /*!< IN: attribute values */
|
||||
const h5_size_t nelems /*!< IN: number of elements */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', "
|
||||
"buffer=%p, nelems=%lld",
|
||||
f, field_name, attrib_name, buffer, (long long)nelems);
|
||||
H5_API_RETURN (h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_INT32,
|
||||
buffer,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Read int32 values from attribute \c attrib_name of field
|
||||
\c field_name into a \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockReadFieldAttribInt32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
h5_int32_t *buffer /*!< OUT: attribute values */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, field_name='%s', attrib_name='%s', buffer=%p",
|
||||
f, field_name, attrib_name, buffer);
|
||||
H5_API_RETURN (h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_INT32,
|
||||
(void*)buffer ));
|
||||
}
|
||||
-604
@@ -1,604 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h> /* va_arg - System dependent ?! */
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <hdf5.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#else /* WIN32 */
|
||||
#include <io.h>
|
||||
#define open _open
|
||||
#define close _close
|
||||
#endif /* WIN32 */
|
||||
|
||||
#include "h5core/h5_core.h"
|
||||
#include "H5Part.h"
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Set the number of particles for the current time-step.
|
||||
After you call this subroutine, all subsequent
|
||||
operations will assume this number of particles will be written.
|
||||
|
||||
For the parallel library, the \c nparticles value is the number of
|
||||
particles that the \e individual task will write. You can use
|
||||
a different value on different tasks.
|
||||
This function uses an \c MPI_Allgather
|
||||
call to aggregate each tasks number of particles and determine
|
||||
the appropiate offsets. Because of the use of this MPI collective,
|
||||
it is advisable to call this function as
|
||||
few times as possible when running at large concurrency.
|
||||
|
||||
This function assumes that your particles' data fields are in stored in
|
||||
contiguous 1D arrays.
|
||||
For instance, the fields \e x and \e y for your particles are stored
|
||||
in separate arrays \c x[] and \c y[].
|
||||
|
||||
If instead you store your particles as tuples, so that the values
|
||||
are arranged \f$ x_1,y_1,x_2,y_2\f$... than you need to setup striding
|
||||
(in this case with value 2) using \ref H5PartSetNumParticlesStrided.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartSetNumParticles (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
h5_size_t nparticles /*!< [in] Number of particles */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, nparticles=%llu",
|
||||
f, (long long unsigned)nparticles);
|
||||
h5_size_t stride = 1;
|
||||
H5_API_RETURN (h5u_set_num_particles(f, nparticles, stride));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Set the number of particles for the current time-step.
|
||||
After you call this subroutine, all subsequent
|
||||
operations will assume this number of particles will be written.
|
||||
|
||||
For the parallel library, the \c nparticles value is the number of
|
||||
particles that the \e individual task will write. You can use
|
||||
a different value on different tasks.
|
||||
This function uses an \c MPI_Allgather
|
||||
call to aggregate each tasks number of particles and determine
|
||||
the appropiate offsets. Because of the use of this MPI collective,
|
||||
it is advisable to call this function as
|
||||
few times as possible when running at large concurrency.
|
||||
|
||||
This function assumes that your particles' data fields are
|
||||
stored tuples. For instance, the fields \e x and \e y of your
|
||||
particles are arranged \f$x_1,y_1,x_2,y_2\f$... in a single data
|
||||
array. In this example, the stride value would be 2.
|
||||
|
||||
If you instead have a separate array for each fields,
|
||||
such as \c x[] and \c y[],
|
||||
use \ref H5PartSetNumParticles.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartSetNumParticlesStrided (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
h5_size_t nparticles, /*!< [in] Number of particles */
|
||||
h5_size_t stride /*!< [in] Stride value (e.g. number of fields in the particle array) */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, nparticles=%llu, stride=%llu",
|
||||
f, (long long unsigned)nparticles,
|
||||
(long long unsigned)stride);
|
||||
H5_API_RETURN (h5u_set_num_particles (f, nparticles, stride));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Define the chunk \c size and enables chunking in the underlying
|
||||
HDF5 layer.
|
||||
|
||||
Note that this policy wastes disk space, but can improve write
|
||||
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
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartSetChunk (
|
||||
h5_file_t *f,
|
||||
h5_size_t size
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, size=%llu", f, (long long unsigned)size);
|
||||
H5_API_RETURN (h5u_set_chunk (f, size));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Write array of 64 bit floating point data to file.
|
||||
|
||||
After setting the number of particles with \c H5PartSetNumParticles() and
|
||||
the current timestep using \c H5SetStep(), you can start writing datasets
|
||||
into the file. Each dataset has a name associated with it (chosen by the
|
||||
user) in order to facilitate later retrieval. The name of the dataset is
|
||||
specified in the parameter \c name, which must be a null-terminated string.
|
||||
|
||||
There are no restrictions on naming of datasets, but it is useful to arrive
|
||||
at some common naming convention when sharing data with other groups.
|
||||
|
||||
The writing routines also implicitly store the datatype of the array so that
|
||||
the array can be reconstructed properly on other systems with incompatible
|
||||
type representations.
|
||||
|
||||
All data that is written after setting the timestep is associated with that
|
||||
timestep. While the number of particles can change for each timestep, you
|
||||
cannot change the number of particles in the middle of a given timestep.
|
||||
|
||||
The data is committed to disk before the routine returns.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartWriteDataFloat64 (
|
||||
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_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_write_data (f, name, (void*)data, H5T_NATIVE_DOUBLE));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Write array of 32 bit floating point data to file.
|
||||
|
||||
After setting the number of particles with \c H5PartSetNumParticles() and
|
||||
the current timestep using \c H5SetStep(), you can start writing datasets
|
||||
into the file. Each dataset has a name associated with it (chosen by the
|
||||
user) in order to facilitate later retrieval. The name of the dataset is
|
||||
specified in the parameter \c name, which must be a null-terminated string.
|
||||
|
||||
There are no restrictions on naming of datasets, but it is useful to arrive
|
||||
at some common naming convention when sharing data with other groups.
|
||||
|
||||
The writing routines also implicitly store the datatype of the array so that
|
||||
the array can be reconstructed properly on other systems with incompatible
|
||||
type representations.
|
||||
|
||||
All data that is written after setting the timestep is associated with that
|
||||
timestep. While the number of particles can change for each timestep, you
|
||||
cannot change the number of particles in the middle of a given timestep.
|
||||
|
||||
The data is committed to disk before the routine returns.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
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_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
h5_err_t h5err = h5u_write_data( f, name, (void*)data, H5T_NATIVE_FLOAT );
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Write array of 64 bit integer data to file.
|
||||
|
||||
After setting the number of particles with \c H5PartSetNumParticles() and
|
||||
the current timestep using \c H5SetStep(), you can start writing datasets
|
||||
into the file. Each dataset has a name associated with it (chosen by the
|
||||
user) in order to facilitate later retrieval. The name of the dataset is
|
||||
specified in the parameter \c name, which must be a null-terminated string.
|
||||
|
||||
There are no restrictions on naming of datasets, but it is useful to arrive
|
||||
at some common naming convention when sharing data with other groups.
|
||||
|
||||
The writing routines also implicitly store the datatype of the array so that
|
||||
the array can be reconstructed properly on other systems with incompatible
|
||||
type representations.
|
||||
|
||||
All data that is written after setting the timestep is associated with that
|
||||
timestep. While the number of particles can change for each timestep, you
|
||||
cannot change the number of particles in the middle of a given timestep.
|
||||
|
||||
The data is committed to disk before the routine returns.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartWriteDataInt64 (
|
||||
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_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_write_data (f, name, (void*)data, H5T_NATIVE_INT64));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Write array of 32 bit integer data to file.
|
||||
|
||||
After setting the number of particles with \c H5PartSetNumParticles() and
|
||||
the current timestep using \c H5SetStep(), you can start writing datasets
|
||||
into the file. Each dataset has a name associated with it (chosen by the
|
||||
user) in order to facilitate later retrieval. The name of the dataset is
|
||||
specified in the parameter \c name, which must be a null-terminated string.
|
||||
|
||||
There are no restrictions on naming of datasets, but it is useful to arrive
|
||||
at some common naming convention when sharing data with other groups.
|
||||
|
||||
The writing routines also implicitly store the datatype of the array so that
|
||||
the array can be reconstructed properly on other systems with incompatible
|
||||
type representations.
|
||||
|
||||
All data that is written after setting the timestep is associated with that
|
||||
timestep. While the number of particles can change for each timestep, you
|
||||
cannot change the number of particles in the middle of a given timestep.
|
||||
|
||||
The data is committed to disk before the routine returns.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
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_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_write_data (f, name, (void*)data, H5T_NATIVE_INT32));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Read array of 64 bit floating point data from file.
|
||||
|
||||
When retrieving datasets from disk, you ask for them
|
||||
by name. There are no restrictions on naming of arrays,
|
||||
but it is useful to arrive at some common naming
|
||||
convention when sharing data with other groups.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
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_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_DOUBLE));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Read array of 32 bit floating point data from file.
|
||||
|
||||
When retrieving datasets from disk, you ask for them
|
||||
by name. There are no restrictions on naming of arrays,
|
||||
but it is useful to arrive at some common naming
|
||||
convention when sharing data with other groups.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
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_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_FLOAT));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Read array of 64 bit integer data from file.
|
||||
|
||||
When retrieving datasets from disk, you ask for them
|
||||
by name. There are no restrictions on naming of arrays,
|
||||
but it is useful to arrive at some common naming
|
||||
convention when sharing data with other groups.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
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_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_INT64));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Read array of 32 bit integer data from file.
|
||||
|
||||
When retrieving datasets from disk, you ask for them
|
||||
by name. There are no restrictions on naming of arrays,
|
||||
but it is useful to arrive at some common naming
|
||||
convention when sharing data with other groups.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
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 */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_INT32));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Get the number of datasets that are stored at the current time-step.
|
||||
|
||||
\return number of datasets in current timestep or error code
|
||||
*/
|
||||
|
||||
h5_ssize_t
|
||||
H5PartGetNumDatasets (
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5u_get_num_datasets(f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
This reads the name of a dataset specified by it's index in the current
|
||||
time-step.
|
||||
|
||||
If the number of datasets is \c n, the range of \c _index is \c 0 to \c n-1.
|
||||
|
||||
\result \c H5_SUCCESS
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartGetDatasetName (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const h5_id_t idx, /*!< [in] Index of the dataset */
|
||||
char *name, /*!< [out] Name of dataset */
|
||||
const h5_size_t len /*!< [in] Size of buffer \c name */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"idx=%lld, "
|
||||
"name='%p', len=%llu, ",
|
||||
f,
|
||||
(long long)idx,
|
||||
name, (unsigned long long)len);
|
||||
H5_API_RETURN (h5u_get_dataset_info(f, idx, name, len, NULL, NULL));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Gets the name, type and number of elements of a dataset based on its
|
||||
index in the current timestep.
|
||||
|
||||
Type is one of the following values:
|
||||
|
||||
- \c H5_FLOAT64_T (for \c h5_float64_t)
|
||||
- \c H5_FLOAT32_T (for \c h5_float32_t)
|
||||
- \c H5_INT64_T (for \c h5_int64_t)
|
||||
- \c H5_INT32_T (for \c h5_int32_t)
|
||||
|
||||
\return \c H5_SUCCESS
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartGetDatasetInfo (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const h5_id_t idx, /*!< [in] Index of the dataset */
|
||||
char *dataset_name, /*!< [out] Name of dataset */
|
||||
const h5_size_t len_dataset_name,
|
||||
/*!< [in] Size of buffer \c dataset_name */
|
||||
h5_int64_t *type, /*!< [out] Type of data in dataset */
|
||||
h5_size_t *nelem /*!< [out] Number of elements. */
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, "
|
||||
"idx=%lld, "
|
||||
"dataset_name='%p', len_dataset_name=%llu, "
|
||||
"type=%p, nelem=%p",
|
||||
f,
|
||||
(long long)idx,
|
||||
dataset_name, (long long unsigned)len_dataset_name,
|
||||
type, nelem);
|
||||
H5_API_RETURN (h5u_get_dataset_info (
|
||||
f, idx, dataset_name, len_dataset_name, type, nelem));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
This function returns the number of particles in this processor's view,
|
||||
if a view has been set.
|
||||
|
||||
If not, it returns the total number of particles across all processors
|
||||
from the last \ref H5PartSetNumParticles call.
|
||||
|
||||
If you have neither set the number of particles
|
||||
nor set a view, then this returns the total number of
|
||||
particles in the first data set of the current time step.
|
||||
Note that H5Part assumes that all data sets within a given time step
|
||||
have the same number of particles (although the number particles can
|
||||
vary across time steps).
|
||||
|
||||
If none of these conditions are met, an error is thrown.
|
||||
|
||||
\return number of particles in current timestep or an error
|
||||
code.
|
||||
*/
|
||||
h5_ssize_t
|
||||
H5PartGetNumParticles (
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE( f );
|
||||
H5_API_RETURN (h5u_get_num_particles (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Reset the view.
|
||||
|
||||
\return \c H5_SUCCESS
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartResetView (
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
H5_API_RETURN (h5u_reset_view (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Check whether a view has been set, either automatically with
|
||||
\ref H5PartSetNumParticles or manually with \ref H5PartSetView
|
||||
or \ref H5PartSetViewIndices.
|
||||
|
||||
\return 0 for false or 1 for true
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartHasView (
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5u_has_view (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
For parallel I/O or for subsetting operations on the datafile,
|
||||
this function allows you to define a subset of the total
|
||||
particle dataset to operate on.
|
||||
The concept of "view" works for both serial
|
||||
and for parallel I/O. The "view" will remain in effect until a new view
|
||||
is set, or the number of particles in a dataset changes, or the view is
|
||||
"unset" by calling \c H5PartSetView(file,-1,-1);
|
||||
|
||||
Before you set a view, \ref H5PartGetNumParticles will return the
|
||||
total number of particles in the current time-step (even for the parallel
|
||||
reads). However, after you set a view, it will return the number of
|
||||
particles contained in the view.
|
||||
|
||||
The range is \e inclusive: the end value is the last index of the
|
||||
data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
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_API_ENTER (h5_err_t,
|
||||
"f=%p, start=%lld, end=%lld",
|
||||
f, (long long)start, (long long)end);
|
||||
H5_API_RETURN (h5u_set_view (f, start, end));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
For parallel I/O or for subsetting operations on the datafile,
|
||||
this function allows you to define a subset of the total
|
||||
dataset to operate on by specifying a list of indices.
|
||||
The concept of "view" works for both serial
|
||||
and for parallel I/O. The "view" will remain in effect until a new view
|
||||
is set, or the number of particles in a dataset changes, or the view is
|
||||
"unset" by calling \c H5PartSetViewIndices(NULL,0);
|
||||
|
||||
When you perform a read or write on a view consisting of indices, it
|
||||
is assumed that your buffer is \b unpacked, meaning that there is room
|
||||
for all the intermediate values (which will not be touched by the read
|
||||
or write).
|
||||
|
||||
Before you set a view, the \c H5PartGetNumParticles() will return the
|
||||
total number of particles in the current time-step (even for the parallel
|
||||
reads). However, after you set a view, it will return the number of
|
||||
particles contained in the view.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartSetViewIndices (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const h5_size_t *indices, /*!< [in] List of indices */
|
||||
h5_size_t nelems /*!< [in] Size of list */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, indices=%p, nelems=%llu",
|
||||
f, indices, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5u_set_view_indices (f, indices, nelems));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Allows you to query the current view. Start and End
|
||||
will be \c -1 if there is no current view established.
|
||||
Use \c H5PartHasView() to see if the view is smaller than the
|
||||
total dataset.
|
||||
|
||||
\return number of elements in the view or error code
|
||||
*/
|
||||
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_API_ENTER (h5_err_t,
|
||||
"f=%p, start=%p, end=%p",
|
||||
f, start, end);
|
||||
H5_API_RETURN (h5u_get_view (f, start, end));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
If it is too tedious to manually set the start and end coordinates
|
||||
for a view, the \c H5SetCanonicalView() will automatically select an
|
||||
appropriate domain decomposition of the data arrays for the degree
|
||||
of parallelism and set the "view" accordingly.
|
||||
|
||||
\return H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartSetCanonicalView (
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5u_set_canonical_view (f));
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
#include "h5core/h5_core.h"
|
||||
#include "H5hut.h"
|
||||
|
||||
h5_ssize_t
|
||||
H5GetNumAttachments (
|
||||
h5_file_t* const f /*!< [in] Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_get_num_attachments (f));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
H5GetAttachmentInfoByIdx (
|
||||
h5_file_t* const f,
|
||||
const h5_size_t idx, // IN
|
||||
char* const fname, // OUT
|
||||
h5_size_t len_fname, // IN
|
||||
h5_size_t* const fsize // OUT
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"idx=%llu, fname=%p, len_fname=%llu, fsize=%p",
|
||||
(long long unsigned)idx,
|
||||
fname, (long long unsigned)len_fname,
|
||||
fsize);
|
||||
H5_API_RETURN (h5_get_attachment_info_by_idx (
|
||||
f, idx, fname, len_fname, fsize));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
H5GetAttachmentInfoByName (
|
||||
h5_file_t* const f,
|
||||
char* const fname, // OUT
|
||||
h5_size_t* const fsize // OUT
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "fname='%s', fsize=%p", fname, fsize);
|
||||
H5_API_RETURN (h5_get_attachment_info_by_name (
|
||||
f, fname, fsize));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
H5AddAttachment (
|
||||
h5_file_t* const f, /*!< [in] Handle to open file */
|
||||
const char* fname /*!< [in] Name of file to attach */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "fname='%s'", fname);
|
||||
H5_API_RETURN (h5_add_attachment (f, fname));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
H5GetAttachment (
|
||||
h5_file_t* const f, /*!< [in] Handle to open file */
|
||||
const char* fname /*!< [in] Name of attachment */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "fname='%s'", fname);
|
||||
H5_API_RETURN (h5_get_attachment (f, fname));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
H5DeleteAttachment (
|
||||
h5_file_t* const f,
|
||||
const char* const fname
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "fname='%s'", fname);
|
||||
H5_API_RETURN (h5_delete_attachment (f, fname));
|
||||
}
|
||||
@@ -1,629 +0,0 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "h5core/h5_core.h"
|
||||
#include "H5hut.h"
|
||||
|
||||
|
||||
/*** WRITE ***/
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with the string \c value to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteFileAttribString (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const char *value /*!< [in] Value of attribute */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', value='%s'", f, name, value);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5T_NATIVE_CHAR,
|
||||
value,
|
||||
strlen(value) + 1 ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with the string \c value to
|
||||
the current timestep.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteStepAttribString (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const char *value /*!< [in] Value of attribute */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', value='%s'", f, name, value);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5T_NATIVE_CHAR,
|
||||
value,
|
||||
strlen(value) + 1 ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_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 */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5T_NATIVE_FLOAT,
|
||||
values,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_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 */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5T_NATIVE_FLOAT,
|
||||
values,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_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 */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5T_NATIVE_DOUBLE,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_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 */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5T_NATIVE_DOUBLE,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_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 */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5T_NATIVE_INT32,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_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 */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5T_NATIVE_INT32,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_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 */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5T_NATIVE_INT64,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_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 */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5T_NATIVE_INT64,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
/*** READ ***/
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_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 */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', value='%s'", f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_STRING_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_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 */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', value='%s'",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_STRING_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_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 */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_INT32_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_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 */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_INT32_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_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 */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_INT64_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_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 */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
h5_err_t h5err = h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_INT64_T,
|
||||
(void*)buffer);
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_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 */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_FLOAT32_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_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 */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_FLOAT32_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_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 */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_FLOAT64_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_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 */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_FLOAT64_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*** QUERY ***/
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Gets the number of attributes in the file's root ("/").
|
||||
|
||||
\return Number of attributes or error code.
|
||||
*/
|
||||
h5_int64_t
|
||||
H5GetNumFileAttribs (
|
||||
h5_file_t *const f /*!< [in] Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_get_num_attribs (f, H5_ATTRIB_FILE));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Gets the number of attributes bound to the current step.
|
||||
|
||||
\h5_err_t h5err = Number of attributes or error code.
|
||||
*/
|
||||
h5_int64_t
|
||||
H5GetNumStepAttribs (
|
||||
h5_file_t *const f /*!< [in] Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_get_num_attribs (f, H5_ATTRIB_STEP));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Gets the name, type and number of elements of the file attribute
|
||||
specified by its index.
|
||||
|
||||
This function can be used to retrieve all attributes bound to the
|
||||
file \c f by looping from \c 0 to the number of attribute minus
|
||||
one. The number of attributes bound to file \c f can be queried
|
||||
by calling \ref H5GetNumFileAttribs.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
|
||||
h5_err_t
|
||||
H5GetFileAttribInfo (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const h5_size_t attrib_idx, /*!< [in] Index of attribute to get
|
||||
infos about */
|
||||
char *attrib_name, /*!< [out] Name of attribute */
|
||||
const h5_size_t len_of_attrib_name,
|
||||
/*!< [in] length of buffer \c name */
|
||||
h5_int64_t *attrib_type, /*!< [out] Type of value. */
|
||||
h5_size_t *attrib_nelem /*!< [out] Number of elements */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"attrib_idx=%llu, attrib_name=%p, len_attrib_name=%llu, "
|
||||
"attrib_type=%p, attrib_nelem=%p",
|
||||
f,
|
||||
(long long unsigned)attrib_idx,
|
||||
attrib_name,
|
||||
(long long unsigned)len_of_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem);
|
||||
H5_API_RETURN (h5_get_attrib_info (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
attrib_idx,
|
||||
attrib_name,
|
||||
len_of_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Gets the name, type and number of elements of the step attribute
|
||||
specified by its index.
|
||||
|
||||
This function can be used to retrieve all attributes bound to the
|
||||
current time-step by looping from \c 0 to the number of attribute
|
||||
minus one. The number of attributes bound to the current
|
||||
time-step can be queried by calling \ref H5GetNumStepAttribs.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5GetStepAttribInfo (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const h5_size_t attrib_idx, /*!< [in] Index of attribute to
|
||||
get infos about */
|
||||
char *attrib_name, /*!< [out] Name of attribute */
|
||||
const h5_size_t len_of_attrib_name,
|
||||
/*!< [in] length of buffer \c name */
|
||||
h5_int64_t *attrib_type, /*!< [out] Type of value. */
|
||||
h5_size_t *attrib_nelem /*!< [out] Number of elements */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"attrib_idx=%llu, attrib_name=%p, len_attrib_name=%llu, "
|
||||
"attrib_type=%p, attrib_nelem=%p",
|
||||
f,
|
||||
(unsigned long long)attrib_idx,
|
||||
attrib_name,
|
||||
(unsigned long long)len_of_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem);
|
||||
H5_API_RETURN (h5_get_attrib_info (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
attrib_idx,
|
||||
attrib_name,
|
||||
len_of_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem));
|
||||
}
|
||||
|
||||
+3
-26
@@ -1,15 +1,5 @@
|
||||
# src/C level Makefile.am
|
||||
|
||||
OBJEXT=o
|
||||
|
||||
AM_CPPFLAGS = -I../include @AM_CPPFLAGS@
|
||||
|
||||
# What to build... Will be determined by configure script.
|
||||
lib_LTLIBRARIES = @LIB_C@
|
||||
|
||||
# Listing of all possible targets that I may build.
|
||||
EXTRA_LTLIBRARIES = libH5hutC.la
|
||||
|
||||
if ENABLE_C
|
||||
# Header files that I wish to install in $(prefix)/include
|
||||
include_HEADERS = \
|
||||
../include/H5hut.h \
|
||||
@@ -28,20 +18,7 @@ include_HEADERS = \
|
||||
|
||||
# Listing of all possible headers that I may include
|
||||
EXTRA_HEADERS =
|
||||
|
||||
# Listing of sources
|
||||
libH5hutC_la_SOURCES = \
|
||||
H5.c \
|
||||
H5_attribs.c \
|
||||
H5_attachments.c \
|
||||
H5Part.c \
|
||||
H5Block.c \
|
||||
H5Block_readwrite.c
|
||||
|
||||
libH5hutC_la_LDFLAGS = -version-info 2:0:0 -rpath '$(libdir)'
|
||||
|
||||
all-local:
|
||||
$(INSTALL) -m644 .libs/libH5hutC.a ../lib
|
||||
endif
|
||||
|
||||
clean-local:
|
||||
$(RM) ../lib/libH5hutC.a
|
||||
$(RM) *~
|
||||
|
||||
@@ -1,580 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
c_head = """
|
||||
#include "h5core/h5_core.h"
|
||||
"""
|
||||
|
||||
h_head = """
|
||||
#ifndef __H5BLOCK_READWRITE_H
|
||||
#define __H5BLOCK_READWRITE_H
|
||||
"""
|
||||
|
||||
h_tail = """
|
||||
#endif
|
||||
"""
|
||||
|
||||
fc_head = """
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "h5core/h5_core.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
|
||||
"""
|
||||
|
||||
write_scalar_h = """
|
||||
h5_err_t
|
||||
H5Block#DIM#dWriteScalarField#TYPE_ABV# (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
const h5_#TYPE_H5P#_t *buffer
|
||||
);
|
||||
"""
|
||||
|
||||
read_scalar_h = """
|
||||
h5_err_t
|
||||
H5Block#DIM#dReadScalarField#TYPE_ABV# (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
h5_#TYPE_H5P#_t *buffer
|
||||
);
|
||||
"""
|
||||
|
||||
write_scalar_c = """
|
||||
/*!
|
||||
\\ingroup h5block_data
|
||||
|
||||
Write a 3-dimensional field \\c name from the buffer starting at \\c data
|
||||
to the current time-step using the defined field layout. Values are
|
||||
#TYPE_FULL#.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \\c data.
|
||||
|
||||
\\return \\c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block#DIM#dWriteScalarField#TYPE_ABV# (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_#TYPE_H5P#_t *buffer /*!< IN: pointer to write buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER3 (h5_err_t, "f=0x%p, name=\\"%s\\", buffer=0x%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5b_write_scalar_data(f, name, (void*)buffer, #TYPE_HDF5# ));
|
||||
}
|
||||
"""
|
||||
|
||||
read_scalar_c = """
|
||||
/*!
|
||||
\\ingroup h5block_data
|
||||
|
||||
Read a 3-dimensional field \\c name into the buffer starting at \\c data from
|
||||
the current time-step using the defined field layout. Values are
|
||||
#TYPE_FULL#.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \\c data.
|
||||
|
||||
\\return \\c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block#DIM#dReadScalarField#TYPE_ABV# (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to read */
|
||||
h5_#TYPE_H5P#_t *buffer /*!< OUT: pointer to read buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER3 (h5_err_t, "f=0x%p, name=\\"%s\\", buffer=0x%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5b_read_scalar_data(f, name, (void*)buffer, #TYPE_HDF5#));
|
||||
}
|
||||
"""
|
||||
|
||||
write_scalar_fi = """
|
||||
!> \\ingroup h5block_data_f
|
||||
!! See \\ref H5Block#DIM#dWriteScalarField#TYPE_ABV#
|
||||
!! \\return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV# ( filehandle, name, buffer )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
#TYPE_F90#, INTENT(IN) :: buffer(*) !< the array of data
|
||||
END FUNCTION
|
||||
"""
|
||||
|
||||
read_scalar_fi = """
|
||||
!> \\ingroup h5block_data_f
|
||||
!! See \\ref H5Block#DIM#dReadScalarField#TYPE_ABV#
|
||||
!! \\return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_#DIM#d_read_scalar_field_#TYPE_F90_ABV# ( filehandle, name, buffer )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
#TYPE_F90#, INTENT(OUT) :: buffer(*) !< buffer to read the data into
|
||||
END FUNCTION
|
||||
"""
|
||||
|
||||
write_scalar_fc = """
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV# F77NAME ( \\
|
||||
h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV#_, \\
|
||||
H5BL_#DIM#D_WRITE_SCALAR_FIELD_#TYPE_F90_ABVC# )
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV# (
|
||||
h5_int64_t *const f,
|
||||
const char *name,
|
||||
const h5_#TYPE_H5P#_t *buffer,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER4 (h5_err_t, "f=0x%p, name=\\"%s\\", buffer=0x%p, l_name=%d",
|
||||
fh, name, buffer, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_write_scalar_data (
|
||||
fh, name2, (void*)buffer, #TYPE_HDF5# );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
"""
|
||||
|
||||
read_scalar_fc = """
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_3d_read_scalar_field_#TYPE_F90_ABV# F77NAME ( \\
|
||||
h5bl_3d_read_scalar_field_#TYPE_F90_ABV#_, \\
|
||||
H5BL_#DIM#D_READ_SCALAR_FIELD_#TYPE_F90_ABVC# )
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5bl_#DIM#d_read_scalar_field_#TYPE_F90_ABV# (
|
||||
h5_int64_t *const f,
|
||||
const char *name,
|
||||
h5_#TYPE_H5P#_t *buffer,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER4 (h5_err_t, "f=0x%p, name=\\"%s\\", buffer=0x%p, l_name=%d",
|
||||
fh, name, buffer, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_read_scalar_data (
|
||||
fh, name2, buffer, #TYPE_HDF5# );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
"""
|
||||
|
||||
write_vector_h = """
|
||||
h5_err_t
|
||||
H5Block#DIM#dWriteVector3dField#TYPE_ABV# (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
const h5_#TYPE_H5P#_t *x_buf,
|
||||
const h5_#TYPE_H5P#_t *y_buf,
|
||||
const h5_#TYPE_H5P#_t *z_buf
|
||||
);
|
||||
"""
|
||||
|
||||
read_vector_h = """
|
||||
h5_err_t
|
||||
H5Block#DIM#dReadVector3dField#TYPE_ABV# (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
h5_#TYPE_H5P#_t *x_buf,
|
||||
h5_#TYPE_H5P#_t *y_buf,
|
||||
h5_#TYPE_H5P#_t *z_buf
|
||||
);
|
||||
"""
|
||||
|
||||
write_vector_c = """
|
||||
/*!
|
||||
\\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Write a 3-dimensional field \\c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \\c x_buf, \\c y_buf and \\c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with #TYPE_FULL# values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \\c x_buf.
|
||||
|
||||
\\return \\c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block#DIM#dWriteVector3dField#TYPE_ABV# (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_#TYPE_H5P#_t *x_buf, /*!< IN: pointer to X axis buffer */
|
||||
const h5_#TYPE_H5P#_t *y_buf, /*!< IN: pointer to Y axis buffer */
|
||||
const h5_#TYPE_H5P#_t *z_buf /*!< IN: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER5 (h5_err_t, "f=0x%p, name=\\"%s\\", x_buf=0x%p, y_buf=0x%p, z_buf=0x%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_write_vector3d_data(f, name,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, #TYPE_HDF5#));
|
||||
}
|
||||
"""
|
||||
|
||||
read_vector_c = """
|
||||
/*!
|
||||
\\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Read a 3-dimensional field \\c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \\c x_buf, \\c y_buf and \\c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with #TYPE_FULL# values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \\c data.
|
||||
|
||||
\\return \\c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block#DIM#dReadVector3dField#TYPE_ABV# (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_#TYPE_H5P#_t *x_buf, /*!< OUT: pointer to X axis buffer */
|
||||
const h5_#TYPE_H5P#_t *y_buf, /*!< OUT: pointer to Y axis buffer */
|
||||
const h5_#TYPE_H5P#_t *z_buf /*!< OUT: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER5 (h5_err_t, "f=0x%p, name=\\"%s\\", x_buf=0x%p, y_buf=0x%p, z_buf=0x%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_read_vector3d_data(f, name,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, #TYPE_HDF5#));
|
||||
}
|
||||
"""
|
||||
|
||||
write_vector_fi = """
|
||||
!> \\ingroup h5block_data_f
|
||||
!! See \\ref H5Block#DIM#dWriteVector3dField#TYPE_ABV#
|
||||
!! \\return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV# ( 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
|
||||
#TYPE_F90#, INTENT(IN) :: x(*) !< the array of x data to write
|
||||
#TYPE_F90#, INTENT(IN) :: y(*) !< the array of y data to write
|
||||
#TYPE_F90#, INTENT(IN) :: z(*) !< the array of z data to write
|
||||
END FUNCTION
|
||||
"""
|
||||
|
||||
read_vector_fi = """
|
||||
!> \\ingroup h5block_data_f
|
||||
!! See \\ref H5Block#DIM#dReadVector3dField#TYPE_ABV#
|
||||
!! \\return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV# ( 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
|
||||
#TYPE_F90#, INTENT(OUT) :: x(*) !< buffer to read the x data into
|
||||
#TYPE_F90#, INTENT(OUT) :: y(*) !< buffer to read the y data into
|
||||
#TYPE_F90#, INTENT(OUT) :: z(*) !< buffer to read the z data into
|
||||
END FUNCTION
|
||||
"""
|
||||
|
||||
write_vector_fc = """
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV# F77NAME ( \\
|
||||
h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV#_, \\
|
||||
H5BL_#DIM#D_WRITE_VECTOR3D_FIELD_#TYPE_F90_ABVC# )
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV# (
|
||||
h5_int64_t *const f,
|
||||
const char *name,
|
||||
const h5_#TYPE_H5P#_t *x_buf,
|
||||
const h5_#TYPE_H5P#_t *y_buf,
|
||||
const h5_#TYPE_H5P#_t *z_buf,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER6 (h5_err_t, "f=0x%p, name=\\"%s\\", x_buf=0x%p, y_buf=0x%p, z_buf=0x%p, l_name=%d",
|
||||
fh, name, x_buf, y_buf, z_buf, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_write_vector3d_data (
|
||||
fh, name2,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, #TYPE_HDF5# );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
"""
|
||||
|
||||
read_vector_fc = """
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV# F77NAME ( \\
|
||||
h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV#_, \\
|
||||
H5BL_#DIM#D_READ_VECTOR3D_FIELD_#TYPE_F90_ABVC# )
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV# (
|
||||
h5_int64_t *const f,
|
||||
const char *name,
|
||||
h5_#TYPE_H5P#_t *x_buf,
|
||||
h5_#TYPE_H5P#_t *y_buf,
|
||||
h5_#TYPE_H5P#_t *z_buf,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER6 (h5_err_t, "f=0x%p, name=\\"%s\\", x_buf=0x%p, y_buf=0x%p, z_buf=0x%p, l_name=%d",
|
||||
fh, name, x_buf, y_buf, z_buf, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_read_vector3d_data (
|
||||
fh, name2,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, #TYPE_HDF5# );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
"""
|
||||
|
||||
write_attr_h = """
|
||||
h5_err_t
|
||||
H5BlockWriteFieldAttrib#TYPE_ABV# (
|
||||
h5_file_t *const f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
const h5_#TYPE_H5P#_t *buffer,
|
||||
const h5_size_t nelems
|
||||
);
|
||||
"""
|
||||
|
||||
write_attr_c = """
|
||||
/*!
|
||||
\\ingroup h5block_attrib
|
||||
|
||||
Write #TYPE_H5P# \\c values as attribute \\c attrib_name of field
|
||||
\\c field_name.
|
||||
|
||||
\\return \\c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockWriteFieldAttrib#TYPE_ABV# (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const h5_#TYPE_H5P#_t *buffer, /*!< IN: attribute values */
|
||||
const h5_size_t nelems /*!< IN: number of elements */
|
||||
) {
|
||||
|
||||
H5_API_ENTER5 (h5_err_t, "f=0x%p, field_name=\\"%s\\", attrib_name=\\"%s\\", "
|
||||
"buffer=0x%p, nelems=%lld",
|
||||
f, field_name, attrib_name, buffer, (long long)nelems);
|
||||
H5_API_RETURN(h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
#TYPE_HDF5#,
|
||||
buffer,
|
||||
nelems ));
|
||||
}
|
||||
"""
|
||||
|
||||
write_attr_fi = """
|
||||
!> \\ingroup h5block_attrib_f
|
||||
!! See \\ref H5BlockWriteFieldAttrib#TYPE_ABV#
|
||||
!! \\return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_writefieldattrib_#TYPE_F90_ABV# ( 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
|
||||
#TYPE_F90#, INTENT(IN) :: buffer(*) !< the array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: nelems !< the number of elements in the array
|
||||
END FUNCTION
|
||||
"""
|
||||
|
||||
write_attr_fc = """
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_writefieldattrib_#TYPE_F90_ABV# F77NAME ( \\
|
||||
h5bl_writefieldattrib_#TYPE_F90_ABV#_, \\
|
||||
H5BL_WRITEFIELDATTRIB_#TYPE_F90_ABVC# )
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5bl_writefieldattrib_#TYPE_F90_ABV# (
|
||||
h5_int64_t *const f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
const h5_#TYPE_H5P#_t *buffer,
|
||||
const h5_size_t *nelems,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER7 (h5_err_t, "f=0x%p, field_name=\\"%s\\", attrib_name=\\"%s\\", "
|
||||
"buffer=0x%p, nelems=%lld, l_field_name=%d, l_attrib_name=%d",
|
||||
fh, field_name, attrib_name, buffer, (long long)*nelems,
|
||||
l_field_name, l_attrib_name);
|
||||
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
|
||||
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
|
||||
h5_err_t herr = h5_write_field_attrib (
|
||||
fh, field_name2, attrib_name2,
|
||||
#TYPE_HDF5#, buffer, *nelems );
|
||||
free ( field_name2 );
|
||||
free ( attrib_name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
"""
|
||||
|
||||
read_attr_h = """
|
||||
h5_err_t
|
||||
H5BlockReadFieldAttrib#TYPE_ABV# (
|
||||
h5_file_t *const f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
h5_#TYPE_H5P#_t *buffer
|
||||
);
|
||||
"""
|
||||
|
||||
read_attr_c = """
|
||||
/*!
|
||||
\\ingroup h5block_attrib
|
||||
|
||||
Read #TYPE_H5P# values from attribute \\c attrib_name of field
|
||||
\\c field_name into a \\c buffer.
|
||||
|
||||
\\return \\c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockReadFieldAttrib#TYPE_ABV# (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
h5_#TYPE_H5P#_t *buffer /*!< OUT: attribute values */
|
||||
) {
|
||||
|
||||
H5_API_ENTER4 (h5_err_t, "f=%p, field_name=\\\"%s\\", attrib_name=\\"%s\\", buffer=0x%p",
|
||||
f, field_name, attrib_name, buffer);
|
||||
H5_API_RETURN(h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
#TYPE_HDF5#,
|
||||
(void*)buffer ));
|
||||
}
|
||||
"""
|
||||
|
||||
read_attr_fi = """
|
||||
!> \\ingroup h5block_attrib_f
|
||||
!! See \\ref H5BlockReadFieldAttrib#TYPE_ABV#
|
||||
!! \\return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_readfieldattrib_#TYPE_F90_ABV# ( 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
|
||||
#TYPE_F90#, INTENT(IN) :: buffer(*) !< the buffer to read into
|
||||
END FUNCTION
|
||||
"""
|
||||
|
||||
read_attr_fc = """
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_readfieldattrib_#TYPE_F90_ABV# F77NAME ( \\
|
||||
h5bl_readfieldattrib_#TYPE_F90_ABV#_, \\
|
||||
H5BL_READFIELDATTRIB_#TYPE_F90_ABVC# )
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5bl_readfieldattrib_#TYPE_F90_ABV# (
|
||||
h5_int64_t *const f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
h5_#TYPE_H5P#_t *buffer,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER6 (h5_err_t, "f=0x%p, field_name=\\"%s\\", attrib_name=\\"%s\\", "
|
||||
"values=0x%p, l_field_name=%d, l_attrib_name=%d",
|
||||
fh, field_name, attrib_name, buffer,
|
||||
l_field_name, l_attrib_name);
|
||||
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
|
||||
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
|
||||
h5_err_t herr = h5_read_field_attrib (
|
||||
fh, field_name2, attrib_name2, #TYPE_HDF5#, buffer );
|
||||
free ( field_name2 );
|
||||
free ( attrib_name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
dims = ["3"]
|
||||
types = [
|
||||
["floating points (64-bit)", "Float64", "float64", "H5T_NATIVE_DOUBLE", "REAL*8", "r8", "R8"],
|
||||
["floating points (32-bit)", "Float32", "float32", "H5T_NATIVE_FLOAT", "REAL*4", "r4", "R4"],
|
||||
["integers (64-bit)", "Int64", "int64", "H5T_NATIVE_INT64", "INTEGER*8", "i8", "I8"],
|
||||
["integers (32-bit)", "Int32", "int32", "H5T_NATIVE_INT32", "INTEGER*4", "i4", "I4"]
|
||||
]
|
||||
|
||||
def create_call(template, type, dim):
|
||||
fcn = template
|
||||
fcn = fcn.replace('#DIM#',dim)\
|
||||
.replace('#TYPE_FULL#',type[0])\
|
||||
.replace('#TYPE_ABV#',type[1])\
|
||||
.replace('#TYPE_H5P#',type[2])\
|
||||
.replace('#TYPE_HDF5#',type[3])\
|
||||
.replace('#TYPE_F90#',type[4])\
|
||||
.replace('#TYPE_F90_ABV#',type[5])\
|
||||
.replace('#TYPE_F90_ABVC#',type[6])
|
||||
return fcn
|
||||
|
||||
def write_calls():
|
||||
cfile = file('H5Block_readwrite.c','w')
|
||||
cfile.write(c_head)
|
||||
hfile = file('../include/H5Block_readwrite.h','w')
|
||||
hfile.write(h_head)
|
||||
fcfile = file('../Fortran/H5Block_readwrite_F.c','w')
|
||||
fcfile.write(fc_head)
|
||||
fifile = file('../Fortran/H5Block_readwrite.f90','w')
|
||||
for dim in dims:
|
||||
for type in types:
|
||||
cfile.write(create_call(write_scalar_c,type,dim));
|
||||
cfile.write(create_call(read_scalar_c,type,dim));
|
||||
hfile.write(create_call(write_scalar_h,type,dim));
|
||||
hfile.write(create_call(read_scalar_h,type,dim));
|
||||
fcfile.write(create_call(write_scalar_fc,type,dim));
|
||||
fcfile.write(create_call(read_scalar_fc,type,dim));
|
||||
fifile.write(create_call(write_scalar_fi,type,dim));
|
||||
fifile.write(create_call(read_scalar_fi,type,dim));
|
||||
cfile.write(create_call(write_vector_c,type,dim));
|
||||
cfile.write(create_call(read_vector_c,type,dim));
|
||||
hfile.write(create_call(write_vector_h,type,dim));
|
||||
hfile.write(create_call(read_vector_h,type,dim));
|
||||
fcfile.write(create_call(write_vector_fc,type,dim));
|
||||
fcfile.write(create_call(read_vector_fc,type,dim));
|
||||
fifile.write(create_call(write_vector_fi,type,dim));
|
||||
fifile.write(create_call(read_vector_fi,type,dim));
|
||||
for type in types:
|
||||
cfile.write(create_call(write_attr_c,type,""));
|
||||
hfile.write(create_call(write_attr_h,type,""));
|
||||
fifile.write(create_call(write_attr_fi,type,""));
|
||||
fcfile.write(create_call(write_attr_fc,type,""));
|
||||
cfile.write(create_call(read_attr_c,type,""));
|
||||
hfile.write(create_call(read_attr_h,type,""));
|
||||
fifile.write(create_call(read_attr_fi,type,""));
|
||||
fcfile.write(create_call(read_attr_fc,type,""));
|
||||
cfile.close()
|
||||
hfile.write(h_tail)
|
||||
hfile.close()
|
||||
fcfile.close()
|
||||
fifile.close()
|
||||
|
||||
write_calls()
|
||||
|
||||
+17
-13
@@ -1,8 +1,6 @@
|
||||
# src/Fortran level Makefile.am
|
||||
|
||||
OBJEXT=o
|
||||
|
||||
AM_CPPFLAGS = -I../include @AM_CPPFLAGS@
|
||||
if ENABLE_FORTRAN
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/src/include
|
||||
|
||||
F90_FILES = H5.f90 \
|
||||
H5_attribs.f90 \
|
||||
@@ -10,7 +8,7 @@ F90_FILES = H5.f90 \
|
||||
H5Block.f90 \
|
||||
H5Block_readwrite.f90
|
||||
|
||||
EXTRA_HEADERS = ../include/H5hut.h
|
||||
EXTRA_HEADERS =
|
||||
|
||||
# Extra files that I wish to include in the dist tar ball.
|
||||
EXTRA_DIST = TestUnderscoreC.c \
|
||||
@@ -19,13 +17,13 @@ EXTRA_DIST = TestUnderscoreC.c \
|
||||
|
||||
# Files that I don't want to include in the dist tar ball
|
||||
#nodist_include_HEADERS = ../include/H5hutF.h @UNDERSCORE_H@
|
||||
nodist_include_HEADERS = ../include/H5hutF.h
|
||||
nodist_include_HEADERS = $(top_srcdir)/src/include/H5hutF.h
|
||||
|
||||
# What to build... Will be determined by configure script.
|
||||
lib_LTLIBRARIES = @LIB_FORTRAN@
|
||||
lib_LTLIBRARIES = libH5hutF.la
|
||||
|
||||
# Listing of all possible targets that I may build.
|
||||
EXTRA_LTLIBRARIES = libH5hutF.la
|
||||
include_HEADERS = \
|
||||
$(top_srcdir)/src/include/H5hutF.h
|
||||
|
||||
libH5hutF_la_SOURCES = \
|
||||
H5_F.c \
|
||||
@@ -34,13 +32,19 @@ libH5hutF_la_SOURCES = \
|
||||
H5Block_F.c \
|
||||
H5Block_readwrite_F.c
|
||||
|
||||
libH5hutF_la_DEPENDENCIES = ../include/H5hutF.h
|
||||
libH5hutF_la_DEPENDENCIES = $(top_srcdir)/src/include/H5hutF.h
|
||||
|
||||
libH5hutF_la_LDFLAGS = -version-info 2:0:0 -rpath '$(libdir)'
|
||||
|
||||
../include/H5hutF.h: $(F90_FILES)
|
||||
$(top_srcdir)/src/include/H5hutF.h: $(F90_FILES)
|
||||
awk '/INTEGER\*8 FUNCTION/{print "\t" $$1 " " $$3}' $^ >$@
|
||||
|
||||
clean: clean-am
|
||||
$(RM) ../include/H5hutF.h
|
||||
all-local:
|
||||
$(INSTALL) -m755 -d ../lib
|
||||
$(INSTALL) -m644 .libs/libH5hutF.a ../lib
|
||||
endif
|
||||
|
||||
clean: clean-am
|
||||
|
||||
clean-local:
|
||||
$(RM) -f *~
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# test level Makefile.am
|
||||
|
||||
SUBDIRS = h5core @BINDINGS@
|
||||
SUBDIRS = h5core C Fortran
|
||||
|
||||
|
||||
+7
-35
@@ -1,36 +1,6 @@
|
||||
# src level Makefile.am
|
||||
|
||||
OBJEXT=o
|
||||
|
||||
AM_CPPFLAGS = -I../include @AM_CPPFLAGS@
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/src/include
|
||||
|
||||
EXTRA_HEADERS = \
|
||||
../include/h5core/h5_attach.h \
|
||||
../include/h5core/h5_attribs.h \
|
||||
../include/h5core/h5_core.h \
|
||||
../include/h5core/h5_errno.h \
|
||||
../include/h5core/h5_errorhandling.h \
|
||||
../include/h5core/h5_hdf5.h \
|
||||
../include/h5core/h5_maps.h \
|
||||
../include/h5core/h5_openclose.h \
|
||||
../include/h5core/h5_readwrite.h \
|
||||
../include/h5core/h5_syscall.h \
|
||||
../include/h5core/h5_types.h \
|
||||
../include/h5core/h5u_readwrite.h \
|
||||
../include/h5core/h5b_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_core.h \
|
||||
../include/h5core/h5t_inquiry.h \
|
||||
../include/h5core/h5t_map.h \
|
||||
../include/h5core/h5t_model.h \
|
||||
../include/h5core/h5t_readwrite.h \
|
||||
../include/h5core/h5t_ref_elements.h \
|
||||
../include/h5core/h5t_retrieve.h \
|
||||
../include/h5core/h5t_storemesh.h \
|
||||
../include/h5core/h5t_tags.h \
|
||||
h5_attribs_private.h \
|
||||
h5_core_private.h \
|
||||
h5_errorhandling_private.h \
|
||||
@@ -72,7 +42,7 @@ EXTRA_DIST = $(EXTRA_HEADERS)
|
||||
lib_LTLIBRARIES = libH5hut.la
|
||||
|
||||
# Listing of sources
|
||||
libH5hut_la_SOURCES = \
|
||||
libH5hut_la_SOURCES = \
|
||||
h5_attach.c \
|
||||
h5_attribs.c \
|
||||
h5_errorhandling.c \
|
||||
@@ -120,12 +90,14 @@ libH5hut_la_DEPENDENCIES = $(EXTRA_HEADERS)
|
||||
libH5hut_la_LDFLAGS = -version-info 2:0:0
|
||||
|
||||
all-local:
|
||||
$(INSTALL) -m644 .libs/libH5hut.a ../lib
|
||||
$(INSTALL) -m0755 -d $(top_builddir)/src/lib
|
||||
$(INSTALL) -m644 .libs/libH5hut.a $(top_builddir)/src/lib
|
||||
|
||||
install-exec-local:
|
||||
@$(INSTALL) -d $(DESTDIR)$(includedir)/h5core
|
||||
@$(INSTALL) -m644 ../include/h5core/*.h $(DESTDIR)$(includedir)/h5core/
|
||||
@$(INSTALL) -m644 $(top_srcdir)/src/include/h5core/*.h $(DESTDIR)$(includedir)/h5core/
|
||||
|
||||
clean-local:
|
||||
$(RM) -f ../lib/libH5hut.*
|
||||
$(RM) -f $(top_srcdir)/src/lib/libH5hut.*
|
||||
$(RM) -f *~
|
||||
|
||||
|
||||
@@ -495,36 +495,6 @@ h5_get_num_steps(
|
||||
f->prefix_step_name);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_filehandling
|
||||
|
||||
Start traversing steps.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
h5_start_traverse_steps (
|
||||
h5_file_t* const f /*!< file handle */
|
||||
) {
|
||||
UNUSED_ARGUMENT (f);
|
||||
return h5_error_not_implemented ();
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_filehandling
|
||||
|
||||
Go to next step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
h5_traverse_steps (
|
||||
h5_file_t* const f /*!< file handle */
|
||||
) {
|
||||
UNUSED_ARGUMENT (f);
|
||||
return h5_error_not_implemented ();
|
||||
}
|
||||
|
||||
char *
|
||||
h5_strdupfor2c (
|
||||
const char *s,
|
||||
|
||||
@@ -559,14 +559,14 @@ update_internal_structs (
|
||||
"m=%p, from_lvl=%u",
|
||||
m, (unsigned)from_lvl);
|
||||
h5_debug ("%s (%lld)", __func__, (long long)from_lvl);
|
||||
clock_t t1 = clock();
|
||||
// clock_t t1 = clock();
|
||||
TRY( compute_elems_of_vertices (m, from_lvl) );
|
||||
clock_t t2 = clock();
|
||||
// clock_t t2 = clock();
|
||||
// fprintf (stderr, "compute_elems_of_vertices(): %f\n",
|
||||
// (float)(t2-t1)/CLOCKS_PER_SEC);
|
||||
t1 = clock();
|
||||
// t1 = clock();
|
||||
TRY( compute_elems_of_edges (m, from_lvl ) );
|
||||
t2 = clock();
|
||||
// t2 = clock();
|
||||
// fprintf (stderr, "compute_elems_of_edge(): %f\n",
|
||||
// (float)(t2-t1)/CLOCKS_PER_SEC);
|
||||
h5_debug ("%s (%lld): done", __func__, (long long)from_lvl);
|
||||
|
||||
+270
-83
@@ -1,17 +1,11 @@
|
||||
/*
|
||||
Copyright 2007-2008
|
||||
Paul Scherrer Institut, Villigen, Switzerland;
|
||||
Benedikt Oswald;
|
||||
Achim Gsell
|
||||
All rights reserved.
|
||||
|
||||
Authors
|
||||
Achim Gsell
|
||||
|
||||
Warning
|
||||
This code is under development.
|
||||
|
||||
*/
|
||||
Copyright (c) 2006-2013, The Regents of the University of California,
|
||||
through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
Institut (Switzerland). All rights reserved.
|
||||
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#ifndef __H5_H
|
||||
#define __H5_H
|
||||
@@ -20,121 +14,314 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
h5_file_t *
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
Open file with name \c filbename. This function is available in the parallel
|
||||
and serial version. In the serial case \c comm may have any value.
|
||||
|
||||
File mode flags are:
|
||||
- H5_O_RDONLY: only reading allowed
|
||||
- H5_O_WRONLY: create new file, dataset must not exist
|
||||
- H5_O_APPEND: allows to append a new datasets to an existing file
|
||||
- H5_O_RDWR: dataset may exist
|
||||
|
||||
You can also select a "virtual file driver" in the HDF5 layer using:
|
||||
- H5_VFD_INDEPENDENT: MPI-IO in independent (asynchronous) mode
|
||||
- H5_VFD_MPIPOSIX: parallel I/O implemented directly by HDF5, bypassing MPI-IO
|
||||
|
||||
\return File handle.
|
||||
\return NULL on error.
|
||||
*/
|
||||
static inline h5_file_p
|
||||
H5OpenFile (
|
||||
const char * filename,
|
||||
h5_int32_t flag,
|
||||
MPI_Comm comm
|
||||
);
|
||||
const char* filename, /*!< file name */
|
||||
h5_int32_t flags, /*!< file open flags */
|
||||
MPI_Comm comm /*!< MPI communicator */
|
||||
) {
|
||||
H5_API_ENTER (h5_file_p, "filename='%s', flags=%d, ...",filename,flags);
|
||||
H5_API_RETURN (h5_open_file (filename, flags, comm, 0));
|
||||
}
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
h5_err_t
|
||||
Close file and free all memory associated with the file handle.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5CloseFile (
|
||||
h5_file_t * f
|
||||
);
|
||||
h5_file_t* const f /*!< file handle */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_close_file (f));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
Verify that the file handle points to a valid H5hut file structure.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5CheckFile (
|
||||
h5_file_t * f
|
||||
);
|
||||
h5_file_t* const f /*!< file handle */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_check_filehandle (f));
|
||||
}
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
h5_err_t
|
||||
Define format of the step names.
|
||||
|
||||
Example: ==H5SetStepNameFormat( f, "Step", 6 )== defines step names
|
||||
like ==Step#000042==.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5SetStepNameFormat (
|
||||
h5_file_t *f,
|
||||
const char *name,
|
||||
const h5_int64_t width
|
||||
);
|
||||
h5_file_t* const f, /*!< Handle to file */
|
||||
const char* name, /*!< Prefix */
|
||||
const h5_int64_t width /*!< Width of the number */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', width=%lld",
|
||||
f, name, (long long) width);
|
||||
H5_API_RETURN (h5_set_stepname_fmt (f, name, width));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Get format of the step names.
|
||||
|
||||
\return value \c >=0 on success
|
||||
\return -1 on error
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5GetStepNameFormat (
|
||||
h5_file_t *f,
|
||||
char *name,
|
||||
const h5_size_t l_name,
|
||||
int *width
|
||||
);
|
||||
h5_file_t* const f, /*!< Handle to file */
|
||||
char* name, /*!< OUT: Prefix */
|
||||
const h5_size_t l_name, /*!< length of buffer name */
|
||||
int* width /*!< OUT: Width of the number */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name=%p, l_name=%llu, width=%p",
|
||||
f, name, (unsigned long long)l_name, width);
|
||||
H5_API_RETURN (h5_get_stepname_fmt (f, name, l_name, width));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Set the current step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5SetStep (
|
||||
h5_file_t *f,
|
||||
const h5_id_t step
|
||||
);
|
||||
h5_file_t* const f, /*!< [in] Handle to open file */
|
||||
const h5_id_t step /*!< [in] Step to set. */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, step=%lld", f, (long long)step);
|
||||
H5_API_RETURN (h5_set_step (f, step));
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Get current step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_id_t
|
||||
H5GetStep (
|
||||
h5_file_t *f
|
||||
);
|
||||
h5_file_t* const f /*!< Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_get_step (f));
|
||||
}
|
||||
|
||||
int
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
Get the number of processors.
|
||||
|
||||
\param[in] f File handle.
|
||||
|
||||
\return Number of processors.
|
||||
\return \c -1 on error.
|
||||
*/
|
||||
static inline int
|
||||
H5GetNumProcs (
|
||||
h5_file_t * const f
|
||||
);
|
||||
h5_file_t* const f
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_get_num_procs(f));
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Get the number of time-steps that are currently stored in the file
|
||||
\c f.
|
||||
|
||||
It works for both reading and writing of files, but is probably
|
||||
only typically used when you are reading.
|
||||
|
||||
\param[in] f File handle.
|
||||
|
||||
\return number of time-steps or error code
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5GetNumSteps (
|
||||
h5_file_t * const f
|
||||
);
|
||||
h5_file_t* const f
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_get_num_steps(f));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5_inquiry
|
||||
|
||||
Query whether a particular step already exists in the file.
|
||||
|
||||
\param[in] f File handle.
|
||||
\param[in] stepno Step number to query for existence
|
||||
|
||||
\return true or false
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5HasStep (
|
||||
h5_file_t * const f,
|
||||
h5_id_t step
|
||||
);
|
||||
h5_file_t* const f,
|
||||
h5_id_t stepno
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, stepno=%lld",
|
||||
f, (long long)stepno);
|
||||
H5_API_RETURN (h5_has_step (f, stepno));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
H5StartTraverseSteps (
|
||||
h5_file_t *f
|
||||
);
|
||||
|
||||
h5_id_t
|
||||
H5TraverseSteps (
|
||||
h5_file_t *f
|
||||
);
|
||||
/*!
|
||||
\ingroup h5hut_error
|
||||
|
||||
h5_err_t
|
||||
H5EndTraverseSteps (
|
||||
h5_file_t *f
|
||||
);
|
||||
Set verbosity level to \c level.
|
||||
|
||||
h5_err_t
|
||||
\return \c H5_SUCCESS
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5SetVerbosityLevel (
|
||||
const h5_id_t level
|
||||
);
|
||||
) {
|
||||
return h5_set_debuglevel (level);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_error
|
||||
|
||||
Set error handler to \c handler.
|
||||
|
||||
\return \c H5_SUCCESS
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5SetErrorHandler (
|
||||
h5_errorhandler_t handler
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "handler=%p", handler);
|
||||
H5_API_RETURN (h5_set_errorhandler (handler));
|
||||
}
|
||||
|
||||
h5_errorhandler_t
|
||||
/*!
|
||||
\ingroup h5hut_error
|
||||
|
||||
Get current error handler.
|
||||
|
||||
\return Pointer to error handler.
|
||||
*/
|
||||
static inline h5_errorhandler_t
|
||||
H5GetErrorHandler (
|
||||
void
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_errorhandler_t, "%s", "void");
|
||||
H5_API_RETURN (h5_get_errorhandler());
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
static inline h5_err_t
|
||||
H5ReportErrorhandler (
|
||||
const char *fmt,
|
||||
const char* fmt,
|
||||
va_list ap
|
||||
);
|
||||
) {
|
||||
return h5_report_errorhandler (fmt, ap);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
static inline h5_err_t
|
||||
H5AbortErrorhandler (
|
||||
const char *fmt,
|
||||
const char* fmt,
|
||||
va_list ap
|
||||
);
|
||||
) {
|
||||
return h5_abort_errorhandler (fmt, ap);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_error
|
||||
|
||||
Get last error code.
|
||||
|
||||
\return error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5GetErrno (
|
||||
void
|
||||
);
|
||||
) {
|
||||
return h5_get_errno ();
|
||||
}
|
||||
|
||||
|
||||
static inline h5_err_t
|
||||
H5FlushStep (
|
||||
h5_file_t* const f /*!< file handle */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_flush_step (f));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FlushFile (
|
||||
h5_file_t* const f /*!< file handle */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_flush_file (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
Set the `throttle` factor, which causes HDF5 write and read
|
||||
calls to be issued in that number of batches.
|
||||
|
||||
This can prevent large concurrency parallel applications that
|
||||
use independent writes from overwhelming the underlying
|
||||
parallel file system.
|
||||
|
||||
Throttling only works with the H5_VFD_MPIPOSIX or
|
||||
H5_VFD_INDEPENDENT drivers and is only available in
|
||||
the parallel library.
|
||||
|
||||
\return \c H5_SUCCESS
|
||||
*/
|
||||
#ifdef PARALLEL_IO
|
||||
h5_err_t
|
||||
static inline h5_err_t
|
||||
H5SetThrottle (
|
||||
h5_file_t* f,
|
||||
int factor
|
||||
);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, factor=%d", f, factor);
|
||||
H5_API_RETURN (h5_set_throttle(f, factor));
|
||||
}
|
||||
#endif
|
||||
#endif // PARALLEL_IO
|
||||
|
||||
#endif
|
||||
|
||||
+585
-103
@@ -1,16 +1,96 @@
|
||||
#ifndef __H5BLOCK_H
|
||||
#define __H5BLOCK_H
|
||||
|
||||
/*!
|
||||
\defgroup h5block_c_api H5Block C API
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
\defgroup h5block_kernel H5Block Kernel
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
\defgroup h5block_private H5Block Private
|
||||
*/
|
||||
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
\defgroup h5block_model Setting up the Data Model
|
||||
*/
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
\defgroup h5block_data Reading and Writing Datasets
|
||||
*/
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
\defgroup h5block_attrib Reading and Writing Attributes
|
||||
*/
|
||||
|
||||
/*!
|
||||
\note
|
||||
Different field sizes are allowed in the same time-step.
|
||||
|
||||
\note
|
||||
The same layout can be used, if the size of the field matches the
|
||||
size of the layout. If the size of the layout doesn't match the
|
||||
size of the field, an error will be indicated.
|
||||
|
||||
\note
|
||||
In write mode partitions are shrinked to make them non-overlaping. This
|
||||
process may shrink the partitions more than required.
|
||||
|
||||
\note
|
||||
In read-mode partitions may not cross boundaries. This means, if the grid
|
||||
size is (X, Y, Z), all partitions must fit into this grid.
|
||||
|
||||
|
||||
\todo
|
||||
check whether layout is reasonable
|
||||
|
||||
API function names
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
h5_int64_t
|
||||
|
||||
/********************** defining the layout **********************************/
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Tests whether a view has been set, either directly with
|
||||
\ref H5Block3dSetView or indirectly with \ref H5Block3dSetGrid.
|
||||
|
||||
\return 0 on false, 1 on true
|
||||
*/
|
||||
static inline h5_int64_t
|
||||
H5Block3dHasView (
|
||||
h5_file_t *const f /*!< IN: File handle */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", f);
|
||||
H5_API_RETURN (h5b_3d_has_view (f));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Defines the partition of the field that this processor owns, using
|
||||
Fortran ordering: the fastest moving index is \c i.
|
||||
|
||||
This routine uses an MPI_Allgather, so at large concurrency it should
|
||||
be called as infrequently as possible. For instance, if several timesteps
|
||||
use the same field dimensions, set the layout only once before the
|
||||
first timestep.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dSetView (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const h5_int64_t i_start, /*!< IN: start index of \c i */
|
||||
@@ -19,20 +99,56 @@ H5Block3dSetView (
|
||||
const h5_int64_t j_end, /*!< IN: end index of \c j */
|
||||
const h5_int64_t k_start, /*!< IN: start index of \c k */
|
||||
const h5_int64_t k_end /*!< IN: end index of \c k */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"i_start=%lld, i_end=%lld, "
|
||||
"j_start=%lld, j_end=%lld, "
|
||||
"k_start=%lld, k_end=%lld",
|
||||
f,
|
||||
(long long)i_start, (long long)i_end,
|
||||
(long long)j_start, (long long)j_end,
|
||||
(long long)k_start, (long long)k_end);
|
||||
H5_API_RETURN (h5b_3d_set_view(f, i_start, i_end, j_start, j_end, k_start, k_end));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Return the view of this processor.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dGetView (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
h5_size_t *const i_start, /*!< OUT: start index of \c i */
|
||||
h5_size_t *const i_end, /*!< OUT: end index of \c i */
|
||||
h5_size_t *const j_start, /*!< OUT: start index of \c j */
|
||||
h5_size_t *const j_end, /*!< OUT: end index of \c j */
|
||||
h5_size_t *const k_start, /*!< OUT: start index of \c k */
|
||||
h5_size_t *const k_end /*!< OUT: end index of \c k */
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
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_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"i_start=%p, i_end=%p, "
|
||||
"j_start=%p, j_end=%p, "
|
||||
"k_start=%p, k_end=%p",
|
||||
f,
|
||||
i_start, i_end,
|
||||
j_start, j_end,
|
||||
k_start, k_end);
|
||||
H5_API_RETURN (h5b_3d_get_view (f, i_start, i_end, j_start, j_end, k_start, k_end));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Return the reduced (ghost-zone free) view of this processor.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dGetReducedView (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
h5_size_t *const i_start, /*!< OUT: start index of \c i */
|
||||
@@ -41,157 +157,523 @@ H5Block3dGetReducedView (
|
||||
h5_size_t *const j_end, /*!< OUT: end index of \c j */
|
||||
h5_size_t *const k_start, /*!< OUT: start index of \c j */
|
||||
h5_size_t *const k_end /*!< OUT: end index of \c j */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"i_start=%p, i_end=%p, "
|
||||
"j_start=%p, j_end=%p, "
|
||||
"k_start=%p, k_end=%p",
|
||||
f,
|
||||
i_start, i_end,
|
||||
j_start, j_end,
|
||||
k_start, k_end);
|
||||
H5_API_RETURN (h5b_3d_get_reduced_view(f, i_start, i_end, j_start, j_end, k_start, k_end));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Define the chunk dimensions and enable chunking in the underlying
|
||||
HDF5 dataset.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dSetChunk (
|
||||
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_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%llu, j=%llu, k=%llu",
|
||||
f,
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
H5_API_RETURN (h5b_3d_set_chunk(f, i, j, k));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Lookup the chunk dimensions of the underlying HDF5 dataset.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dGetChunk (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const char *field_name, /*!< IN: name of dataset */
|
||||
h5_size_t *const i, /*!< OUT: size of i */
|
||||
h5_size_t *const j, /*!< OUT: size of j */
|
||||
h5_size_t *const k /*!< OUT: size of k */
|
||||
);
|
||||
h5_size_t *const i, /*!< OUT: size of \c i */
|
||||
h5_size_t *const j, /*!< OUT: size of \c j */
|
||||
h5_size_t *const k /*!< OUT: size of \c k */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%p, j=%p, k=%p",
|
||||
f, i, j, k);
|
||||
H5_API_RETURN (h5b_3d_get_chunk(f, field_name, i, j, k));
|
||||
}
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
h5_err_t
|
||||
#ifdef PARALLEL_IO
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Define an underlying 3D Cartesian grid on the processors with dimensions
|
||||
(\c i,\c j,\c k). You can look up a processor's index into the grid
|
||||
using \ref H5Block3dGetGridCoords.
|
||||
|
||||
This function can be used in conjunction with \ref H5Block3dSetDims
|
||||
to setup the view for a regular grid.
|
||||
|
||||
The product of the dimensions must equal the size of the MPI communicator.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dSetGrid (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const h5_size_t i, /*!< IN: dimension in \c i */
|
||||
const h5_size_t j, /*!< IN: dimension in \c j */
|
||||
const h5_size_t k /*!< IN: dimension in \c k */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%llu, j=%llu, k=%llu",
|
||||
f,
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
H5_API_RETURN (h5b_3d_set_grid(f, i, j, k));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Look up the index (\c i, \c j, \c k) in the grid belonging to MPI processor
|
||||
\c proc.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dGetGridCoords (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const int proc, /*!< IN: MPI processor */
|
||||
h5_int64_t *const i, /*!< OUT: index in \c i */
|
||||
h5_int64_t *const j, /*!< OUT: index in \c j */
|
||||
h5_int64_t *const k /*!< OUT: index in \c k */
|
||||
);
|
||||
h5_int64_t *i, /*!< OUT: index in \c i */
|
||||
h5_int64_t *j, /*!< OUT: index in \c j */
|
||||
h5_int64_t *k /*!< OUT: index in \c k */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, proc=%d, i=%p, j=%p, k=%p",
|
||||
f, proc, i, j, k);
|
||||
H5_API_RETURN (h5b_3d_get_grid_coords(f, proc, i, j, k));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Set the dimensions of each processor's block when the field is a regular
|
||||
grid.
|
||||
|
||||
A grid must be already set with \ref H5Block3dSetGrid, and all processors
|
||||
must specify the same dimensions.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dSetDims (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const h5_size_t i, /*!< IN: dimension in \c i */
|
||||
const h5_size_t j, /*!< IN: dimension in \c j */
|
||||
const h5_size_t k /*!< IN: dimension in \c k */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%llu, j=%llu, k=%llu",
|
||||
f,
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
H5_API_RETURN (h5b_3d_set_dims(f, i, j, k));
|
||||
}
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Sets the additional cells (\c i, \c j, \c k) in each direction to use as
|
||||
the `halo` region (or `ghost zone`) that overlaps between neighboring
|
||||
processors on the grid.
|
||||
|
||||
A grid with dimensions must already be set with \ref H5Block3dSetGrid and
|
||||
\ref H5Block3dSetDims, and all processors must specify the same halo radii.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dSetHalo (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const h5_size_t i, /*!< IN: radius in \c i */
|
||||
const h5_size_t j, /*!< IN: radius in \c j */
|
||||
const h5_size_t k /*!< IN: radius in \c k */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%llu, j=%llu, k=%llu",
|
||||
f,
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
H5_API_RETURN (h5b_3d_set_halo(f, i, j, k));
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Query number of fields in current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5BlockGetNumFields (
|
||||
h5_file_t *const f /*!< IN: file handle */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
H5_API_RETURN (h5b_get_num_fields(f));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Get the name, rank and dimensions of the field specified by the
|
||||
index \c idx.
|
||||
|
||||
\c elem_rank reports the rank of the elements in the field
|
||||
(e.g. scalar or vector).
|
||||
|
||||
This function can be used to retrieve all fields bound to the
|
||||
current time-step by looping from \c 0 to the number of fields
|
||||
minus one. The number of fields bound to the current time-step
|
||||
can be queried by calling the function \ref H5BlockGetNumFields.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockGetFieldInfo (
|
||||
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 *const field_rank, /*!< OUT: field rank */
|
||||
h5_size_t *const field_dims, /*!< OUT: field dimensions */
|
||||
h5_size_t *const elem_rank, /*!< OUT: element rank */
|
||||
h5_int64_t *const type /*!< OUT: datatype */
|
||||
);
|
||||
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 *field_rank, /*!< OUT: field rank */
|
||||
h5_size_t *field_dims, /*!< OUT: field dimensions */
|
||||
h5_size_t *elem_rank, /*!< OUT: element rank */
|
||||
h5_int64_t *type /*!< OUT: datatype */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, idx=%llu, "
|
||||
"name=%p, len_name=%llu, "
|
||||
"field_rank=%p, field_dims=%p, elem_rank=%p, type=%p",
|
||||
f, (long long unsigned)idx,
|
||||
name, (long long unsigned)len_name,
|
||||
field_rank, field_dims, elem_rank,
|
||||
type);
|
||||
H5_API_RETURN (
|
||||
h5b_get_field_info (
|
||||
f,
|
||||
idx,
|
||||
name,
|
||||
len_name,
|
||||
field_rank,
|
||||
field_dims,
|
||||
elem_rank,
|
||||
type));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Get the rank and dimensions of the field specified by its name.
|
||||
See \ref H5BlockGetFieldInfo.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockGetFieldInfoByName (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: field name */
|
||||
h5_size_t *const field_rank, /*!< OUT: field rank */
|
||||
h5_size_t *const field_dims, /*!< OUT: field dimensions */
|
||||
h5_size_t *const elem_rank, /*!< OUT: element rank */
|
||||
h5_int64_t *const type /*!< OUT: datatype */
|
||||
);
|
||||
h5_size_t *field_rank, /*!< OUT: field rank */
|
||||
h5_size_t *field_dims, /*!< OUT: field dimensions */
|
||||
h5_size_t *elem_rank, /*!< OUT: element rank */
|
||||
h5_int64_t *type /*!< OUT: datatype */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', "
|
||||
"field_rank=%p, field_dims=%p, elem_rank=%p, type=%p",
|
||||
f, name, field_rank, field_dims, elem_rank, type);
|
||||
H5_API_RETURN (
|
||||
h5b_get_field_info_by_name (
|
||||
f,
|
||||
name,
|
||||
field_rank,
|
||||
field_dims,
|
||||
elem_rank,
|
||||
type));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/********************** reading and writing attribute ************************/
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Write the string \c value as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockWriteFieldAttribString (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *const field_name, /*!< IN: field name */
|
||||
const char *const attrib_name, /*!< IN: attribute name */
|
||||
const char *const value /*!< IN: attribute value */
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const char *buffer /*!< IN: attribute value */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"field_name='%s', "
|
||||
"attrib_name='%s', "
|
||||
"buffer='%s'",
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
buffer);
|
||||
H5_API_RETURN (
|
||||
h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_CHAR,
|
||||
buffer,
|
||||
strlen(buffer) + 1));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Read the string value from attribute \c attrib_name of field
|
||||
\c field_name into a \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockReadFieldAttribString (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *const field_name, /*!< IN: field name */
|
||||
const char *const attrib_name, /*!< IN: attribute name */
|
||||
char *const buffer /*!< OUT: attribute value */
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
char *buffer /*!< OUT: attribute value */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"field_name='%s', "
|
||||
"attrib_name='%s', "
|
||||
"buffer=%p",
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
buffer);
|
||||
H5_API_RETURN (
|
||||
h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5_STRING_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Query the number of attributes of field \c field_name.
|
||||
|
||||
\return number of attributes or error code
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5BlockGetNumFieldAttribs (
|
||||
h5_file_t *const f, /*<! IN: file handle */
|
||||
const char *const field_name /*<! IN: field name */
|
||||
);
|
||||
h5_file_t *const f, /*<! IN: file handle */
|
||||
const char *field_name /*<! IN: field name */
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "f=%p, field_name='%s'", f, field_name);
|
||||
H5_API_RETURN (h5b_get_num_field_attribs (f, field_name));
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Gets the name, type and number of elements of the field attribute
|
||||
specified by its index.
|
||||
|
||||
This function can be used to retrieve all attributes bound to the
|
||||
specified field by looping from \c 0 to the number of attribute
|
||||
minus one. The number of attributes bound to the
|
||||
field can be queried by calling \ref H5BlockGetNumFieldAttribs.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockGetFieldAttribInfo (
|
||||
h5_file_t *const f, /*<! IN: Handle to open file */
|
||||
const char *const field_name, /*<! IN: field name */
|
||||
const char *field_name, /*<! IN: field name */
|
||||
const h5_size_t attrib_idx, /*<! IN: Index of attribute to
|
||||
get infos about */
|
||||
char *const attrib_name, /*<! OUT: Name of attribute */
|
||||
const h5_size_t len_of_attrib_name,
|
||||
char *attrib_name, /*<! OUT: Name of attribute */
|
||||
const h5_size_t len_attrib_name,
|
||||
/*<! IN: length of buffer \c name */
|
||||
h5_int64_t *const attrib_type, /*<! OUT: Type of value. */
|
||||
h5_size_t *const attrib_nelem /*<! OUT: Number of elements */
|
||||
);
|
||||
h5_int64_t *attrib_type, /*<! OUT: Type of value. */
|
||||
h5_size_t *attrib_nelem /*<! OUT: Number of elements */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p field_name='%s', "
|
||||
"attrib_idx=%llu, "
|
||||
"attrib_name=%p, len_attrib_name=%llu, "
|
||||
"attrib_type=%p, "
|
||||
"attrib_nelem=%p",
|
||||
f,
|
||||
field_name,
|
||||
(long long unsigned)attrib_idx,
|
||||
attrib_name, (long long unsigned)len_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem);
|
||||
H5_API_RETURN (
|
||||
h5b_get_field_attrib_info (
|
||||
f,
|
||||
field_name,
|
||||
attrib_idx,
|
||||
attrib_name,
|
||||
len_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
#define H5BLOCK_FIELD_ORIGIN_NAME "__Origin__"
|
||||
#define H5BLOCK_FIELD_SPACING_NAME "__Spacing__"
|
||||
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
|
||||
Get field origin.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dGetFieldOrigin (
|
||||
h5_file_t *f,
|
||||
const char *field_name,
|
||||
h5_float64_t *x_origin,
|
||||
h5_float64_t *y_origin,
|
||||
h5_float64_t *z_origin
|
||||
);
|
||||
h5_file_t *f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
h5_float64_t *x_origin, /*!< OUT: X origin */
|
||||
h5_float64_t *y_origin, /*!< OUT: Y origin */
|
||||
h5_float64_t *z_origin /*!< OUT: Z origin */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', x_origin=%p, y_origin=%p, z_origin=%p",
|
||||
f, field_name, x_origin, y_origin, z_origin);
|
||||
h5_float64_t origin[3];
|
||||
|
||||
h5_err_t
|
||||
TRY (h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_ORIGIN_NAME,
|
||||
H5_FLOAT64_T,
|
||||
origin));
|
||||
|
||||
*x_origin = origin[0];
|
||||
*y_origin = origin[1];
|
||||
*z_origin = origin[2];
|
||||
|
||||
H5_API_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
|
||||
Set field origin.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dSetFieldOrigin (
|
||||
h5_file_t *f,
|
||||
const char *field_name,
|
||||
const h5_float64_t x_origin,
|
||||
const h5_float64_t y_origin,
|
||||
const h5_float64_t z_origin
|
||||
);
|
||||
h5_file_t *f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const h5_float64_t x_origin, /*!< IN: X origin */
|
||||
const h5_float64_t y_origin, /*!< IN: Y origin */
|
||||
const h5_float64_t z_origin /*!< IN: Z origin */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', x_origin=%g, y_origin=%g, z_origin=%g",
|
||||
f, field_name, x_origin, y_origin, z_origin);
|
||||
h5_float64_t origin[3] = { x_origin, y_origin, z_origin };
|
||||
H5_API_RETURN (h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_ORIGIN_NAME,
|
||||
(hid_t)H5_FLOAT64_T,
|
||||
origin,
|
||||
3));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
|
||||
Get field spacing for field \c field_name in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dGetFieldSpacing (
|
||||
h5_file_t *f,
|
||||
const char *field_name,
|
||||
h5_float64_t *x_spacing,
|
||||
h5_float64_t *y_spacing,
|
||||
h5_float64_t *z_spacing
|
||||
);
|
||||
h5_file_t *f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
h5_float64_t *x_spacing, /*!< OUT: X spacing */
|
||||
h5_float64_t *y_spacing, /*!< OUT: Y spacing */
|
||||
h5_float64_t *z_spacing /*!< OUT: Z spacing */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', x_spacing=%p, y_spacing=%p, z_spacing=%p",
|
||||
f, field_name, x_spacing, y_spacing, z_spacing);
|
||||
h5_float64_t spacing[3];
|
||||
TRY (h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_SPACING_NAME,
|
||||
H5_FLOAT64_T,
|
||||
spacing));
|
||||
*x_spacing = spacing[0];
|
||||
*y_spacing = spacing[1];
|
||||
*z_spacing = spacing[2];
|
||||
H5_API_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
|
||||
Set field spacing for field \c field_name in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dSetFieldSpacing (
|
||||
h5_file_t *f,
|
||||
const char *field_name,
|
||||
const h5_float64_t x_spacing,
|
||||
const h5_float64_t y_spacing,
|
||||
const h5_float64_t z_spacing
|
||||
);
|
||||
h5_file_t *f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const h5_float64_t x_spacing, /*!< IN: X spacing */
|
||||
const h5_float64_t y_spacing, /*!< IN: Y spacing */
|
||||
const h5_float64_t z_spacing /*!< IN: Z spacing */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', x_spacing=%g, y_spacing=%g, z_spacing=%g",
|
||||
f, field_name, x_spacing, y_spacing, z_spacing);
|
||||
h5_float64_t spacing[3] = { x_spacing, y_spacing, z_spacing };
|
||||
H5_API_RETURN (h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_SPACING_NAME,
|
||||
(hid_t)H5_FLOAT64_T,
|
||||
spacing,
|
||||
3));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+575
-148
@@ -5,201 +5,628 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Write a 3-dimensional field \c name from the buffer starting at \c data
|
||||
to the current time-step using the defined field layout. Values are
|
||||
floating points (64-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dWriteScalarFieldFloat64 (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
const h5_float64_t *buffer
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_float64_t *buffer /*!< IN: pointer to write buffer */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_write_scalar_data(f, name, (void*)buffer, H5T_NATIVE_DOUBLE ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Read a 3-dimensional field \c name into the buffer starting at \c data from
|
||||
the current time-step using the defined field layout. Values are
|
||||
floating points (64-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dReadScalarFieldFloat64 (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
h5_float64_t *buffer
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to read */
|
||||
h5_float64_t *buffer /*!< OUT: pointer to read buffer */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_read_scalar_data(f, name, (void*)buffer, H5T_NATIVE_DOUBLE));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Write a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with floating points (64-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c x_buf.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dWriteVector3dFieldFloat64 (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
const h5_float64_t *x_buf,
|
||||
const h5_float64_t *y_buf,
|
||||
const h5_float64_t *z_buf
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_float64_t *x_buf, /*!< IN: pointer to X axis buffer */
|
||||
const h5_float64_t *y_buf, /*!< IN: pointer to Y axis buffer */
|
||||
const h5_float64_t *z_buf /*!< IN: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_write_vector3d_data(f, name,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_DOUBLE));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Read a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with floating points (64-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dReadVector3dFieldFloat64 (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
h5_float64_t *x_buf,
|
||||
h5_float64_t *y_buf,
|
||||
h5_float64_t *z_buf
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
h5_float64_t *const x_buf, /*!< OUT: pointer to X axis buffer */
|
||||
h5_float64_t *const y_buf, /*!< OUT: pointer to Y axis buffer */
|
||||
h5_float64_t *const z_buf /*!< OUT: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_read_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_DOUBLE));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Write a 3-dimensional field \c name from the buffer starting at \c data
|
||||
to the current time-step using the defined field layout. Values are
|
||||
floating points (32-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dWriteScalarFieldFloat32 (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
const h5_float32_t *buffer
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_float32_t *buffer /*!< IN: pointer to write buffer */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_write_scalar_data(f, name, buffer, H5T_NATIVE_FLOAT ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Read a 3-dimensional field \c name into the buffer starting at \c data from
|
||||
the current time-step using the defined field layout. Values are
|
||||
floating points (32-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dReadScalarFieldFloat32 (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
h5_float32_t *buffer
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to read */
|
||||
h5_float32_t *const buffer /*!< OUT: pointer to read buffer */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_read_scalar_data(f, name, buffer, H5T_NATIVE_FLOAT));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Write a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with floating points (32-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c x_buf.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dWriteVector3dFieldFloat32 (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
const h5_float32_t *x_buf,
|
||||
const h5_float32_t *y_buf,
|
||||
const h5_float32_t *z_buf
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_float32_t *x_buf, /*!< IN: pointer to X axis buffer */
|
||||
const h5_float32_t *y_buf, /*!< IN: pointer to Y axis buffer */
|
||||
const h5_float32_t *z_buf /*!< IN: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_write_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_FLOAT));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Read a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with floating points (32-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dReadVector3dFieldFloat32 (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
h5_float32_t *x_buf,
|
||||
h5_float32_t *y_buf,
|
||||
h5_float32_t *z_buf
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
h5_float32_t *const x_buf, /*!< OUT: pointer to X axis buffer */
|
||||
h5_float32_t *const y_buf, /*!< OUT: pointer to Y axis buffer */
|
||||
h5_float32_t *const z_buf /*!< OUT: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_read_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_FLOAT));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Write a 3-dimensional field \c name from the buffer starting at \c data
|
||||
to the current time-step using the defined field layout. Values are
|
||||
integers (64-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dWriteScalarFieldInt64 (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
const h5_int64_t *buffer
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_int64_t *buffer /*!< IN: pointer to write buffer */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_write_scalar_data(f, name, buffer, H5T_NATIVE_INT64 ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Read a 3-dimensional field \c name into the buffer starting at \c data from
|
||||
the current time-step using the defined field layout. Values are
|
||||
integers (64-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dReadScalarFieldInt64 (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
h5_int64_t *buffer
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to read */
|
||||
h5_int64_t *const buffer /*!< OUT: pointer to read buffer */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_read_scalar_data(f, name, buffer, H5T_NATIVE_INT64));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Write a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with integers (64-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c x_buf.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dWriteVector3dFieldInt64 (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
const h5_int64_t *x_buf,
|
||||
const h5_int64_t *y_buf,
|
||||
const h5_int64_t *z_buf
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_int64_t *x_buf, /*!< IN: pointer to X axis buffer */
|
||||
const h5_int64_t *y_buf, /*!< IN: pointer to Y axis buffer */
|
||||
const h5_int64_t *z_buf /*!< IN: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN (h5b_write_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_INT64));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Read a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with integers (64-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dReadVector3dFieldInt64 (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
h5_int64_t *x_buf,
|
||||
h5_int64_t *y_buf,
|
||||
h5_int64_t *z_buf
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
h5_int64_t *const x_buf, /*!< OUT: pointer to X axis buffer */
|
||||
h5_int64_t *const y_buf, /*!< OUT: pointer to Y axis buffer */
|
||||
h5_int64_t *const z_buf /*!< OUT: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN (h5b_read_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_INT64));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Write a 3-dimensional field \c name from the buffer starting at \c data
|
||||
to the current time-step using the defined field layout. Values are
|
||||
integers (32-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dWriteScalarFieldInt32 (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
const h5_int32_t *buffer
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_int32_t *buffer /*!< IN: pointer to write buffer */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_write_scalar_data(f, name, buffer, H5T_NATIVE_INT32 ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Read a 3-dimensional field \c name into the buffer starting at \c data from
|
||||
the current time-step using the defined field layout. Values are
|
||||
integers (32-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dReadScalarFieldInt32 (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
h5_int32_t *buffer
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to read */
|
||||
h5_int32_t *const buffer /*!< OUT: pointer to read buffer */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_read_scalar_data(f, name, buffer, H5T_NATIVE_INT32));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Write a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with integers (32-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c x_buf.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dWriteVector3dFieldInt32 (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
const h5_int32_t *x_buf,
|
||||
const h5_int32_t *y_buf,
|
||||
const h5_int32_t *z_buf
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_int32_t *x_buf, /*!< IN: pointer to X axis buffer */
|
||||
const h5_int32_t *y_buf, /*!< IN: pointer to Y axis buffer */
|
||||
const h5_int32_t *z_buf /*!< IN: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_write_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_INT32));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Read a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with integers (32-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dReadVector3dFieldInt32 (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
h5_int32_t *x_buf,
|
||||
h5_int32_t *y_buf,
|
||||
h5_int32_t *z_buf
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
h5_int32_t *const x_buf, /*!< OUT: pointer to X axis buffer */
|
||||
h5_int32_t *const y_buf, /*!< OUT: pointer to Y axis buffer */
|
||||
h5_int32_t *const z_buf /*!< OUT: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_read_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_INT32));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Write float64 \c values as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockWriteFieldAttribFloat64 (
|
||||
h5_file_t *const f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
const h5_float64_t *buffer,
|
||||
const h5_size_t nelems
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const h5_float64_t *buffer, /*!< IN: attribute values */
|
||||
const h5_size_t nelems /*!< IN: number of elements */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', "
|
||||
"buffer=%p, nelems=%lld",
|
||||
f, field_name, attrib_name, buffer, (long long)nelems);
|
||||
H5_API_RETURN (h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_DOUBLE,
|
||||
buffer,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Read float64 values from attribute \c attrib_name of field
|
||||
\c field_name into a \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockReadFieldAttribFloat64 (
|
||||
h5_file_t *const f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
h5_float64_t *buffer
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
h5_float64_t *buffer /*!< OUT: attribute values */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t, "f=%p, field_name='%s', attrib_name='%s', buffer=%p",
|
||||
f, field_name, attrib_name, buffer);
|
||||
H5_API_RETURN (h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_DOUBLE,
|
||||
(void*)buffer ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Write float32 \c values as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockWriteFieldAttribFloat32 (
|
||||
h5_file_t *const f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
const h5_float32_t *buffer,
|
||||
const h5_size_t nelems
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const h5_float32_t *buffer, /*!< IN: attribute values */
|
||||
const h5_size_t nelems /*!< IN: number of elements */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', "
|
||||
"buffer=%p, nelems=%lld",
|
||||
f, field_name, attrib_name, buffer, (long long)nelems);
|
||||
H5_API_RETURN (h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_FLOAT,
|
||||
buffer,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Read float32 values from attribute \c attrib_name of field
|
||||
\c field_name into a \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockReadFieldAttribFloat32 (
|
||||
h5_file_t *const f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
h5_float32_t *buffer
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
h5_float32_t *const buffer /*!< OUT: attribute values */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t, "f=%p, field_name='%s', attrib_name='%s', buffer=%p",
|
||||
f, field_name, attrib_name, buffer);
|
||||
H5_API_RETURN (h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_FLOAT,
|
||||
buffer ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Write int64 \c values as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockWriteFieldAttribInt64 (
|
||||
h5_file_t *const f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
const h5_int64_t *buffer,
|
||||
const h5_size_t nelems
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const h5_int64_t *buffer, /*!< IN: attribute values */
|
||||
const h5_size_t nelems /*!< IN: number of elements */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', buffer=%p, nelems=%lld",
|
||||
f, field_name, attrib_name, buffer, (long long)nelems);
|
||||
H5_API_RETURN (h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_INT64,
|
||||
buffer,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Read int64 values from attribute \c attrib_name of field
|
||||
\c field_name into a \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockReadFieldAttribInt64 (
|
||||
h5_file_t *const f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
h5_int64_t *buffer
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
h5_int64_t *const buffer /*!< OUT: attribute values */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t, "f=%p, field_name='%s', attrib_name='%s', buffer=%p",
|
||||
f, field_name, attrib_name, buffer);
|
||||
H5_API_RETURN (h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_INT64,
|
||||
buffer ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Write int32 \c values as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockWriteFieldAttribInt32 (
|
||||
h5_file_t *const f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
const h5_int32_t *buffer,
|
||||
const h5_size_t nelems
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const h5_int32_t *buffer, /*!< IN: attribute values */
|
||||
const h5_size_t nelems /*!< IN: number of elements */
|
||||
) {
|
||||
|
||||
h5_err_t
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', "
|
||||
"buffer=%p, nelems=%lld",
|
||||
f, field_name, attrib_name, buffer, (long long)nelems);
|
||||
H5_API_RETURN (h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_INT32,
|
||||
buffer,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Read int32 values from attribute \c attrib_name of field
|
||||
\c field_name into a \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockReadFieldAttribInt32 (
|
||||
h5_file_t *const f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
h5_int32_t *buffer
|
||||
);
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
h5_int32_t *buffer /*!< OUT: attribute values */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, field_name='%s', attrib_name='%s', buffer=%p",
|
||||
f, field_name, attrib_name, buffer);
|
||||
H5_API_RETURN (h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_INT32,
|
||||
(void*)buffer ));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+491
-42
@@ -5,95 +5,402 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Set the number of particles for the current time-step.
|
||||
After you call this subroutine, all subsequent
|
||||
operations will assume this number of particles will be written.
|
||||
|
||||
For the parallel library, the \c nparticles value is the number of
|
||||
particles that the \e individual task will write. You can use
|
||||
a different value on different tasks.
|
||||
This function uses an \c MPI_Allgather
|
||||
call to aggregate each tasks number of particles and determine
|
||||
the appropiate offsets. Because of the use of this MPI collective,
|
||||
it is advisable to call this function as
|
||||
few times as possible when running at large concurrency.
|
||||
|
||||
This function assumes that your particles' data fields are in stored in
|
||||
contiguous 1D arrays.
|
||||
For instance, the fields \e x and \e y for your particles are stored
|
||||
in separate arrays \c x[] and \c y[].
|
||||
|
||||
If instead you store your particles as tuples, so that the values
|
||||
are arranged \f$ x_1,y_1,x_2,y_2\f$... than you need to setup striding
|
||||
(in this case with value 2) using \ref H5PartSetNumParticlesStrided.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartSetNumParticles (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
h5_size_t nparticles /*!< [in] Number of particles */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, nparticles=%llu",
|
||||
f, (long long unsigned)nparticles);
|
||||
h5_size_t stride = 1;
|
||||
H5_API_RETURN (h5u_set_num_particles(f, nparticles, stride));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Set the number of particles for the current time-step.
|
||||
After you call this subroutine, all subsequent
|
||||
operations will assume this number of particles will be written.
|
||||
|
||||
For the parallel library, the \c nparticles value is the number of
|
||||
particles that the \e individual task will write. You can use
|
||||
a different value on different tasks.
|
||||
This function uses an \c MPI_Allgather
|
||||
call to aggregate each tasks number of particles and determine
|
||||
the appropiate offsets. Because of the use of this MPI collective,
|
||||
it is advisable to call this function as
|
||||
few times as possible when running at large concurrency.
|
||||
|
||||
This function assumes that your particles' data fields are
|
||||
stored tuples. For instance, the fields \e x and \e y of your
|
||||
particles are arranged \f$x_1,y_1,x_2,y_2\f$... in a single data
|
||||
array. In this example, the stride value would be 2.
|
||||
|
||||
If you instead have a separate array for each fields,
|
||||
such as \c x[] and \c y[],
|
||||
use \ref H5PartSetNumParticles.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartSetNumParticlesStrided (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
h5_size_t nparticles, /*!< [in] Number of particles */
|
||||
h5_size_t stride /*!< [in] Stride value (e.g. number of fields in the particle array) */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, nparticles=%llu, stride=%llu",
|
||||
f, (long long unsigned)nparticles,
|
||||
(long long unsigned)stride);
|
||||
H5_API_RETURN (h5u_set_num_particles (f, nparticles, stride));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Define the chunk \c size and enables chunking in the underlying
|
||||
HDF5 layer.
|
||||
|
||||
Note that this policy wastes disk space, but can improve write
|
||||
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
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartSetChunk (
|
||||
h5_file_t *f,
|
||||
h5_size_t size
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, size=%llu", f, (long long unsigned)size);
|
||||
H5_API_RETURN (h5u_set_chunk (f, size));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Write array of 64 bit floating point data to file.
|
||||
|
||||
After setting the number of particles with \c H5PartSetNumParticles() and
|
||||
the current timestep using \c H5SetStep(), you can start writing datasets
|
||||
into the file. Each dataset has a name associated with it (chosen by the
|
||||
user) in order to facilitate later retrieval. The name of the dataset is
|
||||
specified in the parameter \c name, which must be a null-terminated string.
|
||||
|
||||
There are no restrictions on naming of datasets, but it is useful to arrive
|
||||
at some common naming convention when sharing data with other groups.
|
||||
|
||||
The writing routines also implicitly store the datatype of the array so that
|
||||
the array can be reconstructed properly on other systems with incompatible
|
||||
type representations.
|
||||
|
||||
All data that is written after setting the timestep is associated with that
|
||||
timestep. While the number of particles can change for each timestep, you
|
||||
cannot change the number of particles in the middle of a given timestep.
|
||||
|
||||
The data is committed to disk before the routine returns.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartWriteDataFloat64 (
|
||||
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_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_write_data (f, name, (void*)data, H5T_NATIVE_DOUBLE));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Write array of 32 bit floating point data to file.
|
||||
|
||||
After setting the number of particles with \c H5PartSetNumParticles() and
|
||||
the current timestep using \c H5SetStep(), you can start writing datasets
|
||||
into the file. Each dataset has a name associated with it (chosen by the
|
||||
user) in order to facilitate later retrieval. The name of the dataset is
|
||||
specified in the parameter \c name, which must be a null-terminated string.
|
||||
|
||||
There are no restrictions on naming of datasets, but it is useful to arrive
|
||||
at some common naming convention when sharing data with other groups.
|
||||
|
||||
The writing routines also implicitly store the datatype of the array so that
|
||||
the array can be reconstructed properly on other systems with incompatible
|
||||
type representations.
|
||||
|
||||
All data that is written after setting the timestep is associated with that
|
||||
timestep. While the number of particles can change for each timestep, you
|
||||
cannot change the number of particles in the middle of a given timestep.
|
||||
|
||||
The data is committed to disk before the routine returns.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
h5_err_t h5err = h5u_write_data( f, name, (void*)data, H5T_NATIVE_FLOAT );
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Write array of 64 bit integer data to file.
|
||||
|
||||
After setting the number of particles with \c H5PartSetNumParticles() and
|
||||
the current timestep using \c H5SetStep(), you can start writing datasets
|
||||
into the file. Each dataset has a name associated with it (chosen by the
|
||||
user) in order to facilitate later retrieval. The name of the dataset is
|
||||
specified in the parameter \c name, which must be a null-terminated string.
|
||||
|
||||
There are no restrictions on naming of datasets, but it is useful to arrive
|
||||
at some common naming convention when sharing data with other groups.
|
||||
|
||||
The writing routines also implicitly store the datatype of the array so that
|
||||
the array can be reconstructed properly on other systems with incompatible
|
||||
type representations.
|
||||
|
||||
All data that is written after setting the timestep is associated with that
|
||||
timestep. While the number of particles can change for each timestep, you
|
||||
cannot change the number of particles in the middle of a given timestep.
|
||||
|
||||
The data is committed to disk before the routine returns.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartWriteDataInt64 (
|
||||
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_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_write_data (f, name, (void*)data, H5T_NATIVE_INT64));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Write array of 32 bit integer data to file.
|
||||
|
||||
After setting the number of particles with \c H5PartSetNumParticles() and
|
||||
the current timestep using \c H5SetStep(), you can start writing datasets
|
||||
into the file. Each dataset has a name associated with it (chosen by the
|
||||
user) in order to facilitate later retrieval. The name of the dataset is
|
||||
specified in the parameter \c name, which must be a null-terminated string.
|
||||
|
||||
There are no restrictions on naming of datasets, but it is useful to arrive
|
||||
at some common naming convention when sharing data with other groups.
|
||||
|
||||
The writing routines also implicitly store the datatype of the array so that
|
||||
the array can be reconstructed properly on other systems with incompatible
|
||||
type representations.
|
||||
|
||||
All data that is written after setting the timestep is associated with that
|
||||
timestep. While the number of particles can change for each timestep, you
|
||||
cannot change the number of particles in the middle of a given timestep.
|
||||
|
||||
The data is committed to disk before the routine returns.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_write_data (f, name, (void*)data, H5T_NATIVE_INT32));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Read array of 64 bit floating point data from file.
|
||||
|
||||
When retrieving datasets from disk, you ask for them
|
||||
by name. There are no restrictions on naming of arrays,
|
||||
but it is useful to arrive at some common naming
|
||||
convention when sharing data with other groups.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_DOUBLE));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Read array of 32 bit floating point data from file.
|
||||
|
||||
When retrieving datasets from disk, you ask for them
|
||||
by name. There are no restrictions on naming of arrays,
|
||||
but it is useful to arrive at some common naming
|
||||
convention when sharing data with other groups.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_FLOAT));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Read array of 64 bit integer data from file.
|
||||
|
||||
When retrieving datasets from disk, you ask for them
|
||||
by name. There are no restrictions on naming of arrays,
|
||||
but it is useful to arrive at some common naming
|
||||
convention when sharing data with other groups.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_INT64));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Read array of 32 bit integer data from file.
|
||||
|
||||
When retrieving datasets from disk, you ask for them
|
||||
by name. There are no restrictions on naming of arrays,
|
||||
but it is useful to arrive at some common naming
|
||||
convention when sharing data with other groups.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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 */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_INT32));
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Get the number of datasets that are stored at the current time-step.
|
||||
|
||||
\return number of datasets in current timestep or error code
|
||||
*/
|
||||
|
||||
static inline h5_ssize_t
|
||||
H5PartGetNumDatasets (
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5u_get_num_datasets(f));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
This reads the name of a dataset specified by it's index in the current
|
||||
time-step.
|
||||
|
||||
If the number of datasets is \c n, the range of \c _index is \c 0 to \c n-1.
|
||||
|
||||
\result \c H5_SUCCESS
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartGetDatasetName (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const h5_id_t idx, /*!< [in] Index of the dataset */
|
||||
char *name, /*!< [out] Name of dataset */
|
||||
const h5_size_t len /*!< [in] Size of buffer \c name */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"idx=%lld, "
|
||||
"name='%p', len=%llu, ",
|
||||
f,
|
||||
(long long)idx,
|
||||
name, (unsigned long long)len);
|
||||
H5_API_RETURN (h5u_get_dataset_info(f, idx, name, len, NULL, NULL));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Gets the name, type and number of elements of a dataset based on its
|
||||
index in the current timestep.
|
||||
|
||||
Type is one of the following values:
|
||||
|
||||
- \c H5_FLOAT64_T (for \c h5_float64_t)
|
||||
- \c H5_FLOAT32_T (for \c h5_float32_t)
|
||||
- \c H5_INT64_T (for \c h5_int64_t)
|
||||
- \c H5_INT32_T (for \c h5_int32_t)
|
||||
|
||||
\return \c H5_SUCCESS
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartGetDatasetInfo (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const h5_id_t idx, /*!< [in] Index of the dataset */
|
||||
@@ -102,48 +409,190 @@ H5PartGetDatasetInfo (
|
||||
/*!< [in] Size of buffer \c dataset_name */
|
||||
h5_int64_t *type, /*!< [out] Type of data in dataset */
|
||||
h5_size_t *nelem /*!< [out] Number of elements. */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, "
|
||||
"idx=%lld, "
|
||||
"dataset_name='%p', len_dataset_name=%llu, "
|
||||
"type=%p, nelem=%p",
|
||||
f,
|
||||
(long long)idx,
|
||||
dataset_name, (long long unsigned)len_dataset_name,
|
||||
type, nelem);
|
||||
H5_API_RETURN (h5u_get_dataset_info (
|
||||
f, idx, dataset_name, len_dataset_name, type, nelem));
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
This function returns the number of particles in this processor's view,
|
||||
if a view has been set.
|
||||
|
||||
If not, it returns the total number of particles across all processors
|
||||
from the last \ref H5PartSetNumParticles call.
|
||||
|
||||
If you have neither set the number of particles
|
||||
nor set a view, then this returns the total number of
|
||||
particles in the first data set of the current time step.
|
||||
Note that H5Part assumes that all data sets within a given time step
|
||||
have the same number of particles (although the number particles can
|
||||
vary across time steps).
|
||||
|
||||
If none of these conditions are met, an error is thrown.
|
||||
|
||||
\return number of particles in current timestep or an error
|
||||
code.
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5PartGetNumParticles (
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE( f );
|
||||
H5_API_RETURN (h5u_get_num_particles (f));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Reset the view.
|
||||
|
||||
\return \c H5_SUCCESS
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartResetView (
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
H5_API_RETURN (h5u_reset_view (f));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Check whether a view has been set, either automatically with
|
||||
\ref H5PartSetNumParticles or manually with \ref H5PartSetView
|
||||
or \ref H5PartSetViewIndices.
|
||||
|
||||
\return 0 for false or 1 for true
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartHasView (
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5u_has_view (f));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
For parallel I/O or for subsetting operations on the datafile,
|
||||
this function allows you to define a subset of the total
|
||||
particle dataset to operate on.
|
||||
The concept of "view" works for both serial
|
||||
and for parallel I/O. The "view" will remain in effect until a new view
|
||||
is set, or the number of particles in a dataset changes, or the view is
|
||||
"unset" by calling \c H5PartSetView(file,-1,-1);
|
||||
|
||||
Before you set a view, \ref H5PartGetNumParticles will return the
|
||||
total number of particles in the current time-step (even for the parallel
|
||||
reads). However, after you set a view, it will return the number of
|
||||
particles contained in the view.
|
||||
|
||||
The range is \e inclusive: the end value is the last index of the
|
||||
data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t,
|
||||
"f=%p, start=%lld, end=%lld",
|
||||
f, (long long)start, (long long)end);
|
||||
H5_API_RETURN (h5u_set_view (f, start, end));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
For parallel I/O or for subsetting operations on the datafile,
|
||||
this function allows you to define a subset of the total
|
||||
dataset to operate on by specifying a list of indices.
|
||||
The concept of "view" works for both serial
|
||||
and for parallel I/O. The "view" will remain in effect until a new view
|
||||
is set, or the number of particles in a dataset changes, or the view is
|
||||
"unset" by calling \c H5PartSetViewIndices(NULL,0);
|
||||
|
||||
When you perform a read or write on a view consisting of indices, it
|
||||
is assumed that your buffer is \b unpacked, meaning that there is room
|
||||
for all the intermediate values (which will not be touched by the read
|
||||
or write).
|
||||
|
||||
Before you set a view, the \c H5PartGetNumParticles() will return the
|
||||
total number of particles in the current time-step (even for the parallel
|
||||
reads). However, after you set a view, it will return the number of
|
||||
particles contained in the view.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartSetViewIndices (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const h5_size_t *indices, /*!< [in] List of indices */
|
||||
h5_size_t nelems /*!< [in] Size of list */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, indices=%p, nelems=%llu",
|
||||
f, indices, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5u_set_view_indices (f, indices, nelems));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Allows you to query the current view. Start and End
|
||||
will be \c -1 if there is no current view established.
|
||||
Use \c H5PartHasView() to see if the view is smaller than the
|
||||
total dataset.
|
||||
|
||||
\return number of elements in the view or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t,
|
||||
"f=%p, start=%p, end=%p",
|
||||
f, start, end);
|
||||
H5_API_RETURN (h5u_get_view (f, start, end));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
If it is too tedious to manually set the start and end coordinates
|
||||
for a view, the \c H5SetCanonicalView() will automatically select an
|
||||
appropriate domain decomposition of the data arrays for the degree
|
||||
of parallelism and set the "view" accordingly.
|
||||
|
||||
\return H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartSetCanonicalView (
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5u_set_canonical_view (f));
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -5,44 +5,68 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
h5_ssize_t
|
||||
static inline h5_ssize_t
|
||||
H5GetNumAttachments (
|
||||
h5_file_t* const f
|
||||
);
|
||||
h5_file_t* const f /*!< [in] Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_get_num_attachments (f));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
static inline h5_err_t
|
||||
H5GetAttachmentInfoByIdx (
|
||||
h5_file_t* const f,
|
||||
const h5_size_t idx, // IN
|
||||
char* const fname, // OUT
|
||||
h5_size_t len_fname, // IN
|
||||
h5_size_t* const fsize // OUT
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"idx=%llu, fname=%p, len_fname=%llu, fsize=%p",
|
||||
(long long unsigned)idx,
|
||||
fname, (long long unsigned)len_fname,
|
||||
fsize);
|
||||
H5_API_RETURN (h5_get_attachment_info_by_idx (
|
||||
f, idx, fname, len_fname, fsize));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
static inline h5_err_t
|
||||
H5GetAttachmentInfoByName (
|
||||
h5_file_t* const f,
|
||||
char* const fname,
|
||||
h5_size_t* const fsize
|
||||
);
|
||||
char* const fname, // OUT
|
||||
h5_size_t* const fsize // OUT
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "fname='%s', fsize=%p", fname, fsize);
|
||||
H5_API_RETURN (h5_get_attachment_info_by_name (
|
||||
f, fname, fsize));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
static inline h5_err_t
|
||||
H5AddAttachment (
|
||||
h5_file_t* const f,
|
||||
const char* fname
|
||||
);
|
||||
h5_file_t* const f, /*!< [in] Handle to open file */
|
||||
const char* fname /*!< [in] Name of file to attach */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "fname='%s'", fname);
|
||||
H5_API_RETURN (h5_add_attachment (f, fname));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
static inline h5_err_t
|
||||
H5GetAttachment (
|
||||
h5_file_t* const f,
|
||||
const char* name
|
||||
);
|
||||
h5_file_t* const f, /*!< [in] Handle to open file */
|
||||
const char* fname /*!< [in] Name of attachment */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "fname='%s'", fname);
|
||||
H5_API_RETURN (h5_get_attachment (f, fname));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
static inline h5_err_t
|
||||
H5DeleteAttachment (
|
||||
h5_file_t* const f,
|
||||
const char* const name
|
||||
);
|
||||
const char* const fname
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "fname='%s'", fname);
|
||||
H5_API_RETURN (h5_delete_attachment (f, fname));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+489
-48
@@ -5,165 +5,555 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
/*** WRITE ***/
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with the string \c value to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5WriteFileAttribString (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const char *value /*!< [in] Value of attribute */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', value='%s'", f, name, value);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5T_NATIVE_CHAR,
|
||||
value,
|
||||
strlen(value) + 1 ));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with the string \c value to
|
||||
the current timestep.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5WriteStepAttribString (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const char *value /*!< [in] Value of attribute */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', value='%s'", f, name, value);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5T_NATIVE_CHAR,
|
||||
value,
|
||||
strlen(value) + 1 ));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with float32 \c values to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5T_NATIVE_FLOAT,
|
||||
values,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with float32 \c values to
|
||||
the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5T_NATIVE_FLOAT,
|
||||
values,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with float64 \c values to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5T_NATIVE_DOUBLE,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with float64 \c values to
|
||||
the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5T_NATIVE_DOUBLE,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with int32 \c values to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5T_NATIVE_INT32,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with int32 \c values to
|
||||
the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5T_NATIVE_INT32,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with int64 \c values to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5T_NATIVE_INT64,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with int64 \c values to
|
||||
the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5T_NATIVE_INT64,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*** READ ***/
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read a string into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', value='%s'", f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_STRING_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read a string into a \c buffer from an attribute \c name
|
||||
in the current timestep.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', value='%s'",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_STRING_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read int32 values into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_INT32_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_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
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_INT32_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read int64 values into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_INT64_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_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
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
h5_err_t h5err = h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_INT64_T,
|
||||
(void*)buffer);
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read float32 values into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_FLOAT32_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_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
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_FLOAT32_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read float64 values into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_FLOAT64_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
/*!
|
||||
\ingroup h5hut_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
|
||||
*/
|
||||
static inline 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_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_FLOAT64_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
/*** QUERY ***/
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Gets the number of attributes in the file's root ("/").
|
||||
|
||||
\return Number of attributes or error code.
|
||||
*/
|
||||
static inline h5_int64_t
|
||||
H5GetNumFileAttribs (
|
||||
h5_file_t *const f /*!< [in] Handle to open file */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_get_num_attribs (f, H5_ATTRIB_FILE));
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Gets the number of attributes bound to the current step.
|
||||
|
||||
\h5_err_t h5err = Number of attributes or error code.
|
||||
*/
|
||||
static inline h5_int64_t
|
||||
H5GetNumStepAttribs (
|
||||
h5_file_t *const f /*!< [in] Handle to open file */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_get_num_attribs (f, H5_ATTRIB_STEP));
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Gets the name, type and number of elements of the file attribute
|
||||
specified by its index.
|
||||
|
||||
This function can be used to retrieve all attributes bound to the
|
||||
file \c f by looping from \c 0 to the number of attribute minus
|
||||
one. The number of attributes bound to file \c f can be queried
|
||||
by calling \ref H5GetNumFileAttribs.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
|
||||
static inline h5_err_t
|
||||
H5GetFileAttribInfo (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const h5_size_t attrib_idx, /*!< [in] Index of attribute to get
|
||||
@@ -173,9 +563,41 @@ H5GetFileAttribInfo (
|
||||
/*!< [in] length of buffer \c name */
|
||||
h5_int64_t *attrib_type, /*!< [out] Type of value. */
|
||||
h5_size_t *attrib_nelem /*!< [out] Number of elements */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"attrib_idx=%llu, attrib_name=%p, len_attrib_name=%llu, "
|
||||
"attrib_type=%p, attrib_nelem=%p",
|
||||
f,
|
||||
(long long unsigned)attrib_idx,
|
||||
attrib_name,
|
||||
(long long unsigned)len_of_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem);
|
||||
H5_API_RETURN (h5_get_attrib_info (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
attrib_idx,
|
||||
attrib_name,
|
||||
len_of_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem));
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Gets the name, type and number of elements of the step attribute
|
||||
specified by its index.
|
||||
|
||||
This function can be used to retrieve all attributes bound to the
|
||||
current time-step by looping from \c 0 to the number of attribute
|
||||
minus one. The number of attributes bound to the current
|
||||
time-step can be queried by calling \ref H5GetNumStepAttribs.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5GetStepAttribInfo (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const h5_size_t attrib_idx, /*!< [in] Index of attribute to
|
||||
@@ -185,7 +607,26 @@ H5GetStepAttribInfo (
|
||||
/*!< [in] length of buffer \c name */
|
||||
h5_int64_t *attrib_type, /*!< [out] Type of value. */
|
||||
h5_size_t *attrib_nelem /*!< [out] Number of elements */
|
||||
);
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"attrib_idx=%llu, attrib_name=%p, len_attrib_name=%llu, "
|
||||
"attrib_type=%p, attrib_nelem=%p",
|
||||
f,
|
||||
(unsigned long long)attrib_idx,
|
||||
attrib_name,
|
||||
(unsigned long long)len_of_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem);
|
||||
H5_API_RETURN (h5_get_attrib_info (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
attrib_idx,
|
||||
attrib_name,
|
||||
len_of_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+9
-19
@@ -1,16 +1,17 @@
|
||||
# test level Makefile.am
|
||||
|
||||
#SUBDIRS = H5Block H5Fed H5Part
|
||||
SUBDIRS = H5Fed
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/src/include
|
||||
AM_LDFLAGS += -L${abs_top_builddir}/src/lib
|
||||
|
||||
OBJEXT=o
|
||||
LDADD =
|
||||
LDADD += -lH5hut
|
||||
|
||||
AM_CPPFLAGS = -I../src/include @AM_CPPFLAGS@
|
||||
noinst_PROGRAMS =
|
||||
|
||||
noinst_PROGRAMS = @BUILD_TESTS@
|
||||
if ENABLE_C
|
||||
noinst_PROGRAMS += h5u_test h5b_test h5_attach_test
|
||||
|
||||
TESTS_ENVIRONMENT = env LD_LIBRARY_PATH=@HDF5ROOT@/lib:$(LD_LIBRARY_PATH)
|
||||
TESTS = @BUILD_TESTS@
|
||||
TESTS_ENVIRONMENT = env LD_LIBRARY_PATH=@HDF5_PREFIX@/lib:$(LD_LIBRARY_PATH)
|
||||
|
||||
EXTRA_PROGRAMS = h5u_test h5b_test h5_attach_test
|
||||
|
||||
@@ -22,10 +23,6 @@ h5u_test_SOURCES = \
|
||||
testframe.h \
|
||||
params.h
|
||||
|
||||
h5u_test_LDADD = \
|
||||
../src/C/libH5hutC.la \
|
||||
../src/h5core/libH5hut.la
|
||||
|
||||
h5b_test_SOURCES = \
|
||||
h5b_test.c \
|
||||
h5b_write.c \
|
||||
@@ -34,16 +31,9 @@ h5b_test_SOURCES = \
|
||||
testframe.h \
|
||||
params.h
|
||||
|
||||
h5b_test_LDADD = \
|
||||
../src/C/libH5hutC.la \
|
||||
../src/h5core/libH5hut.la
|
||||
|
||||
h5_attach_test_SOURCES = \
|
||||
h5_attach_test.c
|
||||
|
||||
h5_attach_test_LDADD = \
|
||||
../src/C/libH5hutC.la \
|
||||
../src/h5core/libH5hut.la
|
||||
endif
|
||||
|
||||
clean-local:
|
||||
${RM} -f *.h5
|
||||
|
||||
+9
-17
@@ -6,31 +6,23 @@ if ENABLE_VTKCONVERTER
|
||||
SUBDIRS += vtk2h5grid
|
||||
endif
|
||||
|
||||
AM_LDFLAGS = -L../src/lib @LDFLAGS@
|
||||
LIBS = -lH5hutC -lH5hut @LIBS@
|
||||
AM_CPPFLAGS += -I${abs_top_builddir}/src/include -Wno-deprecated
|
||||
FFLAGS += -cpp $(AM_CPPFLAGS)
|
||||
AM_LDFLAGS += -L${abs_top_builddir}/src/lib
|
||||
|
||||
AM_CPPFLAGS = -I../src/include @AM_CPPFLAGS@
|
||||
LDADD =
|
||||
LDADD += -lH5hut
|
||||
|
||||
# What to build... make install will place these files in the $(prefix)/bin directory.
|
||||
bin_PROGRAMS = @BUILD_TOOLS@
|
||||
EXTRA_PROGRAMS = h5pAttrib h5PartDcToVtk h5PartSurfaceToVtk
|
||||
if ENABLE_C
|
||||
EXTRA_SCRIPTS = # h5hutcc
|
||||
EXTRA_PROGRAMS = h5pAttrib
|
||||
endif
|
||||
|
||||
# Listing of all programs that maybe built. (Has to know statically...)
|
||||
EXTRA_SCRIPTS = h5hutcc
|
||||
|
||||
# Extra files that I wish to include in the dist tar ball.
|
||||
#EXTRA_DIST = h5pAttrib.cc h5pToGNUplot.cc## TO BE TAILORED LATER...
|
||||
|
||||
# Listing of sources
|
||||
h5pAttrib_SOURCES = h5pAttrib.cc
|
||||
|
||||
#h5pToGNUplot_SOURCES = h5pToGNUplot.cc
|
||||
|
||||
#homdynToH5p_SOURCES = homdynToH5p.cc
|
||||
|
||||
h5PartDcToVtk_SOURCES = h5PartDcToVtk.cc
|
||||
|
||||
h5PartSurfaceToVtk_SOURCES = h5PartSurfaceToVtk.cc
|
||||
|
||||
clean: clean-am
|
||||
|
||||
|
||||
Reference in New Issue
Block a user