Files
src_old/src/include/H5Part_io.h
T
Gsell Achim 4daf9b786c * C-API
- H5PartSetNumPoints() renamed to H5PartSetNumItems()
- H5PartGetNumPoints() renamed to H5PartGetNumItems()
- Dataset names longer then 64 bytes are handled as error.
- Same for step/iteration names.
* core API
- we use the term 'iteration' instead of 'step'
- we use the term 'item' instead of 'point'
- re-factor function and variable names
- in printing messages/debug output fixed
- do not flush (sync to disk) after writing a dataset by default,
  can be controlled by a property
2018-09-14 16:46:40 +02:00

257 lines
5.7 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_log.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/iteration.
After setting the current (time-)step/iteration 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 (time-)step/iteration is
associated with that (time-)step/iteratiion. While the number of
elements can change for each timestep, you cannot change the number
of elements in the middle of a given (time-)step/iteration.
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_dataset (
f, name, (void*)data,
H5_FLOAT64_T));
}
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_dataset (
f, name, (void*)data,
H5_FLOAT32_T));
}
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_dataset (
f, name, (void*)data,
H5_INT64_T));
}
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_dataset (
f, name, (void*)data,
H5_INT32_T));
}
/**
\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_dataset (
f, name, data, H5_FLOAT64_T));
}
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_dataset (
f, name, data, H5_FLOAT32_T));
}
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_dataset (
f, name, data,
H5_INT64_T));
}
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_dataset (
f, name, data,
H5_INT32_T));
}
#ifdef __cplusplus
}
#endif
///< @}
#endif