major changes in preparations for 1.6 release: will add details to CHANGES

This commit is contained in:
Marc Howison
2010-02-10 01:02:14 +00:00
parent 7c4126c2c8
commit 181c03008f
45 changed files with 5570 additions and 1999 deletions
+15 -3
View File
@@ -23,15 +23,15 @@ doc/doxyfooter -text
/missing -text
/rules.make -text
src/H5Block.c -text
src/H5Block.f90 -text
src/H5Block.h -text
src/H5BlockErrors.h -text
src/H5BlockF.c -text
src/H5BlockF90.inc -text
src/H5BlockPrivate.h -text
src/H5BlockReadWrite.c -text
src/H5BlockReadWrite.f90 -text
src/H5BlockReadWrite.h -text
src/H5BlockReadWriteF.c -text
src/H5BlockReadWriteF90.inc -text
src/H5BlockTypes.h -text
src/H5MultiBlock.c -text
src/H5MultiBlock.h -text
@@ -41,15 +41,20 @@ src/H5MultiBlockReadWrite.c -text
src/H5MultiBlockReadWrite.h -text
src/H5MultiBlockTypes.h -text
src/H5Part.c -text
src/H5Part.f90 -text
src/H5Part.h -text
src/H5PartAttrib.c -text
src/H5PartAttrib.f90 -text
src/H5PartAttrib.h -text
src/H5PartAttribF.c -text
src/H5PartErrors.h -text
src/H5PartF.c -text
src/H5PartF90.inc -text
src/H5PartPrivate.h -text
src/H5PartTypes.h -text
src/Makefile.am -text
src/TestUnderscore.f -text
src/TestUnderscoreC.c -text
src/generate-attr.py -text
src/generate-h5bl-readwrite.py -text
src/generate-h5multi-readwrite.py -text
test/Bench.c -text
@@ -68,6 +73,13 @@ test/H5test.cc -text
test/H5testF.f -text
test/H5testFpar.F90 -text
test/Makefile.am -text
test/params.h -text
test/test.c -text
test/testframe.c -text
test/testframe.h -text
test/write.c -text
tools/H5BlockBench.c -text
tools/H5PartBench.c -text
tools/Makefile.am -text
tools/README -text
tools/h5pAttrib.cc -text
+15 -26
View File
@@ -79,7 +79,6 @@ SAVE_MPIFC=$MPIFC
SAVE_MPILIB=$MPILIB
SAVE_MPIINC=$MPIINC
SAVE_CFLAGS=$CFLAGS
CFLAGS=''
SAVE_FFLAGS=$FFLAGS
SAVE_MPIROOT=$MPIROOT
SAVE_HDF5ROOT=$HDF5ROOT
@@ -392,15 +391,15 @@ if test "X$USE_PARALLEL" = "Xyes"; then
fi
MTARGET="libpH5Part.a"
TTARGET="H5PartTestP H5PartAndreasTest Bench"
TTARGET="${TTARGET} H5BlockTestAttributes"
TTARGET="${TTARGET} H5BlockParTestScalarField"
TTARGET="test"
# parallel + fortran
if test "X$USE_FORTRAN" = "Xyes"; then
AC_PATH_PROGS([MPIFC], [mpxlf_r mpif90], [], [$PATH])
FFLAGS="${FFLAGS} -DPARALLEL_IO"
if test -z "${MPIFC}" ; then
if test -e "${MPIROOT}/bin/mpif90"; then
MPIFC=${MPIROOT}/bin/mpif90
@@ -419,28 +418,29 @@ if test "X$USE_PARALLEL" = "Xyes"; then
fi
MTARGET="${MTARGET} libpH5PartF.a"
TTARGET="${TTARGET} H5testFpar"
TTARGET="${TTARGET} H5BlockParTestScalarFieldF"
TTARGET="${TTARGET} testf"
fi
else # --enable-parallel=no
AC_MSG_RESULT([no])
MTARGET="libH5Part.a"
TTARGET="H5PartTest H5test"
TTARGET="${TTARGET} H5BlockTestAttributes"
TTARGET="test"
if test "X$USE_FORTRAN" = "Xyes"; then
MTARGET="${MTARGET} libH5PartF.a"
TTARGET="${TTARGET} H5testF"
TTARGET="${TTARGET} H5BlockTestAttributesF"
fi
TTARGET="${TTARGET} testf"
fi
fi
AC_MSG_CHECKING([wheter tools are enabled])
AC_MSG_CHECKING([whether tools are enabled])
if test "X$USE_TOOLS" = "Xyes"; then
AC_MSG_RESULT([yes])
BUILD_TOOLS="h5pAttrib h5pToGNUplot # homdynToH5p"
BUILD_TOOLS="h5pAttrib h5pToGNUplot homdynToH5p"
# tools + parallel
if test "X$USE_PARALLEL" = "Xyes"; then
BUILD_TOOLS="${BUILD_TOOLS} H5PartBench H5BlockBench"
fi
else
AC_MSG_RESULT([no])
fi
@@ -506,6 +506,8 @@ if test -n "$ZLIBROOT"; then
LDFLAGS="$LDFLAGS -L$ZLIBROOT/lib"
fi
FCFLAGS=${FFLAGS}
###############################################################################
#################### MISC SETTINGS - path, flags, etc #########################
@@ -570,16 +572,6 @@ if test -n "$SAVE_LDFLAGS"; then
LDFLAGS=$SAVE_LDFLAGS
fi
if test -n "$MPICXX"; then
TOOLS_CXX=$MPICXX
TOOLS_H5PART_LIB="-lpH5Part"
TOOLS_HDFLIB="-L$HDF5ROOT/lib -lhdf5"
else
TOOLS_CXX=$CXX
TOOLS_H5PART_LIB="-lH5Part"
TOOLS_HDFLIB="-L$HDF5ROOT/lib -lhdf5"
fi
###############################################################################
############## EXPORTING VARIABLES & CREATING OUTPUT FILES ####################
###############################################################################
@@ -607,9 +599,6 @@ AC_SUBST(H5P_LIB_LOC)
AC_SUBST(UNDERSCORE_H)
AC_SUBST(BUILD_TOOLS)
AC_SUBST(LDFLAGS)
AC_SUBST(TOOLS_CXX)
AC_SUBST(TOOLS_H5PART_LIB)
AC_SUBST(TOOLS_HDFLIB)
# Make AC_OUTPUT create each `file' by copying an input file (by default `file.in'),
# substituting the output variable values.
+16 -11
View File
@@ -58,8 +58,8 @@ HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = NO
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO
SORT_BRIEF_DOCS = YES
SORT_BY_SCOPE_NAME = YES
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
@@ -83,10 +83,15 @@ WARN_LOGFILE =
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT += ../src/H5Part.c
INPUT += ../src/H5PartAttrib.c
INPUT += ../src/H5Block.c
INPUT += ../src/H5MultiBlock.c
INPUT += ../src/H5BlockReadWrite.c
INPUT += ../src/H5MultiBlock.c
INPUT += ../src/H5MultiBlockReadWrite.c
INPUT += ../src/H5Part.f90
INPUT += ../src/H5PartAttrib.f90
INPUT += ../src/H5Block.f90
INPUT += ../src/H5BlockReadWrite.f90
FILE_PATTERNS =
RECURSIVE = YES
EXCLUDE =
@@ -200,7 +205,7 @@ SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES = YES
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
@@ -208,12 +213,12 @@ PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
CLASS_DIAGRAMS = NO
HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = NO
CLASS_GRAPH = NO
COLLABORATION_GRAPH = NO
GROUP_GRAPHS = NO
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = NO
@@ -222,7 +227,7 @@ CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH = /Applications/Graphviz.app/Contents/MacOS
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
+16 -17
View File
@@ -16,11 +16,11 @@
/*!
\ingroup h5block_c_api
\defgroup h5block_write File Writing
\defgroup h5block_model Setting up the Data Model
*/
/*!
\ingroup h5block_c_api
\defgroup h5block_read File Reading
\defgroup h5block_data Reading and Writing Datasets
*/
/*!
\ingroup h5block_c_api
@@ -81,7 +81,7 @@
*/
static h5part_int64_t
_file_is_valid (
_H5Block_file_is_valid (
const H5PartFile *f /*!< IN: file handle */
) {
@@ -114,7 +114,7 @@ _H5Block_init (
h5part_int64_t herr;
struct H5BlockStruct *b;
herr = _file_is_valid ( f );
herr = _H5Block_file_is_valid ( f );
if ( herr == H5PART_SUCCESS ) return H5PART_SUCCESS;
if ( (f == 0) || (f->file == 0) ) return HANDLE_H5PART_BADFD_ERR;
@@ -719,7 +719,7 @@ _release_hyperslab (
}
/*!
\ingroup h5block_write
\ingroup h5block_model
Define the field layout given the dense index space at the actual
time step.
@@ -770,7 +770,7 @@ H5BlockDefine3DFieldLayout(
}
/*!
\ingroup h5block_write
\ingroup h5block_model
Define the chunk dimensions and enable chunking in the underlying
HDF5 dataset.
@@ -808,7 +808,7 @@ H5BlockDefine3DChunkDims(
}
/*!
\ingroup h5block_read
\ingroup h5block_model
Lookup the chunk dimensions of the underlying HDF5 dataset.
@@ -867,7 +867,7 @@ H5BlockGet3DChunkDims(
}
/*!
\ingroup h5block_read
\ingroup h5block_model
Return partition of processor \c proc as specified with
\c H5BlockDefine3dLayout().
@@ -907,7 +907,7 @@ H5Block3dGetPartitionOfProc (
}
/*!
\ingroup h5block_read
\ingroup h5block_model
Return reduced (ghost-zone free) partition of processor \c proc
as specified with \c H5BlockDefine3dLayout().
@@ -948,7 +948,7 @@ H5Block3dGetReducedPartitionOfProc (
/*!
\ingroup h5block_read
\ingroup h5block_model
Returns the processor computing the reduced (ghostzone-free)
partition given by the coordinates \c i, \c j and \c k.
@@ -1461,7 +1461,7 @@ _H5Block_write_data (
/********************** query information about available fields *************/
/*!
\ingroup h5block_read
\ingroup h5block_model
Query number of fields in current time step.
@@ -1548,7 +1548,7 @@ _get_field_info (
}
/*!
\ingroup h5block_read
\ingroup h5block_model
Get the name, rank and dimensions of the field specified by the
index \c idx.
@@ -1589,7 +1589,7 @@ H5BlockGetFieldInfo (
}
/*!
\ingroup h5block_read
\ingroup h5block_model
Get the rank and dimensions of the field specified by its name.
@@ -1715,7 +1715,7 @@ H5BlockWriteFieldAttribString (
*/
h5part_int64_t
H5BlockGetNumFieldAttribs (
H5PartFile *f, /*!< IN: file handle */
H5PartFile *f, /*<! IN: file handle */
const char *field_name /*<! IN: field name */
) {
@@ -1970,9 +1970,8 @@ H5Block3dSetFieldSpacing (
}
/*!
\ingroup h5block_read
*/
/*
\ingroup h5block_model
Checks whether the current time-step has field data or not.
\return \c H5PART_SUCCESS if field data is available otherwise \c
+234
View File
@@ -0,0 +1,234 @@
! Declaration of subroutines for Fortran Bindings
!> \defgroup h5block_f90_api H5Block F90 API
!> \ingroup h5block_f90_api
!! \defgroup h5blockf_model Setting up the Data Model
!<
!> \ingroup h5block_f90_api
!! \defgroup h5blockf_data Reading and Writing Datasets
!<
!> \ingroup h5block_f90_api
!! \defgroup h5blockf_attrib Reading and Writing Attributes
!<
!!!!!!!! Setting up the Data Model !!!!!!!!
!> \ingroup h5blockf_model
!! See \ref H5BlockDefine3DFieldLayout
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_define3dlayout ( filehandle, i_start, i_end, j_start, j_end, k_start, k_end )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(IN) :: i_start
INTEGER*8, INTENT(IN) :: i_end
INTEGER*8, INTENT(IN) :: j_start
INTEGER*8, INTENT(IN) :: j_end
INTEGER*8, INTENT(IN) :: k_start
INTEGER*8, INTENT(IN) :: k_end
END FUNCTION
!> \ingroup h5blockf_model
!! See \ref H5BlockDefine3DChunkDims
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_define3dchunkdims ( filehandle, i, j, k )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(IN) :: i
INTEGER*8, INTENT(IN) :: j
INTEGER*8, INTENT(IN) :: k
END FUNCTION
!> \ingroup h5blockf_model
!! See \ref H5Block3dGetPartitionOfProc
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_get_partition_of_proc ( filehandle, proc, i_start, i_end, j_start, j_end, k_start, k_end )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(OUT) :: proc
INTEGER*8, INTENT(OUT) :: i_start
INTEGER*8, INTENT(OUT) :: i_end
INTEGER*8, INTENT(OUT) :: j_start
INTEGER*8, INTENT(OUT) :: j_end
INTEGER*8, INTENT(OUT) :: k_start
INTEGER*8, INTENT(OUT) :: k_end
END FUNCTION
!> \ingroup h5blockf_model
!! See \ref H5Block3dGetReducedPartitionOfProc
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_get_reduced_partition_of_proc ( filehandle, proc, i_start, i_end, j_start, j_end, k_start, k_end )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(OUT) :: proc
INTEGER*8, INTENT(OUT) :: i_start
INTEGER*8, INTENT(OUT) :: i_end
INTEGER*8, INTENT(OUT) :: j_start
INTEGER*8, INTENT(OUT) :: j_end
INTEGER*8, INTENT(OUT) :: k_start
INTEGER*8, INTENT(OUT) :: k_end
END FUNCTION
!> \ingroup h5blockf_model
!! See \ref H5Block3dGetProcOf
!! \return rank of processor error code
!<
INTEGER*8 FUNCTION h5bl_get_proc_of ( filehandle, i, j, k )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(IN) :: i
INTEGER*8, INTENT(IN) :: j
INTEGER*8, INTENT(IN) :: k
END FUNCTION
!> \ingroup h5blockf_model
!! See \ref H5BlockGetNumFields
!! \return number of fields or error code
!<
INTEGER*8 FUNCTION h5bl_getnumfields ( filehandle )
INTEGER*8, INTENT(IN) :: filehandle
END FUNCTION
!> \ingroup h5blockf_model
!! See \ref H5BlockGetFieldInfo
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_getfieldinfo ( filehandle, idx, field_name, grid_rank, grid_dims, field_dims )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(IN) :: idx
CHARACTER(LEN=*), INTENT(OUT) :: field_name
INTEGER*8, INTENT(OUT) :: grid_rank
INTEGER*8, INTENT(OUT) :: grid_dims(*)
INTEGER*8, INTENT(OUT) :: field_dims
END FUNCTION
!> \ingroup h5blockf_model
!! See \ref H5BlockHasFieldData
!! \return 0 if false, 1 if true, or error code
!<
INTEGER*8 FUNCTION h5bl_has_fielddata ( filehandle )
INTEGER*8, INTENT(IN) :: filehandle
END FUNCTION
!!!!!!!! Reading and Writing Attributes !!!!!!!!
!> \ingroup h5blockf_attrib
!! See \ref H5BlockWriteFieldAttribString
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_writefieldattrib_string ( filehandle, field_name, attrib_name, attrib_value )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
CHARACTER(LEN=*), INTENT(IN) :: attrib_value ! The array of data to write into the attribute
END FUNCTION
!> \ingroup h5blockf_attrib
!! See \ref H5BlockGetNumFieldAttribs
!! \return number of attributes or error code
!<
INTEGER*8 FUNCTION h5bl_getnfieldattribs ( filehandle, field_name )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
END FUNCTION
!> \ingroup h5blockf_attrib
!! See \ref H5BlockGetFieldAttribInfo
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_getfieldattribinfo ( filehandle, field_name, idx, attrib_name, attrib_nelem)
INTEGER*8,INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
INTEGER*8,INTENT(IN) :: idx ! index of the attribute being queried
CHARACTER(LEN=*), INTENT(OUT):: attrib_name ! The name of the attribute
INTEGER*8,INTENT(OUT):: attrib_nelem ! Number of elements in the attrib array
END FUNCTION
!> \ingroup h5blockf_attrib
!! Read the attribute \c attrib_name from the field \c field_name at the
!! current timestep, and store the int64 value in \c attrib_value.
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_readfieldattrib_i8 ( filehandle, field_name, attrib_name, attrib_value )
INTEGER*8,INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
INTEGER*8,INTENT(OUT):: attrib_value(*)! the attribute data will be read into this array
END FUNCTION
!> \ingroup h5blockf_attrib
!! Read the attribute \c attrib_name from the field \c field_name at the
!! current timestep, and store the float64 value in \c attrib_value.
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_readfieldattrib_r8 ( filehandle, field_name, attrib_name, attrib_value )
INTEGER*8,INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
REAL*8, INTENT(OUT):: attrib_value(*)! the attribute data will be read into this array
END FUNCTION
!> \ingroup h5blockf_attrib
!! Read the attribute \c attrib_name from the field \c field_name at the
!! current timestep, and store the string value in \c attrib_value.
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_readfieldattrib_string ( filehandle, field_name, attrib_name, attrib_value )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
CHARACTER(LEN=*), INTENT(IN) :: attrib_value ! The array of data to write into the attribute
END FUNCTION
!> \ingroup h5blockf_attrib
!! See \ref H5Block3dGetFieldSpacing
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_get_field_spacing ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*8, INTENT(OUT) :: x
REAL*8, INTENT(OUT) :: y
REAL*8, INTENT(OUT) :: z
END FUNCTION
!> \ingroup h5blockf_attrib
!! See \ref H5Block3dSetFieldSpacing
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_set_field_spacing ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*8, INTENT(IN) :: x
REAL*8, INTENT(IN) :: y
REAL*8, INTENT(IN) :: z
END FUNCTION
!> \ingroup h5blockf_attrib
!! See \ref H5Block3dGetFieldOrigin
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_get_field_origin ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*8, INTENT(OUT) :: x
REAL*8, INTENT(OUT) :: y
REAL*8, INTENT(OUT) :: z
END FUNCTION
!> \ingroup h5blockf_attrib
!! See \ref H5Block3dSetFieldOrigin
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_set_field_origin ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*8, INTENT(IN) :: x
REAL*8, INTENT(IN) :: y
REAL*8, INTENT(IN) :: z
END FUNCTION
+2 -2
View File
@@ -1,5 +1,5 @@
#ifndef __H5BLOCK_H
#define __H5BLOCK_H
#ifndef _H5BLOCK_H_
#define _H5BLOCK_H_
#ifdef __cplusplus
extern "C" {
+3 -3
View File
@@ -1,7 +1,7 @@
#ifndef __H5BLOCKERRORS_H
#define __H5BLOCKERRORS_H
#ifndef _H5BLOCK_ERRORS_H_
#define _H5BLOCK_ERRORS_H_
#define _err_handler H5PartGetErrorHandler()
extern h5part_error_handler _err_handler;
#define CHECK_LAYOUT( f ) \
if ( ! f->block->have_layout ) \
-143
View File
@@ -1,143 +0,0 @@
INCLUDE 'H5BlockReadWriteF90.inc'
INTERFACE
INTEGER*8 FUNCTION h5bl_define3dlayout ( filehandle, i_start, i_end, j_start, j_end, k_start, k_end )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(IN) :: i_start
INTEGER*8, INTENT(IN) :: i_end
INTEGER*8, INTENT(IN) :: j_start
INTEGER*8, INTENT(IN) :: j_end
INTEGER*8, INTENT(IN) :: k_start
INTEGER*8, INTENT(IN) :: k_end
END FUNCTION
INTEGER*8 FUNCTION h5bl_define3dchunkdims ( filehandle, i, j, k )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(IN) :: i
INTEGER*8, INTENT(IN) :: j
INTEGER*8, INTENT(IN) :: k
END FUNCTION
INTEGER*8 FUNCTION h5bl_get_partition_of_proc ( filehandle, proc, i_start, i_end, j_start, j_end, k_start, k_end )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(OUT) :: proc
INTEGER*8, INTENT(OUT) :: i_start
INTEGER*8, INTENT(OUT) :: i_end
INTEGER*8, INTENT(OUT) :: j_start
INTEGER*8, INTENT(OUT) :: j_end
INTEGER*8, INTENT(OUT) :: k_start
INTEGER*8, INTENT(OUT) :: k_end
END FUNCTION
INTEGER*8 FUNCTION h5bl_get_reduced_partition_of_proc ( filehandle, proc, i_start, i_end, j_start, j_end, k_start, k_end )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(OUT) :: proc
INTEGER*8, INTENT(OUT) :: i_start
INTEGER*8, INTENT(OUT) :: i_end
INTEGER*8, INTENT(OUT) :: j_start
INTEGER*8, INTENT(OUT) :: j_end
INTEGER*8, INTENT(OUT) :: k_start
INTEGER*8, INTENT(OUT) :: k_end
END FUNCTION
INTEGER*8 FUNCTION h5bl_get_proc_of ( filehandle, i, j, k )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(IN) :: i
INTEGER*8, INTENT(IN) :: j
INTEGER*8, INTENT(IN) :: k
END FUNCTION
INTEGER*8 FUNCTION h5bl_getnumfields ( filehandle )
INTEGER*8, INTENT(IN) :: filehandle
END FUNCTION
INTEGER*8 FUNCTION h5bl_getfieldinfo ( filehandle, idx, field_name, grid_rank, grid_dims, field_dims )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(IN) :: idx
CHARACTER(LEN=*), INTENT(OUT) :: field_name
INTEGER*8, INTENT(OUT) :: grid_rank
INTEGER*8, INTENT(OUT) :: grid_dims(*)
INTEGER*8, INTENT(OUT) :: field_dims
END FUNCTION
INTEGER*8 FUNCTION h5bl_writefieldattrib_string ( filehandle, field_name, attrib_name, attrib_value )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
CHARACTER(LEN=*), INTENT(IN) :: attrib_value ! The array of data to write into the attribute
END FUNCTION
INTEGER*8 FUNCTION h5bl_getnfieldattribs ( filehandle, field_name )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
END FUNCTION
INTEGER*8 FUNCTION h5bl_getfieldattribinfo ( filehandle, field_name, idx, attrib_name, attrib_nelem)
INTEGER*8,INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
INTEGER*8,INTENT(IN) :: idx ! index of the attribute being queried
CHARACTER(LEN=*), INTENT(OUT):: attrib_name ! The name of the attribute
INTEGER*8,INTENT(OUT):: attrib_nelem ! Number of elements in the attrib array
END FUNCTION
INTEGER*8 FUNCTION h5bl_readfieldattrib_i8 ( filehandle, field_name, attrib_name, attrib_value )
INTEGER*8,INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
INTEGER*8,INTENT(OUT):: attrib_value(*)! the attribute data will be read into this array
END FUNCTION
INTEGER*8 FUNCTION h5bl_readfieldattrib_r8 ( filehandle, field_name, attrib_name, attrib_value )
INTEGER*8,INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
REAL*8, INTENT(OUT):: attrib_value(*)! the attribute data will be read into this array
END FUNCTION
INTEGER*8 FUNCTION h5bl_readfieldattrib_string ( filehandle, field_name, attrib_name, attrib_value )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
CHARACTER(LEN=*), INTENT(IN) :: attrib_value ! The array of data to write into the attribute
END FUNCTION
INTEGER*8 FUNCTION h5bl_has_fielddata ( filehandle )
INTEGER*8, INTENT(IN) :: filehandle
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_get_field_spacing ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*8, INTENT(OUT) :: x
REAL*8, INTENT(OUT) :: y
REAL*8, INTENT(OUT) :: z
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_set_field_spacing ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*8, INTENT(IN) :: x
REAL*8, INTENT(IN) :: y
REAL*8, INTENT(IN) :: z
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_get_field_origin ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*8, INTENT(OUT) :: x
REAL*8, INTENT(OUT) :: y
REAL*8, INTENT(OUT) :: z
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_set_field_origin ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*8, INTENT(IN) :: x
REAL*8, INTENT(IN) :: y
REAL*8, INTENT(IN) :: z
END FUNCTION
END INTERFACE
+2 -2
View File
@@ -1,5 +1,5 @@
#ifndef __H5BLOCKPRIVATE_H
#define __H5BLOCKPRIVATE_H
#ifndef _H5BLOCK_PRIVATE_H_
#define _H5BLOCK_PRIVATE_H_
#define H5BLOCK_GROUPNAME_BLOCK "Block"
+16 -16
View File
@@ -13,7 +13,7 @@
#include "H5BlockErrors.h"
/*!
\ingroup h5block_write
\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
@@ -49,7 +49,7 @@ H5Block3dWriteScalarFieldFloat64 (
}
/*!
\ingroup h5block_read
\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
@@ -84,7 +84,7 @@ H5Block3dReadScalarFieldFloat64 (
}
/*!
\ingroup h5block_write
\ingroup h5block_data
*/
/*!
Write a 3-dimensional field \c name with 3-dimensional vectors as values
@@ -128,7 +128,7 @@ H5Block3dWrite3dVectorFieldFloat64 (
}
/*!
\ingroup h5block_read
\ingroup h5block_data
*/
/*!
Read a 3-dimensional field \c name with 3-dimensional vectors as values
@@ -171,7 +171,7 @@ H5Block3dRead3dVectorFieldFloat64 (
}
/*!
\ingroup h5block_write
\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
@@ -207,7 +207,7 @@ H5Block3dWriteScalarFieldFloat32 (
}
/*!
\ingroup h5block_read
\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
@@ -242,7 +242,7 @@ H5Block3dReadScalarFieldFloat32 (
}
/*!
\ingroup h5block_write
\ingroup h5block_data
*/
/*!
Write a 3-dimensional field \c name with 3-dimensional vectors as values
@@ -286,7 +286,7 @@ H5Block3dWrite3dVectorFieldFloat32 (
}
/*!
\ingroup h5block_read
\ingroup h5block_data
*/
/*!
Read a 3-dimensional field \c name with 3-dimensional vectors as values
@@ -329,7 +329,7 @@ H5Block3dRead3dVectorFieldFloat32 (
}
/*!
\ingroup h5block_write
\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
@@ -365,7 +365,7 @@ H5Block3dWriteScalarFieldInt64 (
}
/*!
\ingroup h5block_read
\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
@@ -400,7 +400,7 @@ H5Block3dReadScalarFieldInt64 (
}
/*!
\ingroup h5block_write
\ingroup h5block_data
*/
/*!
Write a 3-dimensional field \c name with 3-dimensional vectors as values
@@ -444,7 +444,7 @@ H5Block3dWrite3dVectorFieldInt64 (
}
/*!
\ingroup h5block_read
\ingroup h5block_data
*/
/*!
Read a 3-dimensional field \c name with 3-dimensional vectors as values
@@ -487,7 +487,7 @@ H5Block3dRead3dVectorFieldInt64 (
}
/*!
\ingroup h5block_write
\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
@@ -523,7 +523,7 @@ H5Block3dWriteScalarFieldInt32 (
}
/*!
\ingroup h5block_read
\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
@@ -558,7 +558,7 @@ H5Block3dReadScalarFieldInt32 (
}
/*!
\ingroup h5block_write
\ingroup h5block_data
*/
/*!
Write a 3-dimensional field \c name with 3-dimensional vectors as values
@@ -602,7 +602,7 @@ H5Block3dWrite3dVectorFieldInt32 (
}
/*!
\ingroup h5block_read
\ingroup h5block_data
*/
/*!
Read a 3-dimensional field \c name with 3-dimensional vectors as values
+224
View File
@@ -0,0 +1,224 @@
!> \ingroup h5blockf_data
!! See \ref H5Block3dWriteScalarFieldFloat64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_r8 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*8, INTENT(IN) :: data(*) !< the array of data
END FUNCTION
!> \ingroup h5blockf_data
!! See \ref H5Block3dReadScalarFieldFloat64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_r8 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*8, INTENT(OUT) :: data(*) !< buffer to read the data into
END FUNCTION
!> \ingroup h5blockf_data
!! See \ref H5Block3dWrite3dVectorFieldFloat64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_r8 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*8, INTENT(IN) :: x(*) !< the array of x data to write
REAL*8, INTENT(IN) :: y(*) !< the array of y data to write
REAL*8, INTENT(IN) :: z(*) !< the array of z data to write
END FUNCTION
!> \ingroup h5blockf_data
!! See \ref H5Block3dRead3dVectorFieldFloat64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_read_3dvector_field_r8 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*8, INTENT(OUT) :: x(*) !< buffer to read the x data into
REAL*8, INTENT(OUT) :: y(*) !< buffer to read the y data into
REAL*8, INTENT(OUT) :: z(*) !< buffer to read the z data into
END FUNCTION
!> \ingroup h5blockf_data
!! See \ref H5Block3dWriteScalarFieldFloat32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_r4 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*4, INTENT(IN) :: data(*) !< the array of data
END FUNCTION
!> \ingroup h5blockf_data
!! See \ref H5Block3dReadScalarFieldFloat32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_r4 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*4, INTENT(OUT) :: data(*) !< buffer to read the data into
END FUNCTION
!> \ingroup h5blockf_data
!! See \ref H5Block3dWrite3dVectorFieldFloat32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_r4 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*4, INTENT(IN) :: x(*) !< the array of x data to write
REAL*4, INTENT(IN) :: y(*) !< the array of y data to write
REAL*4, INTENT(IN) :: z(*) !< the array of z data to write
END FUNCTION
!> \ingroup h5blockf_data
!! See \ref H5Block3dRead3dVectorFieldFloat32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_read_3dvector_field_r4 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*4, INTENT(OUT) :: x(*) !< buffer to read the x data into
REAL*4, INTENT(OUT) :: y(*) !< buffer to read the y data into
REAL*4, INTENT(OUT) :: z(*) !< buffer to read the z data into
END FUNCTION
!> \ingroup h5blockf_data
!! See \ref H5Block3dWriteScalarFieldInt64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_i8 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*8, INTENT(IN) :: data(*) !< the array of data
END FUNCTION
!> \ingroup h5blockf_data
!! See \ref H5Block3dReadScalarFieldInt64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_i8 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*8, INTENT(OUT) :: data(*) !< buffer to read the data into
END FUNCTION
!> \ingroup h5blockf_data
!! See \ref H5Block3dWrite3dVectorFieldInt64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_i8 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*8, INTENT(IN) :: x(*) !< the array of x data to write
INTEGER*8, INTENT(IN) :: y(*) !< the array of y data to write
INTEGER*8, INTENT(IN) :: z(*) !< the array of z data to write
END FUNCTION
!> \ingroup h5blockf_data
!! See \ref H5Block3dRead3dVectorFieldInt64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_read_3dvector_field_i8 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*8, INTENT(OUT) :: x(*) !< buffer to read the x data into
INTEGER*8, INTENT(OUT) :: y(*) !< buffer to read the y data into
INTEGER*8, INTENT(OUT) :: z(*) !< buffer to read the z data into
END FUNCTION
!> \ingroup h5blockf_data
!! See \ref H5Block3dWriteScalarFieldInt32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_i4 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*4, INTENT(IN) :: data(*) !< the array of data
END FUNCTION
!> \ingroup h5blockf_data
!! See \ref H5Block3dReadScalarFieldInt32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_i4 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*4, INTENT(OUT) :: data(*) !< buffer to read the data into
END FUNCTION
!> \ingroup h5blockf_data
!! See \ref H5Block3dWrite3dVectorFieldInt32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_i4 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*4, INTENT(IN) :: x(*) !< the array of x data to write
INTEGER*4, INTENT(IN) :: y(*) !< the array of y data to write
INTEGER*4, INTENT(IN) :: z(*) !< the array of z data to write
END FUNCTION
!> \ingroup h5blockf_data
!! See \ref H5Block3dRead3dVectorFieldInt32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_read_3dvector_field_i4 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*4, INTENT(OUT) :: x(*) !< buffer to read the x data into
INTEGER*4, INTENT(OUT) :: y(*) !< buffer to read the y data into
INTEGER*4, INTENT(OUT) :: z(*) !< buffer to read the z data into
END FUNCTION
!> \ingroup h5blockf_attrib
!! See \ref H5BlockWriteFieldAttribFloat64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_writefieldattrib_r8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
REAL*8, INTENT(IN) :: attrib_value(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: attrib_nelem !< the number of elements in the array
END FUNCTION
!> \ingroup h5blockf_attrib
!! See \ref H5BlockWriteFieldAttribFloat32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_writefieldattrib_r4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
REAL*4, INTENT(IN) :: attrib_value(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: attrib_nelem !< the number of elements in the array
END FUNCTION
!> \ingroup h5blockf_attrib
!! See \ref H5BlockWriteFieldAttribInt64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_writefieldattrib_i8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
INTEGER*8, INTENT(IN) :: attrib_value(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: attrib_nelem !< the number of elements in the array
END FUNCTION
!> \ingroup h5blockf_attrib
!! See \ref H5BlockWriteFieldAttribInt32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_writefieldattrib_i4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
INTEGER*4, INTENT(IN) :: attrib_value(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: attrib_nelem !< the number of elements in the array
END FUNCTION
+2 -2
View File
@@ -1,6 +1,6 @@
#ifndef __H5BLOCKREADWRITE_H
#define __H5BLOCKREADWRITE_H
#ifndef _H5BLOCK_READWRITE_H_
#define _H5BLOCK_READWRITE_H_
#ifdef __cplusplus
extern "C" {
-148
View File
@@ -1,148 +0,0 @@
INTERFACE
INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_r8 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*8, INTENT(IN) :: data(*)
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_r8 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*8, INTENT(OUT) :: data(*)
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_r8 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*8, INTENT(IN) :: x(*)
REAL*8, INTENT(IN) :: y(*)
REAL*8, INTENT(IN) :: z(*)
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_read_3dvector_field_r8 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*8, INTENT(OUT) :: x(*)
REAL*8, INTENT(OUT) :: y(*)
REAL*8, INTENT(OUT) :: z(*)
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_r4 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*4, INTENT(IN) :: data(*)
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_r4 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*4, INTENT(OUT) :: data(*)
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_r4 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*4, INTENT(IN) :: x(*)
REAL*4, INTENT(IN) :: y(*)
REAL*4, INTENT(IN) :: z(*)
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_read_3dvector_field_r4 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*4, INTENT(OUT) :: x(*)
REAL*4, INTENT(OUT) :: y(*)
REAL*4, INTENT(OUT) :: z(*)
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_i8 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER*8, INTENT(IN) :: data(*)
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_i8 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER*8, INTENT(OUT) :: data(*)
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_i8 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER*8, INTENT(IN) :: x(*)
INTEGER*8, INTENT(IN) :: y(*)
INTEGER*8, INTENT(IN) :: z(*)
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_read_3dvector_field_i8 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER*8, INTENT(OUT) :: x(*)
INTEGER*8, INTENT(OUT) :: y(*)
INTEGER*8, INTENT(OUT) :: z(*)
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_i4 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER*4, INTENT(IN) :: data(*)
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_i4 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER*4, INTENT(OUT) :: data(*)
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_i4 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER*4, INTENT(IN) :: x(*)
INTEGER*4, INTENT(IN) :: y(*)
INTEGER*4, INTENT(IN) :: z(*)
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_read_3dvector_field_i4 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER*4, INTENT(OUT) :: x(*)
INTEGER*4, INTENT(OUT) :: y(*)
INTEGER*4, INTENT(OUT) :: z(*)
END FUNCTION
INTEGER*8 FUNCTION h5bl_writefieldattrib_r8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
REAL*8, INTENT(IN) :: attrib_value(*) ! The array of data to write into the attribute
INTEGER*8, INTENT(IN) :: attrib_nelem ! Number of elements in the attrib array
END FUNCTION
INTEGER*8 FUNCTION h5bl_writefieldattrib_r4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
REAL*4, INTENT(IN) :: attrib_value(*) ! The array of data to write into the attribute
INTEGER*8, INTENT(IN) :: attrib_nelem ! Number of elements in the attrib array
END FUNCTION
INTEGER*8 FUNCTION h5bl_writefieldattrib_i8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
INTEGER*8, INTENT(IN) :: attrib_value(*) ! The array of data to write into the attribute
INTEGER*8, INTENT(IN) :: attrib_nelem ! Number of elements in the attrib array
END FUNCTION
INTEGER*8 FUNCTION h5bl_writefieldattrib_i4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
INTEGER*4, INTENT(IN) :: attrib_value(*) ! The array of data to write into the attribute
INTEGER*8, INTENT(IN) :: attrib_nelem ! Number of elements in the attrib array
END FUNCTION
END INTERFACE
+2 -2
View File
@@ -1,5 +1,5 @@
#ifndef __H5BLOCKTYPES_H
#define __H5BLOCKTYPES_H
#ifndef _H5BLOCK_TYPES_H
#define _H5BLOCK_TYPES_H
struct H5BlockPartition {
h5part_int64_t i_start;
+14 -12
View File
@@ -28,12 +28,14 @@
/*!
\ingroup h5multiblock_c_api
\defgroup h5multiblock_write File Writing
\defgroup h5multiblock_model Setting up the Data Model
*/
/*!
\ingroup h5multiblock_c_api
\defgroup h5multiblock_read File Reading
\defgroup h5multiblock_data Reading and Writing Datasets
*/
/*!
\ingroup h5multiblock_c_api
\defgroup h5multiblock_attrib Reading and Writing Attributes
@@ -89,7 +91,7 @@
\return H5PART_SUCCESS or error code
*/
static h5part_int64_t
_file_is_valid (
_H5MultiBlock_file_is_valid (
const H5PartFile *f /*!< IN: file handle */
) {
@@ -1055,7 +1057,7 @@ _H5MultiBlock_write_data (
*******************************************************************************/
/*!
\ingroup h5multiblock_write
\ingroup h5multiblock_model
Define the radius for halo exchanges between the blocks. Blocks on the edges
of the field will be padded with zero values out to the radius.
@@ -1083,7 +1085,7 @@ H5MultiBlock3dDefineRadius (
}
/*!
\ingroup h5multiblock_write
\ingroup h5multiblock_model
Define the radii for halo exchanges between the blocks. Blocks on the edges
of the field will be padded with zero values out to the radius.
@@ -1115,7 +1117,7 @@ H5MultiBlock3dDefineRadii (
}
/*!
\ingroup h5multiblock_write
\ingroup h5multiblock_model
Define the field and block dimensions for writing.
@@ -1151,7 +1153,7 @@ H5MultiBlock3dDefineDims (
}
/*!
\ingroup h5multiblock_read
\ingroup h5multiblock_model
Returns the field dimensions of the last field that was read.
@@ -1180,7 +1182,7 @@ H5MultiBlock3dGetFieldDims(
}
/*!
\ingroup h5multiblock_read
\ingroup h5multiblock_model
Returns the block dimensions of the last field that was read.
@@ -1210,7 +1212,7 @@ H5MultiBlock3dGetBlockDims(
}
/*!
\ingroup h5multiblock_read
\ingroup h5multiblock_model
Return the offsets for the block belonging to processor \c proc.
@@ -1240,7 +1242,7 @@ H5MultiBlock3dGetOffsetsOfProc (
}
/*!
\ingroup h5multiblock_c_api
\ingroup h5multiblock_model
Finds a 3D block decomposition for an arbitrary number of processors
\c nprocs.
@@ -1266,7 +1268,7 @@ H5MultiBlock3dCalculateDecomp (
}
/*!
\ingroup h5multiblock_read
\ingroup h5multiblock_data
Frees a \c block that was allocated during a read.
@@ -1283,7 +1285,7 @@ H5MultiBlockFree (
}
/*!
\ingroup h5multiblock_c_api
\ingroup h5multiblock_model
Shifts the assignment of procs to blocks within the field.
+2 -2
View File
@@ -1,5 +1,5 @@
#ifndef __H5MULTIBLOCK_H
#define __H5MULTIBLOCK_H
#ifndef _H5MULTIBLOCK_H_
#define _H5MULTIBLOCK_H_
#ifdef __cplusplus
extern "C" {
+3 -3
View File
@@ -1,7 +1,7 @@
#ifndef __H5MULTIBLOCKERRORS_H
#define __H5MULTIBLOCKERRORS_H
#ifndef _H5MULTIBLOCK_ERRORS_H_
#define _H5MULTIBLOCK_ERRORS_H_
#define _err_handler H5PartGetErrorHandler()
extern h5part_error_handler _err_handler;
#define CHECK_DECOMP( f ) \
if ( ! f->multiblock->have_decomp ) \
+2 -2
View File
@@ -1,5 +1,5 @@
#ifndef __H5MULTIBLOCKPRIVATE_H
#define __H5MULTIBLOCKPRIVATE_H
#ifndef _H5MULTIBLOCK_PRIVATE_H_
#define _H5MULTIBLOCK_PRIVATE_H_
#define MULTIBLOCK_INIT( f ) { \
h5part_int64_t herr = _H5MultiBlock_init ( f ); \
+2 -2
View File
@@ -1,6 +1,6 @@
#ifndef __H5MULTIBLOCKREADWRITE_H
#define __H5MULTIBLOCKREADWRITE_H
#ifndef _H5MULTIBLOCK_READWRITE_H_
#define _H5MULTIBLOCK_READWRITE_H_
#ifdef __cplusplus
extern "C" {
+2 -2
View File
@@ -1,5 +1,5 @@
#ifndef __H5MULTIBLOCKTYPES_H
#define __H5MULTIBLOCKTYPES_H
#ifndef _H5MULTIBLOCK_TYPES_H_
#define _H5MULTIBLOCK_TYPES_H_
struct H5MultiBlockStruct {
h5part_int64_t halo_radii[3];
+873 -709
View File
File diff suppressed because it is too large Load Diff
+439
View File
@@ -0,0 +1,439 @@
! Declaration of subroutines for Fortran Bindings
!> \defgroup h5part_f90_api H5Part F90 API
!> \ingroup h5part_f90_api
!! \defgroup h5partf_open File Opening and Closing
!<
!> \ingroup h5part_f90_api
!! \defgroup h5partf_model Setting up the Data Model
!<
!> \ingroup h5part_f90_api
!! \defgroup h5partf_data Reading and Writing Datasets
!<
!> \ingroup h5part_f90_api
!! \defgroup h5partf_attrib Reading and Writing Attributes
!<
!!!!!!!! File Opening and Closing !!!!!!!!
!> \ingroup h5partf_open
!! Opens a file for reading. See \ref H5PartOpenFile
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_openr ( filename )
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for reading
END FUNCTION
!> \ingroup h5partf_open
!! Opens a file for writing in truncate mode. See \ref H5PartOpenFile
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_openw ( filename )
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for writing
END FUNCTION
!> \ingroup h5partf_open
!! Opens a file for writing in append mode. See \ref H5PartOpenFile
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_opena ( filename )
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for appending
END FUNCTION
!> \ingroup h5partf_open
!! Opens a parallel file for reading.
!! See \ref H5PartOpenFileParallel
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_openr_par ( filename, mpi_communicator )
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for reading
INTEGER, INTENT(IN) :: mpi_communicator !< the MPI communicator used by the program
END FUNCTION
!> \ingroup h5partf_open
!! Opens a parallel file for writing in truncate mode.
!! See \ref H5PartOpenFileParallel
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_openw_par ( filename, mpi_communicator )
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for writing
INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program
END FUNCTION
!> \ingroup h5partf_open
!! Opens a parallel file for writing in append mode.
!! See \ref H5PartOpenFileParallel
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_opena_par ( filename, mpi_communicator )
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for appending
INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program
END FUNCTION
!> \ingroup h5partf_open
!! Opens a file for reading and specifies an HDF5 alignment.
!! See \ref H5PartOpenFileAlign
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_openr_align ( filename, align )
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for reading
INTEGER*8, INTENT(IN) :: align !< alignment value in bytes
END FUNCTION
!> \ingroup h5partf_open
!! Opens a file for writing in truncate mode and specifies an HDF5 alignment.
!! See \ref H5PartOpenFileAlign
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_openw_align ( filename, align )
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for writing
INTEGER*8, INTENT(IN) :: align !< alignment value in bytes
END FUNCTION
!> \ingroup h5partf_open
!! Opens a file for writing in append mode and specifies an HDF5 alignment.
!! See \ref H5PartOpenFileAlign
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_opena_align ( filename, align )
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for appending
INTEGER*8, INTENT(IN) :: align !< alignment value in bytes
END FUNCTION
!> \ingroup h5partf_open
!! Opens a parallel file for reading and specifies an HDF5 alignment.
!! See \ref H5PartOpenFileParallelAlign
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_openr_par_align ( filename, mpi_communicator, align )
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for reading
INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program
INTEGER*8, INTENT(IN) :: align !< alignment value in bytes
END FUNCTION
!> \ingroup h5partf_open
!! Opens a parallel file for writing in truncate mode and specifies
!! an HDF5 alignment.
!! See \ref H5PartOpenFileParallelAlign
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_openw_par_align ( filename, mpi_communicator, align, flags )
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for writing
INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program
INTEGER*8, INTENT(IN) :: align !< alignment value in bytes
CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags
END FUNCTION
!> \ingroup h5partf_open
!! Opens a parallel file for writing in append mode and specifies
!! an HDF5 alignment.
!! See \ref H5PartOpenFileParallelAlign
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_opena_par_align ( filename, mpi_communicator, align, flags )
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for appending
INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program
INTEGER*8, INTENT(IN) :: align !< alignment value in bytes
CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags
END FUNCTION
!> \ingroup h5partf_open
!! Closes a file. See \ref H5PartCloseFile
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_close ( filehandle )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
END FUNCTION
!> \ingroup h5partf_open
!! See \ref H5PartSetVerbosityLevel
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_set_verbosity_level ( level )
INTEGER*8, INTENT(IN) :: level !< the level from 0 (no output) to 5 (most detailed)
END FUNCTION
!!!!!!!! Setting up the Data Model !!!!!!!!
!> \ingroup h5partf_model
!! See \ref H5PartSetNumParticles
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_setnpoints ( filehandle, npoints )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
INTEGER*8, INTENT(IN) :: npoints !< the number of particles on *this* processor
END FUNCTION
!> \ingroup h5partf_model
!! See \ref H5PartSetNumParticlesStrided
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_setnpoints_strided ( filehandle, npoints, stride )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
INTEGER*8, INTENT(IN) :: npoints !< the number of particles on *this* processor
INTEGER*8, INTENT(IN) :: stride !< the stride value (e.g. the number of fields in the particle data array)
END FUNCTION
!> \ingroup h5partf_model
!! See \ref H5PartSetStep
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_setstep (filehandle,step)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
INTEGER*8, INTENT(IN) :: step !< a timestep value >= 1
END FUNCTION
!> \ingroup h5partf_model
!! See \ref H5PartGetNumSteps
!! \return the number of steps or error code
!<
INTEGER*8 FUNCTION h5pt_getnsteps (filehandle)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
END FUNCTION
!> \ingroup h5partf_model
!! See \ref H5PartGetNumDatasets
!! \return the number of datasets or error code
!<
INTEGER*8 FUNCTION h5pt_getndatasets (filehandle)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
END FUNCTION
!> \ingroup h5partf_model
!! See \ref H5PartGetNumParticles
!! \return the number of particles or error code
!<
INTEGER*8 FUNCTION h5pt_getnpoints (filehandle)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
END FUNCTION
!> \ingroup h5partf_model
!! See \ref H5PartGetDatasetName
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_getdatasetname (filehandle,index,name)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
INTEGER*8, INTENT(IN) :: index !< index of dataset to query (starting from 0)
CHARACTER(LEN=*), INTENT(OUT) :: name !< buffer to read the dataset name into
END FUNCTION
!> \ingroup h5partf_model
!! See \ref H5PartSetView
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_setview (filehandle,start,end)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
INTEGER*8, INTENT(IN) :: start !< offset of the first particle in the view
INTEGER*8, INTENT(IN) :: end !< offset of the last particle in the view (inclusive)
END FUNCTION
!> \ingroup h5partf_model
!! See \ref H5PartSetViewIndices
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_setview_indices (filehandle,indices,nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
INTEGER*8, INTENT(IN) :: indices(*) !< list of indicies to select in this view
INTEGER*8, INTENT(IN) :: nelem !< number of particles in the list
END FUNCTION
!> \ingroup h5partf_model
!! See \ref H5PartResetView
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_resetview (filehandle)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
END FUNCTION
!> \ingroup h5partf_model
!! See \ref H5PartResetView
!! \return 1 if true, 0 if false, or error code
!<
INTEGER*8 FUNCTION h5pt_hasview (filehandle)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
END FUNCTION
!> \ingroup h5partf_model
!! See \ref H5PartGetView
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_getview (filehandle,start,end)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
INTEGER*8, INTENT(OUT) :: start !< buffer to store the offset of the first particle in the view
INTEGER*8, INTENT(OUT) :: end !< buffer to store the offset of the last particle in the view (inclusive)
END FUNCTION
!!!!!!!! Reading and Writing Datasets !!!!!!!!
!> \ingroup h5partf_data
!! See \ref H5PartWriteDataFloat64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_writedata_r8 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*8, INTENT(IN) :: data(*) !< the array of float64 data to write
END FUNCTION
!> \ingroup h5partf_data
!! See \ref H5PartWriteDataFloat32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_writedata_r4 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL, INTENT(IN) :: data(*) !< the array of float32 data to write
END FUNCTION
!> \ingroup h5partf_data
!! See \ref H5PartWriteDataInt64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_writedata_i8 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*8, INTENT(IN) :: data(*) !< the array of int64 data to write
END FUNCTION
!> \ingroup h5partf_data
!! See \ref H5PartWriteDataInt32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_writedata_i4 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER, INTENT(IN) :: data(*) !< the array of int32 data to write
END FUNCTION
!> \ingroup h5partf_data
!! See \ref H5PartReadDataFloat64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_readdata_r8 (filehandle,name,data)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*8, INTENT(OUT) :: data(*) !< array to read float64 data into
END FUNCTION
!> \ingroup h5partf_data
!! See \ref H5PartReadDataFloat32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_readdata_r4 (filehandle,name,data)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL, INTENT(OUT) :: data(*) !< array to read float32 data into
END FUNCTION
!> \ingroup h5partf_data
!! See \ref H5PartReadDataInt64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_readdata_i8 (filehandle,name,data)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*8, INTENT(OUT) :: data(*) !< array to read int64 data into
END FUNCTION
!> \ingroup h5partf_data
!! See \ref H5PartReadDataInt32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_readdata_i4 (filehandle,name,data)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER, INTENT(OUT) :: data(*) !< array to read int32 data into
END FUNCTION
!!!!!!!! Reading and Writing Attributes !!!!!!!!
!> \ingroup h5partf_attrib
!! See \ref H5PartWriteFileAttribString
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_writefileattrib_string (filehandle,attrib_name,attrib_value)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
CHARACTER(LEN=*), INTENT(IN) :: value !< the string value to store
END FUNCTION
!> \ingroup h5partf_attrib
!! See \ref H5PartWriteStepAttribString
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_writestepattrib_string (filehandle,attrib_name,attrib_value)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
CHARACTER(LEN=*), INTENT(IN) :: value !< the string value to store
END FUNCTION
!> \ingroup h5partf_attrib
!! Reads the attribute \c name in the file root ("/")
!! into the string buffer \c value.
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_readfileattrib_string (filehandle,attrib_name,attrib_value)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
CHARACTER(LEN=*), INTENT(OUT) :: value !< buffer to read the string value into
END FUNCTION
!> \ingroup h5partf_attrib
!! Reads the attribute \c name in the current step
!! into the string buffer \c value.
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_readstepattrib_string (filehandle,attrib_name,attrib_value)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
CHARACTER(LEN=*), INTENT(OUT) :: value !< buffer to read the string value into
END FUNCTION
!> \ingroup h5partf_attrib
!! See \ref H5PartGetNumStepAttribs
!! \return number of attributes or error code
!<
INTEGER*8 FUNCTION h5pt_getnstepattribs (filehandle)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
END FUNCTION
!> \ingroup h5partf_attrib
!! See \ref H5PartGetNumFileAttribs
!! \return number of attributes or error code
!<
INTEGER*8 FUNCTION h5pt_getnfileattribs (filehandle)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
END FUNCTION
!> \ingroup h5partf_attrib
!! See \ref H5PartGetStepAttribInfo
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_getstepattribinfo (filehandle,idx,attrib_name,attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
INTEGER*8, INTENT(IN) :: index !< index of the attribute to query (starting from 0)
CHARACTER(LEN=*), INTENT(OUT) :: name !< buffer to read the attribute name into
INTEGER*8, INTENT(OUT) :: nelem !< number of elements in the attribute's array
END FUNCTION
!> \ingroup h5partf_attrib
!! See \ref H5PartGetFileAttribInfo
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_getfileattribinfo (filehandle,idx,attrib_name,attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
INTEGER*8, INTENT(IN) :: index !< index of the attribute to query (starting from 0)
CHARACTER(LEN=*), INTENT(OUT) :: name !< buffer to read the attribute name into
INTEGER*8, INTENT(OUT) :: nelem !< number of elements in the attribute's array
END FUNCTION
+22 -16
View File
@@ -10,12 +10,17 @@ extern "C" {
#endif
#include "H5PartTypes.h"
#include "H5PartAttrib.h"
#include "H5Block.h"
#ifdef PARALLEL_IO
#include "H5MultiBlock.h"
#endif
#define H5PART_VER_STRING "1.5.0"
#define H5PART_VER_MAJOR 1
#define H5PART_VER_MINOR 5
#define H5PART_VER_RELEASE 0
/* error values */
#define H5PART_SUCCESS 0
#define H5PART_ERR_NOMEM -12
@@ -24,6 +29,8 @@ extern "C" {
#define H5PART_ERR_INIT -200
#define H5PART_ERR_NOENTRY -201
#define H5PART_ERR_NOTYPE -210
#define H5PART_ERR_BAD_VIEW -220
#define H5PART_ERR_MPI -300
#define H5PART_ERR_HDF5 -400
@@ -50,7 +57,7 @@ extern "C" {
#define H5PART_FLOAT64 ((h5part_int64_t)H5T_NATIVE_DOUBLE)
#define H5PART_FLOAT32 ((h5part_int64_t)H5T_NATIVE_FLOAT)
#define H5PART_CHAR ((h5part_int64_t)H5T_NATIVE_CHAR)
#define H5PART_STRING ((h5part_int64_t)H5T_STRING)
#define H5PART_STRING ((h5part_int64_t)H5T_C_S1)
/*========== File Opening/Closing ===============*/
H5PartFile*
@@ -107,6 +114,13 @@ H5PartSetNumParticles (
const h5part_int64_t nparticles
);
h5part_int64_t
H5PartSetNumParticlesStrided (
H5PartFile *f, /*!< [in] Handle to open file */
const h5part_int64_t nparticles, /*!< [in] Number of particles */
const h5part_int64_t stride /*!< [in] Stride (e.g. number of fields in the particle array) */
);
h5part_int64_t
H5PartWriteDataFloat64 (
H5PartFile *f,
@@ -188,6 +202,12 @@ H5PartSetView (
const h5part_int64_t end
);
h5part_int64_t
H5PartSetViewIndices (
H5PartFile *f, /*!< [in] Handle to open file */
const hsize_t *indices, /*!< [in] List of indices */
h5part_int64_t nelems /*!< [in] Size of list */
);
h5part_int64_t
H5PartGetView (
@@ -292,20 +312,6 @@ H5PartWriteStepAttribString (
const char *value
);
h5part_int64_t
H5PartWriteStepAttribInt32 (
H5PartFile *f,
const char *name,
const h5part_int32_t value
);
h5part_int64_t
H5PartWriteStepAttribFloat32 (
H5PartFile *f,
const char *name,
const h5part_float32_t value
);
h5part_int64_t
H5PartGetNumStepAttribs ( /* for current filestep */
H5PartFile *f
+265
View File
@@ -0,0 +1,265 @@
#include <stdlib.h>
#include <string.h>
#include <hdf5.h>
#include "H5Part.h"
#include "H5PartErrors.h"
#include "H5PartPrivate.h"
/*!
\ingroup h5part_attrib
Writes a \c value of type floating points (64-bit)
to the root ("/") of the file
as attribute \c name.
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5PartWriteFileAttribFloat64 (
H5PartFile *f, /*!< IN: file handle */
const char *name, /*!< IN: attribute name */
const h5part_float64_t value /*!< IN: attribute value */
) {
SET_FNAME ( "H5PartWriteFileAttribFloat64" );
CHECK_FILEHANDLE ( f );
CHECK_WRITABLE_MODE( f );
h5part_int64_t herr = _H5Part_write_file_attrib (
f,
name,
H5T_NATIVE_DOUBLE,
(void*)&value,
1 );
if ( herr < 0 ) return herr;
return H5PART_SUCCESS;
}
/*!
\ingroup h5part_attrib
Writes a \c value of type floating points (32-bit)
to the root ("/") of the file
as attribute \c name.
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5PartWriteFileAttribFloat32 (
H5PartFile *f, /*!< IN: file handle */
const char *name, /*!< IN: attribute name */
const h5part_float32_t value /*!< IN: attribute value */
) {
SET_FNAME ( "H5PartWriteFileAttribFloat32" );
CHECK_FILEHANDLE ( f );
CHECK_WRITABLE_MODE( f );
h5part_int64_t herr = _H5Part_write_file_attrib (
f,
name,
H5T_NATIVE_FLOAT,
(void*)&value,
1 );
if ( herr < 0 ) return herr;
return H5PART_SUCCESS;
}
/*!
\ingroup h5part_attrib
Writes a \c value of type integers (64-bit)
to the root ("/") of the file
as attribute \c name.
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5PartWriteFileAttribInt64 (
H5PartFile *f, /*!< IN: file handle */
const char *name, /*!< IN: attribute name */
const h5part_int64_t value /*!< IN: attribute value */
) {
SET_FNAME ( "H5PartWriteFileAttribInt64" );
CHECK_FILEHANDLE ( f );
CHECK_WRITABLE_MODE( f );
h5part_int64_t herr = _H5Part_write_file_attrib (
f,
name,
H5T_NATIVE_INT64,
(void*)&value,
1 );
if ( herr < 0 ) return herr;
return H5PART_SUCCESS;
}
/*!
\ingroup h5part_attrib
Writes a \c value of type integers (32-bit)
to the root ("/") of the file
as attribute \c name.
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5PartWriteFileAttribInt32 (
H5PartFile *f, /*!< IN: file handle */
const char *name, /*!< IN: attribute name */
const h5part_int32_t value /*!< IN: attribute value */
) {
SET_FNAME ( "H5PartWriteFileAttribInt32" );
CHECK_FILEHANDLE ( f );
CHECK_WRITABLE_MODE( f );
h5part_int64_t herr = _H5Part_write_file_attrib (
f,
name,
H5T_NATIVE_INT32,
(void*)&value,
1 );
if ( herr < 0 ) return herr;
return H5PART_SUCCESS;
}
/*!
\ingroup h5part_attrib
Writes a \c value of type floating points (64-bit)
to the root ("/") of the file
as attribute \c name.
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5PartWriteStepAttribFloat64 (
H5PartFile *f, /*!< IN: file handle */
const char *name, /*!< IN: attribute name */
const h5part_float64_t value /*!< IN: attribute value */
) {
SET_FNAME ( "H5PartWriteStepAttribFloat64" );
CHECK_FILEHANDLE ( f );
CHECK_WRITABLE_MODE( f );
h5part_int64_t herr = _H5Part_write_step_attrib (
f,
name,
H5T_NATIVE_DOUBLE,
(void*)&value,
1 );
if ( herr < 0 ) return herr;
return H5PART_SUCCESS;
}
/*!
\ingroup h5part_attrib
Writes a \c value of type floating points (32-bit)
to the root ("/") of the file
as attribute \c name.
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5PartWriteStepAttribFloat32 (
H5PartFile *f, /*!< IN: file handle */
const char *name, /*!< IN: attribute name */
const h5part_float32_t value /*!< IN: attribute value */
) {
SET_FNAME ( "H5PartWriteStepAttribFloat32" );
CHECK_FILEHANDLE ( f );
CHECK_WRITABLE_MODE( f );
h5part_int64_t herr = _H5Part_write_step_attrib (
f,
name,
H5T_NATIVE_FLOAT,
(void*)&value,
1 );
if ( herr < 0 ) return herr;
return H5PART_SUCCESS;
}
/*!
\ingroup h5part_attrib
Writes a \c value of type integers (64-bit)
to the root ("/") of the file
as attribute \c name.
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5PartWriteStepAttribInt64 (
H5PartFile *f, /*!< IN: file handle */
const char *name, /*!< IN: attribute name */
const h5part_int64_t value /*!< IN: attribute value */
) {
SET_FNAME ( "H5PartWriteStepAttribInt64" );
CHECK_FILEHANDLE ( f );
CHECK_WRITABLE_MODE( f );
h5part_int64_t herr = _H5Part_write_step_attrib (
f,
name,
H5T_NATIVE_INT64,
(void*)&value,
1 );
if ( herr < 0 ) return herr;
return H5PART_SUCCESS;
}
/*!
\ingroup h5part_attrib
Writes a \c value of type integers (32-bit)
to the root ("/") of the file
as attribute \c name.
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5PartWriteStepAttribInt32 (
H5PartFile *f, /*!< IN: file handle */
const char *name, /*!< IN: attribute name */
const h5part_int32_t value /*!< IN: attribute value */
) {
SET_FNAME ( "H5PartWriteStepAttribInt32" );
CHECK_FILEHANDLE ( f );
CHECK_WRITABLE_MODE( f );
h5part_int64_t herr = _H5Part_write_step_attrib (
f,
name,
H5T_NATIVE_INT32,
(void*)&value,
1 );
if ( herr < 0 ) return herr;
return H5PART_SUCCESS;
}
+168
View File
@@ -0,0 +1,168 @@
!< \ingroup h5partf_attrib
!! See \ref H5PartWritefileAttribFloat64
!! \return 0 on success or error code
!>
INTEGER*8 FUNCTION h5pt_writefileattrib_r8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
REAL*8, INTENT(IN) :: data(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array
END FUNCTION
!< \ingroup h5partf_attrib
!! Read the attribute \c name into the buffer \c data.
!! \return 0 on success or error code
!>
INTEGER*8 FUNCTION h5pt_readfileattrib_r8 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
REAL*8, INTENT(OUT) :: data(*) !< buffer to read value into
END FUNCTION
!< \ingroup h5partf_attrib
!! See \ref H5PartWritefileAttribFloat32
!! \return 0 on success or error code
!>
INTEGER*8 FUNCTION h5pt_writefileattrib_r4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
REAL*4, INTENT(IN) :: data(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array
END FUNCTION
!< \ingroup h5partf_attrib
!! Read the attribute \c name into the buffer \c data.
!! \return 0 on success or error code
!>
INTEGER*8 FUNCTION h5pt_readfileattrib_r4 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
REAL*4, INTENT(OUT) :: data(*) !< buffer to read value into
END FUNCTION
!< \ingroup h5partf_attrib
!! See \ref H5PartWritefileAttribInt64
!! \return 0 on success or error code
!>
INTEGER*8 FUNCTION h5pt_writefileattrib_i8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
INTEGER*8, INTENT(IN) :: data(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array
END FUNCTION
!< \ingroup h5partf_attrib
!! Read the attribute \c name into the buffer \c data.
!! \return 0 on success or error code
!>
INTEGER*8 FUNCTION h5pt_readfileattrib_i8 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
INTEGER*8, INTENT(OUT) :: data(*) !< buffer to read value into
END FUNCTION
!< \ingroup h5partf_attrib
!! See \ref H5PartWritefileAttribInt32
!! \return 0 on success or error code
!>
INTEGER*8 FUNCTION h5pt_writefileattrib_i4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
INTEGER*4, INTENT(IN) :: data(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array
END FUNCTION
!< \ingroup h5partf_attrib
!! Read the attribute \c name into the buffer \c data.
!! \return 0 on success or error code
!>
INTEGER*8 FUNCTION h5pt_readfileattrib_i4 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
INTEGER*4, INTENT(OUT) :: data(*) !< buffer to read value into
END FUNCTION
!< \ingroup h5partf_attrib
!! See \ref H5PartWritestepAttribFloat64
!! \return 0 on success or error code
!>
INTEGER*8 FUNCTION h5pt_writestepattrib_r8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
REAL*8, INTENT(IN) :: data(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array
END FUNCTION
!< \ingroup h5partf_attrib
!! Read the attribute \c name into the buffer \c data.
!! \return 0 on success or error code
!>
INTEGER*8 FUNCTION h5pt_readstepattrib_r8 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
REAL*8, INTENT(OUT) :: data(*) !< buffer to read value into
END FUNCTION
!< \ingroup h5partf_attrib
!! See \ref H5PartWritestepAttribFloat32
!! \return 0 on success or error code
!>
INTEGER*8 FUNCTION h5pt_writestepattrib_r4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
REAL*4, INTENT(IN) :: data(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array
END FUNCTION
!< \ingroup h5partf_attrib
!! Read the attribute \c name into the buffer \c data.
!! \return 0 on success or error code
!>
INTEGER*8 FUNCTION h5pt_readstepattrib_r4 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
REAL*4, INTENT(OUT) :: data(*) !< buffer to read value into
END FUNCTION
!< \ingroup h5partf_attrib
!! See \ref H5PartWritestepAttribInt64
!! \return 0 on success or error code
!>
INTEGER*8 FUNCTION h5pt_writestepattrib_i8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
INTEGER*8, INTENT(IN) :: data(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array
END FUNCTION
!< \ingroup h5partf_attrib
!! Read the attribute \c name into the buffer \c data.
!! \return 0 on success or error code
!>
INTEGER*8 FUNCTION h5pt_readstepattrib_i8 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
INTEGER*8, INTENT(OUT) :: data(*) !< buffer to read value into
END FUNCTION
!< \ingroup h5partf_attrib
!! See \ref H5PartWritestepAttribInt32
!! \return 0 on success or error code
!>
INTEGER*8 FUNCTION h5pt_writestepattrib_i4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
INTEGER*4, INTENT(IN) :: data(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array
END FUNCTION
!< \ingroup h5partf_attrib
!! Read the attribute \c name into the buffer \c data.
!! \return 0 on success or error code
!>
INTEGER*8 FUNCTION h5pt_readstepattrib_i4 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
INTEGER*4, INTENT(OUT) :: data(*) !< buffer to read value into
END FUNCTION
+71
View File
@@ -0,0 +1,71 @@
#ifndef _H5PART_ATTRIB_H_
#define _H5PART_ATTRIB_H_
#ifdef __cplusplus
extern "C" {
#endif
h5part_int64_t
H5PartWriteFileAttribFloat64 (
H5PartFile *f,
const char *name,
const h5part_float64_t data
);
h5part_int64_t
H5PartWriteFileAttribFloat32 (
H5PartFile *f,
const char *name,
const h5part_float32_t data
);
h5part_int64_t
H5PartWriteFileAttribInt64 (
H5PartFile *f,
const char *name,
const h5part_int64_t data
);
h5part_int64_t
H5PartWriteFileAttribInt32 (
H5PartFile *f,
const char *name,
const h5part_int32_t data
);
h5part_int64_t
H5PartWriteStepAttribFloat64 (
H5PartFile *f,
const char *name,
const h5part_float64_t data
);
h5part_int64_t
H5PartWriteStepAttribFloat32 (
H5PartFile *f,
const char *name,
const h5part_float32_t data
);
h5part_int64_t
H5PartWriteStepAttribInt64 (
H5PartFile *f,
const char *name,
const h5part_int64_t data
);
h5part_int64_t
H5PartWriteStepAttribInt32 (
H5PartFile *f,
const char *name,
const h5part_int32_t data
);
#ifdef __cplusplus
}
#endif
#endif
+421
View File
@@ -0,0 +1,421 @@
#include "H5Part.h"
#include "H5PartPrivate.h"
#include "Underscore.h"
#if defined(F77_SINGLE_UNDERSCORE)
#define F77NAME(a,b) a
#elif defined(F77_CRAY_UNDERSCORE)
#define F77NAME(a,b) b
#elif defined(F77_NO_UNDERSCORE)
#else
#error Error, no way to determine how to construct fortran bindings
#endif
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_writefileattrib_r8 F77NAME ( \
h5pt_writefileattrib_r8_, \
H5PT_WRITEFILEATTRIB_R8 )
#endif
h5part_int64_t
h5pt_writefileattrib_r8 (
h5part_int64_t *f,
const char *name,
const h5part_float64_t *data,
const h5part_float64_t *nelem,
const int l_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *name2 =_H5Part_strdupfor2c ( name, l_name );
h5part_int64_t herr = H5PartWriteFileAttrib (
filehandle, name2, H5PART_FLOAT64, data, *nelem);
free ( name2 );
return herr;
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_writefileattrib_r8 F77NAME ( \
h5pt_writefileattrib_r8_, \
H5PT_WRITEFILEATTRIB_R8 )
#endif
h5part_int64_t
h5pt_readfileattrib_r8 (
h5part_int64_t *f,
const char *name,
const h5part_float64_t *data,
const int l_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *name2 =_H5Part_strdupfor2c ( name, l_name );
h5part_int64_t herr = H5PartReadFileAttrib (
filehandle, name2, (void*)data);
free ( name2 );
return herr;
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_writefileattrib_r4 F77NAME ( \
h5pt_writefileattrib_r4_, \
H5PT_WRITEFILEATTRIB_R4 )
#endif
h5part_int64_t
h5pt_writefileattrib_r4 (
h5part_int64_t *f,
const char *name,
const h5part_float32_t *data,
const h5part_float32_t *nelem,
const int l_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *name2 =_H5Part_strdupfor2c ( name, l_name );
h5part_int64_t herr = H5PartWriteFileAttrib (
filehandle, name2, H5PART_FLOAT32, data, *nelem);
free ( name2 );
return herr;
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_writefileattrib_r4 F77NAME ( \
h5pt_writefileattrib_r4_, \
H5PT_WRITEFILEATTRIB_R4 )
#endif
h5part_int64_t
h5pt_readfileattrib_r4 (
h5part_int64_t *f,
const char *name,
const h5part_float32_t *data,
const int l_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *name2 =_H5Part_strdupfor2c ( name, l_name );
h5part_int64_t herr = H5PartReadFileAttrib (
filehandle, name2, (void*)data);
free ( name2 );
return herr;
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_writefileattrib_i8 F77NAME ( \
h5pt_writefileattrib_i8_, \
H5PT_WRITEFILEATTRIB_I8 )
#endif
h5part_int64_t
h5pt_writefileattrib_i8 (
h5part_int64_t *f,
const char *name,
const h5part_int64_t *data,
const h5part_int64_t *nelem,
const int l_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *name2 =_H5Part_strdupfor2c ( name, l_name );
h5part_int64_t herr = H5PartWriteFileAttrib (
filehandle, name2, H5PART_INT64, data, *nelem);
free ( name2 );
return herr;
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_writefileattrib_i8 F77NAME ( \
h5pt_writefileattrib_i8_, \
H5PT_WRITEFILEATTRIB_I8 )
#endif
h5part_int64_t
h5pt_readfileattrib_i8 (
h5part_int64_t *f,
const char *name,
const h5part_int64_t *data,
const int l_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *name2 =_H5Part_strdupfor2c ( name, l_name );
h5part_int64_t herr = H5PartReadFileAttrib (
filehandle, name2, (void*)data);
free ( name2 );
return herr;
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_writefileattrib_i4 F77NAME ( \
h5pt_writefileattrib_i4_, \
H5PT_WRITEFILEATTRIB_I4 )
#endif
h5part_int64_t
h5pt_writefileattrib_i4 (
h5part_int64_t *f,
const char *name,
const h5part_int32_t *data,
const h5part_int32_t *nelem,
const int l_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *name2 =_H5Part_strdupfor2c ( name, l_name );
h5part_int64_t herr = H5PartWriteFileAttrib (
filehandle, name2, H5PART_INT32, data, *nelem);
free ( name2 );
return herr;
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_writefileattrib_i4 F77NAME ( \
h5pt_writefileattrib_i4_, \
H5PT_WRITEFILEATTRIB_I4 )
#endif
h5part_int64_t
h5pt_readfileattrib_i4 (
h5part_int64_t *f,
const char *name,
const h5part_int32_t *data,
const int l_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *name2 =_H5Part_strdupfor2c ( name, l_name );
h5part_int64_t herr = H5PartReadFileAttrib (
filehandle, name2, (void*)data);
free ( name2 );
return herr;
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_writestepattrib_r8 F77NAME ( \
h5pt_writestepattrib_r8_, \
H5PT_WRITESTEPATTRIB_R8 )
#endif
h5part_int64_t
h5pt_writestepattrib_r8 (
h5part_int64_t *f,
const char *name,
const h5part_float64_t *data,
const h5part_float64_t *nelem,
const int l_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *name2 =_H5Part_strdupfor2c ( name, l_name );
h5part_int64_t herr = H5PartWriteStepAttrib (
filehandle, name2, H5PART_FLOAT64, data, *nelem);
free ( name2 );
return herr;
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_writestepattrib_r8 F77NAME ( \
h5pt_writestepattrib_r8_, \
H5PT_WRITESTEPATTRIB_R8 )
#endif
h5part_int64_t
h5pt_readstepattrib_r8 (
h5part_int64_t *f,
const char *name,
const h5part_float64_t *data,
const int l_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *name2 =_H5Part_strdupfor2c ( name, l_name );
h5part_int64_t herr = H5PartReadStepAttrib (
filehandle, name2, (void*)data);
free ( name2 );
return herr;
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_writestepattrib_r4 F77NAME ( \
h5pt_writestepattrib_r4_, \
H5PT_WRITESTEPATTRIB_R4 )
#endif
h5part_int64_t
h5pt_writestepattrib_r4 (
h5part_int64_t *f,
const char *name,
const h5part_float32_t *data,
const h5part_float32_t *nelem,
const int l_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *name2 =_H5Part_strdupfor2c ( name, l_name );
h5part_int64_t herr = H5PartWriteStepAttrib (
filehandle, name2, H5PART_FLOAT32, data, *nelem);
free ( name2 );
return herr;
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_writestepattrib_r4 F77NAME ( \
h5pt_writestepattrib_r4_, \
H5PT_WRITESTEPATTRIB_R4 )
#endif
h5part_int64_t
h5pt_readstepattrib_r4 (
h5part_int64_t *f,
const char *name,
const h5part_float32_t *data,
const int l_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *name2 =_H5Part_strdupfor2c ( name, l_name );
h5part_int64_t herr = H5PartReadStepAttrib (
filehandle, name2, (void*)data);
free ( name2 );
return herr;
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_writestepattrib_i8 F77NAME ( \
h5pt_writestepattrib_i8_, \
H5PT_WRITESTEPATTRIB_I8 )
#endif
h5part_int64_t
h5pt_writestepattrib_i8 (
h5part_int64_t *f,
const char *name,
const h5part_int64_t *data,
const h5part_int64_t *nelem,
const int l_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *name2 =_H5Part_strdupfor2c ( name, l_name );
h5part_int64_t herr = H5PartWriteStepAttrib (
filehandle, name2, H5PART_INT64, data, *nelem);
free ( name2 );
return herr;
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_writestepattrib_i8 F77NAME ( \
h5pt_writestepattrib_i8_, \
H5PT_WRITESTEPATTRIB_I8 )
#endif
h5part_int64_t
h5pt_readstepattrib_i8 (
h5part_int64_t *f,
const char *name,
const h5part_int64_t *data,
const int l_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *name2 =_H5Part_strdupfor2c ( name, l_name );
h5part_int64_t herr = H5PartReadStepAttrib (
filehandle, name2, (void*)data);
free ( name2 );
return herr;
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_writestepattrib_i4 F77NAME ( \
h5pt_writestepattrib_i4_, \
H5PT_WRITESTEPATTRIB_I4 )
#endif
h5part_int64_t
h5pt_writestepattrib_i4 (
h5part_int64_t *f,
const char *name,
const h5part_int32_t *data,
const h5part_int32_t *nelem,
const int l_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *name2 =_H5Part_strdupfor2c ( name, l_name );
h5part_int64_t herr = H5PartWriteStepAttrib (
filehandle, name2, H5PART_INT32, data, *nelem);
free ( name2 );
return herr;
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_writestepattrib_i4 F77NAME ( \
h5pt_writestepattrib_i4_, \
H5PT_WRITESTEPATTRIB_I4 )
#endif
h5part_int64_t
h5pt_readstepattrib_i4 (
h5part_int64_t *f,
const char *name,
const h5part_int32_t *data,
const int l_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *name2 =_H5Part_strdupfor2c ( name, l_name );
h5part_int64_t herr = H5PartReadStepAttrib (
filehandle, name2, (void*)data);
free ( name2 );
return herr;
}
+41 -8
View File
@@ -1,22 +1,23 @@
#ifndef __H5PARTERRORS_H
#define __H5PARTERRORS_H
#ifndef __H5PART_ERRORS_H
#define __H5PART_ERRORS_H
extern h5part_error_handler _err_handler;
/***************** Error Handling ***************/
#define CHECK_FILEHANDLE( f ) \
if ( _file_is_valid ( f ) != H5PART_SUCCESS ) \
if ( _H5Part_file_is_valid ( f ) != H5PART_SUCCESS ) \
return HANDLE_H5PART_BADFD_ERR;
#define CHECK_WRITABLE_MODE( f ) \
if ( f->mode==H5PART_READ ) \
if ( f->flags & H5PART_READ ) \
return (*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_INVAL, \
"Attempting to write to read-only file" );
"Attempting to write to read-only file." );
#define CHECK_READONLY_MODE( f ) \
if ( ! f->mode==H5PART_READ ) \
if ( ! (f->flags & H5PART_READ) ) \
return (*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_INVAL, \
@@ -43,6 +44,13 @@
H5PART_ERR_INIT, \
"Cannot initialize H5Part." );
#define HANDLE_H5PART_INVALID_ERR( name, value ) \
(*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_INVAL, \
"Invalid value '%lld' for '%s'.", \
(long long)value, name);
#define HANDLE_H5PART_NOMEM_ERR \
(*_err_handler) ( \
_H5Part_get_funcname(), \
@@ -75,6 +83,13 @@
"Cannot set view to (%lld, %lld).", \
(long long)start, (long long)end );
#define HANDLE_H5PART_BAD_VIEW_ERR( start, end ) \
(*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_BAD_VIEW, \
"Problem with existing view (%lld, %lld).", \
(long long)start, (long long)end );
#define HANDLE_H5PART_GET_NUM_PARTICLES_ERR( rc ) \
(*_err_handler) ( \
_H5Part_get_funcname(), \
@@ -88,6 +103,12 @@
"No entry with index %lld and type %d in group %s!", \
(long long)idx, type, group_name );
#define HANDLE_H5PART_TYPE_ERR \
(*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_NOTYPE, \
"Encountered unkown data type!");
/**************** HDF5 *********************/
/* H5A: Attribute */
#define HANDLE_H5A_CLOSE_ERR \
@@ -318,7 +339,7 @@
(*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_HDF5, \
"Cannot determine the number of elements in dataspace selection." );
"Cannot determine number of elements in dataspace selection." );
#define HANDLE_H5S_GET_SIMPLE_EXTENT_NPOINTS_ERR \
(*_err_handler) ( \
@@ -330,7 +351,13 @@
(*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_HDF5, \
"Cannot set select hyperslap region or add the specified region" );
"Cannot select hyperslap region of dataspace." );
#define HANDLE_H5S_SELECT_ELEMENTS_ERR \
(*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_HDF5, \
"Cannot select elements in dataspace." );
/* H5T: type */
#define HANDLE_H5T_STRING_ERR \
@@ -345,6 +372,12 @@
H5PART_ERR_HDF5, \
"Cannot release datatype." );
/* H5L */
#define HANDLE_H5L_ITERATE_ERR \
(*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_HDF5, \
"Cannot iterate through group." );
/* MPI */
#define HANDLE_MPI_ALLGATHER_ERR \
+42 -213
View File
@@ -60,6 +60,9 @@
#define h5pt_setnpoints F77NAME ( \
h5pt_setnpoints_, \
H5PT_SETNPOINTS )
#define h5pt_setnpoints_strided F77NAME ( \
h5pt_setnpoints_strided_, \
H5PT_SETNPOINTS_STRIDED )
#define h5pt_setstep F77NAME ( \
h5pt_setstep_, \
H5PT_SETSTEP )
@@ -89,14 +92,14 @@
#define h5pt_getdatasetname F77NAME ( \
h5pt_getdatasetname_, \
H5PT_GETDATASETNAME )
#define h5pt_getnumpoints F77NAME ( \
h5pt_getnumpoints_, \
H5PT_GETNUMPOINTS )
/* Views and parallelism */
#define h5pt_setview F77NAME ( \
h5pt_setview_, \
H5PT_SETVIEW )
#define h5pt_setview_indices F77NAME ( \
h5pt_setview_indices_, \
H5PT_SETVIEW_INDICES )
#define h5pt_resetview F77NAME ( \
h5pt_resetview_, \
H5PT_RESETVIEW )
@@ -122,21 +125,9 @@
H5PT_READDATA_I4 )
/* Writing attributes */
#define h5pt_writefileattrib_r8 F77NAME ( \
h5pt_writefileattrib_r8_, \
H5PT_WRITEFILEATTRIB_R8 )
#define h5pt_writefileattrib_i8 F77NAME ( \
h5pt_writefileattrib_i8_, \
H5PT_WRITEFILEATTRIB_I8 )
#define h5pt_writefileattrib_string F77NAME ( \
h5pt_writefileattrib_string_, \
H5PT_writefileattrib_string )
#define h5pt_writestepattrib_r8 F77NAME ( \
h5pt_writestepattrib_r8_, \
H5PT_WRITESTEPATTRIB_R8 )
#define h5pt_writestepattrib_i8 F77NAME ( \
h5pt_writestepattrib_i8_, \
H5PT_WRITESTEPATTRIB_I8 )
#define h5pt_writestepattrib_string F77NAME ( \
h5pt_writestepattrib_string_, \
H5PT_WRITESTEPATTRIB_STRING )
@@ -154,27 +145,9 @@
#define h5pt_getfileattribinfo F77NAME ( \
h5pt_getfileattribinfo_, \
H5PT_GETFILEATTRIBINFO )
#define h5pt_readstepattrib F77NAME ( \
h5pt_readstepattrib_, \
H5PT_READSTEPATTRIB )
#define h5pt_readstepattrib_r8 F77NAME ( \
h5pt_readstepattrib_r8_, \
H5PT_READSTEPATTRIB_R8 )
#define h5pt_readstepattrib_i8 F77NAME ( \
h5pt_readstepattrib_i8_, \
H5PT_READSTEPATTRIB_I8 )
#define h5pt_readstepattrib_string F77NAME ( \
h5pt_readstepattrib_string_, \
H5PT_READSTEPATTRIB_STRING )
#define h5pt_readfileattrib F77NAME ( \
h5pt_readfileattrib_, \
H5PT_READFILEATTRIB )
#define h5pt_readfileattrib_r8 F77NAME ( \
h5pt_readfileattrib_r8_, \
H5PT_READFILEATTRIB_R8 )
#define h5pt_readfileattrib_i8 F77NAME ( \
h5pt_readfileattrib_i8_, \
H5PT_READFILEATTRIB_I8 )
#define h5pt_readfileattrib_string F77NAME ( \
h5pt_readfileattrib_string_, \
H5PT_READFILEATTRIB_STRING )
@@ -480,6 +453,18 @@ h5pt_setnpoints (
return H5PartSetNumParticles ( filehandle, *np );
}
h5part_int64_t
h5pt_setnpoints_strided (
const h5part_int64_t *f,
h5part_int64_t *np,
h5part_int64_t *stride
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
return H5PartSetNumParticlesStrided ( filehandle, *np, *stride );
}
h5part_int64_t
h5pt_setstep (
const h5part_int64_t *f,
@@ -615,16 +600,6 @@ h5pt_getdatasetname (
return herr;
}
h5part_int64_t
h5pt_getnumpoints (
const h5part_int64_t *f
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
return H5PartGetNumParticles( filehandle );
}
/*=============Setting and getting views================*/
h5part_int64_t
@@ -639,6 +614,18 @@ h5pt_setview (
return H5PartSetView ( filehandle, *start, *end );
}
h5part_int64_t
h5pt_setview_indices (
const h5part_int64_t *f,
const h5part_int64_t *indices,
const h5part_int64_t *nelem
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
return H5PartSetViewIndices ( filehandle, indices, *nelem );
}
h5part_int64_t
h5pt_resetview (
const h5part_int64_t *f
@@ -749,49 +736,6 @@ h5pt_readdata_i4 (
/*=================== Attributes ================*/
/* Writeing attributes */
h5part_int64_t
h5pt_writefileattrib_r8 (
const h5part_int64_t *f,
const char *attrib_name,
const h5part_float64_t *attrib_value,
const h5part_int64_t *attrib_nelem,
const int l_attrib_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name);
h5part_int64_t herr = H5PartWriteFileAttrib (
filehandle,
attrib_name2, H5T_NATIVE_DOUBLE, attrib_value, *attrib_nelem );
free ( attrib_name2 );
return herr;
}
h5part_int64_t
h5pt_writefileattrib_i8 (
const h5part_int64_t *f,
const char *attrib_name,
const h5part_int64_t *attrib_value,
const h5part_int64_t *attrib_nelem,
const int l_attrib_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name);
h5part_int64_t herr = H5PartWriteFileAttrib (
filehandle,
attrib_name2, H5T_NATIVE_INT64, attrib_value, *attrib_nelem );
free ( attrib_name2 );
return herr;
}
h5part_int64_t
h5pt_writefileattrib_string (
const h5part_int64_t *f,
@@ -814,48 +758,6 @@ h5pt_writefileattrib_string (
return herr;
}
h5part_int64_t
h5pt_writestepattrib_r8 (
const h5part_int64_t *f,
const char *attrib_name,
const h5part_float64_t *attrib_value,
const h5part_int64_t *attrib_nelem,
const int l_attrib_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *attrib_name2 = _H5Part_strdupfor2c ( attrib_name, l_attrib_name );
h5part_int64_t herr = H5PartWriteStepAttrib (
filehandle,
attrib_name2, H5T_NATIVE_DOUBLE, attrib_value, *attrib_nelem );
free ( attrib_name2 );
return herr;
}
h5part_int64_t
h5pt_writestepattrib_i8 (
const h5part_int64_t *f,
const char *attrib_name,
const h5part_int64_t *attrib_value,
const h5part_int64_t *attrib_nelem,
const int l_attrib_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *attrib_name2 = _H5Part_strdupfor2c ( attrib_name, l_attrib_name );
h5part_int64_t herr = H5PartWriteStepAttrib (
filehandle,
attrib_name2, H5T_NATIVE_INT64, attrib_value, *attrib_nelem );
free ( attrib_name2 );
return herr;
}
h5part_int64_t
h5pt_writestepattrib_string (
const h5part_int64_t *f,
@@ -937,49 +839,6 @@ h5pt_getfileattribinfo (
return herr;
}
h5part_int64_t
h5pt_readstepattrib (
const h5part_int64_t *f,
const char *attrib_name,
void *attrib_value,
const int l_attrib_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char * attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name);
h5part_int64_t herr = H5PartReadStepAttrib (
filehandle, attrib_name2, attrib_value );
free ( attrib_name2 );
return herr;
}
h5part_int64_t
h5pt_readstepattrib_r8 (
const h5part_int64_t *f,
const char *attrib_name,
h5part_float64_t *attrib_value,
const int l_attrib_name
) {
return h5pt_readstepattrib (
f, attrib_name, attrib_value, l_attrib_name );
}
h5part_int64_t
h5pt_readstepattrib_i8 (
const h5part_int64_t *f,
const char *attrib_name,
h5part_int64_t *attrib_value,
const int l_attrib_name
) {
return h5pt_readstepattrib (
f, attrib_name, attrib_value, l_attrib_name );
}
h5part_int64_t
h5pt_readstepattrib_string (
const h5part_int64_t *f,
@@ -988,56 +847,20 @@ h5pt_readstepattrib_string (
const int l_attrib_name,
const int l_attrib_value
) {
h5part_int64_t herr = h5pt_readstepattrib (
f, attrib_name, attrib_value, l_attrib_name );
_H5Part_strc2for ( attrib_value, l_attrib_value );
return herr;
}
h5part_int64_t
h5pt_readfileattrib (
const h5part_int64_t *f,
const char *attrib_name,
void *attrib_value,
const int l_attrib_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char * attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name);
h5part_int64_t herr = H5PartReadFileAttrib (
h5part_int64_t herr = H5PartReadStepAttrib (
filehandle, attrib_name2, attrib_value );
_H5Part_strc2for ( attrib_value, l_attrib_value );
free ( attrib_name2 );
return herr;
}
h5part_int64_t
h5pt_readfileattrib_r8 (
const h5part_int64_t *f,
const char *attrib_name,
h5part_float64_t *attrib_value,
const int l_attrib_name
) {
return h5pt_readfileattrib (
f, attrib_name, attrib_value, l_attrib_name );
}
h5part_int64_t
h5pt_readfileattrib_i8 (
const h5part_int64_t *f,
const char *attrib_name,
h5part_int64_t *attrib_value,
const int l_attrib_name
) {
return h5pt_readfileattrib (
f, attrib_name, attrib_value, l_attrib_name );
}
h5part_int64_t
h5pt_readfileattrib_string (
const h5part_int64_t *f,
@@ -1046,11 +869,17 @@ h5pt_readfileattrib_string (
const int l_attrib_name,
const int l_attrib_value
) {
h5part_int64_t herr = h5pt_readfileattrib (
f, attrib_name, attrib_value, l_attrib_name );
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char * attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name);
h5part_int64_t herr = H5PartReadFileAttrib (
filehandle, attrib_name2, attrib_value );
_H5Part_strc2for ( attrib_value, l_attrib_value );
free ( attrib_name2 );
return herr;
}
-291
View File
@@ -1,291 +0,0 @@
! Declaration of subroutines for Fortran Bindings
! open/close interface
INTERFACE
INTEGER*8 FUNCTION h5pt_openr ( filename )
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for reading
END FUNCTION
INTEGER*8 FUNCTION h5pt_openw ( filename )
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for writing
END FUNCTION
INTEGER*8 FUNCTION h5pt_opena ( filename )
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for appending
END FUNCTION
INTEGER*8 FUNCTION h5pt_openr_par ( filename, mpi_communicator )
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for reading
INTEGER, INTENT(IN) :: mpi_communicator ! the MPI_Communicator used by the program
END FUNCTION
INTEGER*8 FUNCTION h5pt_openw_par ( filename, mpi_communicator )
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for writing
INTEGER, INTENT(IN) :: mpi_communicator ! the MPI_Communicator used by the program
END FUNCTION
INTEGER*8 FUNCTION h5pt_opena_par ( filename, mpi_communicator )
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for appending
INTEGER, INTENT(IN) :: mpi_communicator ! the MPI_Communicator used by the program
END FUNCTION
INTEGER*8 FUNCTION h5pt_openr_align ( filename, align )
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for reading
INTEGER*8, INTENT(IN) :: align ! alignment value in bytes
END FUNCTION
INTEGER*8 FUNCTION h5pt_openw_align ( filename, align )
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for writing
INTEGER*8, INTENT(IN) :: align ! alignment value in bytes
END FUNCTION
INTEGER*8 FUNCTION h5pt_opena_align ( filename, align )
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for appending
INTEGER*8, INTENT(IN) :: align ! alignment value in bytes
END FUNCTION
INTEGER*8 FUNCTION h5pt_openr_par_align ( filename, mpi_communicator, align )
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for reading
INTEGER, INTENT(IN) :: mpi_communicator ! the MPI_Communicator used by the program
INTEGER*8, INTENT(IN) :: align ! alignment value in bytes
END FUNCTION
INTEGER*8 FUNCTION h5pt_openw_par_align ( filename, mpi_communicator, align, flags )
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for writing
INTEGER, INTENT(IN) :: mpi_communicator ! the MPI_Communicator used by the program
INTEGER*8, INTENT(IN) :: align ! alignment value in bytes
CHARACTER(LEN=*), INTENT(IN) :: flags ! additional flags
END FUNCTION
INTEGER*8 FUNCTION h5pt_opena_par_align ( filename, mpi_communicator, align, flags )
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for appending
INTEGER, INTENT(IN) :: mpi_communicator ! the MPI_Communicator used by the program
INTEGER*8, INTENT(IN) :: align ! alignment value in bytes
CHARACTER(LEN=*), INTENT(IN) :: flags ! additional flags
END FUNCTION
INTEGER*8 FUNCTION h5pt_close ( filehandle )
INTEGER*8, INTENT(IN) :: filehandle ! close this open filehandle
END FUNCTION
!==============Writing and Setting Dataset info========
INTEGER*8 FUNCTION h5pt_setnpoints ( filehandle, npoints )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(IN) :: npoints ! The number of particles on *this* processor
END FUNCTION
INTEGER*8 FUNCTION h5pt_setstep (filehandle,step)
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(IN) :: step ! Set the current timestep in the file to this
END FUNCTION
INTEGER*8 FUNCTION h5pt_writedata_r8 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name ! The name of the data we are writing
REAL*8, INTENT(IN) :: data(*) ! The dataarray to write. The number of
! elements is presumably set earlier with
! h5pt_setnpoints(f,npoints)
END FUNCTION
INTEGER*8 FUNCTION h5pt_writedata_r4 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name ! The name of the data we are writing
REAL, INTENT(IN) :: data(*) ! The dataarray to write. The number of
! elements is presumably set earlier with
! h5pt_setnpoints(f,npoints)
END FUNCTION
INTEGER*8 FUNCTION h5pt_writedata_i8 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name ! The name of the data we are writing
INTEGER*8, INTENT(IN) :: data(*)
END FUNCTION
INTEGER*8 FUNCTION h5pt_writedata_i4 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name ! The name of the data we are writing
INTEGER, INTENT(IN) :: data(*)
END FUNCTION
!==============Reading Data Characteristics============
INTEGER*8 FUNCTION h5pt_getnsteps (filehandle)
INTEGER*8, INTENT(IN) :: filehandle
END FUNCTION
INTEGER*8 FUNCTION h5pt_getndatasets (filehandle)
INTEGER*8, INTENT(IN) :: filehandle
END FUNCTION
! returns total number of points in this timestep
! If a "view" has been set using h5pt_setview()
! then it returns the number of points that are
! in the current view.
INTEGER*8 FUNCTION h5pt_getnpoints (filehandle)
INTEGER*8, INTENT(IN) :: filehandle
END FUNCTION
INTEGER*8 FUNCTION h5pt_getdatasetname (filehandle,index,name)
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(IN) :: index ! Index for a given dataset name
CHARACTER(LEN=*), INTENT(OUT) :: name ! returns the name of the dataset at that index
END FUNCTION
!=============Setting and getting views================
INTEGER*8 FUNCTION h5pt_setview (filehandle,start,end)
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(IN) :: start ! offset of the first particle in the view
INTEGER*8, INTENT(IN) :: end ! offset of the first particle after the end of the view
END FUNCTION
INTEGER*8 FUNCTION h5pt_resetview (filehandle)
INTEGER*8, INTENT(IN) :: filehandle ! reset the view on this filehandle to default
END FUNCTION
INTEGER*8 FUNCTION h5pt_hasview (filehandle)
INTEGER*8, INTENT(IN) :: filehandle
END FUNCTION
INTEGER*8 FUNCTION h5pt_getview (filehandle,start,end)
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(OUT) :: start ! offset of first particle in the view
INTEGER*8, INTENT(OUT) :: end ! offset of first particle beyond the current view
END FUNCTION
!==============Reading Data=========================
INTEGER*8 FUNCTION h5pt_readdata_r8 (filehandle,name,data)
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name ! The name of the data we are writing
REAL*8, INTENT(OUT) :: data(*) ! The dataarray to read. Number of points
! read is either the number within the view set
! by h5pt_setview() or the default (the total
! number of particles in the file.
END FUNCTION
INTEGER*8 FUNCTION h5pt_readdata_r4 (filehandle,name,data)
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name ! The name of the data we are writing
REAL, INTENT(OUT) :: data(*) ! The dataarray to read. Number of points
! read is either the number within the view set
! by h5pt_setview() or the default (the total
! number of particles in the file.
END FUNCTION
INTEGER*8 FUNCTION h5pt_readdata_i8 (filehandle,name,data)
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name ! The name of the data we are writing
INTEGER*8, INTENT(OUT) :: data(*) ! The dataarray to read. Number of points
! read is either the number within the view set
! by h5pt_setview() or the default (the total
! number of particles in the file.
END FUNCTION
INTEGER*8 FUNCTION h5pt_readdata_i4 (filehandle,name,data)
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name ! The name of the data we are writing
INTEGER, INTENT(OUT) :: data(*) ! The dataarray to read. Number of points
! read is either the number within the view set
! by h5pt_setview() or the default (the total
! number of particles in the file.
END FUNCTION
!=================== Attributes ================
INTEGER*8 FUNCTION h5pt_writefileattrib_r8 (filehandle,attrib_name,attrib_value,attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
REAL*8, INTENT(IN) :: attrib_value(*) ! The array of data to write into the attribute
INTEGER*8, INTENT(IN) :: attrib_nelem ! Number of elements in the attrib array
END FUNCTION
INTEGER*8 FUNCTION h5pt_writefileattrib_i8 (filehandle,attrib_name,attrib_value,attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
INTEGER*8, INTENT(IN) :: attrib_value(*) ! The array of data to write into the attribute
INTEGER*8, INTENT(IN) :: attrib_nelem ! Number of elements in the attrib array
END FUNCTION
INTEGER*8 FUNCTION h5pt_writefileattrib_string (filehandle,attrib_name,attrib_value)
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
CHARACTER(LEN=*), INTENT(IN) :: attrib_value ! The array of data to write into the attribute
END FUNCTION
INTEGER*8 FUNCTION h5pt_writestepattrib_r8 (filehandle,attrib_name,attrib_value,attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
REAL*8, INTENT(IN) :: attrib_value(*) ! The array of data to write into the attribute
INTEGER*8, INTENT(IN) :: attrib_nelem ! Number of elements in the attrib array
END FUNCTION
INTEGER*8 FUNCTION h5pt_writestepattrib_i8 (filehandle,attrib_name,attrib_value,attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
INTEGER*8, INTENT(IN) :: attrib_value(*) ! The array of data to write into the attribute
INTEGER*8, INTENT(IN) :: attrib_nelem ! Number of elements in the attrib array
END FUNCTION
INTEGER*8 FUNCTION h5pt_writestepattrib_string (filehandle,attrib_name,attrib_value)
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
CHARACTER(LEN=*), INTENT(IN) :: attrib_value ! The array of data to write into the attribute
END FUNCTION
INTEGER*8 FUNCTION h5pt_getnstepattribs (filehandle)
INTEGER*8, INTENT(IN) :: filehandle
END FUNCTION
INTEGER*8 FUNCTION h5pt_getnfileattribs (filehandle)
INTEGER*8, INTENT(IN) :: filehandle
END FUNCTION
INTEGER*8 FUNCTION h5pt_getstepattribinfo (filehandle,idx,attrib_name,attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(IN) :: idx ! index of the attribute being queried
CHARACTER(LEN=*), INTENT(OUT) :: attrib_name ! The name of the attribute
INTEGER*8, INTENT(OUT) :: attrib_nelem ! Number of elements in the attrib array
END FUNCTION
INTEGER*8 FUNCTION h5pt_getfileattribinfo (filehandle,idx,attrib_name,attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(IN) :: idx ! index of the attribute being queried
CHARACTER(LEN=*), INTENT(OUT) :: attrib_name ! The name of the attribute
INTEGER*8, INTENT(OUT) :: attrib_nelem ! Number of elements in the attrib array
END FUNCTION
INTEGER*8 FUNCTION h5pt_readstepattrib_i8 ( filehandle, attrib_name, attrib_value )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
INTEGER*8, INTENT(OUT) :: attrib_value(*) ! the attribute data will be read into this array
END FUNCTION
INTEGER*8 FUNCTION h5pt_readstepattrib_r8 ( filehandle, attrib_name, attrib_value )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
REAL*8, INTENT(OUT) :: attrib_value(*) ! the attribute data will be read into this array
END FUNCTION
INTEGER*8 FUNCTION h5pt_readfileattrib_i8 (filehandle, attrib_name, attrib_value )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
INTEGER*8, INTENT(OUT) :: attrib_value(*) ! the attribute data will be read into this array
END FUNCTION
INTEGER*8 FUNCTION h5pt_readfileattrib_r8 (filehandle, attrib_name, attrib_value )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
REAL*8, INTENT(OUT) :: attrib_value(*) ! the attribute data will be read into this array
END FUNCTION
INTEGER*8 FUNCTION h5pt_set_verbosity_level ( level )
INTEGER*8, INTENT(IN) :: level
END FUNCTION
END INTERFACE
+19 -2
View File
@@ -1,5 +1,5 @@
#ifndef __H5PARTPRIVATE_H
#define __H5PARTPRIVATE_H
#ifndef __H5PART_PRIVATE_H
#define __H5PART_PRIVATE_H
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 6
#define H5_USE_16_API
@@ -9,6 +9,11 @@
#define H5PART_BTREE_IK 10000
h5part_int64_t
_H5Part_file_is_valid (
const H5PartFile *f
);
/*!
The functions declared here are not part of the API, but may be used
in extensions like H5Block. We name these functions "private".
@@ -33,6 +38,13 @@ _H5Part_set_step (
const h5part_int64_t step
);
h5part_int64_t
_H5Part_get_step_name(
H5PartFile *f,
const h5part_int64_t step,
char *name
);
h5part_int64_t
_H5Part_get_num_particles (
H5PartFile *f
@@ -150,6 +162,11 @@ _H5Part_end_throttle (
H5PartFile *f
);
h5part_error_handler
_H5Part_get_err_handle (
void
);
void
_H5Part_vprint_error (
const char *fmt,
+14 -9
View File
@@ -2,8 +2,8 @@
System dependend definitions
*/
#ifndef _H5PARTTYPES_H_
#define _H5PARTTYPES_H_
#ifndef _H5PART_TYPES_H_
#define _H5PART_TYPES_H_
#ifdef WIN32
typedef __int64 int64_t;
@@ -23,6 +23,8 @@ __attribute__ ((format (printf, 3, 4)))
typedef unsigned long MPI_Comm;
#endif
#define H5PART_STEPNAME_LEN 64
struct H5BlockFile;
/**
@@ -35,22 +37,26 @@ struct H5BlockFile;
*/
struct H5PartFile {
hid_t file;
char *groupname_step;
char groupname_step[H5PART_STEPNAME_LEN];
int stepno_width;
int empty;
char flags;
h5part_int64_t timestep;
hsize_t nparticles;
hid_t timegroup;
hid_t shape;
unsigned mode;
hid_t xfer_prop;
hid_t create_prop;
hid_t access_prop;
/* the dataspace on disk for the current view */
hid_t diskshape;
hid_t memshape; /* for parallel I/O (this is on-disk) H5S_ALL
if serial I/O */
/* the dataspace in memory for the current view */
hid_t memshape;
h5part_int64_t viewstart; /* -1 if no view is available: A "view" looks */
h5part_int64_t viewend; /* at a subset of the data. */
@@ -75,11 +81,10 @@ struct H5PartFile {
int myproc;
/**
MPI comnunicator
MPI communicator
*/
MPI_Comm comm;
char flags;
int throttle;
struct H5BlockStruct *block;
+46 -74
View File
@@ -1,37 +1,22 @@
# src level Makefile.am
# PATH SETTING (IMPORTED FROM CONFIGURE)
HDF5ROOT = @HDF5ROOT@
OBJEXT=o
# COMPILERS
CC = @CC@
#INCLUDES
HDFINC = -I$(HDF5ROOT)/include
MPIINC = @MPIINC@
INC = $(HDFINC) ${MPIINC}
# H5Part header file location
H5PINC = -I@prefix@/include
# COMPILER FLAGS
CFLAGS = @CFLAGS@ ${INC}
# H5Part compiled library location
H5PLIB = -L@prefix@/lib
# HDF5 LIBRARY
HDFLIB = -L$(HDF5ROOT)/lib -lhdf5 -lz $(SZLIB) @LDFLAGS@
# SZ LIBRARY
SZLIB = @SZLIB@
INCLUDES = -I@HDF5ROOT@/include @MPIINC@
# Extra files that I wish to include in the dist tar ball.
EXTRA_DIST = TestUnderscoreC.c TestUnderscore.f $(EXTRA_HEADERS)
EXTRA_DIST = TestUnderscoreC.c \
TestUnderscore.f \
generate-attr.py \
generate-h5bl-readwrite.py \
generate-h5multi-readwrite.py \
H5Part.f90 \
H5PartAttrib.f90 \
H5Block.f90 \
H5BlockReadWrite.f90
# Files that I don't want to include in the dist tar ball
nodist_include_HEADERS = @UNDERSCORE_H@
nodist_include_HEADERS = H5PartF.h @UNDERSCORE_H@
# What to build... Will be determined by configure script.
lib_LIBRARIES = @MTARGET@
@@ -40,64 +25,51 @@ lib_LIBRARIES = @MTARGET@
EXTRA_LIBRARIES = libH5Part.a libH5PartF.a
# Header files that I wish to install in $(prefix)/include
include_HEADERS = H5Part.h H5PartTypes.h H5PartErrors.h \
H5Block.h H5BlockReadWrite.h H5BlockTypes.h H5BlockErrors.h \
H5MultiBlock.h H5MultiBlockReadWrite.h H5MultiBlockTypes.h H5MultiBlockErrors.h \
H5Part.inc H5PartF90.inc \
H5BlockF90.inc H5BlockReadWriteF90.inc \
@UNDERSCORE_H@
include_HEADERS = H5Part.h \
H5PartTypes.h \
H5PartErrors.h \
H5PartAttrib.h \
H5Block.h \
H5BlockTypes.h \
H5BlockErrors.h \
H5BlockReadWrite.h \
H5MultiBlock.h \
H5MultiBlockTypes.h \
H5MultiBlockErrors.h \
H5MultiBlockReadWrite.h \
H5PartF.h \
@UNDERSCORE_H@
# Listing of all possible headers that I may include
EXTRA_HEADERS = H5PartPrivate.h H5BlockPrivate.h H5MultiBlockPrivate.h
EXTRA_HEADERS = H5PartPrivate.h \
H5BlockPrivate.h \
H5MultiBlockPrivate.h \
H5PartAttrib.h
# Listing of sources
libH5Part_a_SOURCES = H5Part.c H5Block.c H5BlockReadWrite.c H5MultiBlock.c H5MultiBlockReadWrite.c
libH5PartF_a_SOURCES = H5PartF.c H5BlockF.c H5BlockReadWriteF.c
libH5Part_a_SOURCES = H5Part.c \
H5PartAttrib.c \
H5Block.c \
H5BlockReadWrite.c \
H5MultiBlock.c \
H5MultiBlockReadWrite.c
libH5PartF_a_SOURCES = H5PartF.c \
H5PartAttribF.c \
H5BlockF.c \
H5BlockReadWriteF.c
H5Part.inc: H5PartF90.inc
grep "INTEGER.* FUNCTION" $< | while read type func name rest; do echo " $$type $$name"; done > $@
H5PartF.h: H5Part.f90 H5PartAttrib.f90 H5Block.f90 H5BlockReadWrite.f90
awk '/INTEGER\*8 FUNCTION/{print "\t" $$1 " " $$3}' $^ >$@
# Specific building instruction (What compilers to use...)
# ------------ Serial Lib build commands ------------
libH5Part.a: H5Part.o H5Block.o H5BlockReadWrite.o H5MultiBlock.o H5MultiBlockReadWrite.o
${AR} rucs $@ $^
libH5PartF.a: H5Part.o H5PartF.o H5Block.o H5BlockF.o H5BlockReadWrite.o H5BlockReadWriteF.o
${AR} rucs $@ $^
%.o : %.c
$(CC) $(CFLAGS) $(INC) -c $<
H5Part.o: H5Part.c H5Part.h H5PartPrivate.h H5PartTypes.h
H5PartF.o: H5PartF.c Underscore.h H5Part.h
H5Block.o: H5Block.c H5Part.h H5PartPrivate.h H5PartTypes.h H5Block.h H5BlockTypes.h
H5BlockF.o: H5BlockF.c Underscore.h H5Block.h
H5BlockReadWrite.o: H5BlockReadWrite.c H5Part.h H5PartPrivate.h H5PartTypes.h H5Block.h H5BlockPrivate.h H5BlockReadWrite.h H5BlockTypes.h
H5BlockReadWriteF.o: H5BlockF.c Underscore.h H5Block.h H5BlockReadWrite.h
H5MultiBlock.o: H5MultiBlock.c
H5MultiBlockF.o: H5MultiBlockF.c
H5MultiBlockReadWrite.o: H5MultiBlockReadWrite.c
H5MultiBlockReadWriteF.o: H5MultiBlockReadWriteF.c
# ----------- Build Parallel H5Part Stuff ------------
.c.o:
$(CC) $(CFLAGS) $(INCLUDES) -c $<
libpH5Part.a: libH5Part.a
${RM} $@
$(RM) $@
ln -s $^ $@
libpH5PartF.a: libH5PartF.a
${RM} $@
$(RM) $@
ln -s $^ $@
clean:
rm -f *~ *.o *.a *.so
distclean: clean
rm -f *.a
rm -rf .deps
rm -rf .libs
rm -f Underscore.h
rm -f H5Part_py_wrap.c
rm -f H5Part.py
rm -f Makefile
+218
View File
@@ -0,0 +1,218 @@
#!/usr/bin/python
c_head = """
#include <stdlib.h>
#include <string.h>
#include <hdf5.h>
#include "H5Part.h"
#include "H5PartErrors.h"
#include "H5PartPrivate.h"
"""
h_head = """
#ifndef _H5PART_ATTRIB_H_
#define _H5PART_ATTRIB_H_
#ifdef __cplusplus
extern "C" {
#endif
"""
h_tail = """
#ifdef __cplusplus
}
#endif
#endif
"""
fc_head = """
#include "H5Part.h"
#include "H5PartPrivate.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_attr_h = """
h5part_int64_t
H5PartWrite#LEVEL#Attrib#TYPE_ABV# (
H5PartFile *f,
const char *name,
const h5part_#TYPE_H5P#_t data
);
"""
write_attr_c = """
/*!
\\ingroup h5part_attrib
Writes a \\c value of type #TYPE_FULL#
to the root ("/") of the file
as attribute \\c name.
\\return \\c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5PartWrite#LEVEL#Attrib#TYPE_ABV# (
H5PartFile *f, /*!< IN: file handle */
const char *name, /*!< IN: attribute name */
const h5part_#TYPE_H5P#_t value /*!< IN: attribute value */
) {
SET_FNAME ( "H5PartWrite#LEVEL#Attrib#TYPE_ABV#" );
CHECK_FILEHANDLE ( f );
CHECK_WRITABLE_MODE( f );
h5part_int64_t herr = _H5Part_write_#LEVELLC#_attrib (
f,
name,
#TYPE_HDF5#,
(void*)&value,
1 );
if ( herr < 0 ) return herr;
return H5PART_SUCCESS;
}
"""
write_attr_fi = """
!< \\ingroup h5partf_attrib
!! See \\ref H5PartWrite#LEVELLC#Attrib#TYPE_ABV#
!! \\return 0 on success or error code
!>
INTEGER*8 FUNCTION h5pt_write#LEVELLC#attrib_#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) :: name !< the name of the attribute
#TYPE_F90#, INTENT(IN) :: data(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array
END FUNCTION
"""
write_attr_fc = """
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_write#LEVELLC#attrib_#TYPE_F90_ABV# F77NAME ( \\
h5pt_write#LEVELLC#attrib_#TYPE_F90_ABV#_, \\
H5PT_WRITE#LEVELUC#ATTRIB_#TYPE_F90_ABVC# )
#endif
h5part_int64_t
h5pt_write#LEVELLC#attrib_#TYPE_F90_ABV# (
h5part_int64_t *f,
const char *name,
const h5part_#TYPE_H5P#_t *data,
const h5part_#TYPE_H5P#_t *nelem,
const int l_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *name2 =_H5Part_strdupfor2c ( name, l_name );
h5part_int64_t herr = H5PartWrite#LEVEL#Attrib (
filehandle, name2, #TYPE_ATTRIB#, data, *nelem);
free ( name2 );
return herr;
}
"""
read_attr_fi = """
!< \\ingroup h5partf_attrib
!! Read the attribute \c name into the buffer \c data.
!! \\return 0 on success or error code
!>
INTEGER*8 FUNCTION h5pt_read#LEVELLC#attrib_#TYPE_F90_ABV# ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute
#TYPE_F90#, INTENT(OUT) :: data(*) !< buffer to read value into
END FUNCTION
"""
read_attr_fc = """
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_write#LEVELLC#attrib_#TYPE_F90_ABV# F77NAME ( \\
h5pt_write#LEVELLC#attrib_#TYPE_F90_ABV#_, \\
H5PT_WRITE#LEVELUC#ATTRIB_#TYPE_F90_ABVC# )
#endif
h5part_int64_t
h5pt_read#LEVELLC#attrib_#TYPE_F90_ABV# (
h5part_int64_t *f,
const char *name,
const h5part_#TYPE_H5P#_t *data,
const int l_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *name2 =_H5Part_strdupfor2c ( name, l_name );
h5part_int64_t herr = H5PartRead#LEVEL#Attrib (
filehandle, name2, (void*)data);
free ( name2 );
return herr;
}
"""
levels = ["File", "Step"]
types = [
["floating points (64-bit)", "Float64", "float64", "H5T_NATIVE_DOUBLE", "REAL*8", "r8", "R8", "H5PART_FLOAT64"],
["floating points (32-bit)", "Float32", "float32", "H5T_NATIVE_FLOAT", "REAL*4", "r4", "R4", "H5PART_FLOAT32"],
["integers (64-bit)", "Int64", "int64", "H5T_NATIVE_INT64", "INTEGER*8", "i8", "I8", "H5PART_INT64"],
["integers (32-bit)", "Int32", "int32", "H5T_NATIVE_INT32", "INTEGER*4", "i4", "I4", "H5PART_INT32"]
]
def create_call(template, type, level):
fcn = template
fcn = fcn.replace('#LEVEL#',level)\
.replace('#LEVELLC#',level.lower())\
.replace('#LEVELUC#',level.upper())\
.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])\
.replace('#TYPE_ATTRIB#',type[7])
return fcn
def write_calls():
cfile = file('H5PartAttrib.c','w')
cfile.write(c_head)
hfile = file('H5PartAttrib.h','w')
hfile.write(h_head)
fcfile = file('H5PartAttribF.c','w')
fcfile.write(fc_head)
fifile = file('H5PartAttrib.f90','w')
for level in levels:
for type in types:
cfile.write(create_call(write_attr_c,type,level));
hfile.write(create_call(write_attr_h,type,level));
fifile.write(create_call(write_attr_fi,type,level));
fcfile.write(create_call(write_attr_fc,type,level));
fifile.write(create_call(read_attr_fi,type,level));
fcfile.write(create_call(read_attr_fc,type,level));
cfile.close()
hfile.write(h_tail)
hfile.close()
fcfile.close()
fifile.close()
write_calls()
+49 -39
View File
@@ -16,8 +16,8 @@ c_head = """
"""
h_head = """
#ifndef __H5BLOCKREADWRITE_H
#define __H5BLOCKREADWRITE_H
#ifndef _H5BLOCK_READWRITE_H_
#define _H5BLOCK_READWRITE_H_
#ifdef __cplusplus
extern "C" {
@@ -51,14 +51,6 @@ fc_head = """
#endif
"""
fi_head = """
INTERFACE
"""
fi_tail = """
END INTERFACE
"""
write_scalar_h = """
h5part_int64_t
H5Block#DIM#dWriteScalarField#TYPE_ABV# (
@@ -79,7 +71,7 @@ H5Block#DIM#dReadScalarField#TYPE_ABV# (
write_scalar_c = """
/*!
\\ingroup h5block_write
\\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
@@ -117,7 +109,7 @@ H5Block#DIM#dWriteScalarField#TYPE_ABV# (
read_scalar_c = """
/*!
\\ingroup h5block_read
\\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
@@ -153,18 +145,26 @@ H5Block#DIM#dReadScalarField#TYPE_ABV# (
"""
write_scalar_fi = """
!> \\ingroup h5blockf_data
!! 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, data )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
#TYPE_F90#, INTENT(IN) :: data(*)
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) :: data(*) !< the array of data
END FUNCTION
"""
read_scalar_fi = """
!> \\ingroup h5blockf_data
!! 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, data )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
#TYPE_F90#, INTENT(OUT) :: data(*)
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) :: data(*) !< buffer to read the data into
END FUNCTION
"""
@@ -246,7 +246,7 @@ H5Block#DIM#dRead3dVectorField#TYPE_ABV# (
write_vector_c = """
/*!
\\ingroup h5block_write
\\ingroup h5block_data
*/
/*!
Write a 3-dimensional field \\c name with 3-dimensional vectors as values
@@ -292,7 +292,7 @@ H5Block#DIM#dWrite3dVectorField#TYPE_ABV# (
read_vector_c = """
/*!
\\ingroup h5block_read
\\ingroup h5block_data
*/
/*!
Read a 3-dimensional field \\c name with 3-dimensional vectors as values
@@ -335,23 +335,31 @@ H5Block#DIM#dRead3dVectorField#TYPE_ABV# (
}
"""
write_vector_fi = """
write_vector_fi = """
!> \\ingroup h5blockf_data
!! See \\ref H5Block#DIM#dWrite3dVectorField#TYPE_ABV#
!! \\return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_#DIM#d_write_3dvector_field_#TYPE_F90_ABV# ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
#TYPE_F90#, INTENT(IN) :: x(*)
#TYPE_F90#, INTENT(IN) :: y(*)
#TYPE_F90#, INTENT(IN) :: 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 h5blockf_data
!! See \\ref H5Block#DIM#dRead3dVectorField#TYPE_ABV#
!! \\return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_#DIM#d_read_3dvector_field_#TYPE_F90_ABV# ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
#TYPE_F90#, INTENT(OUT) :: x(*)
#TYPE_F90#, INTENT(OUT) :: y(*)
#TYPE_F90#, INTENT(OUT) :: 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
"""
@@ -458,12 +466,16 @@ H5BlockWriteFieldAttrib#TYPE_ABV# (
"""
write_attr_fi = """
!> \\ingroup h5blockf_attrib
!! 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
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) :: attrib_value(*) ! The array of data to write into the attribute
INTEGER*8, INTENT(IN) :: attrib_nelem ! Number of elements in the attrib array
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) :: attrib_value(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: attrib_nelem !< the number of elements in the array
END FUNCTION
"""
@@ -528,8 +540,7 @@ def write_calls():
hfile.write(h_head)
fcfile = file('H5BlockReadWriteF.c','w')
fcfile.write(fc_head)
fifile = file('H5BlockReadWriteF90.inc','w')
fifile.write(fi_head)
fifile = file('H5BlockReadWrite.f90','w')
for dim in dims:
for type in types:
cfile.write(create_call(write_scalar_c,type,dim));
@@ -557,7 +568,6 @@ def write_calls():
hfile.write(h_tail)
hfile.close()
fcfile.close()
fifile.write(fi_tail)
fifile.close()
write_calls()
+4 -12
View File
@@ -14,8 +14,8 @@ c_head = """
"""
h_head = """
#ifndef __H5MULTIBLOCKREADWRITE_H
#define __H5MULTIBLOCKREADWRITE_H
#ifndef _H5MULTIBLOCK_READWRITE_H_
#define _H5MULTIBLOCK_READWRITE_H_
#ifdef __cplusplus
extern "C" {
@@ -49,14 +49,6 @@ fc_head = """
#endif
"""
fi_head = """
INTERFACE
"""
fi_tail = """
END INTERFACE
"""
write_h = """
h5part_int64_t
H5MultiBlock#DIM#dWriteField#TYPE_ABV# (
@@ -77,7 +69,7 @@ H5MultiBlock#DIM#dReadField#TYPE_ABV# (
write_c = """
/*!
\\ingroup h5multiblock_write
\\ingroup h5multiblock_data
Write a multiblock field \\c name from the buffer starting at \\c data
to the current time-step using the defined block decomposition and dimensions.
@@ -107,7 +99,7 @@ H5MultiBlock#DIM#dWriteField#TYPE_ABV# (
read_c = """
/*!
\\ingroup h5multiblock_read
\\ingroup h5multiblock_data
Allocate a buffer to hold a block from a multiblock field and place the
pointer in \\c data, then read the block into the buffer. Uses the block
+18 -159
View File
@@ -1,171 +1,30 @@
# test level Makefile.am
# PATH SETTING
HDF5ROOT = @HDF5ROOT@
OBJEXT=o
# COMPILER SETTING
CXX = @CXX@
FC = @FC@
MPIFC = @MPIFC@
MPICXX = @MPICXX@
MPICC = @MPICC@
HDFLIB = -L@HDF5ROOT@/lib -lhdf5 -lz @SZLIB@
LIBS = -L@H5P_LIB_LOC@ -lH5PartF -lH5Part $(HDFLIB) -lm
# COMPILER FLAG SETTING
CFLAGS = @CFLAGS@
FFLAGS = @FFLAGS@ @MPIINC@
INCLUDES = -I@H5P_LIB_LOC@ -I@HDF5ROOT@/include @MPIINC@
# LIBRARIES
SZLIB = @SZLIB@
HDFLIB = -L$(HDF5ROOT)/lib -lhdf5 -lz $(SZLIB) @LDFLAGS@
MPILIB = @MPILIB@
H5LIB = -L@H5P_LIB_LOC@ -lH5Part
noinst_PROGRAMS = @TTARGET@
LIBS = ${H5LIB} $(HDFLIB) $(MPILIB) -lm @STDCXX@
TESTS_ENVIRONMENT = env LD_LIBRARY_PATH=@HDF5ROOT@/lib:$(LD_LIBRARY_PATH)
TESTS = @TTARGET@
# H5Part compiled library location
# H5PLIB = -L@prefix@/lib
EXTRA_PROGRAMS = test testf
# INCLUDES
HDFINC = -I$(HDF5ROOT)/include
MPIINC = @MPIINC@
H5INC = -I@H5P_LIB_LOC@
test_SOURCES = test.c \
testframe.c \
write.c \
read.c \
testframe.h
INC = $(HDFINC) $(MPIINC) $(H5INC)
# What to build... make install will place these files in the $(prefix)/bin directory.
bin_PROGRAMS = @TTARGET@
# Some useful scripts that I wish to place in the $(prefix)/bin directory.
bin_SCRIPTS =
#bin_SCRIPTS = JAC_H5PartTestP_script.scr JAC_H5testFpar_script.scr JAC_RUN_ALL_script.scr
# Listing of all programs that maybe built. (Has to know statically...)
EXTRA_PROGRAMS =
# Extra files that I wish to include in the dist tar ball.
EXTRA_DIST = Bench.c \
H5ParallelTest.cc \
H5PartTest.cc H5PartTestParallel.cc \
H5PartAndreasTest.cc \
H5test.cc H5testF.f \
H5testFpar.F90 \
H5BlockParTestScalarField.c H5BlockParTestScalarFieldF.F90 \
H5BlockTestAttributes.c H5BlockTestAttributesF.F90 \
H5PartBench.c H5BlockBench.c \
$(bin_SCRIPTS)
# Specific building instruction (What compilers to use...)
# ------------ Build Tests ------------
Bench: Bench.c
$(CC) $(CFLAGS) $(INC) -o $@ $< $(H5PLIB) -lH5Part $(LIBS)
H5PartBench: H5PartBench.c
$(CC) $(CFLAGS) $(INC) -o $@ $< $(H5PLIB) -lpH5Part $(LIBS)
H5BlockBench: H5BlockBench.c
$(CC) $(CFLAGS) $(INC) -o $@ $< $(H5PLIB) -lpH5Part $(LIBS)
###############################################################################
H5PartTest: H5PartTest.o
$(CXX) -o $@ $< $(H5PLIB) -lH5Part $(LIBS)
H5PartTest.o: H5PartTest.cc
$(CXX) $(CFLAGS) $(INC) -DREGRESSIONTEST -g -c $<
###############################################################################
H5PartTestP: H5PartTestP.o
$(CXX) $(INC) -o $@ $< $(H5LIB) -lH5Part $(LIBS)
H5PartTestP.o: H5PartTest.cc
$(CXX) $(CFLAGS) $(INC) -DREGRESSIONTEST -c $< -o $@
###############################################################################
H5PartTestParallel: H5PartTestParallel.o
$(CXX) -o $@ $< $(H5LIB) -lH5Part $(LIBS)
H5PartTestParallel.o: H5PartTestParallel.cc
$(CXX) $(CFLAGS) $(INC) -c $<
###############################################################################
H5PartAndreasTest: H5PartAndreasTest.o
$(CXX) -o $@ $< $(H5LIB) -lpH5Part $(LIBS)
H5PartAndreasTest.o: H5PartAndreasTest.cc
$(CXX) $(CFLAGS) $(INC) -c $<
###############################################################################
H5testF: H5testF.o
$(FC) -o $@ $< $(H5LIB) -lH5PartF -lH5Part $(LIBS)
H5testF.o: H5testF.f
$(FC) $(FFLAGS) -c $(H5INC) $<
###############################################################################
H5testFpar: H5testFpar.o
$(MPIFC) -o $@ $< $(H5LIB) -lpH5PartF -lpH5Part $(LIBS)
H5testFpar.o: H5testFpar.F90
$(MPIFC) $(FFLAGS) -c $(H5INC) $<
###############################################################################
H5test: H5test.o
$(CXX) -o $@ $< $(H5LIB) $(LIBS)
H5test.o: H5test.cc
$(CXX) $(CFLAGS) $(INC) -DREGRESSIONTEST -g -c $<
###############################################################################
% : %.o
$(CC) -o $@ $< $(H5LIB) $(LIBS)
%.o : %.c
$(CC) $(CFLAGS) $(INC) -g -c $<
%.o : %.F90
${FC} $(FFLAGS) -c $(H5INC) $<
H5BlockTestAttributes.o: H5BlockTestAttributes.c
H5BlockTestAttributes: H5BlockTestAttributes.o
H5BlockTestAttributesF.o: H5BlockTestAttributesF.F90
H5BlockTestAttributesF: H5BlockTestAttributesF.o
$(FC) -o $@ $< $(H5LIB) -lH5PartF -lH5Part $(LIBS)
H5BlockParTestScalarField.o: H5BlockParTestScalarField.c
H5BlockParTestScalarField: H5BlockParTestScalarField.o
H5BlockParTestScalarFieldF.o: H5BlockParTestScalarFieldF.F90
H5BlockParTestScalarFieldF: H5BlockParTestScalarFieldF.o
$(FC) -o $@ $< $(H5LIB) -lH5PartF -lH5Part $(LIBS)
H5BlockDissolveGhosts.o: H5BlockDissolveGhosts.c
H5BlockDissolveGhosts: H5BlockDissolveGhosts.o
###############################################################################
clean:
${RM} -f *~ *.o ${bin_PROGRAMS}
distclean: clean
${RM} -rf .deps
${RM} -rf .libs
${RM} -f parttest.h5
${RM} -rf config.status config.log config.h Makefile
testf_SOURCES = testf.F90
.c.o:
$(CC) $(CFLAGS) $(INCLUDES) -c $<
clean: clean-am
rm -f *.h5
+22
View File
@@ -0,0 +1,22 @@
#ifndef _H5PART_TEST_PARAMS_H_
#define _H5PART_TEST_PARAMS_H_
#define FILENAME "test.h5"
#define LONGSTEPNAME "thisisaverylongstepnamethatshouldexceedthelimitof64charcausingawarningtoprint"
#define NTIMESTEPS 10
/* do not decrease this value below 99, or it will break assumptions
* made in the read tests! */
#define NPARTICLES 99
/* do not increase this value past 32! */
#define MAX_MPI_TASKS 32
#define ATTR_NAME_SIZE 16
#define ATTR_STR_VAL "test"
#define ATTR_INT32_VAL -2147483648
#define ATTR_INT64_VAL 2147483648
#define ATTR_FLOAT_VAL 3.14159265F
#endif
+70
View File
@@ -0,0 +1,70 @@
#include <stdlib.h>
#include <H5Part.h>
#include "testframe.h"
#include "params.h"
/* from write.c */
void test_write1(void);
void test_write2(void);
void test_write3(void);
void test_write4(void);
/* from read.c */
void test_read1(void);
void test_read2(void);
void test_read3(void);
void test_read4(void);
int main(int argc, char **argv)
{
#ifdef PARALLEL_IO
MPI_Init(&argc, &argv);
int procs;
MPI_Comm_size(MPI_COMM_WORLD, &procs);
if (procs > MAX_MPI_TASKS) {
fprintf(stderr, "ERROR: please use <= %d MPI tasks for the test.",
MAX_MPI_TASKS);
MPI_Abort(MPI_COMM_WORLD, -1);
}
#endif
/* Initialize testing framework */
TestInit(argv[0], NULL, NULL);
/* Tests are generally arranged from least to most complexity... */
AddTest("write1", test_write1, NULL, "Write 32-bit data", NULL);
AddTest("read1", test_read1, NULL, "Read 32-bit data", NULL);
AddTest("write2", test_write2, NULL, "Write 32-bit strided data", NULL);
AddTest("read2", test_read2, NULL, "Read 32-bit strided data", NULL);
AddTest("write3", test_write3, NULL, "Write 64-bit strided data", NULL);
AddTest("read3", test_read3, NULL, "Read 64-bit strided data", NULL);
AddTest("write4", test_write4, NULL, "Write 64-bit data", NULL);
AddTest("read4", test_read4, NULL, "Read 64-bit data", NULL);
/* Display testing information */
TestInfo(argv[0]);
/* Parse command line arguments */
TestParseCmdLine(argc, argv);
H5PartSetVerbosityLevel(GetTestVerbosity());
/* Perform requested testing */
PerformTests();
/* Display test summary, if requested */
if (GetTestSummary())
TestSummary();
/* Clean up test files, if allowed */
//if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP"))
// TestCleanup();
//return GetTestNumErrs();
#ifdef PARALLEL_IO
return MPI_Finalize();
#endif
}
+651
View File
@@ -0,0 +1,651 @@
/* Test framework borrowed from HDF5 1.8.3:
* test/testframe.c
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
* Tuesday, January 6, 2004
*
* Purpose: Provides support functions for the testing framework.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <H5Part.h>
#include "testframe.h"
/*
* Definitions for the testing structure.
*/
#define MAXNUMOFTESTS 64
#define MAXTESTNAME 16
#define MAXTESTDESC 64
typedef struct TestStruct {
int NumErrors;
char Description[MAXTESTDESC];
int SkipFlag;
char Name[MAXTESTNAME];
void (*Call)(void);
void (*Cleanup)(void);
const void *Parameters;
} TestStruct;
/*
* Variables used by testing framework.
*/
static int num_errs = 0; /* Total number of errors during testing */
static int Verbosity = VERBO_DEF; /* Default Verbosity is Low */
static int Summary = 0; /* Show test summary. Default is no. */
static int CleanUp = 1; /* Do cleanup or not. Default is yes. */
static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */
static TestStruct Test[MAXNUMOFTESTS];
static int Index = 0;
static const void *Test_parameters = NULL;
static const char *TestProgName = NULL;
static void (*TestPrivateUsage)(void) = NULL;
static int (*TestPrivateParser)(int ac, char *av[]) = NULL;
/*
* Setup a test function and add it to the list of tests.
* It must have no parameters and returns void.
* TheName--short test name.
* If the name starts with '-', do not run it by default.
* TheCall--the test routine.
* Cleanup--the cleanup routine for the test.
* TheDescr--Long description of the test.
* Parameters--pointer to extra parameters. Use NULL if none used.
* Since only the pointer is copied, the contents should not change.
*/
void
AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), const char *TheDescr, const void *Parameters)
{
/* Sanity checking */
if (Index >= MAXNUMOFTESTS) {
printf("Too many tests added, increase MAXNUMOFTEST(%d).\n",
MAXNUMOFTESTS);
exit(-1);
} /* end if */
if (strlen(TheDescr) >= MAXTESTDESC) {
printf("Test description too long, increase MAXTESTDESC(%d).\n",
MAXTESTDESC);
exit(-1);
} /* end if */
if (strlen(TheName) >= MAXTESTNAME) {
printf("Test name too long, increase MAXTESTNAME(%d).\n",
MAXTESTNAME);
exit(-1);
} /* end if */
/* Set up test function */
strcpy(Test[Index].Description, TheDescr);
if (*TheName != '-'){
strcpy(Test[Index].Name, TheName);
Test[Index].SkipFlag = 0;
}
else { /* skip test by default */
strcpy(Test[Index].Name, TheName+1);
Test[Index].SkipFlag = 1;
}
Test[Index].Call = TheCall;
Test[Index].Cleanup = Cleanup;
Test[Index].NumErrors = -1;
Test[Index].Parameters = Parameters;
/* Increment test count */
Index++;
}
/*
* Initialize testing framework
*
* ProgName: Name of test program.
* private_usage: Optional routine provided by test program to print the
* private portion of usage page. Default to NULL which means none is
* provided.
* private_parser: Optional routine provided by test program to parse the
* private options. Default to NULL which means none is provided.
*
* Modifications:
* Albert Cheng 2004/08/17
* Added the ProgName, private_usage and private_parser arguments.
*/
void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[]))
{
#if !(defined MAC || defined SYMANTEC_C)
/* Un-buffer the stdout and stderr */
setbuf(stderr, NULL);
setbuf(stdout, NULL);
#endif
/*
* Turn off automatic error reporting since we do it ourselves. Besides,
* half the functions this test calls are private, so automatic error
* reporting wouldn't do much good since it's triggered at the API layer.
*/
//H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
/*
* Record the program name and private routines if provided.
*/
TestProgName = ProgName;
if (NULL != private_usage)
TestPrivateUsage = private_usage;
if (NULL != private_parser)
TestPrivateParser = private_parser;
}
/*
* Print test usage.
* First print the common test options, then the extra options if provided.
*
* Modification:
* 2004/08/18 Albert Cheng. Add TestPrivateUsage feature.
*/
void TestUsage(void)
{
int i;
printf("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n",
TestProgName, (TestPrivateUsage ? "<extra options>" : ""));
printf(" [-[e]x[clude] name+] \n");
printf(" [-o[nly] name+] \n");
printf(" [-b[egin] name] \n");
printf(" [-s[ummary]] \n");
printf(" [-c[leanoff]] \n");
printf(" [-h[elp]] \n");
printf("\n\n");
printf("verbose controls the amount of information displayed\n");
printf("exclude to exclude tests by name\n");
printf("only to name tests which should be run\n");
printf("begin start at the name of the test givin\n");
printf("summary prints a summary of test results at the end\n");
printf("cleanoff does not delete *.hdf files after execution of tests\n");
printf("help print out this information\n");
if (TestPrivateUsage){
printf("\nExtra options\n");
TestPrivateUsage();
}
printf("\n\n");
printf("This program currently tests the following: \n\n");
printf("%16s %s\n", "Name", "Description");
printf("%16s %s\n", "----", "-----------");
for (i = 0; i < Index; i++)
printf("%16s %s\n", Test[i].Name, Test[i].Description);
printf("\n\n");
}
/*
* Print test info.
*/
void TestInfo(const char *ProgName)
{
unsigned major, minor, release;
H5get_libversion(&major, &minor, &release);
printf("\nFor help use: %s -help\n",ProgName);
printf("Linked with hdf5 version %u.%u release %u\n", major, minor, release);
printf("Linked with H5Part version %s\n", H5PART_VER_STRING);
}
/*
* Parse command line information.
* argc, argv: the usual command line argument count and strings
*
* Modification:
* 2004/08/18 Albert Cheng. Add extra_parse feature.
*/
void TestParseCmdLine(int argc, char *argv[])
{
int ret_code;
while (argv++, --argc > 0){
if ((strcmp(*argv, "-verbose") == 0) ||
(strcmp(*argv, "-v") == 0)) {
if (argc > 0){
--argc; ++argv;
ParseTestVerbosity(*argv);
}else{
TestUsage();
exit(1);
}
}
else if (((strcmp(*argv, "-exclude") == 0) ||
(strcmp(*argv, "-x") == 0))) {
if (argc > 0){
--argc; ++argv;
SetTest(*argv, SKIPTEST);
}else{
TestUsage();
exit(1);
}
}
else if (((strcmp(*argv, "-begin") == 0) ||
(strcmp(*argv, "-b") == 0))) {
if (argc > 0){
--argc; ++argv;
SetTest(*argv, BEGINTEST);
}else{
TestUsage();
exit(1);
}
}
else if (((strcmp(*argv, "-only") == 0) ||
(strcmp(*argv, "-o") == 0))) {
if (argc > 0){
int Loop;
--argc; ++argv;
/* Skip all tests, then activate only one. */
for (Loop = 0; Loop < Index; Loop++)
Test[Loop].SkipFlag = 1;
SetTest(*argv, ONLYTEST);
}else{
TestUsage();
exit(1);
}
}
else if ((strcmp(*argv, "-summary") == 0) || (strcmp(*argv, "-s") == 0))
Summary = 1;
else if ((strcmp(*argv, "-help") == 0) || (strcmp(*argv, "-h") == 0)) {
TestUsage();
exit(0);
}
else if ((strcmp(*argv, "-cleanoff") == 0) || (strcmp(*argv, "-c") == 0))
SetTestNoCleanup();
else {
/* non-standard option. Break out. */
break;
}
}
/* Call extra parsing function if provided. */
if (NULL != TestPrivateParser){
ret_code=TestPrivateParser(argc+1, argv-1);
if (ret_code != 0)
exit(-1);
}
}
/*
* Perform Tests.
*/
void PerformTests(void)
{
int Loop;
for (Loop = 0; Loop < Index; Loop++)
if (Test[Loop].SkipFlag) {
MESSAGE(2, ("Skipping -- %s (%s) \n", Test[Loop].Description, Test[Loop].Name));
} else {
MESSAGE(2, ("Testing -- %s (%s) \n", Test[Loop].Description, Test[Loop].Name));
MESSAGE(5, ("===============================================\n"));
Test[Loop].NumErrors = num_errs;
Test_parameters = Test[Loop].Parameters;
//ALARM_ON;
Test[Loop].Call();
//ALARM_OFF;
Test[Loop].NumErrors = num_errs - Test[Loop].NumErrors;
MESSAGE(5, ("===============================================\n"));
MESSAGE(5, ("There were %d errors detected.\n\n", (int)Test[Loop].NumErrors));
}
Test_parameters = NULL; /* clear it. */
MESSAGE(2, ("\n\n"));
if (num_errs)
printf("!!! %d Error(s) were detected !!!\n\n", (int) num_errs);
else
printf("All tests were successful. \n\n");
}
/*
* Display test summary.
*/
void TestSummary(void)
{
int Loop;
printf("Summary of Test Results:\n");
printf("Name of Test Errors Description of Test\n");
printf("---------------- ------ --------------------------------------\n");
for (Loop = 0; Loop < Index; Loop++) {
if (Test[Loop].NumErrors == -1)
printf("%16s %6s %s\n", Test[Loop].Name, "N/A", Test[Loop].Description);
else
printf("%16s %6d %s\n", Test[Loop].Name, (int)Test[Loop].NumErrors, Test[Loop].Description);
}
printf("\n\n");
}
/*
* Cleanup files from testing
*/
void TestCleanup(void)
{
int Loop;
MESSAGE(2, ("\nCleaning Up temp files...\n\n"));
/* call individual cleanup routines in each source module */
for (Loop = 0; Loop < Index; Loop++)
if (!Test[Loop].SkipFlag && Test[Loop].Cleanup!=NULL)
Test[Loop].Cleanup();
}
/*
* Retrieve the verbosity level for the testing framework
*/
int GetTestVerbosity(void)
{
return(Verbosity);
}
/*
* Set the verbosity level for the testing framework.
* Return previous verbosity level.
*/
int SetTestVerbosity(int newval)
{
int oldval;
oldval = Verbosity;
Verbosity = newval;
return(oldval);
}
/*
* Retrieve the TestExpress mode for the testing framework
Values:
0: Exhaustive run
Tests should take as long as necessary
1: Full run. Default if HDF5TestExpress is not defined
Tests should take no more than 30 minutes
2: Quick run
Tests should take no more than 10 minutes
3: Smoke test. Default if HDF5TestExpress is set to a value other than 0-3
Tests should take less than 1 minute
Design:
If the environment variable $HDF5TestExpress is defined,
then test programs should skip some tests so that they
complete sooner.
Terms:
A "test" is a single executable, even if it contains multiple
sub-tests.
The standard system for test times is a Linux machine running in
NFS space (to catch tests that involve a great deal of disk I/O).
Implementation:
I think this can be easily implemented in the test library (libh5test.a)
so that all tests can just call it to check the status of $HDF5TestExpress.
*/
int GetTestExpress(void)
{
char * env_val;
/* set it here for now. Should be done in something like h5test_init(). */
if(TestExpress==-1)
{
env_val = getenv("HDF5TestExpress");
if(env_val == NULL)
SetTestExpress(1);
else if(strcmp(env_val, "0") == 0)
SetTestExpress(0);
else if(strcmp(env_val, "1") == 0)
SetTestExpress(1);
else if(strcmp(env_val, "2") == 0)
SetTestExpress(2);
else
SetTestExpress(3);
}
return(TestExpress);
}
/*
* Set the TestExpress mode for the testing framework.
* Return previous TestExpress mode.
* Values: non-zero means TestExpress mode is on, 0 means off.
*/
int SetTestExpress(int newval)
{
int oldval;
oldval = TestExpress;
TestExpress = newval;
return(oldval);
}
/*
* Retrieve Summary request value.
* 0 means no summary, 1 means yes.
*/
int GetTestSummary(void)
{
return(Summary);
}
/*
* Retrieve Cleanup request value.
* 0 means no Cleanup, 1 means yes.
*/
int GetTestCleanup(void)
{
return(CleanUp);
}
/*
* Set cleanup to no.
* Return previous cleanup value.
*/
int SetTestNoCleanup(void)
{
int oldval;
oldval = CleanUp;
CleanUp = 0;
return(oldval);
}
/*
* Parse an argument string for verbosity level and set it.
*/
void ParseTestVerbosity(char *argv)
{
if (*argv == 'l')
SetTestVerbosity(VERBO_LO);
else if (*argv == 'm')
SetTestVerbosity(VERBO_MED);
else if (*argv == 'h')
SetTestVerbosity(VERBO_HI);
else
SetTestVerbosity(atoi(argv));
}
/*
* Retrieve the number of testing errors for the testing framework
*/
int GetTestNumErrs(void)
{
return(num_errs);
}
/*
* Increment the number of testing errors
*/
void IncTestNumErrs(void)
{
num_errs++;
}
/*
* Retrieve the current Test Parameters pointer.
*/
const void *GetTestParameters(void)
{
return(Test_parameters);
}
int
TestPrintf(const char *format, ...)
{
va_list arglist;
int ret_value;
#if PARALLEL_IO
int nproc;
MPI_Comm_rank(MPI_COMM_WORLD, &nproc);
if ( nproc == 0 || VERBOSE_HI ) {
char *format2 = malloc(strlen(format)+8);
sprintf(format2, "[%d] %s", nproc, format);
va_start(arglist, format);
ret_value = vprintf(format2, arglist);
va_end(arglist);
}
#else
va_start(arglist, format);
ret_value = vprintf(format, arglist);
va_end(arglist);
#endif
/* Return the length of the string produced (like printf() does) */
return ret_value;
}
/*
* This routine is designed to provide equivalent functionality to 'printf'
* and also increment the error count for the testing framework.
*/
int
TestErrPrintf(const char *format, ...)
{
va_list arglist;
int ret_value;
/* Increment the error count */
num_errs++;
#if PARALLEL_IO
int nproc;
MPI_Comm_rank(MPI_COMM_WORLD, &nproc);
if ( nproc == 0 || VERBOSE_HI ) {
char *format2 = malloc(strlen(format)+8);
sprintf(format2, "[%d] %s", nproc, format);
va_start(arglist, format);
ret_value = vfprintf(stderr, format2, arglist);
va_end(arglist);
}
#else
va_start(arglist, format);
ret_value = vfprintf(stderr, format, arglist);
va_end(arglist);
#endif
/* Return the length of the string produced (like printf() does) */
return ret_value;
}
/*
* Set (control) which test will be tested.
* SKIPTEST: skip this test
* ONLYTEST: do only this test
* BEGINETEST: skip all tests before this test
*
*/
void SetTest(const char *testname, int action)
{
int Loop;
switch (action){
case SKIPTEST:
for (Loop = 0; Loop < Index; Loop++)
if (strcmp(testname, Test[Loop].Name) == 0){
Test[Loop].SkipFlag = 1;
break;
}
break;
case BEGINTEST:
for (Loop = 0; Loop < Index; Loop++) {
if (strcmp(testname, Test[Loop].Name) != 0)
Test[Loop].SkipFlag = 1;
else{
/* Found it. Set it to run. Done. */
Test[Loop].SkipFlag = 0;
break;
}
}
break;
case ONLYTEST:
for (Loop = 0; Loop < Index; Loop++) {
if (strcmp(testname, Test[Loop].Name) != 0)
Test[Loop].SkipFlag = 1;
else {
/* Found it. Set it to run. Break to skip the rest. */
Test[Loop].SkipFlag = 0;
break;
}
}
/* skip the rest */
while (++Loop < Index)
Test[Loop].SkipFlag = 1;
break;
default:
/* error */
printf("*** ERROR: Unknown action (%d) for SetTest\n", action);
break;
}
}
void
get_attr_name(char *name, char *tag, int id)
{
sprintf(name, "Attr%d%s", id, tag);
}
void
test_is_valid(H5PartFile *file)
{
h5part_int64_t status = H5PartFileIsValid(file);
RETURN(status, H5PART_SUCCESS, "H5PartFileIsValid");
}
+188
View File
@@ -0,0 +1,188 @@
/* Test framework borrowed from HDF5 1.8.3:
* test/h5test.h
* test/testhdf5.h
*/
#ifndef _H5PART_TESTFRAME_H_
#define _H5PART_TESTFRAME_H_
#ifdef PARALLEL_IO
#define OPEN(file,mode) \
H5PartOpenFileParallel(file,mode,MPI_COMM_WORLD)
#define OPENALIGN(file,mode,align) \
H5PartOpenFileParallelAlign(file,mode,MPI_COMM_WORLD,align)
#else
#define OPEN(file,mode) H5PartOpenFile(file,mode)
#define OPENALIGN(file,mode,align) H5PartOpenFileAlign(file,mode,align)
#endif
/*
* Predefined test verbosity levels.
*
* Convention:
*
* The higher the verbosity value, the more information printed.
* So, output for higher verbosity also include output of all lower
* verbosity.
*
* Value Description
* 0 None: No informational message.
* 1 "All tests passed"
* 2 Header of overall test
* 3 Default: header and results of individual test
* 4
* 5 Low: Major category of tests.
* 6
* 7 Medium: Minor category of tests such as functions called.
* 8
* 9 High: Highest level. All information.
*/
#define VERBO_DEF 0 /* Default */
#define VERBO_LO 2 /* Low */
#define VERBO_MED 3 /* Medium */
#define VERBO_HI 4 /* High */
/*
* Verbose queries
* Only None needs an exact match. The rest are at least as much.
*/
#define VERBOSE_DEF (GetTestVerbosity()>=VERBO_DEF)
#define VERBOSE_LO (GetTestVerbosity()>=VERBO_LO)
#define VERBOSE_MED (GetTestVerbosity()>=VERBO_MED)
#define VERBOSE_HI (GetTestVerbosity()>=VERBO_HI)
#define SKIPTEST 1
#define ONLYTEST 2
#define BEGINTEST 3
/*
* Print the current location on the standard output stream.
*/
#define AT() TestPrintf (" at %s:%d in %s()...\n", \
__FILE__, __LINE__, __FUNCTION__);
/*
* The name of the test is printed by saying TESTING("something") which will
* result in the string `Testing something' being flushed to standard output.
* If a test passes, fails, or is skipped then the PASSED(), H5_FAILED(), or
* SKIPPED() macro should be called. After H5_FAILED() or SKIPPED() the caller
* should print additional information to stdout indented by at least four
* spaces. If the h5_errors() is used for automatic error handling then
* the H5_FAILED() macro is invoked automatically when an API function fails.
*/
#define TESTING(WHAT) {TestPrintf("Testing %-62s",WHAT); fflush(stdout);}
#define TESTING_2(WHAT) {TestPrintf(" Testing %-62s",WHAT); fflush(stdout);}
#define PASSED() {TestPrintf(" PASSED");fflush(stdout);}
#define H5_FAILED() {TestPrintf("*FAILED*");fflush(stdout);}
#define H5_WARNING() {TestPrintf("*WARNING*");fflush(stdout);}
#define SKIPPED() {TestPrintf(" -SKIP-");fflush(stdout);}
#define TEST_ERROR {H5_FAILED(); AT(); goto error;}
//#define STACK_ERROR {H5Eprint2(H5E_DEFAULT, stdout); goto error;}
//#define FAIL_STACK_ERROR {H5_FAILED(); AT(); H5Eprint2(H5E_DEFAULT, stdout); \
// goto error;}
#define FAIL_PUTS_ERROR(s) {H5_FAILED(); AT(); TestPrintf(s); goto error;}
/* Use %ld to print the value because long should cover most cases. */
/* Used to make certain a return value _is_not_ a value */
#define RETURN(ret, val, where) do { \
if (VERBOSE_HI) TestPrintf( " Call to routine %15s at line %4d " \
"in %s returned %ld \n", \
where, (int)__LINE__, __FILE__, \
(long)(ret)); \
if ((ret) != (val)) { \
TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
"in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \
} \
} while(0)
#define VALUE(val, expected, what) do { \
if ((val) != (expected)) { \
TestErrPrintf( "*** INCORRECT VALUE of %s at line " \
"%d in %s\n", what, (int)__LINE__, \
__FILE__); \
} \
} while(0)
#define IVALUE(val, expected, what) do { \
if (VERBOSE_HI) TestPrintf( " Value of int %15s at line %4d " \
"in %s is %ld =? %ld\n", what, \
(int)__LINE__, __FILE__, \
(long)(val), (long)(expected)); \
VALUE(val, expected, what); \
} while(0)
#define FVALUE(val, expected, what) do { \
if (VERBOSE_HI) TestPrintf( " Value of float %15s at line %4d " \
"in %s is %g =? %g\n", what, \
(int)__LINE__, __FILE__, \
(val), (expected)); \
VALUE(val, expected, what); \
} while(0)
#define CVALUE(val, expected, what) do { \
if (VERBOSE_HI) TestPrintf( " Value of char %15s at line %4d " \
"in %s is %c =? %c\n", what, \
(int)__LINE__, __FILE__, \
(val), (expected)); \
VALUE(val, expected, what); \
} while(0)
#define SVALUE(val, expected, what) do { \
if (VERBOSE_HI) TestPrintf( " Value of string %15s at line %4d " \
"in %s is %s =? %s\n", what, \
(int)__LINE__, __FILE__, \
(val), (expected)); \
if (strcmp(val,expected) != 0) { \
TestErrPrintf( "*** INCORRECT VALUE of %d at line " \
"%4d in %s\n", what, (int)__LINE__, \
__FILE__); \
} \
} while(0)
/* Used to document process through a test */
#define MESSAGE(V,A) do { \
if (V) TestPrintf A; \
} while(0)
#define TEST(WHAT) MESSAGE(VERBOSE_DEF,(WHAT "\n"))
/* definitions for command strings */
#define VERBOSITY_STR "Verbosity"
#define SKIP_STR "Skip"
#define TEST_STR "Test"
#define CLEAN_STR "Cleanup"
void TestUsage(void);
void AddTest(const char *TheName, void (*TheCall) (void),
void (*Cleanup) (void), const char *TheDescr,
const void *Parameters);
void TestInfo(const char *ProgName);
void TestParseCmdLine(int argc, char *argv[]);
void PerformTests(void);
void TestSummary(void);
void TestCleanup(void);
void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[]));
int GetTestVerbosity(void);
int SetTestVerbosity(int newval);
int GetTestSummary(void);
int GetTestCleanup(void);
int SetTestNoCleanup(void);
int GetTestExpress(void);
int SetTestExpress(int newval);
void ParseTestVerbosity(char *argv);
int GetTestNumErrs(void);
void IncTestNumErrs(void);
const void *GetTestParameters(void);
int TestPrintf(const char *format, ...);
int TestErrPrintf(const char *format, ...);
void SetTest(const char *testname, int action);
void
get_attr_name(char *name, char *tag, int id);
void
test_is_valid(H5PartFile *file);
#endif
+418
View File
@@ -0,0 +1,418 @@
#include <H5Part.h>
#include "testframe.h"
#include "params.h"
static void
test_write_file_attribs(H5PartFile *file, int position)
{
h5part_int64_t status;
char name[ATTR_NAME_SIZE];
TEST("Writing file attributes");
get_attr_name(name, "str", position);
status = H5PartWriteFileAttribString(file, name, ATTR_STR_VAL);
RETURN(status, H5PART_SUCCESS, "H5PartWriteFileAttribString");
get_attr_name(name, "i32", position);
status = H5PartWriteFileAttribInt32(file, name, ATTR_INT32_VAL);
RETURN(status, H5PART_SUCCESS, "H5PartWriteFileAttribInt32");
get_attr_name(name, "i64", position);
status = H5PartWriteFileAttribInt64(file, name, ATTR_INT64_VAL);
RETURN(status, H5PART_SUCCESS, "H5PartWriteFileAttribInt64");
get_attr_name(name, "f32", position);
status = H5PartWriteFileAttribFloat32(file, name, ATTR_FLOAT_VAL);
RETURN(status, H5PART_SUCCESS, "H5PartWriteFileAttribFloat32");
get_attr_name(name, "f64", position);
status = H5PartWriteFileAttribFloat64(file, name, ATTR_FLOAT_VAL);
RETURN(status, H5PART_SUCCESS, "H5PartWriteFileAttribFloat64");
}
static void
test_write_step_attribs(H5PartFile *file, int position)
{
h5part_int64_t status;
char name[ATTR_NAME_SIZE];
TEST("Writing step attributes");
get_attr_name(name, "str", position);
status = H5PartWriteStepAttribString(file, name, ATTR_STR_VAL);
RETURN(status, H5PART_SUCCESS, "H5PartWriteStepAttribString");
get_attr_name(name, "i32", position);
status = H5PartWriteStepAttribInt32(file, name, ATTR_INT32_VAL);
RETURN(status, H5PART_SUCCESS, "H5PartWriteStepAttribInt32");
get_attr_name(name, "i64", position);
status = H5PartWriteStepAttribInt64(file, name, ATTR_INT64_VAL);
RETURN(status, H5PART_SUCCESS, "H5PartWriteStepAttribInt64");
get_attr_name(name, "f32", position);
status = H5PartWriteStepAttribFloat32(file, name, ATTR_FLOAT_VAL);
RETURN(status, H5PART_SUCCESS, "H5PartWriteStepAttribFloat32");
get_attr_name(name, "f64", position);
status = H5PartWriteStepAttribFloat64(file, name, ATTR_FLOAT_VAL);
RETURN(status, H5PART_SUCCESS, "H5PartWriteStepAttribFloat64");
}
static void
test_write_data64(H5PartFile *file, int nparticles, int step)
{
int i,t;
h5part_int64_t status;
double *x,*y,*z;
double *px,*py,*pz;
h5part_int64_t *id;
x=(double*)malloc(nparticles*sizeof(double));
y=(double*)malloc(nparticles*sizeof(double));
z=(double*)malloc(nparticles*sizeof(double));
px=(double*)malloc(nparticles*sizeof(double));
py=(double*)malloc(nparticles*sizeof(double));
pz=(double*)malloc(nparticles*sizeof(double));
id=(h5part_int64_t*)malloc(nparticles*sizeof(h5part_int64_t));
/* invalid stride will produce a warning */
status = H5PartSetNumParticlesStrided(file, nparticles, -1);
RETURN(status, H5PART_SUCCESS, "H5PartSetNumParticlesStrided");
#if PARALLEL_IO
TEST("Setting throttle");
status = H5PartSetThrottle(file, 2);
RETURN(status, H5PART_SUCCESS, "H5PartSetThrottle");
#endif
TEST("Writing 64-bit data");
for (t=step; t<step+NTIMESTEPS; t++)
{
for (i=0; i<nparticles; i++)
{
x[i] = 0.0 + (double)(i+nparticles*t);
y[i] = 0.1 + (double)(i+nparticles*t);
z[i] = 0.2 + (double)(i+nparticles*t);
px[i] = 0.3 + (double)(i+nparticles*t);
py[i] = 0.4 + (double)(i+nparticles*t);
pz[i] = 0.5 + (double)(i+nparticles*t);
id[i] = i + nparticles*t;
}
status = H5PartSetStep(file, t);
RETURN(status, H5PART_SUCCESS, "H5PartSetStep");
test_write_step_attribs(file, t);
status = H5PartSetNumParticles(file, nparticles);
RETURN(status, H5PART_SUCCESS, "H5PartSetNumParticles");
status = H5PartWriteDataFloat64(file, "x", x);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat64");
status = H5PartWriteDataFloat64(file, "y", y);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat64");
status = H5PartWriteDataFloat64(file, "z", z);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat64");
status = H5PartWriteDataFloat64(file, "px", px);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat64");
status = H5PartWriteDataFloat64(file, "py", py);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat64");
status = H5PartWriteDataFloat64(file, "pz", pz);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat64");
status = H5PartWriteDataInt64(file, "id", id);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataInt64");
}
}
static void
test_write_strided_data64(H5PartFile *file, int nparticles, int step)
{
int i,t;
h5part_int64_t status;
double *data;
data=(double*)malloc(6*nparticles*sizeof(double));
status = H5PartSetNumParticlesStrided(file, nparticles, 6);
RETURN(status, H5PART_SUCCESS, "H5PartSetNumParticlesStrided");
TEST("Writing 64-bit strided data");
for (t=step; t<step+NTIMESTEPS; t++)
{
for (i=0; i<nparticles; i++)
{
data[6*i] = 0.0 + (double)(i+nparticles*t);
data[6*i+1] = 0.1 + (double)(i+nparticles*t);
data[6*i+2] = 0.2 + (double)(i+nparticles*t);
data[6*i+3] = 0.3 + (double)(i+nparticles*t);
data[6*i+4] = 0.4 + (double)(i+nparticles*t);
data[6*i+5] = 0.5 + (double)(i+nparticles*t);
}
status = H5PartSetStep(file, t);
RETURN(status, H5PART_SUCCESS, "H5PartSetStep");
status = H5PartSetNumParticlesStrided(file, nparticles, 6);
RETURN(status, H5PART_SUCCESS, "H5PartSetNumParticlesStrided");
status = H5PartWriteDataFloat64(file, "x", data+0);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat64");
status = H5PartWriteDataFloat64(file, "y", data+1);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat64");
status = H5PartWriteDataFloat64(file, "z", data+2);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat64");
status = H5PartWriteDataFloat64(file, "px", data+3);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat64");
status = H5PartWriteDataFloat64(file, "py", data+4);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat64");
status = H5PartWriteDataFloat64(file, "pz", data+5);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat64");
test_write_step_attribs(file, t);
}
}
static void
test_write_data32(H5PartFile *file, int nparticles, int step)
{
int i,t;
h5part_int32_t status;
float *x,*y,*z;
float *px,*py,*pz;
int *id;
x=(float*)malloc(nparticles*sizeof(float));
y=(float*)malloc(nparticles*sizeof(float));
z=(float*)malloc(nparticles*sizeof(float));
px=(float*)malloc(nparticles*sizeof(float));
py=(float*)malloc(nparticles*sizeof(float));
pz=(float*)malloc(nparticles*sizeof(float));
id=(int*)malloc(nparticles*sizeof(int));
status = H5PartSetNumParticles(file, nparticles);
RETURN(status, H5PART_SUCCESS, "H5PartSetNumParticles");
#if PARALLEL_IO
/* will generate a warning since we are in MPI-IO Collective mode */
TEST("Setting throttle");
status = H5PartSetThrottle(file, 2);
RETURN(status, H5PART_SUCCESS, "H5PartSetThrottle");
#endif
TEST("Writing 32-bit data");
for (t=step; t<step+NTIMESTEPS; t++)
{
for (i=0; i<nparticles; i++)
{
x[i] = 0.0F + (float)(i+nparticles*t);
y[i] = 0.1F + (float)(i+nparticles*t);
z[i] = 0.2F + (float)(i+nparticles*t);
px[i] = 0.3F + (float)(i+nparticles*t);
py[i] = 0.4F + (float)(i+nparticles*t);
pz[i] = 0.5F + (float)(i+nparticles*t);
id[i] = i + nparticles*t;
}
status = H5PartSetStep(file, t);
RETURN(status, H5PART_SUCCESS, "H5PartSetStep");
status = H5PartSetNumParticles(file, nparticles);
RETURN(status, H5PART_SUCCESS, "H5PartSetNumParticles");
status = H5PartWriteDataFloat32(file, "x", x);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat32");
test_write_step_attribs(file, t);
status = H5PartWriteDataFloat32(file, "y", y);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat32");
status = H5PartWriteDataFloat32(file, "z", z);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat32");
status = H5PartWriteDataFloat32(file, "px", px);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat32");
status = H5PartWriteDataFloat32(file, "py", py);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat32");
status = H5PartWriteDataFloat32(file, "pz", pz);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat32");
status = H5PartWriteDataInt32(file, "id", id);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataInt32");
}
}
static void
test_write_strided_data32(H5PartFile *file, int nparticles, int step)
{
int i,t;
h5part_int64_t status;
float *data;
data=(float*)malloc(6*nparticles*sizeof(float));
//status = H5PartSetNumParticlesStrided(file, nparticles, 6);
//RETURN(status, H5PART_SUCCESS, "H5PartSetNumParticlesStrided");
TEST("Writing 32-bit strided data");
for (t=step; t<step+NTIMESTEPS; t++)
{
for (i=0; i<nparticles; i++)
{
data[6*i] = 0.0F + (float)(i+nparticles*t);
data[6*i+1] = 0.1F + (float)(i+nparticles*t);
data[6*i+2] = 0.2F + (float)(i+nparticles*t);
data[6*i+3] = 0.3F + (float)(i+nparticles*t);
data[6*i+4] = 0.4F + (float)(i+nparticles*t);
data[6*i+5] = 0.5F + (float)(i+nparticles*t);
}
status = H5PartSetStep(file, t);
RETURN(status, H5PART_SUCCESS, "H5PartSetStep");
test_write_step_attribs(file, t);
status = H5PartSetNumParticlesStrided(file, nparticles, 6);
RETURN(status, H5PART_SUCCESS, "H5PartSetNumParticlesStrided");
status = H5PartWriteDataFloat32(file, "x", data+0);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat32");
status = H5PartWriteDataFloat32(file, "y", data+1);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat32");
status = H5PartWriteDataFloat32(file, "z", data+2);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat32");
status = H5PartWriteDataFloat32(file, "px", data+3);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat32");
status = H5PartWriteDataFloat32(file, "py", data+4);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat32");
status = H5PartWriteDataFloat32(file, "pz", data+5);
RETURN(status, H5PART_SUCCESS, "H5PartWriteDataFloat32");
}
}
void test_write1(void)
{
H5PartFile *file1;
h5part_int64_t status;
TEST("Opening file once, write-truncate");
file1 = OPEN(FILENAME,H5PART_WRITE);
test_is_valid(file1);
test_write_data32(file1, NPARTICLES, 1);
test_write_file_attribs(file1, 0);
status = H5PartCloseFile(file1);
RETURN(status, H5PART_SUCCESS, "H5PartCloseFile");
}
void test_write2(void)
{
H5PartFile *file1;
H5PartFile *file2;
h5part_int64_t status;
TEST("Opening file twice, write-append + read-only");
file1 = OPEN(FILENAME,H5PART_APPEND);
test_is_valid(file1);
file2 = OPEN(FILENAME,H5PART_READ);
test_is_valid(file2);
test_write_strided_data32(file1, NPARTICLES, NTIMESTEPS+1);
test_write_file_attribs(file1, 1);
status = H5PartCloseFile(file1);
RETURN(status, H5PART_SUCCESS, "H5PartCloseFile");
status = H5PartCloseFile(file2);
RETURN(status, H5PART_SUCCESS, "H5PartCloseFile");
}
void test_write3(void)
{
H5PartFile *file1;
h5part_int64_t status;
TEST( "Opening file once, write-truncate, lustre filesyste, "
"MPI-POSIX VFD, 64KB alignment");
file1 = OPENALIGN(FILENAME,
H5PART_WRITE | H5PART_VFD_MPIPOSIX | H5PART_FS_LUSTRE,
65536);
test_is_valid(file1);
TEST("Redefining step name");
status = H5PartDefineStepName(file1, LONGSTEPNAME, 16);
RETURN(status, H5PART_SUCCESS, "H5PartDefineStepName");
test_write_strided_data64(file1, NPARTICLES, 0);
test_write_file_attribs(file1, 0);
status = H5PartCloseFile(file1);
RETURN(status, H5PART_SUCCESS, "H5PartCloseFile");
}
void test_write4(void)
{
H5PartFile *file1;
H5PartFile *file2;
h5part_int64_t status;
TEST( "Opening file twice, write-append + read-only, "
"lustre filesystem, MPI-IO Independent VFD, 64K alignment");
file1 = OPENALIGN(FILENAME,
H5PART_APPEND | H5PART_VFD_MPIIO_IND | H5PART_FS_LUSTRE,
65536);
test_is_valid(file1);
file2 = OPENALIGN(FILENAME,
H5PART_READ | H5PART_VFD_MPIIO_IND | H5PART_FS_LUSTRE,
65536);
test_is_valid(file2);
TEST("Redefining step name");
status = H5PartDefineStepName(file1, LONGSTEPNAME, 16);
RETURN(status, H5PART_SUCCESS, "H5PartDefineStepName");
status = H5PartDefineStepName(file2, LONGSTEPNAME, 16);
RETURN(status, H5PART_SUCCESS, "H5PartDefineStepName");
test_write_data64(file1, NPARTICLES, NTIMESTEPS);
test_write_file_attribs(file1, 1);
status = H5PartCloseFile(file1);
RETURN(status, H5PART_SUCCESS, "H5PartCloseFile");
status = H5PartCloseFile(file2);
RETURN(status, H5PART_SUCCESS, "H5PartCloseFile");
}
+509
View File
@@ -0,0 +1,509 @@
/*
* File: H5BlockBench.c
* Author: Mark Howison
* Created: 10-17-2008
* Description: Benchmark application for H5Block, with similar
* functionality to IOR.
*/
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <mpi.h>
#include <H5Part.h>
#include <H5Block.h>
#define VERBOSITY_LOW 1
#define VERBOSITY_MEDIUM 3
#define VERBOSITY_HIGH 5
#define ONE_MEGABYTE 1048576.0
#ifdef PARALLEL_IO
/* Parameters ***********************************************************/
struct Params {
int rank; // MPI
int procs; // MPI
int segments; // number of segments (i.e. time steps)
int repetitions; // number of times to repeat the test
int read; // enable read test
int write; // enable write test
int nofillvals; // disable fill values in HDF5
int verbosity; // verbosity level
char* filename; // path to the test file
char flags; // file open flags
double aggregate_size; // aggregate size in MB
h5part_int64_t alignment; // HDF5 alignment in bytes
h5part_int64_t block_size; // size of the block data
h5part_int64_t bdims[3]; // block dimensions
h5part_int64_t cdims[3]; // chunk dimensions
h5part_int64_t layout[6]; // H5Block layout
};
typedef struct Params Params;
/************************************************************************/
/* Argument helper functions */
/************************************************************************/
void print_usage ()
{
printf ("Usage:\n");
printf (" -a\talignment in bytes [1048576]\n");
printf (" -b\tblock dimensions [64 64 64]\n");
printf (" -c\tchunk dimentions [0 0 0]\n");
printf (" -i\trepetitions [1]\n");
printf (" -n\tHDF5 no fill [0]\n");
printf (" -o\toutput dir [output]\n");
printf (" -r\tperform read test [0]\n");
printf (" -s\tsegments [1]\n");
printf (" -v\tverbosity level [1]\n");
printf (" -w\tpreform write test [0]\n");
printf (" -lustre\tenable lustre-specific tuning\n");
printf (" -posix\tuse the MPI-POSIX VFD\n");
}
void parse_args (int argc, char** argv, Params* p)
{
int i;
if (argc < 2) {
if (p->rank == 0) print_usage();
MPI_Finalize();
exit (EXIT_SUCCESS);
}
// default values
p->bdims[0] = 64;
p->bdims[1] = 64;
p->bdims[2] = 64;
p->cdims[0] = 0;
p->cdims[1] = 0;
p->cdims[2] = 0;
p->segments = 1;
p->repetitions = 1;
p->read = 0;
p->write = 0;
p->alignment = 1048576;
p->nofillvals = 0;
p->verbosity = VERBOSITY_MEDIUM;
p->filename = "output";
p->flags = H5PART_WRITE;
i = 1;
while (i < argc)
{
// block dimensions
if (strcmp(argv[i],"-b") == 0)
{
i++;
p->bdims[0] = atoi (argv[i]);
i++;
p->bdims[1] = atoi (argv[i]);
i++;
p->bdims[2] = atoi (argv[i]);
}
// chunk dimensions
else if (strcmp(argv[i],"-c") == 0)
{
i++;
p->cdims[0] = atoi (argv[i]);
i++;
p->cdims[1] = atoi (argv[i]);
i++;
p->cdims[2] = atoi (argv[i]);
}
// segments
else if (strcmp(argv[i],"-s") == 0)
{
i++;
p->segments = atoi (argv[i]);
}
// repetitions
else if (strcmp(argv[i],"-i") == 0)
{
i++;
p->repetitions = atoi (argv[i]);
}
// read
else if (strcmp(argv[i],"-r") == 0)
{
p->read = 1;
}
// write
else if (strcmp(argv[i],"-w") == 0)
{
p->write = 1;
}
// alignment
else if (strcmp(argv[i],"-a") == 0)
{
i++;
p->alignment = atoi (argv[i]);
}
// nofillvals
else if (strcmp(argv[i],"-n") == 0)
{
p->nofillvals = 1;
}
// verbosity level
else if (strcmp(argv[i],"-v") == 0)
{
i++;
p->verbosity = atoi (argv[i]);
}
// filename
else if (strcmp(argv[i],"-o") == 0)
{
i++;
p->filename = (char*) malloc (strlen (argv[i]) + 1);
strcpy (p->filename, argv[i]);
}
else if (strcmp(argv[i],"-lustre") == 0)
{
p->flags |= H5PART_FS_LUSTRE;
}
else if (strcmp(argv[i],"-posix") == 0)
{
p->flags |= H5PART_VFD_MPIPOSIX;
}
// print usage
else if (strcmp(argv[i],"--help") == 0)
{
if (p->rank == 0) print_usage();
MPI_Finalize();
exit (EXIT_SUCCESS);
}
else
{
if (p->rank == 0) {
fprintf (stderr, "%s: unrecognized argument %s \n",
argv[0], argv[i]);
print_usage();
}
MPI_Finalize();
exit (EXIT_FAILURE);
}
i++;
}
}
/************************************************************************/
/* Layout functions */
/************************************************************************/
int nth_root_int_divisor (const int m, const int n)
{
int i, root;
double p;
p = 1.0 / (double) n;
root = (int) ceil ( pow ((double) m, p) );
for (i=root; i<=m; i++)
{
if (m % i == 0) return i;
}
return i;
}
void set_layout (Params* p)
{
int i, j, k;
int x, y, z;
x = nth_root_int_divisor (p->procs, 3);
y = nth_root_int_divisor (p->procs / x, 2);
z = p->procs / x / y;
if (p->verbosity >= VERBOSITY_HIGH && p->rank == 0) {
printf ("creating (%d,%d,%d) layout\n", x, y, z);
}
i = p->rank % x;
j = (p->rank / x) % y;
k = p->rank / (x * y);
p->layout[0] = i * p->bdims[0];
p->layout[1] = (i + 1) * p->bdims[0] - 1;
p->layout[2] = j * p->bdims[1];
p->layout[3] = (j + 1) * p->bdims[1] - 1;
p->layout[4] = k * p->bdims[2];
p->layout[5] = (k + 1) * p->bdims[2] - 1;
if (p->verbosity >= VERBOSITY_HIGH) {
printf ("rank %d: (%d,%d,%d) [%lld,%lld]x[%lld,%lld]x[%lld,%lld]\n",
p->rank, i, j, k,
(long long)p->layout[0], (long long)p->layout[1],
(long long)p->layout[2], (long long)p->layout[3],
(long long)p->layout[4], (long long)p->layout[5]);
}
}
void check_cdims (Params* p)
{
int i;
for (i=0; i<3; i++) {
if (p->bdims[i] % p->cdims[i] != 0) {
if (p->rank == 0) {
fprintf (stderr,
"Chunk dim %d does not divide block dim %d!\n",
i, i);
}
MPI_Barrier (MPI_COMM_WORLD);
exit (EXIT_FAILURE);
}
}
}
/************************************************************************/
/* Data functions */
/************************************************************************/
void create_data (float* data, Params* p)
{
int i;
if (p->verbosity >= VERBOSITY_HIGH) {
printf ("rank %d: creating random data\n", p->rank);
}
for (i=0; i<p->block_size; i++) {
data[i] = (float) random();
}
}
double write_data (float* data, int iter, Params* p)
{
int i;
double start_time;
double open_time;
double write_time;
double close_time;
double total_time;
double sum_time;
double open_mean;
double write_mean;
double close_mean;
double bandwidth;
float* segment;
char* filename;
H5PartFile* file;
h5part_int64_t status;
if (p->verbosity >= VERBOSITY_HIGH) {
printf ("rank %d: writing data\n", p->rank);
}
start_time = MPI_Wtime();
filename = (char*) malloc (strlen (p->filename) + 64);
sprintf (filename, "%s/%d.h5", p->filename, iter);
file = H5PartOpenFileParallelAlign (filename,
p->flags, MPI_COMM_WORLD, p->alignment);
if (!file) {
fprintf (stderr,
"rank %d: could not open H5Part file!\n", p->rank);
MPI_Barrier (MPI_COMM_WORLD);
exit (EXIT_FAILURE);
}
open_time = MPI_Wtime() - start_time;
if (p->cdims[0] > 0 && p->cdims[1] > 0 && p->cdims[2] > 0) {
status = H5BlockDefine3DChunkDims (file,
p->cdims[0], p->cdims[1], p->cdims[2]);
if (status != H5PART_SUCCESS) {
fprintf (stderr,
"rank %d: H5Block chunk error!", p->rank);
}
}
status = H5BlockDefine3DFieldLayout (file,
p->layout[0], p->layout[1],
p->layout[2], p->layout[3],
p->layout[4], p->layout[5]);
if (status != H5PART_SUCCESS) {
fprintf (stderr,
"rank %d: H5Block layout error!", p->rank);
}
segment = data;
for (i=0; i<p->segments; i++) {
status = H5PartSetStep (file, i);
if (status != H5PART_SUCCESS) {
fprintf (stderr, "rank %d: H5PartSetStep error!", p->rank);
}
status = H5Block3dWriteScalarFieldFloat32 (file, "test", segment);
if (status != H5PART_SUCCESS) {
fprintf (stderr, "rank %d: H5Block write error!", p->rank);
}
segment += p->block_size;
}
write_time = (MPI_Wtime() - start_time) - open_time;
H5PartCloseFile (file);
close_time = (MPI_Wtime() - start_time) - write_time - open_time;
total_time = open_time + write_time + close_time;
if (p->verbosity >= VERBOSITY_HIGH) {
printf ("rank %d: write\t%.3f\t%.3f\t%.3f\t%.3f\n", p->rank,
open_time, write_time, close_time, total_time);
}
MPI_Barrier (MPI_COMM_WORLD);
MPI_Reduce (&open_time, &sum_time, 1, MPI_DOUBLE,
MPI_SUM, 0, MPI_COMM_WORLD);
open_mean = sum_time / p->procs;
MPI_Reduce (&write_time, &sum_time, 1, MPI_DOUBLE,
MPI_SUM, 0, MPI_COMM_WORLD);
write_mean = sum_time / p->procs;
MPI_Reduce (&close_time, &sum_time, 1, MPI_DOUBLE,
MPI_SUM, 0, MPI_COMM_WORLD);
close_mean = sum_time / p->procs;
bandwidth = p->aggregate_size / total_time;
if (p->verbosity >= VERBOSITY_MEDIUM && p->rank == 0) {
printf ("write\t%.1f\t%.3f\t%.3f\t%.3f\t%.3f\n", bandwidth,
open_mean, write_mean, close_mean, total_time);
}
return bandwidth;
}
/************************************************************************/
/* Main procedure */
/************************************************************************/
int main (int argc, char** argv)
{
int i;
Params p;
float* data;
double chunk_size;
double data_size;
double bandwidth;
double write_max;
double write_min;
double write_mean;
double read_max;
double read_min;
double read_mean;
time_t rawtime;
struct tm * timeinfo;
// initialize MPI
MPI_Init (&argc, &argv);
MPI_Comm_rank (MPI_COMM_WORLD, &p.rank);
MPI_Comm_size (MPI_COMM_WORLD, &p.procs);
parse_args (argc, argv, &p);
//check_cdims (&p);
H5PartSetVerbosityLevel (p.verbosity);
if (p.verbosity >= VERBOSITY_MEDIUM && p.rank == 0) {
time (&rawtime);
timeinfo = localtime (&rawtime);
printf ("Started: %s", asctime (timeinfo));
printf ("Command line:\n");
for (i=0; i<argc; i++) {
printf ("%s ",argv[i]);
}
printf ("\n");
}
p.block_size = p.bdims[0]*p.bdims[1]*p.bdims[2];
chunk_size = p.cdims[0]*p.cdims[1]*p.cdims[2] * sizeof(float);
chunk_size /= ONE_MEGABYTE;
data_size = p.segments * p.block_size * sizeof(float);
data_size /= ONE_MEGABYTE;
p.aggregate_size = p.procs * data_size;
set_layout (&p);
if (p.verbosity >= VERBOSITY_MEDIUM && p.rank == 0) {
printf ("chunk_size\t\t= %.1f MB\n", chunk_size);
printf ("block_size\t\t= %.1f MB\n",
p.block_size * sizeof(float) / 1048576.0);
printf (" x %5d segment(s)\t= %.1f MB per proc\n",
p.segments, data_size);
printf (" x %5d procs\t\t= %.1f MB aggregate\n",
p.procs, p.aggregate_size);
}
if (p.verbosity >= VERBOSITY_HIGH) {
printf ("rank %d: mallocing block data\n", p.rank);
}
data = (float*) malloc (p.segments * p.block_size * sizeof(float));
if (!data) {
fprintf (stderr,
"rank %d: could not malloc block data!\n", p.rank);
MPI_Barrier (MPI_COMM_WORLD);
exit (EXIT_FAILURE);
}
if (p.verbosity >= VERBOSITY_MEDIUM && p.rank == 0) {
printf ("access\tbw\topen\twr/rd\tclose\ttotal\n");
printf ("(wr/rd)\t(MB/s)\t(s)\t(s)\t(s)\t(s)\n");
printf ("------\t--\t----\t-----\t-----\t-----\n");
}
write_max = 0.0;
write_min = 10e300;
for (i=0; i<p.repetitions; i++) {
create_data (data, &p);
MPI_Barrier (MPI_COMM_WORLD);
if (p.write) {
bandwidth = write_data (data, i, &p);
if (bandwidth > write_max) write_max = bandwidth;
if (bandwidth < write_min) write_min = bandwidth;
write_mean += bandwidth;
}
}
write_mean /= p.repetitions;
if (p.verbosity >= VERBOSITY_LOW && p.rank == 0) {
printf ("********************************\n");
printf ("** Aggregate Bandwidth (MB/s) **\n");
printf ("access max min mean \n");
printf ("------ --- --- ---- \n");
if (p.write) {
printf ("write\t%.1f\t%.1f\t%.1f\n",
write_max, write_min, write_mean);
}
if (p.read) {
printf ("read\t%.1f\t%.1f\t%.1f\n",
read_max, read_min, read_mean);
}
printf ("********************************\n");
time (&rawtime);
timeinfo = localtime (&rawtime);
printf ("Finished: %s", asctime (timeinfo));
}
if (p.verbosity >= VERBOSITY_HIGH) {
printf ("rank %d: Exiting!\n", p.rank);
}
MPI_Finalize();
return (EXIT_SUCCESS);
}
#else
#error This file only works when PARALLEL_IO is enabled.
#endif
+412
View File
@@ -0,0 +1,412 @@
/*
* File: H5PartBench.c
* Author: Mark Howison
* Created: 11-29-2008
* Description: Benchmark application for H5Part, with similar
* functionality to IOR.
*/
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <mpi.h>
#include <H5Part.h>
#define VERBOSITY_LOW 1
#define VERBOSITY_MEDIUM 3
#define VERBOSITY_HIGH 5
#define ONE_MEGABYTE 1048576.0
#ifdef PARALLEL_IO
/* Parameters ***********************************************************/
struct Params {
int rank; // MPI
int procs; // MPI
int segments; // number of segments (i.e. time steps)
int repetitions; // number of times to repeat the test
int read; // enable read test
int write; // enable write test
int nofillvals; // disable fill values in HDF5
int verbosity; // verbosity level
char* filename; // path to the test file
char flags; // file open flags
double aggregate_size; // aggregate size in MB
h5part_int64_t alignment; // HDF5 alignment in bytes
h5part_int64_t particles; // number of particles to write per block
h5part_int64_t blocks; // number of blocks to write per segment
};
typedef struct Params Params;
/************************************************************************/
/* Argument helper functions */
/************************************************************************/
void print_usage ()
{
printf ("Usage:\n");
printf (" -a\talignment in bytes\n");
printf (" -b\tblocks per segment (i.e. chunks per timestep)\n");
printf (" -i\trepetitions\n");
printf (" -n\tHDF5 no fill\n");
printf (" -o\toutput dir\n");
printf (" -p\tparticles per block\n");
printf (" -r\tperform read test\n");
printf (" -s\tsegments (i.e. H5Part timesteps)\n");
printf (" -v\tverbosity level\n");
printf (" -w\tpreform write test\n");
printf (" -lustre\tenable lustre-specific tuning\n");
printf (" -posix\tuse the MPI-POSIX VFD\n");
}
void parse_args (int argc, char** argv, Params* p)
{
int i;
if (argc < 2) {
if (p->rank == 0) print_usage();
MPI_Finalize();
exit (EXIT_SUCCESS);
}
// default values
p->blocks = 1;
p->particles = 262144;
p->segments = 1;
p->repetitions = 1;
p->read = 0;
p->write = 0;
p->alignment = 1048576;
p->nofillvals = 0;
p->verbosity = VERBOSITY_MEDIUM;
p->filename = "output";
p->flags = H5PART_WRITE;
i = 1;
while (i < argc)
{
// blocks
if (strcmp(argv[i],"-b") == 0)
{
i++;
p->blocks = atoi (argv[i]);
}
// particles
else if (strcmp(argv[i],"-p") == 0)
{
i++;
p->particles = atoi (argv[i]);
}
// segments
else if (strcmp(argv[i],"-s") == 0)
{
i++;
p->segments = atoi (argv[i]);
}
// repetitions
else if (strcmp(argv[i],"-i") == 0)
{
i++;
p->repetitions = atoi (argv[i]);
}
// read
else if (strcmp(argv[i],"-r") == 0)
{
p->read = 1;
}
// write
else if (strcmp(argv[i],"-w") == 0)
{
p->write = 1;
}
// alignment
else if (strcmp(argv[i],"-a") == 0)
{
i++;
p->alignment = atoi (argv[i]);
}
// nofillvals
else if (strcmp(argv[i],"-n") == 0)
{
p->nofillvals = 1;
}
// verbosity level
else if (strcmp(argv[i],"-v") == 0)
{
i++;
p->verbosity = atoi (argv[i]);
}
// filename
else if (strcmp(argv[i],"-o") == 0)
{
i++;
p->filename = (char*) malloc (strlen (argv[i]) + 1);
strcpy (p->filename, argv[i]);
}
else if (strcmp(argv[i],"-lustre") == 0)
{
p->flags |= H5PART_FS_LUSTRE;
}
else if (strcmp(argv[i],"-posix") == 0)
{
p->flags |= H5PART_VFD_MPIPOSIX;
}
// print usage
else if (strcmp(argv[i],"--help") == 0)
{
if (p->rank == 0) print_usage();
MPI_Finalize();
exit (EXIT_SUCCESS);
}
else
{
if (p->rank == 0) {
fprintf (stderr, "%s: unrecognized argument %s \n",
argv[0], argv[i]);
print_usage();
}
MPI_Finalize();
exit (EXIT_FAILURE);
}
i++;
}
}
/************************************************************************/
/* Data functions */
/************************************************************************/
void create_data (float* data, Params* p)
{
int i;
if (p->verbosity >= VERBOSITY_HIGH) {
printf ("rank %d: creating random data\n", p->rank);
}
for (i=0; i<(p->blocks * p->particles); i++) {
data[i] = (float) random();
}
}
double write_data (float* data, int iter, Params* p)
{
int i,j;
double start_time;
double open_time;
double write_time;
double close_time;
double total_time;
double sum_time;
double open_mean;
double write_mean;
double close_mean;
double bandwidth;
float* segment;
char var_name[64];
char* filename;
H5PartFile* file;
h5part_int64_t status;
if (p->verbosity >= VERBOSITY_HIGH) {
printf ("rank %d: writing data\n", p->rank);
}
start_time = MPI_Wtime();
filename = (char*) malloc (strlen (p->filename) + 64);
sprintf (filename, "%s/%d.h5", p->filename, iter);
file = H5PartOpenFileParallelAlign (filename,
p->flags, MPI_COMM_WORLD, p->alignment);
if (!file) {
fprintf (stderr,
"rank %d: could not open H5Part file!\n", p->rank);
MPI_Barrier (MPI_COMM_WORLD);
exit (EXIT_FAILURE);
}
H5PartSetNumParticles (file, p->particles);
if (p->verbosity >= VERBOSITY_HIGH) {
printf ("rank %d: %ld particles\n", p->rank, p->particles);
}
open_time = MPI_Wtime() - start_time;
segment = data;
for (i=1; i<=p->segments; i++) {
status = H5PartSetStep (file, i);
if (status != H5PART_SUCCESS) {
fprintf (stderr, "rank %d: H5PartSetStep error!", p->rank);
}
for (j=0; j<p->blocks; j++) {
sprintf (var_name, "test%d", j);
status = H5PartWriteDataFloat32 (file, var_name, segment);
if (status != H5PART_SUCCESS) {
fprintf (stderr,
"rank %d: H5PartWriteDataFloat32 error!", p->rank);
}
segment += p->particles;
}
}
write_time = (MPI_Wtime() - start_time) - open_time;
H5PartCloseFile (file);
close_time = (MPI_Wtime() - start_time) - write_time - open_time;
total_time = open_time + write_time + close_time;
if (p->verbosity >= VERBOSITY_HIGH) {
printf ("rank %d: write\t%.3f\t%.3f\t%.3f\t%.3f\n", p->rank,
open_time, write_time, close_time, total_time);
}
MPI_Barrier (MPI_COMM_WORLD);
MPI_Reduce (&open_time, &sum_time, 1, MPI_DOUBLE,
MPI_SUM, 0, MPI_COMM_WORLD);
open_mean = sum_time / p->procs;
MPI_Reduce (&write_time, &sum_time, 1, MPI_DOUBLE,
MPI_SUM, 0, MPI_COMM_WORLD);
write_mean = sum_time / p->procs;
MPI_Reduce (&close_time, &sum_time, 1, MPI_DOUBLE,
MPI_SUM, 0, MPI_COMM_WORLD);
close_mean = sum_time / p->procs;
bandwidth = p->aggregate_size / total_time;
if (p->verbosity >= VERBOSITY_MEDIUM && p->rank == 0) {
printf ("write\t%.1f\t%.3f\t%.3f\t%.3f\t%.3f\n", bandwidth,
open_mean, write_mean, close_mean, total_time);
}
free (filename);
return bandwidth;
}
/************************************************************************/
/* Main procedure */
/************************************************************************/
int main (int argc, char** argv)
{
int i;
Params p;
float* data;
double block_size;
double data_size;
double bandwidth;
double write_max;
double write_min;
double write_mean;
double read_max;
double read_min;
double read_mean;
time_t rawtime;
struct tm * timeinfo;
// initialize MPI
MPI_Init (&argc, &argv);
MPI_Comm_rank (MPI_COMM_WORLD, &p.rank);
MPI_Comm_size (MPI_COMM_WORLD, &p.procs);
parse_args (argc, argv, &p);
H5PartSetVerbosityLevel (p.verbosity);
if (p.verbosity >= VERBOSITY_MEDIUM && p.rank == 0) {
time (&rawtime);
timeinfo = localtime (&rawtime);
printf ("Started: %s", asctime (timeinfo));
printf ("Command line:\n");
for (i=0; i<argc; i++) {
printf ("%s ",argv[i]);
}
printf ("\n");
}
block_size = p.particles * sizeof(float);
block_size /= ONE_MEGABYTE;
data_size = p.segments * p.blocks * block_size;
p.aggregate_size = p.procs * data_size;
if (p.verbosity >= VERBOSITY_MEDIUM && p.rank == 0) {
printf ("block_size\t\t= %.1f MB\n", block_size);
printf ("segment_size\t\t= %.1f MB\n",
p.blocks * block_size);
printf (" x %5d segment(s)\t= %.1f MB per proc\n",
p.segments, data_size);
printf (" x %5d procs\t\t= %.1f MB aggregate\n",
p.procs, p.aggregate_size);
}
if (p.verbosity >= VERBOSITY_HIGH) {
printf ("rank %d: mallocing block data\n", p.rank);
}
data = (float*) malloc (p.segments * p.blocks * p.particles
* sizeof(float));
if (!data) {
fprintf (stderr,
"rank %d: could not malloc block data!\n", p.rank);
MPI_Barrier (MPI_COMM_WORLD);
exit (EXIT_FAILURE);
}
if (p.verbosity >= VERBOSITY_MEDIUM && p.rank == 0) {
printf ("access\tbw\topen\twr/rd\tclose\ttotal\n");
printf ("(wr/rd)\t(MB/s)\t(s)\t(s)\t(s)\t(s)\n");
printf ("------\t--\t----\t-----\t-----\t-----\n");
}
write_max = 0.0;
write_min = 10e300;
for (i=0; i<p.repetitions; i++) {
create_data (data, &p);
MPI_Barrier (MPI_COMM_WORLD);
if (p.write) {
bandwidth = write_data (data, i, &p);
if (bandwidth > write_max) write_max = bandwidth;
if (bandwidth < write_min) write_min = bandwidth;
write_mean += bandwidth;
}
}
write_mean /= p.repetitions;
if (p.verbosity >= VERBOSITY_LOW && p.rank == 0) {
printf ("********************************\n");
printf ("** Aggregate Bandwidth (MB/s) **\n");
printf ("access max min mean \n");
printf ("------ --- --- ---- \n");
if (p.write) {
printf ("write\t%.1f\t%.1f\t%.1f\n",
write_max, write_min, write_mean);
}
if (p.read) {
printf ("read\t%.1f\t%.1f\t%.1f\n",
read_max, read_min, read_mean);
}
printf ("********************************\n");
time (&rawtime);
timeinfo = localtime (&rawtime);
printf ("Finished: %s", asctime (timeinfo));
}
if (p.verbosity >= VERBOSITY_HIGH) {
printf ("rank %d: Exiting!\n", p.rank);
}
MPI_Finalize();
return (EXIT_SUCCESS);
}
#else
#error This file only works when PARALLEL_IO is enabled.
#endif
+18 -69
View File
@@ -1,83 +1,32 @@
# tools level Makefile.am
# PATH SETTING
HDF5ROOT = @HDF5ROOT@
OBJEXT=o
# COMPILER SETTING
CXX = @CXX@
TOOLS_CXX = @TOOLS_CXX@
HDFLIB = -L@HDF5ROOT@/lib -lhdf5 -lz @SZLIB@
LIBS = -L@H5P_LIB_LOC@ -lH5Part $(HDFLIB) -lm @STDCXX@
# COMPILER FLAG SETTING
CFLAGS = @CFLAGS@
# # -L$(HDF5ROOT)/lib -lhdf5
# LIBRARIES
SZLIB = @SZLIB@
HDFLIB = @TOOLS_HDFLIB@ -lz $(SZLIB)
LIBS = $(HDFLIB) $(MPILIB) -lm @STDCXX@ @LDFLAGS@
# H5Part compiled library location
# H5PLIB = -L@prefix@/lib
H5PLIB = -L@H5P_LIB_LOC@ @TOOLS_H5PART_LIB@
# INCLUDES
HDFINC = -I$(HDF5ROOT)/include
INC = $(HDFINC) $(H5PINC) $(MPIINC)
# H5Part header file location
# H5PINC = -I@prefix@/include
H5PINC = -I@H5P_LIB_LOC@
INCLUDES = -I@H5P_LIB_LOC@ -I@HDF5ROOT@/include @MPIINC@
# What to build... make install will place these files in the $(prefix)/bin directory.
bin_PROGRAMS = @BUILD_TOOLS@
# Listing of all programs that maybe built. (Has to know statically...)
EXTRA_PROGRAMS = h5pAttrib h5pToGNUplot # homdynToH5p
# Extra files that I wish to include in the dist tar ball.
EXTRA_DIST = h5pAttrib.cc h5pToGNUplot.cc## TO BE TAILORED LATER...
EXTRA_PROGRAMS = h5pAttrib \
h5pToGNUplot \
homdynToH5p \
H5PartBench \
H5BlockBench
# Listing of sources
h5pAttrib_SOURCES = h5pAttrib.cc
h5pAttrib_SOURCES = h5pAttrib.cc
h5pToGNUplot_SOURCES = h5pToGNUplot.cc
homdynToH5p_SOURCES = homdynToH5p.cc
H5PartBench_SOURCES = H5PartBench.c
H5BlockBench_SOURCES = H5BlockBench.c
h5pToGNUplot_SOURCES = h5pToGNUplot.cc
.o.cc:
$(CXX) $(CFLAGS) $(INCLUDES) -c $<
#homdynToH5p_SOURCES = homdynToH5p.cc
.o.c:
$(CC) $(CFLAGS) $(INCLUDES) -c $<
# Specific building instruction (What compilers to use...)
# ------------ Build Tools ------------
h5pAttrib: h5pAttrib.o
$(TOOLS_CXX) -o h5pAttrib h5pAttrib.o $(H5PLIB) $(LIBS)
h5pAttrib.o: h5pAttrib.cc
$(TOOLS_CXX) $(CFLAGS) $(INC) -g -c h5pAttrib.cc
h5pToGNUplot: h5pToGNUplot.o
$(TOOLS_CXX) -o h5pToGNUplot h5pToGNUplot.o $(H5PLIB) $(LIBS)
h5pToGNUplot.o: h5pToGNUplot.cc
$(TOOLS_CXX) $(CFLAGS) $(INC) -g -c $<
homdynToH5p : homdynToH5p.o
$(TOOLS_CXX) -o $@ $< $(H5PLIB) $(LIBS)
homdynToH5p.o: homdynToH5p.cc
$(TOOLS_CXX) $(CFLAGS) $(INC) -g -c $<
clean:
rm -f *~ *.o h5pAttrib h5pToGNUplot
distclean: clean
rm -rf .deps
rm -rf Makefile
# # bash-3.00$ /usr/bin/mpcc_r -g -O2 -I/scratch/scratchdirs/cristina/hdf5/hdf5_par/include -I/u2/antino/trunk/src -c h5pAttrib.cc
# # bash-3.00$ /usr/bin/mpcc_r -o h5pAttrib h5pAttrib.o -L/u2/antino/trunk/src -lpH5Part -L/scratch/scratchdirs/cristina/hdf5/hdf5_par/lib -lhdf5 -lz -lm
#####################################################################################################################