Files
src_old/src/include/H5Part_io.h
T
gsell bdcc8f2089 this commits includes several changes which should have been done in
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
2016-06-17 10:44:25 +02:00

233 lines
5.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 H5PART_IO
#define H5PART_IO
#include "h5core/h5_debug.h"
#include "h5core/h5u_io.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
\addtogroup h5part_io
@{
*/
/*
! _ _
! __ ___ __(_) |_ ___
! \ \ /\ / / '__| | __/ _ \
! \ V V /| | | | || __/
! \_/\_/ |_| |_|\__\___|
*/
/**
\fn h5_err_t H5PartWriteDataFloat64 (
const h5_file_t f,
const char* name,
const h5_float64_t* data
)
\fn h5_err_t H5PartWriteDataFloat32 (
const h5_file_t f,
const char* name,
const h5_float32_t* data
)
\fn h5_err_t H5PartWriteDataInt64 (
const h5_file_t f,
const char* name,
const h5_int64_t* data
)
\fn h5_err_t H5PartWriteDataInt32 (
const h5_file_t f,
const char* name,
const h5_int32_t* data
)
Write a dataset to the current step.
After the current (time-)step and view, you can start writing datasets
into the file. Each dataset has a name associated with it (chosen by the
user) in order to facilitate later retrieval. The name of the dataset is
specified in the parameter \c name, which must be a null-terminated string.
There are no restrictions on naming of datasets, but it is useful to arrive
at some common naming convention when sharing data with other groups.
The writing routines also implicitly store the datatype of the array so that
the array can be reconstructed properly on other systems with incompatible
type representations.
All data that is written after setting the timestep is associated with that
timestep. While the number of elements can change for each timestep, you
cannot change the number of elements in the middle of a given timestep.
The data is committed to disk before the routine returns.
\param f [in] file handle.
\param name [in] name to associate array with
\param data [in] array to commit to disk.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
\see H5PartReadDataFloat64()
\see H5PartReadDataFloat32()
\see H5PartReadDataInt64()
\see H5PartReadDataInt32()
*/
static inline h5_err_t
H5PartWriteDataFloat64 (
const h5_file_t f,
const char* name,
const h5_float64_t* data
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', date=%p",
(h5_file_p)f, name, data);
H5_API_RETURN (h5u_write_data (f, name, (void*)data, H5T_NATIVE_DOUBLE));
}
static inline h5_err_t
H5PartWriteDataFloat32 (
const h5_file_t f,
const char* name,
const h5_float32_t* data
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', date=%p",
(h5_file_p)f, name, data);
H5_API_RETURN (h5u_write_data(f, name, (void*)data, H5T_NATIVE_FLOAT));
}
static inline h5_err_t
H5PartWriteDataInt64 (
const h5_file_t f,
const char* name,
const h5_int64_t* data
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', date=%p",
(h5_file_p)f, name, data);
H5_API_RETURN (h5u_write_data (f, name, (void*)data, H5T_NATIVE_INT64));
}
static inline h5_err_t
H5PartWriteDataInt32 (
const h5_file_t f,
const char* name,
const h5_int32_t* data
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', date=%p",
(h5_file_p)f, name, data);
H5_API_RETURN (h5u_write_data (f, name, (void*)data, H5T_NATIVE_INT32));
}
/**
\fn h5_err_t H5PartReadDataFloat64 (
const h5_file_t f,
const char* name,
h5_float64_t* data
)
\fn h5_err_t H5PartReadDataFloat32 (
const h5_file_t f,
const char* name,
h5_float32_t* data
)
\fn h5_err_t H5PartReadDataInt64 (
const h5_file_t f,
const char* name,
h5_int64_t* data
)
\fn h5_err_t H5PartReadDataInt32 (
const h5_file_t f,
const char* name,
h5_int32_t* data
)
Read dataset from file.
See \ref H5PartWriteDataFloat64() etc. for more details.
\param f [in] file handle
\param name [in] name of dataset to be read
\param data [out] buffer for data to be read
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
\see H5PartWriteDataFloat64()
\see H5PartWriteDataFloat32()
\see H5PartWriteDataInt64()
\see H5PartWriteDataInt32()
*/
static inline h5_err_t
H5PartReadDataFloat64 (
const h5_file_t f,
const char* name,
h5_float64_t* data
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', date=%p",
(h5_file_p)f, name, data);
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_DOUBLE));
}
static inline h5_err_t
H5PartReadDataFloat32 (
const h5_file_t f,
const char* name,
h5_float32_t* data
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', date=%p",
(h5_file_p)f, name, data);
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_FLOAT));
}
static inline h5_err_t
H5PartReadDataInt64 (
const h5_file_t f,
const char* name,
h5_int64_t* data
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', date=%p",
(h5_file_p)f, name, data);
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_INT64));
}
static inline h5_err_t
H5PartReadDataInt32 (
const h5_file_t f,
const char* name,
h5_int32_t* data
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', date=%p",
(h5_file_p)f, name, data);
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_INT32));
}
#ifdef __cplusplus
}
#endif
///< @}
#endif