bdcc8f2089
multiple steps: - the functions for inquiring datasets and attributes do not return an HDF5 type any more but an enum of type h5_types_t. This change was required for the Python module. - bugfix in reading attributes: See https://git.psi.ch/H5hut/src/issues/4 - several consts and macros have been moved from the public C-API to the core API - more consitent file naming - several 'private' function have been moved to their 'private' header files as 'static inline'. - minor formatting changes
161 lines
3.6 KiB
C
161 lines
3.6 KiB
C
/*
|
|
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_MODEL_H
|
|
#define __H5_MODEL_H
|
|
|
|
#include "h5core/h5_debug.h"
|
|
#include "h5core/h5_model.h"
|
|
|
|
/**
|
|
\addtogroup h5_model
|
|
@{
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
Define format of the step names.
|
|
|
|
Example: ==H5SetStepNameFormat( f, "Step", 6 )== defines step names
|
|
like ==Step#000042==.
|
|
|
|
\return \c H5_SUCCESS on success
|
|
\return \c H5_FAILURE on error
|
|
*/
|
|
static inline h5_err_t
|
|
H5SetStepNameFormat (
|
|
const h5_file_t f, ///< [in] file handle
|
|
const char* name, ///< [in] prefix, defaults to \c Step
|
|
const h5_int64_t width ///< [in] width of step number
|
|
) {
|
|
H5_API_ENTER (h5_err_t,
|
|
"f=%p, name='%s', width=%lld",
|
|
(h5_file_p)f, name, (long long) width);
|
|
H5_API_RETURN (h5_set_stepname_fmt (f, name, width));
|
|
}
|
|
|
|
/**
|
|
Get format of the step names.
|
|
|
|
\return \c H5_SUCCESS on success
|
|
\return \c H5_FAILURE on error
|
|
*/
|
|
static inline h5_err_t
|
|
H5GetStepNameFormat (
|
|
const h5_file_t f, ///< [in] file handle
|
|
char* name, ///< [out] prefix
|
|
const h5_size_t l_name, ///< [in] length of buffer name
|
|
int* width ///< [out] width of step number
|
|
) {
|
|
H5_API_ENTER (h5_err_t,
|
|
"f=%p, name=%p, l_name=%llu, width=%p",
|
|
(h5_file_p)f, name, (unsigned long long)l_name, width);
|
|
H5_API_RETURN (h5_get_stepname_fmt (f, name, l_name, width));
|
|
}
|
|
|
|
/**
|
|
Set the current step.
|
|
|
|
\return \c H5_SUCCESS on success
|
|
\return \c H5_FAILURE on error
|
|
*/
|
|
static inline h5_err_t
|
|
H5SetStep (
|
|
const h5_file_t f, ///< [in] file handle.
|
|
const h5_id_t step ///< [in] step to set.
|
|
) {
|
|
H5_API_ENTER (h5_err_t,
|
|
"f=%p, step=%lld",
|
|
(h5_file_p)f, (long long)step);
|
|
H5_API_RETURN (h5_set_step (f, step));
|
|
}
|
|
|
|
/**
|
|
Get current step.
|
|
|
|
\return Step number
|
|
\return \c H5_FAILURE on error
|
|
*/
|
|
static inline h5_id_t
|
|
H5GetStep (
|
|
const h5_file_t f ///< [in] file handle.
|
|
) {
|
|
H5_API_ENTER (h5_err_t,
|
|
"f=%p",
|
|
(h5_file_p)f);
|
|
H5_API_RETURN (h5_get_step (f));
|
|
}
|
|
|
|
/**
|
|
Get the number of time-steps that are currently stored in the file
|
|
\c f.
|
|
|
|
It works for both reading and writing of files, but is probably
|
|
only typically used when you are reading.
|
|
|
|
\return Number of time-steps
|
|
\return \c H5_FAILURE on error.
|
|
*/
|
|
static inline h5_ssize_t
|
|
H5GetNumSteps (
|
|
const h5_file_t f ///< [in] file handle.
|
|
) {
|
|
H5_API_ENTER (h5_err_t,
|
|
"f=%p",
|
|
(h5_file_p)f);
|
|
H5_API_RETURN (h5_get_num_steps(f));
|
|
}
|
|
|
|
/**
|
|
Query whether a particular step already exists in the file.
|
|
|
|
\return true (value \c >0) if step exists
|
|
\return false (\c 0) if step does not exist
|
|
\return \c H5_FAILURE on error
|
|
*/
|
|
static inline h5_err_t
|
|
H5HasStep (
|
|
const h5_file_t f, ///< [in] file handle.
|
|
h5_id_t stepno ///< [in] step number to query for existence.
|
|
) {
|
|
H5_API_ENTER (h5_err_t,
|
|
"f=%p, stepno=%lld",
|
|
(h5_file_p)f, (long long)stepno);
|
|
H5_API_RETURN (h5_has_step (f, stepno));
|
|
}
|
|
|
|
/**
|
|
Get the number of processors.
|
|
|
|
\return Number of processors.
|
|
\return \c H5_FAILURE on error.
|
|
*/
|
|
static inline int
|
|
H5GetNumProcs (
|
|
const h5_file_t f ///< [in] file handle.
|
|
) {
|
|
H5_API_ENTER (h5_err_t,
|
|
"f=%p",
|
|
(h5_file_p)f);
|
|
H5_API_RETURN (h5_get_num_procs(f));
|
|
}
|
|
|
|
/**
|
|
@}
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|