header files and documentation reorganized

This commit is contained in:
2016-03-18 16:37:13 +01:00
parent c5a05a1261
commit 3f7c84dbf5
21 changed files with 1252 additions and 1145 deletions
+7 -649
View File
@@ -10,662 +10,20 @@
#ifndef __H5_H
#define __H5_H
#include <string.h>
#include "H5_model.h"
#include "H5_attribs.h"
/**
\ingroup h5_c_api
\addtogroup h5_file
@{
*/
#ifdef __cplusplus
extern "C" {
#endif
#if H5HUT_API_VERSION == 2
#define H5OpenFile2 H5OpenFile
#define H5SetVerbosityLevel2 H5SetVerbosityLevel
#elif H5HUT_API_VERSION == 1
#define H5OpenFile1 H5OpenFile
#define H5SetVerbosityLevel1 H5SetVerbosityLevel
#endif
/**
Create a new, empty file property list.
File property lists are used to control optional behavior like file
creation, file access, dataset creation, dataset transfer. File
property lists are attached to file handles while opened with \ref
H5OpenFile().
\return empty file property list
\return \c H5_FAILURE on error
\see H5SetPropFileMPIO()
\see H5SetPropFileMPIOCollective()
\see H5SetPropFileMPIOIndependent()
\see H5SetPropFileMPIOPosix() (HDF5 <= 1.8.12 only)
\see H5SetPropFileCoreVFD()
\see H5SetPropFileAlign()
\see H5SetPropFileThrottle()
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_prop_t
H5CreateFileProp (
void
) {
H5_API_ENTER (h5_prop_t, "%s", "");
H5_API_RETURN (h5_create_prop (H5_PROP_FILE));
}
/**
Stores MPI IO communicator information to given file property list. If used in
\ref H5OpenFile(), MPI collective IO will be used.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
\see H5SetPropFileMPIOIndependent()
\see H5SetPropFileMPIOPosix() (HDF5 <= 1.8.12 only)
\see H5SetPropFileCoreVFD()
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_err_t
H5SetPropFileMPIOCollective (
h5_prop_t prop, ///< [in,out] identifier for file property list
MPI_Comm* comm ///< [in] MPI communicator
) {
H5_API_ENTER (h5_err_t, "prop=%p, comm=%p", (void*)prop, comm);
H5_API_RETURN (h5_set_prop_file_mpio_collective (prop, comm));
}
/**
Stores MPI IO communicator information to given file property list. If used in
\ref H5OpenFile(), MPI independent IO will be used.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
\see H5SetPropFileMPIOCollective()
\see H5SetPropFileMPIOPosix() (HDF5 <= 1.8.12 only)
\see H5SetPropFileCoreVFD()
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_err_t
H5SetPropFileMPIOIndependent (
h5_prop_t prop, ///< [in,out] identifier for file property list
MPI_Comm* comm ///< [in] MPI communicator
) {
H5_API_ENTER (h5_err_t, "prop=%p, comm=%p", (void*)prop, comm);
H5_API_RETURN (h5_set_prop_file_mpio_independent (prop, comm));
}
#if H5_VERSION_LE(1,8,12)
/**
Stores MPI IO communicator information to given file property list. If used in
\ref H5OpenFile(), MPI POSIX IO will be used.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
\see H5SetPropFileMPIOCollective()
\see H5SetPropFileMPIOIndependent()
\see H5SetPropFileCoreVFD()
\note This function is available only, if H5hut has been compiled with
HDF5 1.8.12 or older.
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_err_t
H5SetPropFileMPIOPosix (
h5_prop_t prop, ///< [in,out] identifier for file property list
MPI_Comm* comm ///< [in] MPI communicator
) {
H5_API_ENTER (h5_err_t, "prop=%p, comm=%p", (void*)prop, comm);
H5_API_RETURN (h5_set_prop_file_mpio_posix (prop, comm));
}
#endif
/**
Modifies the file property list to use the \c H5FD_CORE driver. The
\c H5FD_CORE driver enables an application to work with a file in memory.
File contents are stored only in memory until the file is closed.
The increment by which allocated memory is to be increased each time more
memory is required, must be specified with \c increment.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_err_t
H5SetPropFileCoreVFD (
h5_prop_t prop, ///< [in,out] identifier for file property list
h5_int64_t increment ///< [in] size, in bytes, of memory increments.
) {
H5_API_ENTER (h5_err_t, "prop=%p", (void*)prop);
H5_API_RETURN (h5_set_prop_file_core_vfd (prop, increment));
}
/**
Sets alignment properties of a file property list so that any file
object greater than or equal in size to threshold bytes will be
aligned on an address which is a multiple of alignment. The
addresses are relative to the end of the user block; the alignment
is calculated by subtracting the user block size from the absolute
file address and then adjusting the address to be a multiple of
alignment.
Default values for alignment is one, implying no
alignment. Generally the default value result in the best
performance for single-process access to the file. For MPI IO and
other parallel systems, choose an alignment which is a multiple of
the disk block size.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
\see H5SetPropFileCoreVFD()
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_err_t
H5SetPropFileAlign (
h5_prop_t prop, ///< [in,out] identifier for file property list
h5_int64_t align ///< [in] alignment
) {
H5_API_ENTER (h5_err_t, "prop=%p, align=%lld",
(void*)prop, (long long int)align);
H5_API_RETURN (h5_set_prop_file_align (prop, align));
}
/**
Set the `throttle` factor, which causes HDF5 write and read
calls to be issued in that number of batches.
This can prevent large concurrency parallel applications that
use independent writes from overwhelming the underlying
parallel file system.
Throttling only works with the H5_VFD_MPIO_POSIX or
H5_VFD_MPIO_INDEPENDENT drivers and is only available in
the parallel library.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_err_t
H5SetPropFileThrottle (
h5_prop_t prop, ///< [in,out] identifier for file property list
h5_int64_t throttle ///< [in] throttle factor
) {
H5_API_ENTER (h5_err_t, "prop=%p, throttle=%lld",
(void*)prop, (long long int)throttle);
H5_API_RETURN (h5_set_prop_file_throttle (prop, throttle));
}
/**
Close file property list.
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_err_t
H5CloseProp (
h5_prop_t prop ///< [in] identifier for file property list
) {
H5_API_ENTER (h5_err_t, "prop=%p", (void*)prop);
H5_API_RETURN (h5_close_prop (prop));
}
/**
Open file with name \c filename.
File mode flags are:
- \c H5_O_RDONLY: Only reading allowed
- \c H5_O_WRONLY: create new file, dataset must not exist
- \c H5_O_APPENDONLY: allows to append new data to an existing file
- \c H5_O_RDWR: dataset may exist
- \c H5_FS_LUSTRE: enable optimizations for the Lustre file system
- \c H5_VFD_MPIO_POSIX: use the HDF5 MPI-POSIX virtual file driver
- \c H5_VFD_MPIO_INDEPENDENT: use MPI-IO in indepedent mode
The file is opened with the properties set in the file property list
\c prop. This argument can also be set to \c H5_PROP_DEFAULT to use
reasonable default values. In this case \c MPI_COMM_WORLD will be
used as MPI communicator in a parallel execution environment.
The typical file extension is \c .h5.
\return File handle
\return \c H5_FAILURE on error
\see H5CreateFileProp()
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | API changed, old implementation is available as \c H5OpenFile1() |
*/
static inline h5_file_t
H5OpenFile2 (
const char* filename, ///< [in] name of file
h5_int64_t mode, ///< [in] file mode
h5_prop_t props ///< [in] identifier for file property list
) {
H5_API_ENTER (h5_file_t,
"filename='%s', mode=%lld, props=%p",
filename, (long long int)mode, (void*)props);
H5_API_RETURN (h5_open_file2 (filename, mode, props));
}
/**
Open file with name \c filename.
File mode flags are:
- \c H5_O_RDONLY: Only reading allowed
- \c H5_O_WRONLY: create new file, dataset must not exist
- \c H5_O_APPENDONLY: allows to append new data to an existing file
- \c H5_O_RDWR: dataset may exist
- \c H5_FS_LUSTRE - enable optimizations for the Lustre file system
- \c H5_VFD_MPIO_POSIX - use the HDF5 MPI-POSIX virtual file driver
(hdf5 <= 1.8.12 only)
- \c H5_VFD_MPIO_INDEPENDENT - use MPI-IO in indepedent mode
In the serial version of H5hut, \c comm can be set to any value.
\return File handle.
\return (h5_file_p*)H5_FAILURE
\note This function is deprecated!
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Old implementation of \c H5OpenFile() |
*/
static inline h5_file_p
H5OpenFile1 (
const char* filename, ///< [in] file name
h5_int32_t flags, ///< [in] file open flags
MPI_Comm comm ///< [in] MPI communicator
) {
H5_API_ENTER (h5_file_p, "filename='%s', flags=%d, ...",filename,flags);
H5_API_RETURN (h5_open_file1 (filename, flags, comm, 0));
}
/**
Close file and free all memory associated with the file handle.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5CloseFile (
const h5_file_t f ///< [in] file handle.
) {
H5_API_ENTER (h5_err_t,
"f=%p",
(h5_file_p)f);
H5_API_RETURN (h5_close_file (f));
}
/**
Verify that the passed file handle is a valid H5hut file handle.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5CheckFile (
const h5_file_t f ///< [in] file handle.
) {
H5_API_ENTER (h5_err_t,
"f=%p",
(h5_file_p)f);
H5_API_RETURN (h5_check_filehandle (f));
}
/**
Flush step data to disk.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5FlushStep (
const h5_file_t f ///< [in] file handle.
) {
H5_API_ENTER (h5_err_t,
"f=%p",
(h5_file_p)f);
H5_API_RETURN (h5_flush_step (f));
}
/**
Flush all file data to disk.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5FlushFile (
const h5_file_t f ///< [in] file handle.
) {
H5_API_ENTER (h5_err_t,
"f=%p",
(h5_file_p)f);
H5_API_RETURN (h5_flush_file (f));
}
/**
Close H5hut library. This function should be called before program exit.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5Finalize (
void
) {
H5_API_ENTER (h5_err_t, "%s", "");
H5_API_RETURN (h5_close_hdf5 ());
}
///< @}
/**
\ingroup h5hut_c_api_error_handling_and_debugging
\addtogroup h5hut_verbosity
@{
*/
/**
Set verbosity level to \c level.
Verbosity levels are:
- \c H5_VERBOSE_NONE: be quiet
- \c H5_VERBOSE_ERROR: output error messages
- \c H5_VERBOSE_WARN: output error messages and warning
- \c H5_VERBOSE_INFO: output error messages, warnings and informational messages
The default verbosity level is \c H5_VERBOSE_ERROR.
\return \c H5_SUCCESS
\see H5GetVerbosityLevel()
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function cannot be used to set the debug level. |
*/
static inline h5_err_t
H5SetVerbosityLevel2 (
const h5_id_t level ///< [in] verbosity level.
) {
return h5_set_debuglevel (level & 0x03);
}
/**
Set verbosity and debug level to \p level.
Verbosity levels are:
- \c H5_VERBOSE_NONE: be quiet
- \c H5_VERBOSE_ERROR: output error messages
- \c H5_VERBOSE_WARN: output error messages and warning
- \c H5_VERBOSE_INFO: output error messages, warnings and informational messages
The default verbosity level is \c H5_VERBOSE_ERROR.
\return \c H5_SUCCESS
\see H5GetVerbosityLevel()
*/
static inline h5_err_t
H5SetVerbosityLevel1 (
const h5_id_t level ///< [in] verbosity level.
) {
return h5_set_debuglevel (level);
}
/**
Get verbosity level.
\return verbosity level
\see H5SetVerbosityLevel()
*/
static inline h5_id_t
H5GetVerbosityLevel (
void
) {
return h5_get_debuglevel () & 0x03;
}
///< @}
/**
\addtogroup h5hut_debug
@{
*/
/**
Set debug mask. The debug mask is an or'ed value of
- \c H5_DEBUG_API: C-API calls
- \c H5_DEBUG_CORE_API: core API calls.
- \c H5_DEBUG_PRIV_API: private API calls
- \c H5_DEBUG_PRIV_FUNC: static functions
- \c H5_DEBUG_HDF5: HDF5 wrapper calls
- \c H5_DEBUG_MPI: MPI wrapper calls
- \c H5_DEBUG_MALLOC: memory allocation
- \c H5_DEBUG_ALL: enable all
\return \c H5_SUCCESS
\see H5GetDebugMask()
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_err_t
H5SetDebugMask (
const h5_id_t mask ///< [in] debug mask
) {
return h5_set_debuglevel (mask & ~0x03);
}
/**
Get debug mask.
\return debug mask
\see H5SetDebugMask()
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_id_t
H5GetDebugMask (
void
) {
return (h5_get_debuglevel () & ~0x03);
}
///< @}
/**
\addtogroup h5hut_error
@{
*/
/**
Report error, do not abort program. The error must be handled in the programm.
\return \c H5_SUCCESS
\see H5SetErrorHandler()
\see H5ReportErrorhandler()
*/
static inline h5_err_t
H5ReportOnError (
void
) {
H5_API_ENTER (h5_err_t, "%s", "");
H5_API_RETURN (h5_set_errorhandler (h5_report_errorhandler));
}
/**
Abort program on error.
\return \c H5_SUCCESS
\see H5SetErrorHandler()
\see H5AbortErrorhandler()
*/
static inline h5_err_t
H5AbortOnError (
void
) {
H5_API_ENTER (h5_err_t, "%s", "");
H5_API_RETURN (h5_set_errorhandler (h5_abort_errorhandler));
}
/**
Set error handler to \c handler.
\return \c H5_SUCCESS
\see H5GetErrorHandler()
\see H5ReportErrorhandler()
\see H5AbortErrorhandler()
*/
static inline h5_err_t
H5SetErrorHandler (
h5_errorhandler_t handler ///< [in] error handler to set.
) {
H5_API_ENTER (h5_err_t, "handler=%p", handler);
H5_API_RETURN (h5_set_errorhandler (handler));
}
/**
Get current error handler.
\return Pointer to error handler.
\see H5SetErrorHandler()
\see H5ReportErrorhandler()
\see H5AbortErrorhandler()
*/
static inline h5_errorhandler_t
H5GetErrorHandler (
void
) {
H5_API_ENTER (h5_errorhandler_t, "%s", "void");
H5_API_RETURN (h5_get_errorhandler());
}
/**
The report error handler writes a message to stderr, sets the error number
and returns.
\return \c H5_FAILURE
*/
static inline h5_err_t
H5ReportErrorhandler (
const char* fmt, ///< [in] format string of error message.
va_list ap ///< [in] arguments to format string.
) {
return h5_report_errorhandler (fmt, ap);
}
/**
The abort error handler writes a message to stderr and exits the programm.
\return does not return.
*/
static inline h5_err_t
H5AbortErrorhandler (
const char* fmt, ///< [in] format string of error message.
va_list ap ///< [in] arguments to format string.
) {
return h5_abort_errorhandler (fmt, ap);
}
/**
Get last error code.
Error codes are:
- \c H5_ERR_BADF: Something is wrong with the file handle.
- \c H5_ERR_NOMEM: Out of memory.
- \c H5_ERR_INVAL: Invalid argument.
- \c H5_ERR_VIEW: Something is wrong with the view.
- \c H5_ERR_NOENTRY: A lookup failed.
- \c H5_ERR_MPI: A MPI error occured.
- \c H5_ERR_HDF5: A HDF5 error occured.
- \c H5_ERR_H5: Unspecified error in H5 module.
- \c H5_ERR_H5PART: Unspecified error in H5Part module.
- \c H5_ERR_H5BLOCK: Unspecified error in H5Block module.
- \c H5_ERR_H5FED: Unspecified error in H5Fed module.
- \c H5_ERR_INTERNAL: Internal error.
- \c H5_ERR_NOT_IMPLEMENTED: Function not yet implemented.
\return error code
*/
static inline h5_err_t
H5GetErrno (
void
) {
return h5_get_errno ();
}
#include "H5_file.h"
#include "H5_model.h"
#include "H5_file_attribs.h"
#include "H5_step_attribs.h"
#include "H5_log.h"
#include "H5_debug.h"
#include "H5_error.h"
#ifdef __cplusplus
}
#endif
///< @}
#endif
-1
View File
@@ -18,7 +18,6 @@
#include "h5core/h5b_attribs.h"
/**
\ingroup h5block_c_api
\addtogroup h5block_attrib
@{
*/
-1
View File
@@ -16,7 +16,6 @@
#include "h5core/h5b_io.h"
/**
\ingroup h5block_c_api
\addtogroup h5block_io
@{
*/
-1
View File
@@ -16,7 +16,6 @@
#include "h5core/h5b_model.h"
/**
\ingroup h5block_c_api
\addtogroup h5block_model
@{
*/
-1
View File
@@ -16,7 +16,6 @@
#include "h5core/h5u_io.h"
/**
\ingroup h5part_c_api
\addtogroup h5part_io
@{
*/
-1
View File
@@ -16,7 +16,6 @@
#include "h5core/h5u_model.h"
/**
\ingroup h5part_c_api
\addtogroup h5part_model
@{
*/
+2 -5
View File
@@ -8,8 +8,7 @@
!
INTERFACE
!>
!! \ingroup \h5hut_f90_api
!! \addtogroup \h5hut_file_attribs_f
!! \addtogroup \h5_file_attribs_f
!! @{
! __ _ _ _ _ _ _ _
! / _(_) | ___ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___
@@ -193,9 +192,7 @@
!> @}
!>
!! \ingroup \h5hut_f90_api
!! \addtogroup \h5hut_step_attribs_f
!> \addtogroup \h5_step_attribs_f
!! @{
! _ _ _ _ _ _
+45
View File
@@ -0,0 +1,45 @@
!
! Copyright (c) 2006-2016, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
INTERFACE
!> \addtogroup h5_debug_f
!! @{
!>
!! Set debug mask. The debug mask is an or'ed value of
!!
!! - \c H5_DEBUG_API: C-API calls
!! - \c H5_DEBUG_CORE_API: core API calls. The core API is used by the C- and Fortran API.
!! - \c H5_DEBUG_PRIV_API: private API calls
!! - \c H5_DEBUG_PRIV_FUNC: static functions
!! - \c H5_DEBUG_HDF5: HDF5 wrapper calls
!! - \c H5_DEBUG_MPI: MPI wrapper calls
!! - \c H5_DEBUG_MALLOC: memory allocation
!! - \c H5_DEBUG_ALL: enable all
!!
!! \return \c H5_SUCCESS
!!
!! \see h5_get_debug_mask()
SUBROUTINE h5_set_debug_mask ( mask )
INTEGER*9, INTEGER(IN) :: mask !< [in] debug mask
END SUBROUTINE h5_set_debug_mask
!>
!! Get debug mask.
!!
!! \return debug mask
!!
!! \see h5_set_debug_mask()
INTEGER*8 FUNCTION h5_get_debug_mask ()
END FUNCTION h5_get_debug_mask
!> @}
END INTERFACE
+69
View File
@@ -0,0 +1,69 @@
/*
Copyright (c) 2006-2016, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#ifndef __H5_DEBUG_H
#define __H5_DEBUG_H
#include "h5core/h5_types.h"
/**
\addtogroup h5_debug
@{
*/
/**
Set debug mask. The debug mask is an or'ed value of
- \c H5_DEBUG_API: C-API calls
- \c H5_DEBUG_CORE_API: core API calls.
- \c H5_DEBUG_PRIV_API: private API calls
- \c H5_DEBUG_PRIV_FUNC: static functions
- \c H5_DEBUG_HDF5: HDF5 wrapper calls
- \c H5_DEBUG_MPI: MPI wrapper calls
- \c H5_DEBUG_MALLOC: memory allocation
- \c H5_DEBUG_ALL: enable all
\return \c H5_SUCCESS
\see H5GetDebugMask()
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_err_t
H5SetDebugMask (
const h5_id_t mask ///< [in] debug mask
) {
return h5_set_debuglevel (mask & ~0x03);
}
/**
Get debug mask.
\return debug mask
\see H5SetDebugMask()
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_id_t
H5GetDebugMask (
void
) {
return (h5_get_debuglevel () & ~0x03);
}
///< @}
#endif
+54
View File
@@ -0,0 +1,54 @@
!
! Copyright (c) 2006-2016, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
INTERFACE
!> \addtogroup h5_error_f
!! @{
!>
!! Report error, do not abort program. The error must be handled in the programm.
SUBROUTINE h5_report_on_error ()
END SUBROUTINE h5_report_on_error
!>
!! Abort program on error.
SUBROUTINE h5_abort_on_error ()
END SUBROUTINE h5_abort_on_error
!>
!! Get last error code.
!!
!! Error codes are:
!!
!! - \c H5_ERR_BADF: Something is wrong with the file handle.
!! - \c H5_ERR_NOMEM: Out of memory.
!! - \c H5_ERR_INVAL: Invalid argument.
!!
!! - \c H5_ERR_VIEW: Something is wrong with the view.
!! - \c H5_ERR_NOENTRY: A lookup failed.
!!
!! - \c H5_ERR_MPI: A MPI error occured.
!! - \c H5_ERR_HDF5: A HDF5 error occured.
!! - \c H5_ERR_H5: Unspecified error in H5 module.
!! - \c H5_ERR_H5PART: Unspecified error in H5Part module.
!! - \c H5_ERR_H5BLOCK: Unspecified error in H5Block module.
!! - \c H5_ERR_H5FED: Unspecified error in H5Fed module.
!!
!! - \c H5_ERR_INTERNAL: Internal error.
!! - \c H5_ERR_NOT_IMPLEMENTED: Function not yet implemented.
!!
!! \return error code
INTEGER*8 FUNCTION h5_get_error_number ()
END FUNCTION h5_get_error_number
!> @}
END INTERFACE
+149
View File
@@ -0,0 +1,149 @@
/*
Copyright (c) 2006-2016, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#ifndef __H5_ERROR_H
#define __H5_ERROR_H
#include "h5core/h5_types.h"
#include "h5core/h5.h"
#include "h5core/h5_debug.h"
/**
\addtogroup h5_error
@{
*/
/**
Report error, do not abort program. The error must be handled in the programm.
\return \c H5_SUCCESS
\see H5SetErrorHandler()
\see H5ReportErrorhandler()
*/
static inline h5_err_t
H5ReportOnError (
void
) {
H5_API_ENTER (h5_err_t, "%s", "");
H5_API_RETURN (h5_set_errorhandler (h5_report_errorhandler));
}
/**
Abort program on error.
\return \c H5_SUCCESS
\see H5SetErrorHandler()
\see H5AbortErrorhandler()
*/
static inline h5_err_t
H5AbortOnError (
void
) {
H5_API_ENTER (h5_err_t, "%s", "");
H5_API_RETURN (h5_set_errorhandler (h5_abort_errorhandler));
}
/**
Set error handler to \c handler.
\return \c H5_SUCCESS
\see H5GetErrorHandler()
\see H5ReportErrorhandler()
\see H5AbortErrorhandler()
*/
static inline h5_err_t
H5SetErrorHandler (
h5_errorhandler_t handler ///< [in] error handler to set.
) {
H5_API_ENTER (h5_err_t, "handler=%p", handler);
H5_API_RETURN (h5_set_errorhandler (handler));
}
/**
Get current error handler.
\return Pointer to error handler.
\see H5SetErrorHandler()
\see H5ReportErrorhandler()
\see H5AbortErrorhandler()
*/
static inline h5_errorhandler_t
H5GetErrorHandler (
void
) {
H5_API_ENTER (h5_errorhandler_t, "%s", "void");
H5_API_RETURN (h5_get_errorhandler());
}
/**
The report error handler writes a message to stderr, sets the error number
and returns.
\return \c H5_FAILURE
*/
static inline h5_err_t
H5ReportErrorhandler (
const char* fmt, ///< [in] format string of error message.
va_list ap ///< [in] arguments to format string.
) {
return h5_report_errorhandler (fmt, ap);
}
/**
The abort error handler writes a message to stderr and exits the programm.
\return does not return.
*/
static inline h5_err_t
H5AbortErrorhandler (
const char* fmt, ///< [in] format string of error message.
va_list ap ///< [in] arguments to format string.
) {
return h5_abort_errorhandler (fmt, ap);
}
/**
Get last error code.
Error codes are:
- \c H5_ERR_BADF: Something is wrong with the file handle.
- \c H5_ERR_NOMEM: Out of memory.
- \c H5_ERR_INVAL: Invalid argument.
- \c H5_ERR_VIEW: Something is wrong with the view.
- \c H5_ERR_NOENTRY: A lookup failed.
- \c H5_ERR_MPI: A MPI error occured.
- \c H5_ERR_HDF5: A HDF5 error occured.
- \c H5_ERR_H5: Unspecified error in H5 module.
- \c H5_ERR_H5PART: Unspecified error in H5Part module.
- \c H5_ERR_H5BLOCK: Unspecified error in H5Block module.
- \c H5_ERR_H5FED: Unspecified error in H5Fed module.
- \c H5_ERR_INTERNAL: Internal error.
- \c H5_ERR_NOT_IMPLEMENTED: Function not yet implemented.
\return error code
*/
static inline h5_err_t
H5GetErrno (
void
) {
return h5_get_errno ();
}
///< @}
#endif
+1 -116
View File
@@ -7,8 +7,7 @@
! License: see file COPYING in top level of source distribution.
!
INTERFACE
!> \ingroup h5hut_f90_api
!! \addtogroup h5hut_file_f
!> \addtogroup h5_file_f
!! @{
!>
@@ -251,118 +250,4 @@
END FUNCTION h5_finalize
!> @}
!> \ingroup h5hut_f90_api_error_handling_and_debugging
!! \addtogroup h5hut_verbosity_f
!! @{
!>
!! Set verbosity level to \c level.
!!
!! Verbosity levels are:
!! - \c H5_VERBOSE_NONE: be quiet
!! - \c H5_VERBOSE_ERROR: output error messages
!! - \c H5_VERBOSE_WARN: output error messages and warning
!! - \c H5_VERBOSE_INFO: output error messages, warnings and informational messages
!!
!! The default verbosity level ist \c H5_VERBOSE_ERROR.
!!
!! \return \c H5_SUCCESS
!!
!! \see h5_get_verbosity_level()
SUBROUTINE h5_set_verbosity_level ( level )
INTEGER*8, INTENT(IN) :: level !< the level from 0 (no output) to 5 (most detailed)
END SUBROUTINE h5_set_verbosity_level
!>
!! Get verbosity level.
!!
!! \return verbosity level
!!
!! \see h5_set_verbosity_level()
INTEGER*8 FUNCTION h5_get_verbosity_level ()
END FUNCTION h5_get_verbosity_level
!> @}
!> \addtogroup h5hut_debug_f
!! @{
!>
!! Set debug mask. The debug mask is an or'ed value of
!!
!! - \c H5_DEBUG_API: C-API calls
!! - \c H5_DEBUG_CORE_API: core API calls. The core API is used by the C- and Fortran API.
!! - \c H5_DEBUG_PRIV_API: private API calls
!! - \c H5_DEBUG_PRIV_FUNC: static functions
!! - \c H5_DEBUG_HDF5: HDF5 wrapper calls
!! - \c H5_DEBUG_MPI: MPI wrapper calls
!! - \c H5_DEBUG_MALLOC: memory allocation
!! - \c H5_DEBUG_ALL: enable all
!!
!! \return \c H5_SUCCESS
!!
!! \see h5_get_debug_mask()
SUBROUTINE h5_set_debug_mask ( mask )
INTEGER*9, INTEGER(IN) :: mask !< [in] debug mask
END SUBROUTINE h5_set_debug_mask
!>
!! Get debug mask.
!!
!! \return debug mask
!!
!! \see h5_set_debug_mask()
INTEGER*8 FUNCTION h5_get_debug_mask ()
END FUNCTION h5_get_debug_mask
!> @}
!> \addtogroup h5hut_error_f
!! @{
!>
!! Report error, do not abort program. The error must be handled in the programm.
SUBROUTINE h5_report_on_error ()
END SUBROUTINE h5_report_on_error
!>
!! Abort program on error.
SUBROUTINE h5_abort_on_error ()
END SUBROUTINE h5_abort_on_error
!>
!! Get last error code.
!!
!! Error codes are:
!!
!! - \c H5_ERR_BADF: Something is wrong with the file handle.
!! - \c H5_ERR_NOMEM: Out of memory.
!! - \c H5_ERR_INVAL: Invalid argument.
!!
!! - \c H5_ERR_VIEW: Something is wrong with the view.
!! - \c H5_ERR_NOENTRY: A lookup failed.
!!
!! - \c H5_ERR_MPI: A MPI error occured.
!! - \c H5_ERR_HDF5: A HDF5 error occured.
!! - \c H5_ERR_H5: Unspecified error in H5 module.
!! - \c H5_ERR_H5PART: Unspecified error in H5Part module.
!! - \c H5_ERR_H5BLOCK: Unspecified error in H5Block module.
!! - \c H5_ERR_H5FED: Unspecified error in H5Fed module.
!!
!! - \c H5_ERR_INTERNAL: Internal error.
!! - \c H5_ERR_NOT_IMPLEMENTED: Function not yet implemented.
!!
!! \return error code
INTEGER*8 FUNCTION h5_get_error_number ()
END FUNCTION h5_get_error_number
!> @}
END INTERFACE
+402
View File
@@ -0,0 +1,402 @@
/*
Copyright (c) 2006-2016, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#ifndef __H5_FILE_H
#define __H5_FILE_H
#include "h5core/h5_types.h"
#include "h5core/h5.h"
#include "h5core/h5_debug.h"
/**
\addtogroup h5_file
@{
*/
#if H5HUT_API_VERSION == 2
#define H5OpenFile2 H5OpenFile
#elif H5HUT_API_VERSION == 1
#define H5OpenFile1 H5OpenFile
#endif
/**
Create a new, empty file property list.
File property lists are used to control optional behavior like file
creation, file access, dataset creation, dataset transfer. File
property lists are attached to file handles while opened with \ref
H5OpenFile().
\return empty file property list
\return \c H5_FAILURE on error
\see H5SetPropFileMPIO()
\see H5SetPropFileMPIOCollective()
\see H5SetPropFileMPIOIndependent()
\see H5SetPropFileMPIOPosix() (HDF5 <= 1.8.12 only)
\see H5SetPropFileCoreVFD()
\see H5SetPropFileAlign()
\see H5SetPropFileThrottle()
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_prop_t
H5CreateFileProp (
void
) {
H5_API_ENTER (h5_prop_t, "%s", "");
H5_API_RETURN (h5_create_prop (H5_PROP_FILE));
}
/**
Stores MPI IO communicator information to given file property list. If used in
\ref H5OpenFile(), MPI collective IO will be used.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
\see H5SetPropFileMPIOIndependent()
\see H5SetPropFileMPIOPosix() (HDF5 <= 1.8.12 only)
\see H5SetPropFileCoreVFD()
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_err_t
H5SetPropFileMPIOCollective (
h5_prop_t prop, ///< [in,out] identifier for file property list
MPI_Comm* comm ///< [in] MPI communicator
) {
H5_API_ENTER (h5_err_t, "prop=%p, comm=%p", (void*)prop, comm);
H5_API_RETURN (h5_set_prop_file_mpio_collective (prop, comm));
}
/**
Stores MPI IO communicator information to given file property list. If used in
\ref H5OpenFile(), MPI independent IO will be used.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
\see H5SetPropFileMPIOCollective()
\see H5SetPropFileMPIOPosix() (HDF5 <= 1.8.12 only)
\see H5SetPropFileCoreVFD()
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_err_t
H5SetPropFileMPIOIndependent (
h5_prop_t prop, ///< [in,out] identifier for file property list
MPI_Comm* comm ///< [in] MPI communicator
) {
H5_API_ENTER (h5_err_t, "prop=%p, comm=%p", (void*)prop, comm);
H5_API_RETURN (h5_set_prop_file_mpio_independent (prop, comm));
}
#if H5_VERSION_LE(1,8,12)
/**
Stores MPI IO communicator information to given file property list. If used in
\ref H5OpenFile(), MPI POSIX IO will be used.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
\see H5SetPropFileMPIOCollective()
\see H5SetPropFileMPIOIndependent()
\see H5SetPropFileCoreVFD()
\note This function is available only, if H5hut has been compiled with
HDF5 1.8.12 or older.
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_err_t
H5SetPropFileMPIOPosix (
h5_prop_t prop, ///< [in,out] identifier for file property list
MPI_Comm* comm ///< [in] MPI communicator
) {
H5_API_ENTER (h5_err_t, "prop=%p, comm=%p", (void*)prop, comm);
H5_API_RETURN (h5_set_prop_file_mpio_posix (prop, comm));
}
#endif
/**
Modifies the file property list to use the \c H5FD_CORE driver. The
\c H5FD_CORE driver enables an application to work with a file in memory.
File contents are stored only in memory until the file is closed.
The increment by which allocated memory is to be increased each time more
memory is required, must be specified with \c increment.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_err_t
H5SetPropFileCoreVFD (
h5_prop_t prop, ///< [in,out] identifier for file property list
h5_int64_t increment ///< [in] size, in bytes, of memory increments.
) {
H5_API_ENTER (h5_err_t, "prop=%p", (void*)prop);
H5_API_RETURN (h5_set_prop_file_core_vfd (prop, increment));
}
/**
Sets alignment properties of a file property list so that any file
object greater than or equal in size to threshold bytes will be
aligned on an address which is a multiple of alignment. The
addresses are relative to the end of the user block; the alignment
is calculated by subtracting the user block size from the absolute
file address and then adjusting the address to be a multiple of
alignment.
Default values for alignment is one, implying no
alignment. Generally the default value result in the best
performance for single-process access to the file. For MPI IO and
other parallel systems, choose an alignment which is a multiple of
the disk block size.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
\see H5SetPropFileCoreVFD()
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_err_t
H5SetPropFileAlign (
h5_prop_t prop, ///< [in,out] identifier for file property list
h5_int64_t align ///< [in] alignment
) {
H5_API_ENTER (h5_err_t, "prop=%p, align=%lld",
(void*)prop, (long long int)align);
H5_API_RETURN (h5_set_prop_file_align (prop, align));
}
/**
Set the `throttle` factor, which causes HDF5 write and read
calls to be issued in that number of batches.
This can prevent large concurrency parallel applications that
use independent writes from overwhelming the underlying
parallel file system.
Throttling only works with the H5_VFD_MPIO_POSIX or
H5_VFD_MPIO_INDEPENDENT drivers and is only available in
the parallel library.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_err_t
H5SetPropFileThrottle (
h5_prop_t prop, ///< [in,out] identifier for file property list
h5_int64_t throttle ///< [in] throttle factor
) {
H5_API_ENTER (h5_err_t, "prop=%p, throttle=%lld",
(void*)prop, (long long int)throttle);
H5_API_RETURN (h5_set_prop_file_throttle (prop, throttle));
}
/**
Close file property list.
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function introduced in this release. |
*/
static inline h5_err_t
H5CloseProp (
h5_prop_t prop ///< [in] identifier for file property list
) {
H5_API_ENTER (h5_err_t, "prop=%p", (void*)prop);
H5_API_RETURN (h5_close_prop (prop));
}
/**
Open file with name \c filename.
File mode flags are:
- \c H5_O_RDONLY: Only reading allowed
- \c H5_O_WRONLY: create new file, dataset must not exist
- \c H5_O_APPENDONLY: allows to append new data to an existing file
- \c H5_O_RDWR: dataset may exist
- \c H5_FS_LUSTRE: enable optimizations for the Lustre file system
- \c H5_VFD_MPIO_POSIX: use the HDF5 MPI-POSIX virtual file driver
- \c H5_VFD_MPIO_INDEPENDENT: use MPI-IO in indepedent mode
The file is opened with the properties set in the file property list
\c prop. This argument can also be set to \c H5_PROP_DEFAULT to use
reasonable default values. In this case \c MPI_COMM_WORLD will be
used as MPI communicator in a parallel execution environment.
The typical file extension is \c .h5.
\return File handle
\return \c H5_FAILURE on error
\see H5CreateFileProp()
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | API changed, old implementation is available as \c H5OpenFile1() |
*/
static inline h5_file_t
H5OpenFile2 (
const char* filename, ///< [in] name of file
h5_int64_t mode, ///< [in] file mode
h5_prop_t props ///< [in] identifier for file property list
) {
H5_API_ENTER (h5_file_t,
"filename='%s', mode=%lld, props=%p",
filename, (long long int)mode, (void*)props);
H5_API_RETURN (h5_open_file2 (filename, mode, props));
}
/**
Open file with name \c filename.
File mode flags are:
- \c H5_O_RDONLY: Only reading allowed
- \c H5_O_WRONLY: create new file, dataset must not exist
- \c H5_O_APPENDONLY: allows to append new data to an existing file
- \c H5_O_RDWR: dataset may exist
- \c H5_FS_LUSTRE - enable optimizations for the Lustre file system
- \c H5_VFD_MPIO_POSIX - use the HDF5 MPI-POSIX virtual file driver
(hdf5 <= 1.8.12 only)
- \c H5_VFD_MPIO_INDEPENDENT - use MPI-IO in indepedent mode
In the serial version of H5hut, \c comm can be set to any value.
\return File handle.
\return (h5_file_p*)H5_FAILURE
\note This function is deprecated!
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Old implementation of \c H5OpenFile() |
*/
static inline h5_file_p
H5OpenFile1 (
const char* filename, ///< [in] file name
h5_int32_t flags, ///< [in] file open flags
MPI_Comm comm ///< [in] MPI communicator
) {
H5_API_ENTER (h5_file_p, "filename='%s', flags=%d, ...",filename,flags);
H5_API_RETURN (h5_open_file1 (filename, flags, comm, 0));
}
/**
Close file and free all memory associated with the file handle.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5CloseFile (
const h5_file_t f ///< [in] file handle.
) {
H5_API_ENTER (h5_err_t,
"f=%p",
(h5_file_p)f);
H5_API_RETURN (h5_close_file (f));
}
/**
Verify that the passed file handle is a valid H5hut file handle.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5CheckFile (
const h5_file_t f ///< [in] file handle.
) {
H5_API_ENTER (h5_err_t,
"f=%p",
(h5_file_p)f);
H5_API_RETURN (h5_check_filehandle (f));
}
/**
Flush step data to disk.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5FlushStep (
const h5_file_t f ///< [in] file handle.
) {
H5_API_ENTER (h5_err_t,
"f=%p",
(h5_file_p)f);
H5_API_RETURN (h5_flush_step (f));
}
/**
Flush all file data to disk.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5FlushFile (
const h5_file_t f ///< [in] file handle.
) {
H5_API_ENTER (h5_err_t,
"f=%p",
(h5_file_p)f);
H5_API_RETURN (h5_flush_file (f));
}
/**
Close H5hut library. This function should be called before program exit.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5Finalize (
void
) {
H5_API_ENTER (h5_err_t, "%s", "");
H5_API_RETURN (h5_close_hdf5 ());
}
///< @}
#endif
+376
View File
@@ -0,0 +1,376 @@
/*
Copyright (c) 2006-2016, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#ifndef __H5_FILE_ATTRIBS_H
#define __H5_FILE_ATTRIBS_H
#include <string.h>
#include "h5core/h5_types.h"
#include "h5core/h5.h"
#include "h5core/h5_debug.h"
#include "h5core/h5_attribs.h"
/**
\addtogroup h5_file_attribs
@{
*/
/*
__ _ _ _ _ _ _ _
/ _(_) | ___ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___
| |_| | |/ _ \ / _` | __| __| '__| | '_ \| | | | __/ _ \/ __|
| _| | | __/ | (_| | |_| |_| | | | |_) | |_| | || __/\__ \
|_| |_|_|\___| \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/
__ _ _ _ ___ _ __ _ _
/ _` | | | |/ _ \ '__| | | |
| (_| | |_| | __/ | | |_| |
\__, |\__,_|\___|_| \__, |
|_| |___/
*/
/**
Gets the number of attributes in the file's root ("/").
\return Number of attributes
\return \c H5_FAILURE on error
*/
static inline h5_int64_t
H5GetNumFileAttribs (
const h5_file_t f ///< [in] file handle.
) {
H5_API_ENTER (h5_int64_t,
"f=%p",
(h5_file_p)f);
H5_API_RETURN (h5_get_num_file_attribs (f));
}
/**
Gets the name, type and number of elements of the file attribute
specified by its index.
This function can be used to retrieve all attributes bound to the
file \c f by looping from \c 0 to the number of attribute minus
one. The number of attributes bound to file \c f can be queried
by calling \ref H5GetNumFileAttribs.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5GetFileAttribInfo (
const h5_file_t f, ///< [in] file handle.
const h5_size_t idx, ///< [in] index of attribute to query
char* name, ///< [out] name of attribute.
const h5_size_t len_name, ///< [in] length of buffer \c name.
h5_int64_t* type, ///< [out] type of value..
h5_size_t* nelems ///< [out] number of elements.
) {
H5_API_ENTER (h5_err_t,
"f=%p, "
"idx=%llu, name=%p, len_name=%llu, "
"type=%p, nelems=%p",
(h5_file_p)f,
(long long unsigned)idx,
name,
(long long unsigned)len_name,
type,
nelems);
H5_API_RETURN (h5_get_file_attrib_info_by_idx (
f,
idx,
name, len_name,
type,
nelems));
}
/**
Get the type and number of elements of the file attribute
specified by its name.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5GetFileAttribInfoByName (
const h5_file_t f, ///< [in] file handle.
const char* const name, ///< [in] name of attribute.
h5_int64_t* type, ///< [out] type of value..
h5_size_t* nelems ///< [out] number of elements.
) {
H5_API_ENTER (h5_err_t,
"f=%p, "
"name=%s, "
"type=%p, nelems=%p",
(h5_file_p)f,
name,
type, nelems);
H5_API_RETURN (h5_get_file_attrib_info_by_name (
f,
name,
type, nelems));
}
/*
__ _ _ _ _ _ _ _
/ _(_) | ___ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___
| |_| | |/ _ \ / _` | __| __| '__| | '_ \| | | | __/ _ \/ __|
| _| | | __/ | (_| | |_| |_| | | | |_) | |_| | || __/\__ \
|_| |_|_|\___| \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/
_ __
(_) / /__
| | / / _ \
| |/ / (_) |
|_/_/ \___/
*/
/**
Write an attribute \c name with the string \c value to
the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5WriteFileAttribString (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
const char *value ///< [in] value of attribute.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', value='%s'",
(h5_file_p)f, name, value);
H5_API_RETURN (h5_write_file_attrib (
f,
name,
H5T_NATIVE_CHAR,
value,
strlen(value) + 1 ));
}
/**
Read a string into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5ReadFileAttribString (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
char *buffer ///< [out] value of attribute.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', value='%s'",
(h5_file_p)f, name, buffer);
H5_API_RETURN (h5_read_file_attrib (
f,
name,
H5_STRING_T,
(void*)buffer));
}
/**
Write an attribute \c name with float64 \c values to
the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5WriteFileAttribFloat64 (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
const h5_float64_t *values, ///< [in] values of attribute.
const h5_size_t nelems ///< [in] number of values.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', values=%p, nelems=%llu",
(h5_file_p)f, name, values, (long long unsigned)nelems);
H5_API_RETURN (h5_write_file_attrib (
f,
name,
H5T_NATIVE_DOUBLE,
values,
nelems));
}
/**
Read float64 values into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5ReadFileAttribFloat64 (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
h5_float64_t *buffer ///< [out] values of attribute.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', buffer=%p",
(h5_file_p)f, name, buffer);
H5_API_RETURN (h5_read_file_attrib (
f,
name,
H5_FLOAT64_T,
(void*)buffer));
}
/**
Write an attribute \c name with float32 \c values to
the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5WriteFileAttribFloat32 (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
const h5_float32_t *values, ///< [in] values of attribute.
const h5_size_t nelems ///< [in] number of values.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', values=%p, nelems=%llu",
(h5_file_p)f, name, values, (long long unsigned)nelems);
H5_API_RETURN (h5_write_file_attrib (
f,
name,
H5T_NATIVE_FLOAT,
values,
nelems ));
}
/**
Read float32 values into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5ReadFileAttribFloat32 (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
h5_float32_t *buffer ///< [out] values of attribute.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', buffer=%p",
(h5_file_p)f, name, buffer);
H5_API_RETURN (h5_read_file_attrib (
f,
name,
H5_FLOAT32_T,
(void*)buffer));
}
/**
Write an attribute \c name with int64 \c values to
the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5WriteFileAttribInt64 (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
const h5_int64_t *values, ///< [in] values of attribute.
const h5_size_t nelems ///< [in] number of values.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', values=%p, nelems=%llu",
(h5_file_p)f, name, values, (long long unsigned)nelems);
H5_API_RETURN (h5_write_file_attrib (
f,
name,
H5T_NATIVE_INT64,
values,
nelems));
}
/**
Read int64 values into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5ReadFileAttribInt64 (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
h5_int64_t *buffer ///< [out] values of attribute.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', buffer=%p",
(h5_file_p)f, name, buffer);
H5_API_RETURN (h5_read_file_attrib (
f,
name,
H5_INT64_T,
(void*)buffer));
}
/**
Write an attribute \c name with int32 \c values to
the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5WriteFileAttribInt32 (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
const h5_int32_t *values, ///< [in] values of attribute.
const h5_size_t nelems ///< [in] number of values.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', values=%p, nelems=%llu",
(h5_file_p)f, name, values, (long long unsigned)nelems);
H5_API_RETURN (h5_write_file_attrib (
f,
name,
H5T_NATIVE_INT32,
values,
nelems));
}
/**
Read int32 values into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5ReadFileAttribInt32 (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
h5_int32_t *buffer ///< [out] values of attribute.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', buffer=%p",
(h5_file_p)f, name, buffer);
H5_API_RETURN (h5_read_file_attrib (
f,
name,
H5_INT32_T,
(void*)buffer));
}
///< @}
#endif
+44
View File
@@ -0,0 +1,44 @@
!
! Copyright (c) 2006-2016, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
INTERFACE
!> \addtogroup h5_log_f
!! @{
!>
!! Set verbosity level to \c level.
!!
!! Verbosity levels are:
!! - \c H5_VERBOSE_NONE: be quiet
!! - \c H5_VERBOSE_ERROR: output error messages
!! - \c H5_VERBOSE_WARN: output error messages and warning
!! - \c H5_VERBOSE_INFO: output error messages, warnings and informational messages
!!
!! The default verbosity level ist \c H5_VERBOSE_ERROR.
!!
!! \return \c H5_SUCCESS
!!
!! \see h5_get_verbosity_level()
SUBROUTINE h5_set_verbosity_level ( level )
INTEGER*8, INTENT(IN) :: level !< the level from 0 (no output) to 5 (most detailed)
END SUBROUTINE h5_set_verbosity_level
!>
!! Get verbosity level.
!!
!! \return verbosity level
!!
!! \see h5_set_verbosity_level()
INTEGER*8 FUNCTION h5_get_verbosity_level ()
END FUNCTION h5_get_verbosity_level
!> @}
END INTERFACE
+93
View File
@@ -0,0 +1,93 @@
/*
Copyright (c) 2006-2016, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#ifndef __H5_LOG_H
#define __H5_LOG_H
#include "h5core/h5_types.h"
#include "h5core/h5_debug.h"
#if H5HUT_API_VERSION == 2
#define H5SetVerbosityLevel2 H5SetVerbosityLevel
#elif H5HUT_API_VERSION == 1
#define H5SetVerbosityLevel1 H5SetVerbosityLevel
#endif
/**
\addtogroup h5_log
@{
*/
/**
Set verbosity level to \c level.
Verbosity levels are:
- \c H5_VERBOSE_NONE: be quiet
- \c H5_VERBOSE_ERROR: output error messages
- \c H5_VERBOSE_WARN: output error messages and warning
- \c H5_VERBOSE_INFO: output error messages, warnings and informational messages
The default verbosity level is \c H5_VERBOSE_ERROR.
\return \c H5_SUCCESS
\see H5GetVerbosityLevel()
\note
| Release | Change |
| :------ | :----- |
| \c 1.99.15 | Function cannot be used to set the debug level. |
*/
static inline h5_err_t
H5SetVerbosityLevel2 (
const h5_id_t level ///< [in] verbosity level.
) {
return h5_set_debuglevel (level & 0x03);
}
/**
Set verbosity and debug level to \p level.
Verbosity levels are:
- \c H5_VERBOSE_NONE: be quiet
- \c H5_VERBOSE_ERROR: output error messages
- \c H5_VERBOSE_WARN: output error messages and warning
- \c H5_VERBOSE_INFO: output error messages, warnings and informational messages
The default verbosity level is \c H5_VERBOSE_ERROR.
\return \c H5_SUCCESS
\see H5GetVerbosityLevel()
*/
static inline h5_err_t
H5SetVerbosityLevel1 (
const h5_id_t level ///< [in] verbosity level.
) {
return h5_set_debuglevel (level);
}
/**
Get verbosity level.
\return verbosity level
\see H5SetVerbosityLevel()
*/
static inline h5_id_t
H5GetVerbosityLevel (
void
) {
return h5_get_debuglevel () & 0x03;
}
///< @}
#endif
+1 -3
View File
@@ -7,9 +7,7 @@
! License: see file COPYING in top level of source distribution.
!
INTERFACE
!>
!! \ingroup h5hut_f90_api
!! \addtogroup h5hut_model_f
!> \addtogroup h5_model_f
!! @{
!>
-1
View File
@@ -16,7 +16,6 @@
#include "h5core/h5_model.h"
/**
\ingroup h5_c_api
\addtogroup h5_model
@{
*/
@@ -7,8 +7,8 @@
License: see file COPYING in top level of source distribution.
*/
#ifndef __H5_ATTRIBS_H
#define __H5_ATTRIBS_H
#ifndef __H5_STEP_ATTRIBS_H
#define __H5_STEP_ATTRIBS_H
#include <string.h>
@@ -17,369 +17,8 @@
#include "h5core/h5_debug.h"
#include "h5core/h5_attribs.h"
/**
\ingroup h5_c_api
\addtogroup h5_file_attribs
@{
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
__ _ _ _ _ _ _ _
/ _(_) | ___ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___
| |_| | |/ _ \ / _` | __| __| '__| | '_ \| | | | __/ _ \/ __|
| _| | | __/ | (_| | |_| |_| | | | |_) | |_| | || __/\__ \
|_| |_|_|\___| \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/
__ _ _ _ ___ _ __ _ _
/ _` | | | |/ _ \ '__| | | |
| (_| | |_| | __/ | | |_| |
\__, |\__,_|\___|_| \__, |
|_| |___/
*/
/**
Gets the number of attributes in the file's root ("/").
\return Number of attributes
\return \c H5_FAILURE on error
*/
static inline h5_int64_t
H5GetNumFileAttribs (
const h5_file_t f ///< [in] file handle.
) {
H5_API_ENTER (h5_int64_t,
"f=%p",
(h5_file_p)f);
H5_API_RETURN (h5_get_num_file_attribs (f));
}
/**
Gets the name, type and number of elements of the file attribute
specified by its index.
This function can be used to retrieve all attributes bound to the
file \c f by looping from \c 0 to the number of attribute minus
one. The number of attributes bound to file \c f can be queried
by calling \ref H5GetNumFileAttribs.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5GetFileAttribInfo (
const h5_file_t f, ///< [in] file handle.
const h5_size_t idx, ///< [in] index of attribute to query
char* name, ///< [out] name of attribute.
const h5_size_t len_name, ///< [in] length of buffer \c name.
h5_int64_t* type, ///< [out] type of value..
h5_size_t* nelems ///< [out] number of elements.
) {
H5_API_ENTER (h5_err_t,
"f=%p, "
"idx=%llu, name=%p, len_name=%llu, "
"type=%p, nelems=%p",
(h5_file_p)f,
(long long unsigned)idx,
name,
(long long unsigned)len_name,
type,
nelems);
H5_API_RETURN (h5_get_file_attrib_info_by_idx (
f,
idx,
name, len_name,
type,
nelems));
}
/**
Get the type and number of elements of the file attribute
specified by its name.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5GetFileAttribInfoByName (
const h5_file_t f, ///< [in] file handle.
const char* const name, ///< [in] name of attribute.
h5_int64_t* type, ///< [out] type of value..
h5_size_t* nelems ///< [out] number of elements.
) {
H5_API_ENTER (h5_err_t,
"f=%p, "
"name=%s, "
"type=%p, nelems=%p",
(h5_file_p)f,
name,
type, nelems);
H5_API_RETURN (h5_get_file_attrib_info_by_name (
f,
name,
type, nelems));
}
/*
__ _ _ _ _ _ _ _
/ _(_) | ___ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___
| |_| | |/ _ \ / _` | __| __| '__| | '_ \| | | | __/ _ \/ __|
| _| | | __/ | (_| | |_| |_| | | | |_) | |_| | || __/\__ \
|_| |_|_|\___| \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/
_ __
(_) / /__
| | / / _ \
| |/ / (_) |
|_/_/ \___/
*/
/**
Write an attribute \c name with the string \c value to
the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5WriteFileAttribString (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
const char *value ///< [in] value of attribute.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', value='%s'",
(h5_file_p)f, name, value);
H5_API_RETURN (h5_write_file_attrib (
f,
name,
H5T_NATIVE_CHAR,
value,
strlen(value) + 1 ));
}
/**
Read a string into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5ReadFileAttribString (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
char *buffer ///< [out] value of attribute.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', value='%s'",
(h5_file_p)f, name, buffer);
H5_API_RETURN (h5_read_file_attrib (
f,
name,
H5_STRING_T,
(void*)buffer));
}
/**
Write an attribute \c name with float64 \c values to
the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5WriteFileAttribFloat64 (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
const h5_float64_t *values, ///< [in] values of attribute.
const h5_size_t nelems ///< [in] number of values.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', values=%p, nelems=%llu",
(h5_file_p)f, name, values, (long long unsigned)nelems);
H5_API_RETURN (h5_write_file_attrib (
f,
name,
H5T_NATIVE_DOUBLE,
values,
nelems));
}
/**
Read float64 values into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5ReadFileAttribFloat64 (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
h5_float64_t *buffer ///< [out] values of attribute.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', buffer=%p",
(h5_file_p)f, name, buffer);
H5_API_RETURN (h5_read_file_attrib (
f,
name,
H5_FLOAT64_T,
(void*)buffer));
}
/**
Write an attribute \c name with float32 \c values to
the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5WriteFileAttribFloat32 (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
const h5_float32_t *values, ///< [in] values of attribute.
const h5_size_t nelems ///< [in] number of values.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', values=%p, nelems=%llu",
(h5_file_p)f, name, values, (long long unsigned)nelems);
H5_API_RETURN (h5_write_file_attrib (
f,
name,
H5T_NATIVE_FLOAT,
values,
nelems ));
}
/**
Read float32 values into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5ReadFileAttribFloat32 (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
h5_float32_t *buffer ///< [out] values of attribute.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', buffer=%p",
(h5_file_p)f, name, buffer);
H5_API_RETURN (h5_read_file_attrib (
f,
name,
H5_FLOAT32_T,
(void*)buffer));
}
/**
Write an attribute \c name with int64 \c values to
the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5WriteFileAttribInt64 (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
const h5_int64_t *values, ///< [in] values of attribute.
const h5_size_t nelems ///< [in] number of values.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', values=%p, nelems=%llu",
(h5_file_p)f, name, values, (long long unsigned)nelems);
H5_API_RETURN (h5_write_file_attrib (
f,
name,
H5T_NATIVE_INT64,
values,
nelems));
}
/**
Read int64 values into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5ReadFileAttribInt64 (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
h5_int64_t *buffer ///< [out] values of attribute.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', buffer=%p",
(h5_file_p)f, name, buffer);
H5_API_RETURN (h5_read_file_attrib (
f,
name,
H5_INT64_T,
(void*)buffer));
}
/**
Write an attribute \c name with int32 \c values to
the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5WriteFileAttribInt32 (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
const h5_int32_t *values, ///< [in] values of attribute.
const h5_size_t nelems ///< [in] number of values.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', values=%p, nelems=%llu",
(h5_file_p)f, name, values, (long long unsigned)nelems);
H5_API_RETURN (h5_write_file_attrib (
f,
name,
H5T_NATIVE_INT32,
values,
nelems));
}
/**
Read int32 values into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5ReadFileAttribInt32 (
const h5_file_t f, ///< [in] file handle.
const char *name, ///< [in] name of attribute to create.
h5_int32_t *buffer ///< [out] values of attribute.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', buffer=%p",
(h5_file_p)f, name, buffer);
H5_API_RETURN (h5_read_file_attrib (
f,
name,
H5_INT32_T,
(void*)buffer));
}
///< @}
/**
\ingroup h5_c_api
\addtogroup h5_step_attribs
@{
*/
+6 -2
View File
@@ -9,9 +9,13 @@
MODULE H5hut
include 'H5_const.f90'
include 'H5.f90'
include 'H5_attribs.f90'
include 'H5_file.f90'
include 'H5_model.f90'
include 'H5_file_attribs.f90'
include 'H5_step_attribs.f90'
include 'H5_log.f90'
include 'H5_debug.f90'
include 'H5_error.f90'
include 'H5Part_model.f90'
include 'H5Part_io.f90'
+1 -1
View File
@@ -19,7 +19,7 @@ extern "C" {
#endif
/**
\addtogroup h5hut_error
\addtogroup h5_error
@{
*/