new trunk merged from old trunk, Roman's master thesis and my changes in the sandbox
This commit is contained in:
@@ -0,0 +1,366 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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_H
|
||||
#define __H5_H
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "H5_model.h"
|
||||
#include "H5_attribs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static inline h5_prop_t
|
||||
H5CreateFileProp (
|
||||
void
|
||||
) {
|
||||
H5_API_ENTER (h5_prop_t, "%s", "");
|
||||
H5_API_RETURN (h5_create_prop (H5_PROP_FILE));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5SetPropFileMPIO (
|
||||
h5_prop_t prop,
|
||||
MPI_Comm* comm
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "prop=%p, comm=%p", (void*)prop, comm);
|
||||
H5_API_RETURN (h5_set_prop_file_mpio (prop, comm));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5SetPropFileAlign (
|
||||
h5_prop_t prop,
|
||||
h5_int64_t align
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "prop=%p, align=%lld", (void*)prop, align);
|
||||
H5_API_RETURN (h5_set_prop_file_align (prop, align));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5SetPropFileThrottle (
|
||||
h5_prop_t prop,
|
||||
h5_int64_t throttle
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "prop=%p, throttle=%lld", (void*)prop, throttle);
|
||||
H5_API_RETURN (h5_set_prop_file_throttle (prop, throttle));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5CloseProp (
|
||||
h5_prop_t prop
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "prop=%p", (void*)prop);
|
||||
H5_API_RETURN (h5_close_prop (prop));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
<A NAME="H5OpenFile"></A>
|
||||
|
||||
Open file with name \c filename. This function is available in the parallel
|
||||
and serial version. In the serial case \c comm may have any value.
|
||||
|
||||
|
||||
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_APPEND: allows to append a new datasets 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_MPIPOSIX - use the HDF5 MPI-POSIX virtual file driver
|
||||
- \c H5_VFD_MPIIO_IND - use MPI-IO in indepedent mode
|
||||
|
||||
The typical file extension is \c .h5.
|
||||
|
||||
\c h5_file_p should be treated as an essentially opaque
|
||||
datastructure. It acts as the file handle, but internally
|
||||
it maintains several key state variables associated with
|
||||
the file.
|
||||
|
||||
\return File handle or \c (void*)H5_FAILURE
|
||||
*/
|
||||
static inline h5_file_t
|
||||
H5OpenFile (
|
||||
const char* filename, ///< [in] file name.
|
||||
h5_int32_t flags, ///< [in] file access mode flags.
|
||||
MPI_Comm comm ///< [in] MPI communicator.
|
||||
) {
|
||||
H5_API_ENTER (h5_file_t,
|
||||
"filename='%s', flags=%d, ...",
|
||||
filename, flags);
|
||||
H5_API_RETURN (h5_open_file (filename, flags, comm, 0));
|
||||
}
|
||||
|
||||
static inline h5_file_t
|
||||
H5OpenFile2 (
|
||||
const char* filename,
|
||||
h5_int64_t mode,
|
||||
h5_prop_t props
|
||||
) {
|
||||
H5_API_ENTER (h5_file_t,
|
||||
"filename='%s', mode=%lld, props=%p",
|
||||
filename, mode, (void*)props);
|
||||
H5_API_RETURN (h5_open_file2 (filename, mode, props));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
<A NAME="H5OpenFileAlign"></A>
|
||||
|
||||
Opens file with specified filename, and also specifices an alignment
|
||||
value used for HDF5 tuning parameters. In the serial case \c comm may have
|
||||
any value.
|
||||
|
||||
File modes and flags are bit values that can be combined with the bit operator \c |
|
||||
and include:
|
||||
|
||||
- \c H5_O_RDONLY: only reading allowed
|
||||
- \c H5_O_WRONLY: create new file, dataset must not exist
|
||||
- \c H5_O_APPEND: allows to append a new datasets 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_MPIPOSIX - use the HDF5 MPI-POSIX virtual file driver
|
||||
- \c H5_VFD_MPIIO_IND - use MPI-IO in indepedent mode
|
||||
|
||||
The typical file extension is \c .h5.
|
||||
|
||||
\c h5_file_p should be treated as an essentially opaque
|
||||
datastructure. It acts as the file handle, but internally
|
||||
it maintains several key state variables associated with
|
||||
the file.
|
||||
|
||||
\return File handle or \c (void*)H5_FAILURE
|
||||
*/
|
||||
static inline h5_file_t
|
||||
H5OpenFileAlign (
|
||||
const char* filename, ///< [in] name of the data file to open.
|
||||
const h5_int32_t flags, ///< [in] file access mode flags.
|
||||
MPI_Comm comm, ///< [in] MPI communicator.
|
||||
const h5_size_t align ///< [in] alignment size in bytes.
|
||||
) {
|
||||
H5_API_ENTER (h5_file_t,
|
||||
"filename='%s', flags=%d, ...",
|
||||
filename, flags);
|
||||
H5_API_RETURN (h5_open_file (filename, flags, comm, align));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
Close file and free all memory associated with the file handle.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
Verify that the file handle points to a valid H5hut file structure.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
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_MPIPOSIX or
|
||||
H5_VFD_MPIIO_IND drivers and is only available in
|
||||
the parallel library.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
#ifdef PARALLEL_IO
|
||||
h5_err_t
|
||||
static inline H5SetThrottle (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
int factor ///< [in] throttle factor
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, factor=%d",
|
||||
(h5_file_p)f, factor);
|
||||
H5_API_RETURN (h5_set_throttle(f, factor));
|
||||
}
|
||||
#endif // PARALLEL_IO
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
Flush step data to disk.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
Flush file data to disk.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
Close H5hut library. This function should be called before program exit.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Finalize (
|
||||
void
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "%s", "");
|
||||
H5_API_RETURN (h5_close_hdf5 ());
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_error
|
||||
|
||||
Set verbosity level to \c level.
|
||||
|
||||
\return \c H5_SUCCESS
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5SetVerbosityLevel (
|
||||
const h5_id_t level ///< [in] verbosity/debug level.
|
||||
) {
|
||||
return h5_set_debuglevel (level);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_error
|
||||
|
||||
Set error handler to \c handler.
|
||||
|
||||
\return \c H5_SUCCESS
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_error
|
||||
|
||||
Get current error handler.
|
||||
|
||||
\return Pointer to error handler.
|
||||
*/
|
||||
static inline h5_errorhandler_t
|
||||
H5GetErrorHandler (
|
||||
void
|
||||
) {
|
||||
H5_API_ENTER (h5_errorhandler_t, "%s", "void");
|
||||
H5_API_RETURN (h5_get_errorhandler());
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_error
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_error
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_error
|
||||
|
||||
Get last error code.
|
||||
|
||||
\return error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5GetErrno (
|
||||
void
|
||||
) {
|
||||
return h5_get_errno ();
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5BLOCK_H
|
||||
#define __H5BLOCK_H
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
\note
|
||||
Different field sizes are allowed in the same time-step.
|
||||
|
||||
\note
|
||||
The same layout can be used, if the size of the field matches the
|
||||
size of the layout. If the size of the layout doesn't match the
|
||||
size of the field, an error will be indicated.
|
||||
|
||||
\note
|
||||
In write mode partitions are shrinked to make them non-overlaping. This
|
||||
process may shrink the partitions more than required.
|
||||
|
||||
\note
|
||||
In read-mode partitions may not cross boundaries. This means, if the grid
|
||||
size is (X, Y, Z), all partitions must fit into this grid.
|
||||
|
||||
\todo
|
||||
check whether layout is reasonable
|
||||
*/
|
||||
|
||||
#include "H5Block_attribs.h"
|
||||
#include "H5Block_model.h"
|
||||
#include "H5Block_io.h"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,733 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5BLOCK_ATTRIB
|
||||
#define __H5BLOCK_ATTRIB
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5b_attribs.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5BlockGetNumFieldAttribs
|
||||
|
||||
Query the number of attributes of field \c field_name.
|
||||
|
||||
\return number of attributes
|
||||
\return H5_FAILURE on error
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5BlockGetNumFieldAttribs (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* field_name ///< [in] field name.
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t,
|
||||
"f=%p, field_name='%s'",
|
||||
(h5_file_p)f, field_name);
|
||||
H5_API_RETURN (h5b_get_num_field_attribs (f, field_name));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5BlockGetFieldAttribInfo
|
||||
|
||||
Gets the name, type and number of elements of the field attribute
|
||||
specified by its index.
|
||||
|
||||
This function can be used to retrieve all attributes bound to the
|
||||
specified field by looping from \c 0 to the number of attribute
|
||||
minus one. The number of attributes bound to the
|
||||
field can be queried by calling \ref H5BlockGetNumFieldAttribs.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockGetFieldAttribInfo (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* field_name, ///< [in] field name.
|
||||
const h5_size_t attrib_idx, ///< [in] index of attribute to query
|
||||
char* attrib_name, ///< [out] name of attribute.
|
||||
const h5_size_t len_attrib_name,///< [in] length of buffer \c name.
|
||||
h5_int64_t* attrib_type, ///< [out] type of value.
|
||||
h5_size_t* attrib_nelem ///< [out] number of elements.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p field_name='%s', "
|
||||
"attrib_idx=%llu, "
|
||||
"attrib_name=%p, len_attrib_name=%llu, "
|
||||
"attrib_type=%p, "
|
||||
"attrib_nelem=%p",
|
||||
(h5_file_p)f,
|
||||
field_name,
|
||||
(long long unsigned)attrib_idx,
|
||||
attrib_name, (long long unsigned)len_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem);
|
||||
H5_API_RETURN (
|
||||
h5b_get_field_attrib_info (
|
||||
f,
|
||||
field_name,
|
||||
attrib_idx,
|
||||
attrib_name,
|
||||
len_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem));
|
||||
}
|
||||
|
||||
/********************** reading and writing attribute ************************/
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5BlockWriteFieldAttribString
|
||||
|
||||
Write the string in \c buffer as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockWriteFieldAttribString (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* field_name, ///< [in] field name.
|
||||
const char* attrib_name, ///< [in] attribute name.
|
||||
const char* buffer ///< [in] attribute value.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"field_name='%s', "
|
||||
"attrib_name='%s', "
|
||||
"buffer='%s'",
|
||||
(h5_file_p)f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
buffer);
|
||||
H5_API_RETURN (
|
||||
h5b_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_CHAR,
|
||||
buffer,
|
||||
strlen(buffer) + 1));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5BlockReadFieldAttribString (
|
||||
|
||||
Read the string value from attribute \c attrib_name of field
|
||||
\c field_name into \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockReadFieldAttribString (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* field_name, ///< [in] field name.
|
||||
const char* attrib_name, ///< [in] attribute name.
|
||||
char* buffer ///< [out] attribute value.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"field_name='%s', "
|
||||
"attrib_name='%s', "
|
||||
"buffer=%p",
|
||||
(h5_file_p)f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
buffer);
|
||||
H5_API_RETURN (
|
||||
h5b_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5_STRING_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5BlockWriteFieldAttribFloat64
|
||||
|
||||
Write float64 \c values as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockWriteFieldAttribFloat64 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* field_name, ///< [in] field name.
|
||||
const char* attrib_name, ///< [in] attribute name.
|
||||
const h5_float64_t* buffer, ///< [in] attribute values.
|
||||
const h5_size_t nelems ///< [in] number of elements.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', "
|
||||
"buffer=%p, nelems=%lld",
|
||||
(h5_file_p)f, field_name, attrib_name, buffer, (long long)nelems);
|
||||
H5_API_RETURN (h5b_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_DOUBLE,
|
||||
buffer,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5BlockReadFieldAttribFloat64
|
||||
|
||||
Read float64 values from attribute \c attrib_name of field
|
||||
\c field_name into a \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockReadFieldAttribFloat64 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* field_name, ///< [in] field name.
|
||||
const char* attrib_name, ///< [in] attribute name.
|
||||
h5_float64_t* buffer ///< [out] attribute values.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', buffer=%p",
|
||||
(h5_file_p)f, field_name, attrib_name, buffer);
|
||||
H5_API_RETURN (h5b_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_DOUBLE,
|
||||
(void*)buffer ));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5BlockWriteFieldAttribFloat32
|
||||
|
||||
Write float32 \c values as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockWriteFieldAttribFloat32 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* field_name, ///< [in] field name.
|
||||
const char* attrib_name, ///< [in] attribute name.
|
||||
const h5_float32_t* buffer, ///< [in] attribute values.
|
||||
const h5_size_t nelems ///< [in] number of elements.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', "
|
||||
"buffer=%p, nelems=%lld",
|
||||
(h5_file_p)f, field_name, attrib_name, buffer, (long long)nelems);
|
||||
H5_API_RETURN (h5b_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_FLOAT,
|
||||
buffer,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5BlockReadFieldAttribFloat32
|
||||
|
||||
Read float32 values from attribute \c attrib_name of field
|
||||
\c field_name into a \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockReadFieldAttribFloat32 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* field_name, ///< [in] field name.
|
||||
const char* attrib_name, ///< [in] attribute name.
|
||||
h5_float32_t* const buffer ///< [out] attribute values.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', buffer=%p",
|
||||
(h5_file_p)f, field_name, attrib_name, buffer);
|
||||
H5_API_RETURN (h5b_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_FLOAT,
|
||||
buffer ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5BlockWriteFieldAttribInt64
|
||||
|
||||
Write int64 \c values as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockWriteFieldAttribInt64 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* field_name, ///< [in] field name.
|
||||
const char* attrib_name, ///< [in] attribute name.
|
||||
const h5_int64_t* buffer, ///< [in] attribute values.
|
||||
const h5_size_t nelems ///< [in] number of elements.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', buffer=%p, nelems=%lld",
|
||||
(h5_file_p)f, field_name, attrib_name, buffer, (long long)nelems);
|
||||
H5_API_RETURN (h5b_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_INT64,
|
||||
buffer,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5BlockReadFieldAttribInt64
|
||||
|
||||
Read int64 values from attribute \c attrib_name of field
|
||||
\c field_name into a \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockReadFieldAttribInt64 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* field_name, ///< [in] field name.
|
||||
const char* attrib_name, ///< [in] attribute name.
|
||||
h5_int64_t* const buffer ///< [out] attribute values.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', buffer=%p",
|
||||
(h5_file_p)f, field_name, attrib_name, buffer);
|
||||
H5_API_RETURN (h5b_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_INT64,
|
||||
buffer ));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5BlockWriteFieldAttribInt32
|
||||
|
||||
Write int32 \c values as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockWriteFieldAttribInt32 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* field_name, ///< [in] field name.
|
||||
const char* attrib_name, ///< [in] attribute name.
|
||||
const h5_int32_t* buffer, ///< [in] attribute values.
|
||||
const h5_size_t nelems ///< [in] number of elements.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', "
|
||||
"buffer=%p, nelems=%lld",
|
||||
(h5_file_p)f, field_name, attrib_name, buffer, (long long)nelems);
|
||||
H5_API_RETURN (h5b_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_INT32,
|
||||
buffer,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5BlockReadFieldAttribInt32
|
||||
|
||||
Read int32 values from attribute \c attrib_name of field
|
||||
\c field_name into a \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockReadFieldAttribInt32 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* field_name, ///< [in] field name.
|
||||
const char* attrib_name, ///< [in] attribute name.
|
||||
h5_int32_t* buffer ///< [out] attribute values.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', buffer=%p",
|
||||
(h5_file_p)f, field_name, attrib_name, buffer);
|
||||
H5_API_RETURN (h5b_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_INT32,
|
||||
(void*)buffer ));
|
||||
}
|
||||
|
||||
/*
|
||||
:TODO: move macros to private include file
|
||||
*/
|
||||
#define H5BLOCK_FIELD_ORIGIN_NAME "__Origin__"
|
||||
#define H5BLOCK_FIELD_SPACING_NAME "__Spacing__"
|
||||
#define H5BLOCK_FIELD_XCOORD_NAME "__X_Coordinates__"
|
||||
#define H5BLOCK_FIELD_YCOORD_NAME "__Y_Coordinates__"
|
||||
#define H5BLOCK_FIELD_ZCOORD_NAME "__Z_Coordinates__"
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5Block3dGetFieldOrigin
|
||||
|
||||
Get field origin.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dGetFieldOrigin (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* field_name, ///< [in] field name.
|
||||
h5_float64_t* x_origin, ///< [out] X origin.
|
||||
h5_float64_t* y_origin, ///< [out] Y origin.
|
||||
h5_float64_t* z_origin ///< [out] Z origin.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', x_origin=%p, y_origin=%p, z_origin=%p",
|
||||
(h5_file_p)f, field_name, x_origin, y_origin, z_origin);
|
||||
h5_float64_t origin[3];
|
||||
|
||||
TRY (h5b_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_ORIGIN_NAME,
|
||||
H5_FLOAT64_T,
|
||||
origin));
|
||||
|
||||
*x_origin = origin[0];
|
||||
*y_origin = origin[1];
|
||||
*z_origin = origin[2];
|
||||
|
||||
H5_API_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5Block3dSetFieldOrigin
|
||||
|
||||
Set field origin.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dSetFieldOrigin (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* field_name, ///< [in] field name.
|
||||
const h5_float64_t x_origin, ///< [in] X origin.
|
||||
const h5_float64_t y_origin, ///< [in] Y origin.
|
||||
const h5_float64_t z_origin ///< [in] Z origin.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', x_origin=%g, y_origin=%g, z_origin=%g",
|
||||
(h5_file_p)f, field_name, x_origin, y_origin, z_origin);
|
||||
h5_float64_t origin[3] = { x_origin, y_origin, z_origin };
|
||||
H5_API_RETURN (h5b_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_ORIGIN_NAME,
|
||||
(hid_t)H5_FLOAT64_T,
|
||||
origin,
|
||||
3));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5Block3dGetFieldSpacing
|
||||
|
||||
Get field spacing for field \c field_name in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dGetFieldSpacing (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* field_name, ///< [in] field name.
|
||||
h5_float64_t* x_spacing, ///< [out] X spacing.
|
||||
h5_float64_t* y_spacing, ///< [out] Y spacing.
|
||||
h5_float64_t* z_spacing ///< [out] Z spacing.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', "
|
||||
"x_spacing=%p, y_spacing=%p, z_spacing=%p",
|
||||
(h5_file_p)f, field_name, x_spacing, y_spacing, z_spacing);
|
||||
h5_float64_t spacing[3];
|
||||
TRY (h5b_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_SPACING_NAME,
|
||||
H5_FLOAT64_T,
|
||||
spacing));
|
||||
*x_spacing = spacing[0];
|
||||
*y_spacing = spacing[1];
|
||||
*z_spacing = spacing[2];
|
||||
H5_API_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5Block3dSetFieldSpacing
|
||||
|
||||
Set field spacing for field \c field_name in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dSetFieldSpacing (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* field_name, ///< [in] field name.
|
||||
const h5_float64_t x_spacing, ///< [in] X spacing.
|
||||
const h5_float64_t y_spacing, ///< [in] Y spacing.
|
||||
const h5_float64_t z_spacing ///< [in] Z spacing.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', x_spacing=%g, y_spacing=%g, z_spacing=%g",
|
||||
(h5_file_p)f, field_name, x_spacing, y_spacing, z_spacing);
|
||||
h5_float64_t spacing[3] = { x_spacing, y_spacing, z_spacing };
|
||||
H5_API_RETURN (h5b_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_SPACING_NAME,
|
||||
(hid_t)H5_FLOAT64_T,
|
||||
spacing,
|
||||
3));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5Block3dSetFieldXCoords
|
||||
|
||||
Set an explicit list of X coordinates for field \c field_name in the current
|
||||
time step. The coordinates are a 1D array of floating point values with
|
||||
dimension \c n_coords.
|
||||
|
||||
By convention, the \c coords array should have the same length as the X
|
||||
dimension of the field, and a warning will be printed if not.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dSetFieldXCoords (
|
||||
const h5_file_t f, ///< [in] file handle
|
||||
const char* field_name, ///< [in] field name
|
||||
const h5_float64_t* const coords,///< [in] X coordinates
|
||||
const h5_int64_t n_coords ///< [in] number of coordinates
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"field_name='%s', "
|
||||
"coords=%p, n_coords=%llu",
|
||||
(h5_file_p)f,
|
||||
field_name,
|
||||
coords, (long long unsigned)n_coords);
|
||||
H5_API_RETURN (h5b_set_3d_field_coords (
|
||||
f, 0, field_name, H5BLOCK_FIELD_XCOORD_NAME,
|
||||
coords, n_coords));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5Block3dGetFieldXCoords
|
||||
|
||||
Get the explicit list of X coordinates for field \c field_name in the current
|
||||
time step. The coordinates are read into the 1D array \c coords which has
|
||||
length \c n_coords.
|
||||
|
||||
By convention, the \c coords array should have the same length as the X
|
||||
dimension of the field, and a warning will be printed if they differ.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dGetFieldXCoords (
|
||||
const h5_file_t f, ///< [in] file handle
|
||||
const char* field_name, ///< [in] field name
|
||||
h5_float64_t* const coords, ///< [in] X coordinates
|
||||
const h5_int64_t n_coords ///< [in] number of coordinates
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"field_name='%s', "
|
||||
"coords=%p, n_coords=%llu",
|
||||
(h5_file_p)f,
|
||||
field_name,
|
||||
coords, (long long unsigned)n_coords);
|
||||
H5_API_RETURN (h5b_get_3d_field_coords (
|
||||
f, 0, field_name, H5BLOCK_FIELD_XCOORD_NAME,
|
||||
coords, n_coords));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5Block3dSetFieldYCoords
|
||||
|
||||
Set an explicit list of Y coordinates for field \c field_name in the current
|
||||
time step. The coordinates are a 1D array of floating point values with
|
||||
dimension \c n_coords.
|
||||
|
||||
By convention, the \c coords array should have the same length as the Y
|
||||
dimension of the field, and a warning will be printed if not.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dSetFieldYCoords (
|
||||
const h5_file_t f, ///< [in] file handle
|
||||
const char* field_name, ///< [in] field name
|
||||
const h5_float64_t* const coords,///< [in] X coordinates
|
||||
const h5_int64_t n_coords ///< [in] number of coordinates
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"field_name='%s', "
|
||||
"coords=%p, n_coords=%llu",
|
||||
(h5_file_p)f,
|
||||
field_name,
|
||||
coords, (long long unsigned)n_coords);
|
||||
H5_API_RETURN (h5b_set_3d_field_coords (
|
||||
f, 1, field_name, H5BLOCK_FIELD_YCOORD_NAME,
|
||||
coords, n_coords));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5Block3dGetFieldYCoords
|
||||
|
||||
Get the explicit list of Y coordinates for field \c field_name in the current
|
||||
time step. The coordinates are read into the 1D array \c coords which has
|
||||
length \c n_coords.
|
||||
|
||||
By convention, the \c coords array should have the same length as the Y
|
||||
dimension of the field, and a warning will be printed if they differ.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dGetFieldYCoords (
|
||||
const h5_file_t f, ///< [in] file handle
|
||||
const char* field_name, ///< [in] field name
|
||||
h5_float64_t* const coords, ///< [in] Y coordinates
|
||||
const h5_int64_t n_coords ///< [in] number of coordinates
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"field_name='%s', "
|
||||
"coords=%p, n_coords=%llu",
|
||||
(h5_file_p)f,
|
||||
field_name,
|
||||
coords, (long long unsigned)n_coords);
|
||||
H5_API_RETURN (h5b_get_3d_field_coords (
|
||||
f, 1, field_name, H5BLOCK_FIELD_YCOORD_NAME,
|
||||
coords, n_coords));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5Block3dSetFieldZCoords
|
||||
|
||||
Set an explicit list of Z coordinates for field \c field_name in the current
|
||||
time step. The coordinates are a 1D array of floating point values with
|
||||
dimension \c n_coords.
|
||||
|
||||
By convention, the \c coords array should have the same length as the Z
|
||||
dimension of the field, and a warning will be printed if not.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dSetFieldZCoords (
|
||||
const h5_file_t f, ///< [in] file handle
|
||||
const char* field_name, ///< [in] field name
|
||||
const h5_float64_t* const coords,///< [in] Z coordinates
|
||||
const h5_int64_t n_coords ///< [in] number of coordinates
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"field_name='%s', "
|
||||
"coords=%p, n_coords=%llu",
|
||||
(h5_file_p)f,
|
||||
field_name,
|
||||
coords, (long long unsigned)n_coords);
|
||||
H5_API_RETURN (h5b_set_3d_field_coords (
|
||||
f, 2, field_name, H5BLOCK_FIELD_ZCOORD_NAME,
|
||||
coords, n_coords));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
\anchor H5Block3dGetFieldZCoords
|
||||
|
||||
Get the explicit list of Z coordinates for field \c field_name in the current
|
||||
time step. The coordinates are read into the 1D array \c coords which has
|
||||
length \c n_coords.
|
||||
|
||||
By convention, the \c coords array should have the same length as the Z
|
||||
dimension of the field, and a warning will be printed if they differ.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dGetFieldZCoords (
|
||||
const h5_file_t f, ///< [in] file handle
|
||||
const char* field_name, ///< [in] field name
|
||||
h5_float64_t* const coords, ///< [in] Z coordinates
|
||||
const h5_int64_t n_coords ///< [in] number of coordinates
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"field_name='%s', "
|
||||
"coords=%p, n_coords=%llu",
|
||||
(h5_file_p)f,
|
||||
field_name,
|
||||
coords, (long long unsigned)n_coords);
|
||||
H5_API_RETURN (h5b_get_3d_field_coords (
|
||||
f, 2, field_name, H5BLOCK_FIELD_ZCOORD_NAME,
|
||||
coords, n_coords));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,464 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5BLOCK_IO_H
|
||||
#define __H5BLOCK_IO_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5b_io.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\ingroup h5block_io
|
||||
\anchor H5Block3dWriteScalarFieldFloat64
|
||||
|
||||
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
|
||||
floating points (64-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dWriteScalarFieldFloat64 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name of dataset to write.
|
||||
const h5_float64_t* buffer ///< [in] pointer to write buffer.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', buffer=%p",
|
||||
(h5_file_p)f, name, buffer);
|
||||
H5_API_RETURN (h5b_write_scalar_data(f, name, (void*)buffer, H5T_NATIVE_DOUBLE ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_io
|
||||
\anchor H5Block3dReadScalarFieldFloat64
|
||||
|
||||
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
|
||||
floating points (64-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dReadScalarFieldFloat64 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name of dataset to read.
|
||||
h5_float64_t* buffer ///< [out] pointer to read buffer.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', buffer=%p",
|
||||
(h5_file_p)f, name, buffer);
|
||||
H5_API_RETURN (h5b_read_scalar_data(f, name, (void*)buffer, H5T_NATIVE_DOUBLE));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_io
|
||||
\anchor H5Block3dWriteVector3dFieldFloat64
|
||||
|
||||
Write a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with floating points (64-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c x_buf.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dWriteVector3dFieldFloat64 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name of dataset to write.
|
||||
const h5_float64_t* x_buf, ///< [in] pointer to X axis buffer.
|
||||
const h5_float64_t* y_buf, ///< [in] pointer to Y axis buffer.
|
||||
const h5_float64_t* z_buf ///< [in] pointer to Z axis buffer.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
(h5_file_p)f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_write_vector3d_data(f, name,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_DOUBLE));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_io
|
||||
\anchor H5Block3dReadVector3dFieldFloat64
|
||||
|
||||
Read a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with floating points (64-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dReadVector3dFieldFloat64 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name of dataset to write.
|
||||
h5_float64_t* const x_buf, ///< [out] pointer to X axis buffer.
|
||||
h5_float64_t* const y_buf, ///< [out] pointer to Y axis buffer.
|
||||
h5_float64_t* const z_buf ///< [out] pointer to Z axis buffer.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
(h5_file_p)f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_read_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_DOUBLE));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5block_io
|
||||
\anchor H5Block3dWriteScalarFieldFloat32
|
||||
|
||||
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
|
||||
floating points (32-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dWriteScalarFieldFloat32 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name of dataset to write.
|
||||
const h5_float32_t* buffer ///< [in] pointer to write buffer.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', buffer=%p",
|
||||
(h5_file_p)f, name, buffer);
|
||||
H5_API_RETURN (h5b_write_scalar_data(f, name, buffer, H5T_NATIVE_FLOAT ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_io
|
||||
\anchor H5Block3dReadScalarFieldFloat32
|
||||
|
||||
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
|
||||
floating points (32-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dReadScalarFieldFloat32 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name of dataset to read.
|
||||
h5_float32_t* const buffer ///< [out] pointer to read buffer.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', buffer=%p",
|
||||
(h5_file_p)f, name, buffer);
|
||||
H5_API_RETURN (h5b_read_scalar_data(f, name, buffer, H5T_NATIVE_FLOAT));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_io
|
||||
\anchor H5Block3dWriteVector3dFieldFloat32
|
||||
|
||||
Write a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with floating points (32-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c x_buf.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dWriteVector3dFieldFloat32 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name of dataset to write.
|
||||
const h5_float32_t* x_buf, ///< [in] pointer to X axis buffer.
|
||||
const h5_float32_t* y_buf, ///< [in] pointer to Y axis buffer.
|
||||
const h5_float32_t* z_buf ///< [in] pointer to Z axis buffer.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
(h5_file_p)f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_write_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_FLOAT));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_io
|
||||
\anchor H5Block3dReadVector3dFieldFloat32
|
||||
|
||||
Read a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with floating points (32-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dReadVector3dFieldFloat32 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name of dataset to write.
|
||||
h5_float32_t* const x_buf, ///< [out] pointer to X axis buffer.
|
||||
h5_float32_t* const y_buf, ///< [out] pointer to Y axis buffer.
|
||||
h5_float32_t* const z_buf ///< [out] pointer to Z axis buffer.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
(h5_file_p)f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_read_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_FLOAT));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5block_io
|
||||
\anchor H5Block3dWriteScalarFieldInt64
|
||||
|
||||
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
|
||||
integers (64-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dWriteScalarFieldInt64 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name of dataset to write.
|
||||
const h5_int64_t* buffer ///< [in] pointer to write buffer.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', buffer=%p",
|
||||
(h5_file_p)f, name, buffer);
|
||||
H5_API_RETURN (h5b_write_scalar_data(f, name, buffer, H5T_NATIVE_INT64 ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_io
|
||||
\anchor H5Block3dReadScalarFieldInt64
|
||||
|
||||
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
|
||||
integers (64-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dReadScalarFieldInt64 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name of dataset to read.
|
||||
h5_int64_t* const buffer ///< [out] pointer to read buffer.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', buffer=%p",
|
||||
(h5_file_p)f, name, buffer);
|
||||
H5_API_RETURN (h5b_read_scalar_data(f, name, buffer, H5T_NATIVE_INT64));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5block_io
|
||||
\anchor H5Block3dWriteVector3dFieldInt64
|
||||
|
||||
Write a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with integers (64-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c x_buf.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dWriteVector3dFieldInt64 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name of dataset to write.
|
||||
const h5_int64_t* x_buf, ///< [in] pointer to X axis buffer.
|
||||
const h5_int64_t* y_buf, ///< [in] pointer to Y axis buffer.
|
||||
const h5_int64_t* z_buf ///< [in] pointer to Z axis buffer.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
(h5_file_p)f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN (h5b_write_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_INT64));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_io
|
||||
\anchor H5Block3dReadVector3dFieldInt64
|
||||
|
||||
Read a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with integers (64-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dReadVector3dFieldInt64 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name of dataset to write.
|
||||
h5_int64_t* const x_buf, ///< [out] pointer to X axis buffer.
|
||||
h5_int64_t* const y_buf, ///< [out] pointer to Y axis buffer.
|
||||
h5_int64_t* const z_buf ///< [out] pointer to Z axis buffer.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
(h5_file_p)f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN (h5b_read_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_INT64));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5block_io
|
||||
\anchor H5Block3dWriteScalarFieldInt32
|
||||
|
||||
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
|
||||
integers (32-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dWriteScalarFieldInt32 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name of dataset to write.
|
||||
const h5_int32_t* buffer ///< [in] pointer to write buffer.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', buffer=%p",
|
||||
(h5_file_p)f, name, buffer);
|
||||
H5_API_RETURN (h5b_write_scalar_data(f, name, buffer, H5T_NATIVE_INT32 ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_io
|
||||
\anchor H5Block3dReadScalarFieldInt32
|
||||
|
||||
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
|
||||
integers (32-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dReadScalarFieldInt32 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name of dataset to read.
|
||||
h5_int32_t* const buffer ///< [out] pointer to read buffer.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', buffer=%p",
|
||||
(h5_file_p)f, name, buffer);
|
||||
H5_API_RETURN (h5b_read_scalar_data(f, name, buffer, H5T_NATIVE_INT32));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5block_io
|
||||
\anchor H5Block3dWriteVector3dFieldInt32
|
||||
|
||||
Write a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with integers (32-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c x_buf.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dWriteVector3dFieldInt32 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name of dataset to write.
|
||||
const h5_int32_t* x_buf, ///< [in] pointer to X axis buffer.
|
||||
const h5_int32_t* y_buf, ///< [in] pointer to Y axis buffer.
|
||||
const h5_int32_t* z_buf ///< [in] pointer to Z axis buffer.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
(h5_file_p)f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_write_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_INT32));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_io
|
||||
\anchor H5Block3dReadVector3dFieldInt32
|
||||
|
||||
Read a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with integers (32-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dReadVector3dFieldInt32 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name of dataset to write.
|
||||
h5_int32_t* const x_buf, ///< [out] pointer to X axis buffer.
|
||||
h5_int32_t* const y_buf, ///< [out] pointer to Y axis buffer.
|
||||
h5_int32_t* const z_buf ///< [out] pointer to Z axis buffer.
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
(h5_file_p)f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_read_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_INT32));
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,425 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5BLOCK_MODEL
|
||||
#define __H5BLOCK_MODEL
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5b_model.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/********************** defining the layout **********************************/
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
\anchor H5BlockHasFieldData
|
||||
|
||||
Checks whether the current time-step has field data or not.
|
||||
|
||||
\return \c H5_SUCCESS if field data is available otherwise \c
|
||||
H5_NOK.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockHasFieldData (
|
||||
const h5_file_t f ///< [in] file handle
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, ",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5b_has_field_data (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
\anchor H5Block3dHasView
|
||||
|
||||
Tests whether a view has been set, either directly with
|
||||
\ref H5Block3dSetView or indirectly with \ref H5Block3dSetGrid.
|
||||
|
||||
\return \c 1 on true.
|
||||
\return \c 0 on false.
|
||||
*/
|
||||
static inline h5_int64_t
|
||||
H5Block3dHasView (
|
||||
const h5_file_t f ///< [in] File handle */
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5b_3d_has_view (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
\anchor H5Block3dSetView
|
||||
|
||||
Defines the partition of the field that this processor owns, using
|
||||
Fortran ordering: the fastest moving index is \c i.
|
||||
|
||||
This routine uses an MPI_Allgather, so at large concurrency it should
|
||||
be called as infrequently as possible. For instance, if several timesteps
|
||||
use the same field dimensions, set the layout only once before the
|
||||
first timestep.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dSetView (
|
||||
const h5_file_t f, ///< [in] File handle.
|
||||
const h5_int64_t i_start, ///< [in] start index of \c i
|
||||
const h5_int64_t i_end, ///< [in] end index of \c i
|
||||
const h5_int64_t j_start, ///< [in] start index of \c j
|
||||
const h5_int64_t j_end, ///< [in] end index of \c j
|
||||
const h5_int64_t k_start, ///< [in] start index of \c k
|
||||
const h5_int64_t k_end ///< [in] end index of \c k
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"i_start=%lld, i_end=%lld, "
|
||||
"j_start=%lld, j_end=%lld, "
|
||||
"k_start=%lld, k_end=%lld",
|
||||
(h5_file_p)f,
|
||||
(long long)i_start, (long long)i_end,
|
||||
(long long)j_start, (long long)j_end,
|
||||
(long long)k_start, (long long)k_end);
|
||||
H5_API_RETURN (h5b_3d_set_view (f,
|
||||
i_start, i_end,
|
||||
j_start, j_end,
|
||||
k_start, k_end));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
\anchor H5Block3dGetView
|
||||
Return the view of this processor.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dGetView (
|
||||
const h5_file_t f, ///< [in] File handle.
|
||||
h5_size_t* i_start, ///< [out] start index of \c i
|
||||
h5_size_t* i_end, ///< [out] end index of \c i
|
||||
h5_size_t* j_start, ///< [out] start index of \c j
|
||||
h5_size_t* j_end, ///< [out] end index of \c j
|
||||
h5_size_t* k_start, ///< [out] start index of \c k
|
||||
h5_size_t* k_end ///< [out] end index of \c k
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"i_start=%p, i_end=%p, "
|
||||
"j_start=%p, j_end=%p, "
|
||||
"k_start=%p, k_end=%p",
|
||||
(h5_file_p)f,
|
||||
i_start, i_end,
|
||||
j_start, j_end,
|
||||
k_start, k_end);
|
||||
H5_API_RETURN (h5b_3d_get_view (f, i_start, i_end, j_start, j_end, k_start, k_end));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
\anchor H5Block3dGetReducedView
|
||||
|
||||
Return the reduced (ghost-zone free) view of this processor.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dGetReducedView (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
h5_size_t* const i_start, ///< [out] start index of \c i
|
||||
h5_size_t* const i_end, ///< [out] end index of \c i
|
||||
h5_size_t* const j_start, ///< [out] start index of \c j
|
||||
h5_size_t* const j_end, ///< [out] end index of \c j
|
||||
h5_size_t* const k_start, ///< [out] start index of \c j
|
||||
h5_size_t* const k_end ///< [out] end index of \c j
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"i_start=%p, i_end=%p, "
|
||||
"j_start=%p, j_end=%p, "
|
||||
"k_start=%p, k_end=%p",
|
||||
(h5_file_p)f,
|
||||
i_start, i_end,
|
||||
j_start, j_end,
|
||||
k_start, k_end);
|
||||
H5_API_RETURN (h5b_3d_get_reduced_view(f, i_start, i_end, j_start, j_end, k_start, k_end));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
\anchor H5Block3dSetChunkSize
|
||||
|
||||
Define the chunk dimensions and enable chunking in the underlying
|
||||
HDF5 dataset.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dSetChunkSize (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const h5_size_t i, ///< [in] size of \c i
|
||||
const h5_size_t j, ///< [in] size of \c j
|
||||
const h5_size_t k ///< [in] size of \c k
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%llu, j=%llu, k=%llu",
|
||||
(h5_file_p)f,
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
H5_API_RETURN (h5b_3d_set_chunk(f, i, j, k));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
\anchor H5Block3dGetChunkSize
|
||||
|
||||
Lookup the chunk dimensions of the underlying HDF5 dataset.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dGetChunkSize (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* field_name, ///< [in] name of dataset
|
||||
h5_size_t* const i, ///< [out] size of \c i
|
||||
h5_size_t* const j, ///< [out] size of \c j
|
||||
h5_size_t* const k ///< [out] size of \c k
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%p, j=%p, k=%p",
|
||||
(h5_file_p)f, i, j, k);
|
||||
H5_API_RETURN (h5b_3d_get_chunk(f, field_name, i, j, k));
|
||||
}
|
||||
|
||||
#ifdef PARALLEL_IO
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
\anchor H5Block3dSetGrid
|
||||
|
||||
Define an underlying 3D Cartesian grid on the processors with dimensions
|
||||
(\c i,\c j,\c k). You can look up a processor's index into the grid
|
||||
using \ref H5Block3dGetGridCoords.
|
||||
|
||||
This function can be used in conjunction with \ref H5Block3dSetDims
|
||||
to setup the view for a regular grid.
|
||||
|
||||
The product of the dimensions must equal the size of the MPI communicator.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dSetGrid (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const h5_size_t i, ///< [in] dimension in \c i
|
||||
const h5_size_t j, ///< [in] dimension in \c j
|
||||
const h5_size_t k ///< [in] dimension in \c k
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%llu, j=%llu, k=%llu",
|
||||
(h5_file_p)f,
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
H5_API_RETURN (h5b_3d_set_grid(f, i, j, k));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
\anchor H5Block3dGetGridCoords
|
||||
|
||||
Look up the index (\c i, \c j, \c k) in the grid belonging to MPI processor
|
||||
\c proc.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dGetGridCoords (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const int proc, ///< [in] MPI processor
|
||||
h5_int64_t* i, ///< [out] index in \c i
|
||||
h5_int64_t* j, ///< [out] index in \c j
|
||||
h5_int64_t* k ///< [out] index in \c k
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, proc=%d, i=%p, j=%p, k=%p",
|
||||
(h5_file_p)f, proc, i, j, k);
|
||||
H5_API_RETURN (h5b_3d_get_grid_coords(f, proc, i, j, k));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
\anchor H5Block3dSetDims
|
||||
|
||||
Set the dimensions of each processor's block when the field is a regular
|
||||
grid.
|
||||
|
||||
A grid must be already set with \ref H5Block3dSetGrid, and all processors
|
||||
must specify the same dimensions.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dSetDims (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const h5_size_t i, ///< [in] dimension in \c i
|
||||
const h5_size_t j, ///< [in] dimension in \c j
|
||||
const h5_size_t k ///< [in] dimension in \c k
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%llu, j=%llu, k=%llu",
|
||||
(h5_file_p)f,
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
H5_API_RETURN (h5b_3d_set_dims(f, i, j, k));
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
\anchor H5Block3dSetHalo
|
||||
|
||||
Sets the additional cells (\c i, \c j, \c k) in each direction to use as
|
||||
the `halo` region (or `ghost zone`) that overlaps between neighboring
|
||||
processors on the grid.
|
||||
|
||||
A grid with dimensions must already be set with \ref H5Block3dSetGrid and
|
||||
\ref H5Block3dSetDims, and all processors must specify the same halo radii.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5Block3dSetHalo (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const h5_size_t i, ///< [in] radius in \c i
|
||||
const h5_size_t j, ///< [in] radius in \c j
|
||||
const h5_size_t k ///< [in] radius in \c k
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%llu, j=%llu, k=%llu",
|
||||
(h5_file_p)f,
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
H5_API_RETURN (h5b_3d_set_halo(f, i, j, k));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
\anchor H5BlockGetNumFields
|
||||
|
||||
Query number of fields in current time step.
|
||||
|
||||
\return \c number of fields
|
||||
\return H5_FAILURE on error
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5BlockGetNumFields (
|
||||
const h5_file_t f ///< [in] file handle.
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t,
|
||||
"f=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5b_get_num_fields(f));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
\anchor H5BlockGetFieldInfo
|
||||
|
||||
Get the name, rank and dimensions of the field specified by the
|
||||
index \c idx.
|
||||
|
||||
\c elem_rank reports the rank of the elements in the field
|
||||
(e.g. scalar or vector).
|
||||
|
||||
This function can be used to retrieve all fields bound to the
|
||||
current time-step by looping from \c 0 to the number of fields
|
||||
minus one. The number of fields bound to the current time-step
|
||||
can be queried by calling the function \ref H5BlockGetNumFields.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockGetFieldInfo (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const h5_size_t idx, ///< [in] index of field.
|
||||
char* name, ///< [out] field name.
|
||||
const h5_size_t len_name, ///< [in] buffer size.
|
||||
h5_size_t* field_rank, ///< [out] field rank.
|
||||
h5_size_t* field_dims, ///< [out] field dimensions.
|
||||
h5_size_t* elem_rank, ///< [out] element rank.
|
||||
h5_int64_t* type ///< [out] datatype.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, idx=%llu, "
|
||||
"name=%p, len_name=%llu, "
|
||||
"field_rank=%p, field_dims=%p, elem_rank=%p, type=%p",
|
||||
(h5_file_p)f, (long long unsigned)idx,
|
||||
name, (long long unsigned)len_name,
|
||||
field_rank, field_dims, elem_rank,
|
||||
type);
|
||||
H5_API_RETURN (
|
||||
h5b_get_field_info (
|
||||
f,
|
||||
idx,
|
||||
name,
|
||||
len_name,
|
||||
field_rank,
|
||||
field_dims,
|
||||
elem_rank,
|
||||
type));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
\anchor H5BlockGetFieldInfoByName
|
||||
|
||||
Get the rank and dimensions of the field specified by its name.
|
||||
See \ref H5BlockGetFieldInfo.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5BlockGetFieldInfoByName (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] field name.
|
||||
h5_size_t* field_rank, ///< [out] field rank.
|
||||
h5_size_t* field_dims, ///< [out] field dimensions.
|
||||
h5_size_t* elem_rank, ///< [out] element rank.
|
||||
h5_int64_t* type ///< [out] datatype.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', "
|
||||
"field_rank=%p, field_dims=%p, elem_rank=%p, type=%p",
|
||||
(h5_file_p)f, name, field_rank, field_dims, elem_rank, type);
|
||||
H5_API_RETURN (
|
||||
h5b_get_field_info_by_name (
|
||||
f,
|
||||
name,
|
||||
field_rank,
|
||||
field_dims,
|
||||
elem_rank,
|
||||
type));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5FED_H
|
||||
#define __H5FED_H
|
||||
|
||||
#include "H5Fed_adjacency.h"
|
||||
#include "H5Fed_model.h"
|
||||
#include "H5Fed_retrieve.h"
|
||||
#include "H5Fed_store.h"
|
||||
#include "H5Fed_tags.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/****** General routines *****************************************************/
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedOpenTetrahedralMesh (
|
||||
const h5_file_t f,
|
||||
const char* name,
|
||||
h5t_mesh_t** mesh
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name=%s, mesh=%p",
|
||||
(h5_file_p)f, name, mesh);
|
||||
H5_API_RETURN (h5t_open_tetrahedral_mesh (f, name, mesh));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedOpenTetrahedralMeshByIndex (
|
||||
const h5_file_t f,
|
||||
const h5_id_t idx,
|
||||
h5t_mesh_t** mesh
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, idx=%lld, mesh=%p",
|
||||
(h5_file_p)f, (long long)idx, mesh);
|
||||
H5_API_RETURN (h5t_open_tetrahedral_mesh_by_idx (f, idx, mesh));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedOpenTriangleMesh (
|
||||
const h5_file_t f,
|
||||
const char* name,
|
||||
h5t_mesh_t** mesh
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name=%s, mesh=%p",
|
||||
(h5_file_p)f, name, mesh);
|
||||
H5_API_RETURN (h5t_open_triangle_mesh (f, name, mesh));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedOpenTriangleMeshPart (
|
||||
const h5_file_t f,
|
||||
const char* name,
|
||||
h5t_mesh_t** mesh,
|
||||
h5_glb_idx_t* const elem_indices,
|
||||
const h5_glb_idx_t num_elems
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name=%s, mesh=%p",
|
||||
(h5_file_p)f, name, mesh);
|
||||
H5_API_RETURN (h5t_open_triangle_mesh_part (f, name, mesh, elem_indices, num_elems));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedOpenTriangleMeshByIndex (
|
||||
const h5_file_t f,
|
||||
const h5_id_t idx,
|
||||
h5t_mesh_t** mesh
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, idx=%lld, mesh=%p",
|
||||
(h5_file_p)f, (long long)idx, mesh);
|
||||
H5_API_RETURN (h5t_open_triangle_mesh_by_idx (f, idx, mesh));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedCloseMesh (
|
||||
h5t_mesh_t* const m
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "m=%p", m);
|
||||
H5_API_RETURN (h5t_close_mesh (m));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedSetLevel (
|
||||
h5t_mesh_t* const m,
|
||||
const h5_lvl_idx_t level_id
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "m=%p, level_id=%d", m, level_id);
|
||||
H5_API_RETURN (h5t_set_level (m, level_id));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedSetMeshChanged (
|
||||
h5t_mesh_t* const m
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "m=%p", m);
|
||||
H5_API_RETURN (h5t_set_mesh_changed (m));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedLinkMeshToStep (
|
||||
h5_file_t* const m,
|
||||
const h5_id_t mesh_id
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "m=%p, mesh_id=%lld", m, (long long)mesh_id);
|
||||
H5_API_RETURN (h5_error_not_implemented ());
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5FED_ADJACENCY_H
|
||||
#define __H5FED_ADJACENCY_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5t_adjacencies.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedGetAdjacencies (
|
||||
h5t_mesh_t* const m,
|
||||
const h5_loc_id_t entity_id,
|
||||
const h5_int32_t dim,
|
||||
h5_loc_idlist_t** list
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"m=%p, entity_id=%lld, dim=%d, list=%p",
|
||||
m, (long long)entity_id, dim, list);
|
||||
H5_API_RETURN (h5t_get_adjacencies (m, entity_id, dim, list));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedReleaseListOfAdjacencies (
|
||||
h5t_mesh_t* const m,
|
||||
h5_loc_idlist_t** list
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, list=%p", m, list);
|
||||
H5_API_RETURN (h5t_release_list_of_adjacencies (m, list));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5FED_MODEL_H
|
||||
#define __H5FED_MODEL_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5t_model.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Get number of meshes of given type.
|
||||
|
||||
\param[in] f File handle
|
||||
\param[in] type_id Type of mesh we want the number of.
|
||||
|
||||
\return Number of meshes of type \c type_id or error code.
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5FedGetNumTetrahedralMeshes (
|
||||
const h5_file_t f
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5t_get_num_tetmeshes (f));
|
||||
}
|
||||
|
||||
static inline h5_ssize_t
|
||||
H5FedGetNumTriangleMeshes (
|
||||
const h5_file_t f
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5t_get_num_trimeshes (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
Get the number of hierarchical mesh levels.
|
||||
|
||||
\param[in] f File handle
|
||||
|
||||
\return Number of hierarchical mesh levels or error code.
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5FedGetNumLevels (
|
||||
h5t_mesh_t* const m
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "m=%p", m);
|
||||
H5_API_RETURN (h5t_get_num_leaf_levels (m));
|
||||
}
|
||||
|
||||
/*!
|
||||
Get current mesh levels.
|
||||
|
||||
\param[in] f File handle
|
||||
|
||||
\return ID of current mesh levels or error code.
|
||||
*/
|
||||
static inline h5_lvl_idx_t
|
||||
H5FedGetLevel (
|
||||
h5t_mesh_t* const m
|
||||
) {
|
||||
H5_API_ENTER (h5_lvl_idx_t, "m=%p", m);
|
||||
H5_API_RETURN (h5t_get_level (m));
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the number of vertices used for defining the (sub-)mesh
|
||||
at current level on this compute node.
|
||||
|
||||
\param[in] f file handle
|
||||
|
||||
\return Number of vertices or error code.
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5FedGetNumVertices (
|
||||
h5t_mesh_t* const m /*!< file handle */
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "m=%p", m);
|
||||
H5_API_RETURN (h5t_get_num_vertices (m, -1));
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the number of vertices used for defining the (sub-)mesh
|
||||
at current level on compute node \c cnode.
|
||||
|
||||
\param[in] f file handle
|
||||
\param[in] cnode compute node
|
||||
|
||||
\return Number of vertices or error code.
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5FedGetNumVerticesCnode (
|
||||
h5t_mesh_t* const m,
|
||||
const int cnode
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "m=%p, cnode=%d", m, cnode);
|
||||
H5_API_RETURN (h5t_get_num_vertices (m, cnode));
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the number of vertices used for defining the (sub-)mesh
|
||||
at current level overl all compute nodes.
|
||||
|
||||
\param[in] f file handle
|
||||
|
||||
\return Total number of vertices or error code.
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5FedGetNumVerticesTotal (
|
||||
h5t_mesh_t* const m
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "m=%p", m);
|
||||
H5_API_RETURN (h5t_get_num_vertices (m, -1));
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the number of elements present in the (sub-)mesh
|
||||
at current level on this compute node.
|
||||
|
||||
\param[in] f file handle
|
||||
|
||||
\return Number of elements or error code.
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5FedGetNumElements (
|
||||
h5t_mesh_t* const m
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "m=%p", m);
|
||||
H5_API_RETURN (h5t_get_num_leaf_elems (m, -1));
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the number of elements present in the (sub-)mesh
|
||||
at current level on compute node \c cnode.
|
||||
|
||||
\param[in] f file handle
|
||||
\param[in] cnode Compute node
|
||||
|
||||
\return Number of elements or error code.
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5FedGetNumElementsCnode (
|
||||
h5t_mesh_t* const m,
|
||||
const int cnode
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "m=%p, cnode=%d", m, cnode);
|
||||
H5_API_RETURN (h5t_get_num_leaf_elems (m, cnode));
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the number of elements present in the mesh
|
||||
at current level over all compute nodes.
|
||||
|
||||
\param[in] f File handle.
|
||||
|
||||
\return Number of elements or error code.
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5FedGetNumElementsTotal (
|
||||
h5t_mesh_t* const m
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "m=%p", m);
|
||||
H5_API_RETURN (h5t_get_num_leaf_elems (m, -1));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,218 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5FED_RETRIEVE_H
|
||||
#define __H5FED_RETRIEVE_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_syscall.h"
|
||||
#include "h5core/h5t_map.h"
|
||||
#include "h5core/h5t_retrieve.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
Begin traverse over all entities on this compute node.
|
||||
Initialize internal data structures.
|
||||
|
||||
\remark
|
||||
Entities might be on processor boundaries! Therefore the same entity might be
|
||||
processed on several compute nodes.
|
||||
|
||||
\param[in] f file handle
|
||||
\param[in] codim co-dimension of entity to traverse
|
||||
|
||||
\return H5_SUCCESS or error code
|
||||
*/
|
||||
|
||||
static inline h5t_iterator_p
|
||||
H5FedBeginTraverseEntities (
|
||||
h5t_mesh_t* const m,
|
||||
const int codim
|
||||
) {
|
||||
H5_API_ENTER (h5t_iterator_p, "m=%p, codim=%d", m, codim);
|
||||
h5t_iterator_p iter;
|
||||
TRY (iter = (h5t_iterator_p)h5_calloc (1, sizeof (*iter)));
|
||||
TRY (h5t_init_leaf_iterator (iter, m, codim));
|
||||
H5_API_RETURN (iter);
|
||||
}
|
||||
|
||||
static inline h5t_iterator_p
|
||||
H5FedBeginTraverseBoundaryFaces (
|
||||
h5t_mesh_t* const m,
|
||||
const int codim
|
||||
) {
|
||||
H5_API_ENTER (h5t_iterator_p, "m=%p, codim=%d", m, codim);
|
||||
h5t_iterator_p iter;
|
||||
TRY (iter = (h5t_iterator_p)h5_calloc (1, sizeof (*iter)));
|
||||
TRY (h5t_init_boundary_face_iterator (iter, m, codim));
|
||||
H5_API_RETURN (iter);
|
||||
}
|
||||
|
||||
/*!
|
||||
Get next local entity ID.
|
||||
|
||||
\param[in/out] iter iterator
|
||||
|
||||
\return Local entity ID
|
||||
\return -1, if done
|
||||
\return error code on error
|
||||
*/
|
||||
static inline h5_loc_id_t
|
||||
H5FedTraverseEntities (
|
||||
h5t_iterator_t* iter
|
||||
) {
|
||||
H5_API_ENTER (h5_loc_id_t, "iter=%p", iter);
|
||||
H5_API_RETURN (h5t_iterate_entities (iter));
|
||||
}
|
||||
|
||||
/*!
|
||||
End of traversing. Release internal data structures.
|
||||
|
||||
\param[in/out] iter iterator
|
||||
|
||||
\return H5_SUCCESS or error code
|
||||
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5FedEndTraverseEntities (
|
||||
h5t_iterator_t* iter
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "iter=%p", iter);
|
||||
H5_API_RETURN (h5t_release_entity_iterator (iter));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Get coordinates of vertex given by local index
|
||||
|
||||
\param[in] f file handle
|
||||
\param[in] vertex_idx local index of vertex
|
||||
\param[out] P 3-dimensional coordinates
|
||||
|
||||
\return H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5FedGetVertexCoordsByIndex (
|
||||
h5t_mesh_t* const m,
|
||||
h5_loc_idx_t vertex_index,
|
||||
h5_float64_t P[3]
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"m=%p, vertex_index=%lld, P=%p",
|
||||
m, (long long)vertex_index, P);
|
||||
H5_API_RETURN (h5t_get_vertex_coords_by_index (m, vertex_index, P));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedGetVertexCoordsByID (
|
||||
h5t_mesh_t* const m,
|
||||
h5_loc_id_t vertex_id,
|
||||
h5_float64_t P[3]
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"m=%p, vertex_id=%lld, P=%p",
|
||||
m, (long long)vertex_id, P);
|
||||
H5_API_RETURN (h5t_get_vertex_coords_by_id (m, vertex_id, P));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedGetVertexIndicesOfEdge (
|
||||
h5t_mesh_t* const m,
|
||||
h5_loc_id_t entity_id,
|
||||
h5_loc_idx_t* vertex_indices
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"m=%p, entity_id=%lld, vertex_indices=%p",
|
||||
m, (long long)entity_id, vertex_indices);
|
||||
H5_API_RETURN (h5t_get_loc_vertex_indices_of_edge (m, entity_id, vertex_indices));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedGetVertexIndicesOfTriangle (
|
||||
h5t_mesh_t* const m,
|
||||
h5_loc_id_t entity_id,
|
||||
h5_loc_idx_t* vertex_indices
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"m=%p, entity_id=%lld, vertex_indices=%p",
|
||||
m, (long long)entity_id, vertex_indices);
|
||||
H5_API_RETURN (h5t_get_loc_vertex_indices_of_triangle (m, entity_id, vertex_indices));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedGetVertexIndicesOfTet (
|
||||
h5t_mesh_t* const m,
|
||||
h5_loc_id_t entity_id,
|
||||
h5_loc_idx_t* vertex_indices
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"m=%p, entity_id=%lld, vertex_indices=%p",
|
||||
m, (long long)entity_id, vertex_indices);
|
||||
H5_API_RETURN (h5t_get_loc_vertex_indices_of_tet (m, entity_id, vertex_indices));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedGetVertexIndicesOfEntity (
|
||||
h5t_mesh_t* const m,
|
||||
h5_loc_id_t entity_id,
|
||||
h5_loc_idx_t* indices
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"m=%p, entity_id=%lld, indices=%p",
|
||||
m, (long long)entity_id, indices);
|
||||
H5_API_RETURN (h5t_get_loc_vertex_indices_of_entity (m, entity_id, indices));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedGetGlobalVertexIndicesOfEntity (
|
||||
h5t_mesh_t* const m,
|
||||
h5_loc_id_t entity_id,
|
||||
h5_glb_idx_t* indices
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"m=%p, entity_id=%lld, indices=%p",
|
||||
m, (long long)entity_id, indices);
|
||||
H5_API_RETURN (h5t_get_glb_vertex_indices_of_entity (m, entity_id, indices));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedGetVertexByID (
|
||||
h5t_mesh_t* const m,
|
||||
const h5_loc_id_t entity_id,
|
||||
h5_glb_idx_t* glb_idx,
|
||||
h5_float64_t* P[]
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"m=%p, entity_id=%lld, glb_idx=%p, P[]=%p",
|
||||
m, (long long)entity_id, glb_idx, P);
|
||||
H5_API_RETURN (h5t_get_vertex_by_id (m, entity_id, glb_idx, P));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedGetNeighborIndicesOfElement (
|
||||
h5t_mesh_t* const m,
|
||||
h5_loc_id_t entity_id,
|
||||
h5_loc_idx_t* neighbor_indices
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"m=%p, entity_id=%lld, neighbor_indices=%p",
|
||||
m, (long long)entity_id, neighbor_indices);
|
||||
H5_API_RETURN (h5t_get_neighbor_indices (m, entity_id, neighbor_indices));
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,218 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5FED_STORE_H
|
||||
#define __H5FED_STORE_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5t_store.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedAddTetrahedralMesh (
|
||||
const h5_file_t f,
|
||||
const char* name,
|
||||
h5t_mesh_t** mesh
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name=%s, mesh=%p",
|
||||
(h5_file_p)f, name, mesh);
|
||||
H5_API_RETURN (h5t_add_tetrahedral_mesh (f, name, mesh));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedAddChunkedTetrahedralMesh (
|
||||
const h5_file_t f,
|
||||
const char* name,
|
||||
h5t_mesh_t** mesh
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name=%s, mesh=%p",
|
||||
(h5_file_p)f, name, mesh);
|
||||
H5_API_RETURN (h5t_add_chunked_tetrahedral_mesh (f, name, mesh));
|
||||
}
|
||||
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedAddTriangleMesh (
|
||||
const h5_file_t f,
|
||||
const char* name,
|
||||
h5t_mesh_t** mesh
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name=%s, mesh=%p",
|
||||
(h5_file_p)f, name, mesh);
|
||||
H5_API_RETURN (h5t_add_triangle_mesh (f, name, mesh));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedAddChunkedTriangleMesh (
|
||||
const h5_file_t f,
|
||||
const char* name,
|
||||
h5t_mesh_t** mesh
|
||||
) {
|
||||
H5_API_ENTER(h5_err_t,
|
||||
"f=%p, name=%s, mesh=%p",
|
||||
(h5_file_p)f, name, mesh);
|
||||
H5_API_RETURN (h5t_add_chunked_triangle_mesh (f, name, mesh));
|
||||
}
|
||||
/*!
|
||||
\ingroup h5fed_c_api
|
||||
|
||||
Add a new level with \c num_elems elements. The number of elements must be the
|
||||
real number of elements to add the level. If you want to refine \c n tetrahedra
|
||||
\c n*8 elements must be added.
|
||||
|
||||
\param[in] f File handle.
|
||||
\param[in] num_elems_to_refine Number of elements which will be refined.
|
||||
|
||||
\return ID of new level.
|
||||
|
||||
\note
|
||||
values for f->t.num_levels:
|
||||
\c -1 unknown: after opening the file. This is equivalent to
|
||||
"topological data has not been initialized".
|
||||
\c 0 no levels: HDF5 group for meshes may already exist but must not!
|
||||
\c > 0 number of mesh levels
|
||||
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5FedBeginStoreVertices (
|
||||
h5t_mesh_t* const m,
|
||||
const h5_size_t num
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"m=%p, num=%llu",
|
||||
m, (long long unsigned)num);
|
||||
H5_API_RETURN (h5t_begin_store_vertices (m, num));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5fed_c_api
|
||||
|
||||
Stores the the coordinates of a specific vertex at level \c level
|
||||
with id \c vertex_id of the tetrahedral mesh.
|
||||
|
||||
\return local vertex id on success
|
||||
\return errno on error
|
||||
*/
|
||||
static inline h5_loc_idx_t
|
||||
H5FedStoreVertex (
|
||||
h5t_mesh_t* const m, /*!< file handle */
|
||||
const h5_glb_id_t vertex_id, /*!< id from mesher or -1 */
|
||||
const h5_float64_t P[3] /*!< coordinates */
|
||||
) {
|
||||
H5_API_ENTER (h5_loc_idx_t,
|
||||
"m=%p, vertex_id=%lld, P=%p",
|
||||
m, (long long)vertex_id, P);
|
||||
if (h5t_get_level (m) != 0) {
|
||||
H5_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"Vertices can be added to level 0 only!"));
|
||||
}
|
||||
H5_API_RETURN (h5t_store_vertex (m, vertex_id, P));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedEndStoreVertices (
|
||||
h5t_mesh_t* const m
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "m=%p", m);
|
||||
H5_API_RETURN (h5t_end_store_vertices (m));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedBeginStoreElements (
|
||||
h5t_mesh_t* const m,
|
||||
const h5_size_t num,
|
||||
const h5_weight_t num_weights
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"m=%p, num=%llu, num_weights=%d",
|
||||
m, (long long unsigned)num, num_weights);
|
||||
H5_API_RETURN (h5t_begin_store_elems (m, num, num_weights));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5fed_c_api
|
||||
|
||||
Stores the 4-tuple, that contains the specific indices describing
|
||||
a tetrahedron with id \c tet_id at level \c level of the tetrahedral
|
||||
mesh.
|
||||
|
||||
Errors:
|
||||
* current level not yet defined
|
||||
* to many tets stored on level
|
||||
|
||||
\return local tetrahedron id
|
||||
\return \c errno on error
|
||||
*/
|
||||
static inline h5_loc_idx_t
|
||||
H5FedStoreElement (
|
||||
h5t_mesh_t* const m, /*!< file handle */
|
||||
const h5_loc_idx_t local_vids[], /*!< tuple with vertex id's */
|
||||
const h5_weight_t weights[] // tuple with weights
|
||||
) {
|
||||
H5_API_ENTER (h5_loc_idx_t, "m=%p, local_vids=%p", m, local_vids);
|
||||
if (h5t_get_level (m) != 0) {
|
||||
H5_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"Elements can be added to level 0 only!"));
|
||||
}
|
||||
H5_API_RETURN (h5t_store_elem2 (m, -1, local_vids, weights));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedEndStoreElements (
|
||||
h5t_mesh_t* const m
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "m=%p", m);
|
||||
|
||||
H5_API_RETURN ((h5t_is_chunked(m)) ? h5t_end_store_ckd_elems (m) : h5t_end_store_elems (m));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedBeginRefineElements (
|
||||
h5t_mesh_t* const m
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "m=%p", m);
|
||||
H5_API_RETURN (h5t_begin_refine_elems (m));
|
||||
}
|
||||
|
||||
static inline h5_loc_idx_t
|
||||
H5FedRefineElement (
|
||||
h5t_mesh_t* const m, /*!< file handle */
|
||||
const h5_loc_id_t local_eid /*!< local element id */
|
||||
) {
|
||||
H5_API_ENTER (h5_loc_idx_t,
|
||||
"m=%p, local_eid=%lld",
|
||||
m, (long long)local_eid);
|
||||
H5_API_RETURN (h5t_mark_entity (m, local_eid));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
H5FedEndRefineElements (
|
||||
h5t_mesh_t* const m
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "m=%p", m);
|
||||
H5_API_RETURN (h5t_end_refine_elems (m));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5FED_TAGS_H
|
||||
#define __H5FED_TAGS_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5t_tags.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Get number of tagsets assocciated with the mesh.
|
||||
|
||||
\param[in] m mesh
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5FedGetNumMTagsets (
|
||||
h5t_mesh_t* const m
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "m=%p", m);
|
||||
H5_API_RETURN (h5t_get_num_mtagsets(m));
|
||||
}
|
||||
|
||||
/*!
|
||||
Get some information about the tagset \c name.
|
||||
|
||||
\param[in] m mesh
|
||||
\param[in] idx index of tagset to query
|
||||
\param[out] name name of tagset
|
||||
\param[in] len_name len of buffer \c name
|
||||
\param[out] type type of tagset
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5FedGetMTagsetInfo (
|
||||
h5t_mesh_t* const m,
|
||||
const h5_size_t idx,
|
||||
char name[],
|
||||
const h5_size_t len_name,
|
||||
h5_int64_t* const type
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"m=%p, idx=%llu, name=%p, len_name=%llu, type=%p",
|
||||
m, (long long unsigned)idx, name,
|
||||
(long long unsigned)len_name, type);
|
||||
H5_API_RETURN (h5t_get_mtagset_info (m, idx, name, len_name, type));
|
||||
}
|
||||
|
||||
/*!
|
||||
Test whether tagset \c name exists.
|
||||
|
||||
\param[in] m mesh
|
||||
\param[out] name name of tagset to test existance
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5FedMTagsetExists (
|
||||
h5t_mesh_t* const m,
|
||||
const char name[]
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "m=%p, name=%s", m, name);
|
||||
H5_API_RETURN (h5t_mtagset_exists (m, name));
|
||||
}
|
||||
|
||||
/*!
|
||||
Add a tagset to the current mesh.
|
||||
|
||||
\param[in] m mesh to add a tagset to
|
||||
\param[in] name name of tagset
|
||||
\param[in] type data type of tagset
|
||||
\param[out] tagset new tagset
|
||||
|
||||
\return H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5FedAddMTagset (
|
||||
h5t_mesh_t* const m,
|
||||
const char name[],
|
||||
const h5_id_t type,
|
||||
h5t_tagset_t** tagset
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"m=%p, name='%s', type=%lld tagset=%p",
|
||||
m, name, (long long)type, tagset);
|
||||
H5_API_RETURN (h5t_create_mtagset (m, name, type, tagset));
|
||||
}
|
||||
|
||||
/*!
|
||||
Open tagset \c name.
|
||||
|
||||
\param[in] m mesh
|
||||
\param[in] name name of tagset to open
|
||||
\param[out] tagset open tagset
|
||||
|
||||
\return H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5FedOpenMTagset (
|
||||
h5t_mesh_t* const m,
|
||||
const char name[],
|
||||
h5t_tagset_t** tagset
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"m=%p, name='%s', tagset=%p",
|
||||
m, name, tagset);
|
||||
H5_API_RETURN (h5t_open_mtagset (m, name, tagset));
|
||||
}
|
||||
|
||||
/*!
|
||||
Close tagset.
|
||||
|
||||
\param[in] tagset open tagset
|
||||
|
||||
\return H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5FedCloseMTagset (
|
||||
h5t_tagset_t* tagset
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "tagset=%p", tagset);
|
||||
H5_API_RETURN (h5t_close_mtagset(tagset));
|
||||
}
|
||||
|
||||
/*!
|
||||
Remove tagset from mesh
|
||||
|
||||
\param[in] tagset tagset
|
||||
\param[in] name name of tagset to remove
|
||||
|
||||
\return H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5FedRemoveMTagset (
|
||||
h5t_mesh_t* m,
|
||||
const char name[]
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "m=%p, name='%s'", m, name);
|
||||
H5_API_RETURN (h5t_remove_mtagset (m, name));
|
||||
}
|
||||
|
||||
/*!
|
||||
Set tag for entity in current mesh.
|
||||
|
||||
\param[in] tagset ptr tagset
|
||||
\param[in] entity_id id of entity
|
||||
\param[in] size size of value
|
||||
\param[in] val tag value
|
||||
|
||||
\return H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5FedSetTag (
|
||||
h5t_tagset_t* const tagset,
|
||||
h5_loc_id_t entity_id,
|
||||
const h5_size_t size,
|
||||
void* val
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"tagset=%p, entity_id=%lld, size=%lld, val=%p",
|
||||
tagset, (long long)entity_id, (long long)size, val);
|
||||
H5_API_RETURN (h5t_set_tag (tagset, entity_id, size, val));
|
||||
}
|
||||
|
||||
/*!
|
||||
Get tag for entity in current mesh. If entity is not tagged, return tag of
|
||||
the next coarser tagged entity. The corresponding entity ID is returned.
|
||||
|
||||
\param[in] tagset ptr to tagset
|
||||
\param[in] entity_id id of entity to tag
|
||||
\param[out] size size of value
|
||||
\param[out] val tag value
|
||||
|
||||
\return entity id
|
||||
\return H5_ERR on error
|
||||
*/
|
||||
static inline h5_loc_id_t
|
||||
H5FedGetTag (
|
||||
h5t_tagset_t* const tagset,
|
||||
const h5_loc_id_t entity_id,
|
||||
h5_size_t* size,
|
||||
void* val
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"tagset=%p, entity_id=%lld, size=%p, val=%p",
|
||||
tagset, (long long)entity_id, size, val);
|
||||
H5_API_RETURN (h5t_get_tag (tagset, entity_id, size, val));
|
||||
}
|
||||
|
||||
/*!
|
||||
Remove tag for entity in current mesh.
|
||||
|
||||
\param[in] tagset ptr to tagset tagset
|
||||
\param[in] entity_id id of entity from which the tag must be removed.
|
||||
|
||||
\return H5_SUCCESS or error code
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5FedRemoveMTag (
|
||||
h5t_tagset_t* const tagset,
|
||||
const h5_loc_id_t entity_id
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"tagset=%p, entity_id=%lld",
|
||||
tagset, (long long)entity_id);
|
||||
H5_API_RETURN (h5t_remove_tag (tagset, entity_id));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
Copyright (c) 2006-2012, 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_H
|
||||
#define __H5PART_H
|
||||
|
||||
#include "H5Part_io.h"
|
||||
#include "H5Part_model.h"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,274 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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_types.h"
|
||||
#include "h5core/h5.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5u_io.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Write array of 64 bit floating point data to file.
|
||||
|
||||
After setting the number of particles with \c H5PartSetNumParticles() and
|
||||
the current timestep using \c H5SetStep(), 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 particles can change for each timestep, you
|
||||
cannot change the number of particles in the middle of a given timestep.
|
||||
|
||||
The data is committed to disk before the routine returns.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartWriteDataFloat64 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name to associate array with.
|
||||
const h5_float64_t* data ///< [in] array to commit to disk.
|
||||
) {
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Write array of 32 bit floating point data to file.
|
||||
|
||||
After setting the number of particles with \c H5PartSetNumParticles() and
|
||||
the current timestep using \c H5SetStep(), 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 particles can change for each timestep, you
|
||||
cannot change the number of particles in the middle of a given timestep.
|
||||
|
||||
The data is committed to disk before the routine returns.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartWriteDataFloat32 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name to associate array with.
|
||||
const h5_float32_t* data ///< [in] array to commit to disk.
|
||||
) {
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Write array of 64 bit integer data to file.
|
||||
|
||||
After setting the number of particles with \c H5PartSetNumParticles() and
|
||||
the current timestep using \c H5SetStep(), 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 particles can change for each timestep, you
|
||||
cannot change the number of particles in the middle of a given timestep.
|
||||
|
||||
The data is committed to disk before the routine returns.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartWriteDataInt64 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name to associate array with.
|
||||
const h5_int64_t* data ///< [in] array to commit to disk.
|
||||
) {
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Write array of 32 bit integer data to file.
|
||||
|
||||
After setting the number of particles with \c H5PartSetNumParticles() and
|
||||
the current timestep using \c H5SetStep(), 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 particles can change for each timestep, you
|
||||
cannot change the number of particles in the middle of a given timestep.
|
||||
|
||||
The data is committed to disk before the routine returns.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartWriteDataInt32 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name to associate array with.
|
||||
const h5_int32_t* data ///< [in] array to commit to disk.
|
||||
) {
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Read array of 64 bit floating point data from file.
|
||||
|
||||
When retrieving datasets from disk, you ask for them
|
||||
by name. There are no restrictions on naming of arrays,
|
||||
but it is useful to arrive at some common naming
|
||||
convention when sharing data with other groups.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartReadDataFloat64 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name to associate dataset with.
|
||||
h5_float64_t* data ///< [out] array of 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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Read array of 32 bit floating point data from file.
|
||||
|
||||
When retrieving datasets from disk, you ask for them
|
||||
by name. There are no restrictions on naming of arrays,
|
||||
but it is useful to arrive at some common naming
|
||||
convention when sharing data with other groups.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartReadDataFloat32 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name to associate dataset with.
|
||||
h5_float32_t* data ///< [out] array of 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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Read array of 64 bit integer data from file.
|
||||
|
||||
When retrieving datasets from disk, you ask for them
|
||||
by name. There are no restrictions on naming of arrays,
|
||||
but it is useful to arrive at some common naming
|
||||
convention when sharing data with other groups.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartReadDataInt64 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name to associate dataset with.
|
||||
h5_int64_t* data ///< [out] array of 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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Read array of 32 bit integer data from file.
|
||||
|
||||
When retrieving datasets from disk, you ask for them
|
||||
by name. There are no restrictions on naming of arrays,
|
||||
but it is useful to arrive at some common naming
|
||||
convention when sharing data with other groups.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartReadDataInt32 (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* name, ///< [in] name to associate dataset with.
|
||||
h5_int32_t* data ///< [out] Array of 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
|
||||
@@ -0,0 +1,395 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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_MODEL
|
||||
#define H5PART_MODEL
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5u_model.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Set the number of particles for the current time-step.
|
||||
After you call this subroutine, all subsequent
|
||||
operations will assume this number of particles will be written.
|
||||
|
||||
For the parallel library, the \c nparticles value is the number of
|
||||
particles that the \e individual task will write. You can use
|
||||
a different value on different tasks.
|
||||
This function uses an \c MPI_Allgather
|
||||
call to aggregate each tasks number of particles and determine
|
||||
the appropiate offsets. Because of the use of this MPI collective,
|
||||
it is advisable to call this function as
|
||||
few times as possible when running at large concurrency.
|
||||
|
||||
This function assumes that your particles' data fields are in stored in
|
||||
contiguous 1D arrays.
|
||||
For instance, the fields \e x and \e y for your particles are stored
|
||||
in separate arrays \c x[] and \c y[].
|
||||
|
||||
If instead you store your particles as tuples, so that the values
|
||||
are arranged \f$ x_1,y_1,x_2,y_2\f$... than you need to setup striding
|
||||
(in this case with value 2) using \ref H5PartSetNumParticlesStrided.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartSetNumParticles (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
h5_size_t nparticles ///< [in] Number of particles.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, nparticles=%llu",
|
||||
(h5_file_p)f, (long long unsigned)nparticles);
|
||||
h5_size_t stride = 1;
|
||||
H5_API_RETURN (h5u_set_num_particles (f, nparticles, stride));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Set the number of particles for the current time-step.
|
||||
After you call this subroutine, all subsequent
|
||||
operations will assume this number of particles will be written.
|
||||
|
||||
For the parallel library, the \c nparticles value is the number of
|
||||
particles that the \e individual task will write. You can use
|
||||
a different value on different tasks.
|
||||
This function uses an \c MPI_Allgather
|
||||
call to aggregate each tasks number of particles and determine
|
||||
the appropiate offsets. Because of the use of this MPI collective,
|
||||
it is advisable to call this function as
|
||||
few times as possible when running at large concurrency.
|
||||
|
||||
This function assumes that your particles' data fields are
|
||||
stored tuples. For instance, the fields \e x and \e y of your
|
||||
particles are arranged \f$x_1,y_1,x_2,y_2\f$... in a single data
|
||||
array. In this example, the stride value would be 2.
|
||||
|
||||
If you instead have a separate array for each fields,
|
||||
such as \c x[] and \c y[],
|
||||
use \ref H5PartSetNumParticles.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartSetNumParticlesStrided (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
h5_size_t nparticles, ///< [in] number of particles.
|
||||
h5_size_t stride ///< [in] stride value (e.g. number
|
||||
///< of fields in the particle array).
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, nparticles=%llu, stride=%llu",
|
||||
(h5_file_p)f, (long long unsigned)nparticles,
|
||||
(long long unsigned)stride);
|
||||
H5_API_RETURN (h5u_set_num_particles (f, nparticles, stride));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Define the chunk \c size and enables chunking in the underlying
|
||||
HDF5 layer.
|
||||
|
||||
Note that this policy wastes some disk space, but can improve read and write
|
||||
performance depending on the access pattern.
|
||||
|
||||
On parallel filesystems that are sensitive to write alignment (e.g. lustre)
|
||||
it is recommended to set a reasonable chunk size when using the MPI-POSIX
|
||||
or MPI-IO independent VFDs (see \ref H5OpenFile).
|
||||
|
||||
For more details about chunking, please read the HDF5 documentation.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartSetChunkSize (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
h5_size_t size ///< [in] chunk size.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, size=%llu",
|
||||
(h5_file_p)f, (long long unsigned)size);
|
||||
H5_API_RETURN (h5u_set_chunk (f, size));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Get the number of datasets that are stored at the current time-step.
|
||||
|
||||
\return number of datasets in current timestep or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5PartGetNumDatasets (
|
||||
const h5_file_t f ///< [in] file handle.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5u_get_num_datasets(f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
This reads the name of a dataset specified by it's index in the current
|
||||
time-step.
|
||||
|
||||
If the number of datasets is \c n, the range of \c _index is \c 0 to \c n-1.
|
||||
|
||||
\result \c H5_SUCCESS
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartGetDatasetName (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const h5_id_t idx, ///< [in] index of the dataset.
|
||||
char* name, ///< [out] name of dataset.
|
||||
const h5_size_t len ///< [in] size of buffer \c name.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"idx=%lld, "
|
||||
"name='%p', len=%llu, ",
|
||||
(h5_file_p)f,
|
||||
(long long)idx,
|
||||
name, (unsigned long long)len);
|
||||
H5_API_RETURN (h5u_get_dataset_info(f, idx, name, len, NULL, NULL));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Gets the name, type and number of elements of a dataset based on its
|
||||
index in the current timestep.
|
||||
|
||||
Type is one of the following values:
|
||||
|
||||
- \c H5_FLOAT64_T (for \c h5_float64_t)
|
||||
- \c H5_FLOAT32_T (for \c h5_float32_t)
|
||||
- \c H5_INT64_T (for \c h5_int64_t)
|
||||
- \c H5_INT32_T (for \c h5_int32_t)
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartGetDatasetInfo (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const h5_id_t idx, ///< [in] index of the dataset.
|
||||
char* name, ///< [out] name of dataset.
|
||||
const h5_size_t len_name, ///< [in] size of buffer \c name.
|
||||
h5_int64_t* type, ///< [out] type of data in dataset.
|
||||
h5_size_t* nelems ///< [out] number of elements.
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, "
|
||||
"idx=%lld, "
|
||||
"name='%p', len_name=%llu, "
|
||||
"type=%p, nelems=%p",
|
||||
(h5_file_p)f,
|
||||
(long long)idx,
|
||||
name, (long long unsigned)len_name,
|
||||
type, nelems);
|
||||
H5_API_RETURN (h5u_get_dataset_info (
|
||||
f, idx, name, len_name, type, nelems));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
This function returns the number of particles in this processor's view,
|
||||
if a view has been set.
|
||||
|
||||
If not, it returns the total number of particles across all processors
|
||||
from the last \ref H5PartSetNumParticles call.
|
||||
|
||||
If you have neither set the number of particles
|
||||
nor set a view, then this returns the total number of
|
||||
particles in the first data set of the current time step.
|
||||
Note that H5Part assumes that all data sets within a given time step
|
||||
have the same number of particles (although the number particles can
|
||||
vary across time steps).
|
||||
|
||||
If none of these conditions are met, an error is thrown.
|
||||
|
||||
\return number of particles in current step.
|
||||
\return \c H5_FAILURE on error.
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5PartGetNumParticles (
|
||||
const h5_file_t f ///< [in] file handle.
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t,
|
||||
"f=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5u_get_num_particles (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Reset the view.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartResetView (
|
||||
const h5_file_t f ///< [in] file handle.
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t,
|
||||
"f=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5u_reset_view (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Check whether a view has been set, either automatically with
|
||||
\ref H5PartSetNumParticles or manually with \ref H5PartSetView
|
||||
or \ref H5PartSetViewIndices.
|
||||
|
||||
\return \c 1 if view has been set.
|
||||
\return \c 0 otherwise.
|
||||
\return \c H5_FAILURE on error.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartHasView (
|
||||
const h5_file_t f ///< [in] file handle.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5u_has_view (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
For parallel I/O or for subsetting operations on the datafile,
|
||||
this function allows you to define a subset of the total
|
||||
particle dataset to operate on.
|
||||
The concept of "view" works for both serial
|
||||
and for parallel I/O. The "view" will remain in effect until a new view
|
||||
is set, or the number of particles in a dataset changes, or the view is
|
||||
"unset" by calling \c H5PartSetView(file,-1,-1);
|
||||
|
||||
Before you set a view, \ref H5PartGetNumParticles will return the
|
||||
total number of particles in the current time-step (even for the parallel
|
||||
reads). However, after you set a view, it will return the number of
|
||||
particles contained in the view.
|
||||
|
||||
The range is \e inclusive: the end value is the last index of the
|
||||
data.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartSetView (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
h5_int64_t start, ///< [in] start particle.
|
||||
h5_int64_t end ///< [in] end particle.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, start=%lld, end=%lld",
|
||||
(h5_file_p)f, (long long)start, (long long)end);
|
||||
H5_API_RETURN (h5u_set_view (f, start, end));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
For parallel I/O or for subsetting operations on the datafile,
|
||||
this function allows you to define a subset of the total
|
||||
dataset to operate on by specifying a list of indices.
|
||||
The concept of "view" works for both serial
|
||||
and for parallel I/O. The "view" will remain in effect until a new view
|
||||
is set, or the number of particles in a dataset changes, or the view is
|
||||
"unset" by calling \c H5PartSetViewIndices(NULL,0);
|
||||
|
||||
When you perform a read or write on a view consisting of indices, it
|
||||
is assumed that your buffer is \b unpacked, meaning that there is room
|
||||
for all the intermediate values (which will not be touched by the read
|
||||
or write).
|
||||
|
||||
Before you set a view, the \c H5PartGetNumParticles() will return the
|
||||
total number of particles in the current time-step (even for the parallel
|
||||
reads). However, after you set a view, it will return the number of
|
||||
particles contained in the view.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartSetViewIndices (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const h5_size_t* indices, ///< [in] list of indices.
|
||||
h5_size_t nelems ///< [in] size of list.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, indices=%p, nelems=%llu",
|
||||
(h5_file_p)f, indices, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5u_set_view_indices (f, indices, nelems));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Allows you to query the current view. Start and End
|
||||
will be \c -1 if there is no current view established.
|
||||
Use \c H5PartHasView() to see if the view is smaller than the
|
||||
total dataset.
|
||||
|
||||
\return number of elements in the view
|
||||
\return \c H5_FAILURE on error
|
||||
*/
|
||||
static inline h5_int64_t
|
||||
H5PartGetView (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
h5_int64_t* start, ///< [out] start particle.
|
||||
h5_int64_t* end ///< [out] end particle.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, start=%p, end=%p",
|
||||
(h5_file_p)f, start, end);
|
||||
H5_API_RETURN (h5u_get_view (f, start, end));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
If it is too tedious to manually set the start and end coordinates
|
||||
for a view, the \c H5SetCanonicalView() will automatically select an
|
||||
appropriate domain decomposition of the data arrays for the degree
|
||||
of parallelism and set the "view" accordingly.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_int64_t
|
||||
H5PartSetCanonicalView (
|
||||
const h5_file_t f ///< [in] file handle.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5u_set_canonical_view (f));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,650 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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_ATTRIBS_H
|
||||
#define __H5_ATTRIBS_H
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_attribs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*** WRITE ***/
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with the string \c value to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
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 ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with the string \c value to
|
||||
the current timestep.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5WriteStepAttribString (
|
||||
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_step_attrib (
|
||||
f,
|
||||
name,
|
||||
H5T_NATIVE_CHAR,
|
||||
value,
|
||||
strlen(value) + 1 ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with float32 \c values to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
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 ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with float32 \c values to
|
||||
the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5WriteStepAttribFloat32 (
|
||||
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_step_attrib (
|
||||
f,
|
||||
name,
|
||||
H5T_NATIVE_FLOAT,
|
||||
values,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with float64 \c values to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with float64 \c values to
|
||||
the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5WriteStepAttribFloat64 (
|
||||
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_step_attrib (
|
||||
f,
|
||||
name,
|
||||
H5T_NATIVE_DOUBLE,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with int32 \c values to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with int32 \c values to
|
||||
the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5WriteStepAttribInt32 (
|
||||
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_step_attrib (
|
||||
f,
|
||||
name,
|
||||
H5T_NATIVE_INT32,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with int64 \c values to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with int64 \c values to
|
||||
the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5WriteStepAttribInt64 (
|
||||
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_step_attrib (
|
||||
f,
|
||||
name,
|
||||
H5T_NATIVE_INT64,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
/*** READ ***/
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read a string into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read a string into a \c buffer from an attribute \c name
|
||||
in the current timestep.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5ReadStepAttribString (
|
||||
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_step_attrib (
|
||||
f,
|
||||
name,
|
||||
H5_STRING_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read int32 values into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
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 h5hut_attrib
|
||||
|
||||
Read int32 values into a \c buffer from an attribute \c name
|
||||
in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5ReadStepAttribInt32 (
|
||||
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_step_attrib (
|
||||
f,
|
||||
name,
|
||||
H5_INT32_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read int64 values into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read int64 values into a \c buffer from an attribute \c name
|
||||
in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5ReadStepAttribInt64 (
|
||||
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_err_t h5err = h5_read_step_attrib (
|
||||
f,
|
||||
name,
|
||||
H5_INT64_T,
|
||||
(void*)buffer);
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read float32 values into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read float32 values into a \c buffer from an attribute \c name
|
||||
in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5ReadStepAttribFloat32 (
|
||||
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_step_attrib (
|
||||
f,
|
||||
name,
|
||||
H5_FLOAT32_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read float64 values into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read float64 values into a \c buffer from an attribute \c name
|
||||
in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5ReadStepAttribFloat64 (
|
||||
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_step_attrib (
|
||||
f,
|
||||
name,
|
||||
H5_FLOAT64_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*** QUERY ***/
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Gets the number of attributes in the file's root ("/").
|
||||
|
||||
\return Number of attributes or \c H5_FAILURE..
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Gets the number of attributes bound to the current step.
|
||||
|
||||
\return Number of attributes or \c H5_FAILURE..
|
||||
*/
|
||||
static inline h5_int64_t
|
||||
H5GetNumStepAttribs (
|
||||
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_step_attribs (f));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
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 or \c H5_FAILURE.
|
||||
*/
|
||||
|
||||
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 (
|
||||
f,
|
||||
idx,
|
||||
name, len_name,
|
||||
type,
|
||||
nelems));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Gets the name, type and number of elements of the step attribute
|
||||
specified by its index.
|
||||
|
||||
This function can be used to retrieve all attributes bound to the
|
||||
current time-step by looping from \c 0 to the number of attribute
|
||||
minus one. The number of attributes bound to the current
|
||||
time-step can be queried by calling \ref H5GetNumStepAttribs.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE.
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5GetStepAttribInfo (
|
||||
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_step_attrib_info (
|
||||
f,
|
||||
idx,
|
||||
name,
|
||||
len_name,
|
||||
type,
|
||||
nelems));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,314 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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_types.h"
|
||||
#include "h5core/h5.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_model.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Define format of the step names.
|
||||
|
||||
Example: ==H5SetStepNameFormat( f, "Step", 6 )== defines step names
|
||||
like ==Step#000042==.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Get format of the step names.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Set the current step.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Get current step.
|
||||
|
||||
\return Step index
|
||||
\return 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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Query whether a particular step already exists in the file.
|
||||
|
||||
\return \c 1 if step exists
|
||||
\return \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));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Start traversing steps.
|
||||
|
||||
\note This function is not yet implemented!
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5StartTraverseSteps (
|
||||
const h5_file_t f ///< [in] file handle.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5_start_traverse_steps (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Go to next step.
|
||||
|
||||
\note This function is not yet implemented!
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5TraverseSteps (
|
||||
const h5_file_t f ///< [in] file handle.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5_traverse_steps (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Return number of attached files.
|
||||
|
||||
\return number of attachments.
|
||||
\return \c H5_FAILURE on error.
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5GetNumAttachments (
|
||||
const h5_file_t f ///< [in] file handle.
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t,
|
||||
"f=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5_get_num_attachments (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Get name and size of attachment given by index \c idx. Return the file name
|
||||
in \c fname and the original size in \c fsize.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5GetAttachmentInfoByIdx (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const h5_size_t idx, ///< [in] index of attachment to be queried.
|
||||
char* const fname, ///< [out] original file name.
|
||||
h5_size_t len_fname, ///< [in] max length of file name.
|
||||
h5_size_t* const fsize ///< [out] size of original file.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"idx=%llu, fname=%p, len_fname=%llu, fsize=%p",
|
||||
(long long unsigned)idx,
|
||||
fname, (long long unsigned)len_fname,
|
||||
fsize);
|
||||
H5_API_RETURN (h5_get_attachment_info_by_idx (
|
||||
f, idx, fname, len_fname, fsize));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Get size of attached file with name \c fname.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5GetAttachmentInfoByName (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
char* const fname, ///< [in] original file name.
|
||||
h5_size_t* const fsize ///< [out] size of original file.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "fname='%s', fsize=%p", fname, fsize);
|
||||
H5_API_RETURN (h5_get_attachment_info_by_name (
|
||||
f, fname, fsize));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Attach file \c fname.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5AddAttachment (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* fname ///< [in] name of file to attach.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "fname='%s'", fname);
|
||||
H5_API_RETURN (h5_add_attachment (f, fname));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Get attachment \c fname from H5hut file and write it to disk in
|
||||
the current working directory.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5GetAttachment (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* fname ///< [in] name of attachment.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "fname='%s'", fname);
|
||||
H5_API_RETURN (h5_get_attachment (f, fname));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Delete attachment \c fname.
|
||||
|
||||
\return \c H5_SUCCESS or \c H5_FAILURE
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5DeleteAttachment (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const char* const fname ///< [in] name of attachment.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "fname='%s'", fname);
|
||||
H5_API_RETURN (h5_delete_attachment (f, fname));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
Copyright (c) 2006-2012, 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 __H5HUT_H
|
||||
#define __H5HUT_H
|
||||
|
||||
#include "H5.h"
|
||||
#include "H5Part.h"
|
||||
#include "H5Block.h"
|
||||
#include "H5Fed.h"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
# src/C level Makefile.am
|
||||
|
||||
# Header files that I wish to install in $(prefix)/include
|
||||
include_HEADERS = \
|
||||
../include/h5core/h5.h \
|
||||
../include/h5core/h5_attribs.h \
|
||||
../include/h5core/h5_debug.h \
|
||||
../include/h5core/h5_errorhandling.h \
|
||||
../include/h5core/h5_model.h \
|
||||
../include/h5core/h5_syscall.h \
|
||||
../include/h5core/h5_types.h \
|
||||
../include/h5core/h5b_attribs.h \
|
||||
../include/h5core/h5b_model.h \
|
||||
../include/h5core/h5b_io.h \
|
||||
../include/h5core/h5t_adjacencies.h \
|
||||
../include/h5core/h5t_map.h \
|
||||
../include/h5core/h5t_model.h \
|
||||
../include/h5core/h5t_retrieve.h \
|
||||
../include/h5core/h5t_store.h \
|
||||
../include/h5core/h5t_tags.h \
|
||||
../include/h5core/h5u_model.h \
|
||||
../include/h5core/h5u_io.h
|
||||
|
||||
# Listing of all possible headers that I may include
|
||||
EXTRA_HEADERS =
|
||||
|
||||
clean-local:
|
||||
$(RM) *~
|
||||
$(RM) h5core/*~
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5CORE_H5_H
|
||||
#define __H5CORE_H5_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include <hdf5.h>
|
||||
|
||||
#define UNUSED_ARGUMENT(x) (void)x
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int h5_initialized;
|
||||
|
||||
h5_err_t
|
||||
h5_initialize (void);
|
||||
|
||||
hid_t
|
||||
h5_get_hdf5_file(
|
||||
const h5_file_t);
|
||||
|
||||
h5_prop_t
|
||||
h5_create_prop (
|
||||
const h5_int64_t);
|
||||
|
||||
h5_err_t
|
||||
h5_set_prop_file_throttle (
|
||||
h5_prop_t, const h5_int64_t);
|
||||
|
||||
h5_err_t
|
||||
h5_set_prop_file_align (
|
||||
h5_prop_t, const h5_int64_t);
|
||||
|
||||
h5_err_t
|
||||
h5_set_prop_file_mpio (
|
||||
h5_prop_t, MPI_Comm* const);
|
||||
|
||||
h5_err_t
|
||||
h5_close_prop (
|
||||
h5_prop_t);
|
||||
|
||||
h5_file_t
|
||||
h5_open_file (
|
||||
const char*, const h5_int32_t, MPI_Comm, const h5_size_t);
|
||||
|
||||
h5_file_t
|
||||
h5_open_file2 (
|
||||
const char*, const h5_int32_t, h5_prop_t prop);
|
||||
|
||||
h5_err_t
|
||||
h5_check_filehandle (
|
||||
const h5_file_t);
|
||||
|
||||
h5_err_t
|
||||
h5_close_file (
|
||||
const h5_file_t);
|
||||
|
||||
h5_err_t
|
||||
h5_close_hdf5 (
|
||||
void);
|
||||
|
||||
|
||||
h5_err_t
|
||||
h5_flush_step (
|
||||
const h5_file_t);
|
||||
|
||||
h5_err_t
|
||||
h5_flush_file (
|
||||
const h5_file_t);
|
||||
|
||||
h5_err_t
|
||||
h5_set_stepname_fmt (
|
||||
const h5_file_t, const char*, const int);
|
||||
|
||||
h5_err_t
|
||||
h5_get_stepname_fmt (
|
||||
const h5_file_t, char* const, const int, int* const);
|
||||
|
||||
int
|
||||
h5_get_num_procs (
|
||||
const h5_file_t);
|
||||
|
||||
h5_ssize_t
|
||||
h5_get_num_steps (
|
||||
const h5_file_t);
|
||||
|
||||
h5_int64_t
|
||||
h5_has_step (
|
||||
const h5_file_t, const h5_int64_t);
|
||||
|
||||
h5_int64_t
|
||||
h5_get_step (
|
||||
const h5_file_t);
|
||||
|
||||
h5_err_t
|
||||
h5_start_traverse_steps (
|
||||
const h5_file_t);
|
||||
|
||||
h5_err_t
|
||||
h5_traverse_steps (
|
||||
const h5_file_t);
|
||||
|
||||
h5_err_t
|
||||
h5_set_throttle (
|
||||
h5_file_t f,
|
||||
int factor
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
Copyright (c) 2006-2012, 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 __H5CORE_H5_ATTRIBS_H
|
||||
#define __H5CORE_H5_ATTRIBS_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5_read_file_attrib (
|
||||
const h5_file_t, const char*, const hid_t, void*);
|
||||
|
||||
h5_err_t
|
||||
h5_read_step_attrib (
|
||||
const h5_file_t, const char*, const hid_t, void*);
|
||||
|
||||
h5_err_t
|
||||
h5_write_file_attrib (
|
||||
const h5_file_t, const char*, const hid_t, const void*, const hsize_t);
|
||||
|
||||
h5_err_t
|
||||
h5_write_step_attrib (
|
||||
const h5_file_t, const char*, const hid_t, const void*, const hsize_t);
|
||||
|
||||
h5_err_t
|
||||
h5_get_file_attrib_info (
|
||||
const h5_file_t, const h5_size_t, char*, const h5_size_t, h5_int64_t* const,
|
||||
h5_size_t*);
|
||||
|
||||
h5_err_t
|
||||
h5_get_step_attrib_info (
|
||||
const h5_file_t, const h5_size_t, char*, const h5_size_t, h5_int64_t*,
|
||||
h5_size_t*);
|
||||
|
||||
h5_ssize_t
|
||||
h5_get_num_file_attribs (
|
||||
const h5_file_t);
|
||||
|
||||
h5_ssize_t
|
||||
h5_get_num_step_attribs (
|
||||
const h5_file_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5CORE_H5_DEBUG_H
|
||||
#define __H5CORE_H5_DEBUG_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5_errorhandling.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define H5_DEBUG_USER (1<<2)
|
||||
#define H5_DEBUG_API (1<<3)
|
||||
#define H5_DEBUG_CORE_API (1<<4)
|
||||
#define H5_DEBUG_PRIV_API (1<<5)
|
||||
#define H5_DEBUG_PRIV_FUNC (1<<6)
|
||||
#define H5_DEBUG_HDF5 (1<<7)
|
||||
#define H5_DEBUG_MPI (1<<8)
|
||||
#define H5_DEBUG_MALLOC (1<<9)
|
||||
#define H5_DEBUG_CLIB (1<<10)
|
||||
|
||||
#define H5_DEBUG_ALL (-1)
|
||||
|
||||
extern char* h5_rfmts[];
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// function enter macro
|
||||
#if defined(NDEBUG)
|
||||
|
||||
#define __API_ENTER(type, mask, fmt, ...) \
|
||||
h5_call_stack_init (__func__,e_##type); \
|
||||
type ret_value = (type)H5_ERR;
|
||||
|
||||
#define __FUNC_ENTER(type, mask, fmt, ...) \
|
||||
type ret_value = (type)H5_ERR;
|
||||
|
||||
#else // NDEBUG not defined
|
||||
|
||||
#define __API_ENTER(type, mask, fmt, ...) \
|
||||
h5_call_stack_push (__func__,e_##type); \
|
||||
type ret_value = (type)H5_ERR; \
|
||||
if (h5_debug_level & mask ) { \
|
||||
h5_debug ("(" fmt ")", __VA_ARGS__); \
|
||||
}
|
||||
|
||||
#define __FUNC_ENTER(type, mask, fmt, ...) \
|
||||
type ret_value = (type)H5_ERR; \
|
||||
if (h5_debug_level & mask ) { \
|
||||
h5_call_stack_push (__func__,e_##type); \
|
||||
h5_debug ("(" fmt ")", __VA_ARGS__); \
|
||||
} \
|
||||
|
||||
#endif
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define __API_LEAVE(expr) { \
|
||||
ret_value = expr; \
|
||||
goto done; \
|
||||
}
|
||||
|
||||
#define __FUNC_LEAVE(expr) { \
|
||||
ret_value = expr; \
|
||||
goto done; \
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// function return macro
|
||||
#if defined(NDEBUG)
|
||||
|
||||
#define __API_RETURN(expr, mask) \
|
||||
ret_value = expr; \
|
||||
goto done; \
|
||||
done: \
|
||||
h5_call_stack_reset (); \
|
||||
return ret_value;
|
||||
|
||||
#define __FUNC_RETURN(expr, mask) \
|
||||
ret_value = expr; \
|
||||
goto done; \
|
||||
done: \
|
||||
return ret_value;
|
||||
|
||||
#else // NDEBUG not defined
|
||||
|
||||
#define __API_RETURN(expr, mask) \
|
||||
ret_value = expr; \
|
||||
goto done; \
|
||||
done: \
|
||||
if (h5_debug_level & mask ) { \
|
||||
char fmt[256]; \
|
||||
snprintf (fmt, sizeof(fmt), "return: %s", \
|
||||
h5_rfmts[h5_call_stack_get_type()]); \
|
||||
h5_debug (fmt, ret_value); \
|
||||
} \
|
||||
h5_call_stack_reset (); \
|
||||
return ret_value;
|
||||
|
||||
#define __FUNC_RETURN(expr, mask) \
|
||||
ret_value = expr; \
|
||||
goto done; \
|
||||
done: \
|
||||
if (h5_debug_level & mask ) { \
|
||||
char fmt[256]; \
|
||||
snprintf (fmt, sizeof(fmt), "return: %s", \
|
||||
h5_rfmts[h5_call_stack_get_type()]); \
|
||||
h5_debug (fmt, ret_value); \
|
||||
h5_call_stack_pop(); \
|
||||
} \
|
||||
return ret_value;
|
||||
|
||||
#endif
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define H5_API_ENTER(type, fmt, ...) \
|
||||
if (!h5_initialized) { \
|
||||
h5_initialize(); \
|
||||
} \
|
||||
__API_ENTER(type, H5_DEBUG_API, fmt, __VA_ARGS__)
|
||||
#define H5_API_LEAVE(expr) __API_LEAVE(expr)
|
||||
#define H5_API_RETURN(expr) __API_RETURN(expr, H5_DEBUG_API);
|
||||
|
||||
|
||||
#define TRY( func ) \
|
||||
if ((int64_t)(ptrdiff_t)(func) <= (int64_t)H5_ERR) { \
|
||||
goto done; \
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,321 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5CORE_H5_ERRORHANDLING_H
|
||||
#define __H5CORE_H5_ERRORHANDLING_H
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include "h5core/h5_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
\addtogroup h5hut_error
|
||||
@{
|
||||
*/
|
||||
|
||||
#define H5_SUCCESS 0 ///< Function performs successfully
|
||||
#define H5_OK H5_SUCCESS ///< Alias for \c H5_SUCCESS
|
||||
#define H5_NOK -1 ///<
|
||||
#define H5_FAILURE -2 ///< Function runs into an error
|
||||
#define H5_ERR H5_FAILURE ///< Alias for H5_FAILURE
|
||||
|
||||
#define H5_ERR_BADF -9 ///< Something is wrong with the file handle.
|
||||
#define H5_ERR_NOMEM -12 ///< Out of memory.
|
||||
#define H5_ERR_INVAL -22 ///< Invalid argument.
|
||||
|
||||
#define H5_ERR_VIEW -100 ///< Something is wrong with the view.
|
||||
#define H5_ERR_NOENTRY -101 ///< A lookup failed.
|
||||
|
||||
#define H5_ERR_MPI -201 ///< A MPI error occured.
|
||||
#define H5_ERR_HDF5 -202 ///< A HDF5 error occured.
|
||||
#define H5_ERR_H5 -203 ///< Unspecified error in H5 module.
|
||||
#define H5_ERR_H5PART -204 ///< Unspecified error in H5Part module.
|
||||
#define H5_ERR_H5BLOCK -205 ///< Unspecified error in H5Block module.
|
||||
#define H5_ERR_H5FED -206 ///< Unspecified error in H5Fed module.
|
||||
|
||||
#define H5_ERR_INTERNAL -253 ///< Internal error.
|
||||
#define H5_ERR_NOT_IMPLEMENTED -254 ///< Function not yet implemented.
|
||||
|
||||
/** @}*/
|
||||
|
||||
enum h5_rtypes {
|
||||
e_int = 0,
|
||||
e_ssize_t,
|
||||
e_char_p,
|
||||
e_void_p,
|
||||
e_h5_err_t,
|
||||
e_h5_int64_t,
|
||||
e_h5_id_t,
|
||||
e_h5_ssize_t,
|
||||
e_h5_errorhandler_t,
|
||||
e_h5_file_p,
|
||||
e_h5_file_t,
|
||||
e_h5_lvl_idx_t,
|
||||
e_h5t_iterator_p,
|
||||
e_h5_loc_id_t,
|
||||
e_h5_loc_idx_t,
|
||||
e_hid_t,
|
||||
e_H5O_type_t,
|
||||
e_h5_glb_elem_p,
|
||||
e_h5_prop_p,
|
||||
e_h5_prop_t,
|
||||
e_h5_prop_file_p,
|
||||
e_h5_prop_file_t,
|
||||
e_herr_t
|
||||
};
|
||||
|
||||
struct call_stack_entry {
|
||||
char* name;
|
||||
enum h5_rtypes type;
|
||||
};
|
||||
|
||||
struct call_stack {
|
||||
int level;
|
||||
struct call_stack_entry entry[1024];
|
||||
};
|
||||
|
||||
extern h5_int32_t h5_debug_level;
|
||||
extern struct call_stack h5_call_stack;
|
||||
extern h5_err_t h5_errno;
|
||||
|
||||
#define h5_error_not_implemented() \
|
||||
h5_error( \
|
||||
H5_ERR_NOT_IMPLEMENTED, \
|
||||
"%s: Function '%s', line %d not yet implemented!", \
|
||||
__FILE__, __func__, __LINE__);
|
||||
|
||||
#define h5_error_internal() \
|
||||
h5_error( \
|
||||
H5_ERR_INTERNAL, \
|
||||
"%s: Internal error: %s line %d!", \
|
||||
__FILE__, __func__, __LINE__)
|
||||
|
||||
|
||||
h5_err_t
|
||||
h5_set_debuglevel (
|
||||
const h5_id_t);
|
||||
|
||||
h5_err_t
|
||||
h5_get_debuglevel (
|
||||
void);
|
||||
|
||||
h5_err_t
|
||||
h5_set_errorhandler (
|
||||
const h5_errorhandler_t);
|
||||
|
||||
h5_errorhandler_t
|
||||
h5_get_errorhandler (
|
||||
void);
|
||||
|
||||
h5_err_t
|
||||
h5_get_errno (
|
||||
void);
|
||||
|
||||
void
|
||||
h5_set_errno (
|
||||
const h5_err_t);
|
||||
|
||||
static inline void
|
||||
h5_call_stack_init (
|
||||
const char* fname,
|
||||
enum h5_rtypes type
|
||||
) {
|
||||
h5_call_stack.level = 0;
|
||||
h5_call_stack.entry[0].name = (char *)fname;
|
||||
h5_call_stack.entry[0].type = type;
|
||||
}
|
||||
|
||||
static inline void
|
||||
h5_call_stack_push (
|
||||
const char* fname,
|
||||
enum h5_rtypes type
|
||||
) {
|
||||
h5_call_stack.entry[h5_call_stack.level].name = (char *)fname;
|
||||
h5_call_stack.entry[h5_call_stack.level].type = type;
|
||||
h5_call_stack.level++;
|
||||
}
|
||||
|
||||
static inline const char*
|
||||
h5_call_stack_pop (
|
||||
void
|
||||
) {
|
||||
return h5_call_stack.entry[--h5_call_stack.level].name;
|
||||
}
|
||||
|
||||
static inline const char*
|
||||
h5_call_stack_get_name (
|
||||
void
|
||||
) {
|
||||
return h5_call_stack.entry[h5_call_stack.level-1].name;
|
||||
}
|
||||
|
||||
static inline const char*
|
||||
h5_get_funcname (
|
||||
void
|
||||
) {
|
||||
return h5_call_stack.entry[0].name;
|
||||
}
|
||||
|
||||
static inline enum h5_rtypes
|
||||
h5_call_stack_get_type (
|
||||
void
|
||||
) {
|
||||
return h5_call_stack.entry[h5_call_stack.level-1].type;
|
||||
}
|
||||
|
||||
static inline int
|
||||
h5_call_stack_get_level (
|
||||
void
|
||||
) {
|
||||
return h5_call_stack.level;
|
||||
}
|
||||
|
||||
static inline const char*
|
||||
h5_call_stack_reset (
|
||||
void
|
||||
) {
|
||||
h5_call_stack.level = 0;
|
||||
return h5_call_stack.entry[0].name;
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_report_errorhandler (
|
||||
const char *fmt,
|
||||
va_list ap
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5_abort_errorhandler (
|
||||
const char *fmt,
|
||||
va_list ap
|
||||
);
|
||||
|
||||
void
|
||||
h5priv_vprintf (
|
||||
FILE* f,
|
||||
const char* prefix,
|
||||
const char* __funcname,
|
||||
const char* fmt,
|
||||
va_list ap
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5_error (
|
||||
const h5_err_t error_no,
|
||||
const char *fmt,
|
||||
...
|
||||
)
|
||||
#ifdef __GNUC__
|
||||
__attribute__ ((format (printf, 2, 3)))
|
||||
#endif
|
||||
;
|
||||
|
||||
void
|
||||
h5_verror (
|
||||
const char* fmt,
|
||||
va_list ap
|
||||
);
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_errorhandling
|
||||
|
||||
Print a warning message to \c stderr.
|
||||
*/
|
||||
|
||||
static inline h5_err_t
|
||||
h5_warn (
|
||||
const char *fmt,
|
||||
...
|
||||
)
|
||||
#ifdef __GNUC__
|
||||
__attribute__ ((format (printf, 1, 2)))
|
||||
#endif
|
||||
;
|
||||
static inline h5_err_t
|
||||
h5_warn (
|
||||
const char* fmt,
|
||||
...
|
||||
) {
|
||||
if (h5_debug_level >= 2) {
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
h5priv_vprintf (stderr, "W", h5_get_funcname(), fmt, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
return H5_NOK;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_errorhandling
|
||||
|
||||
Print an informational message to \c stdout.
|
||||
*/
|
||||
static inline void
|
||||
h5_info (
|
||||
const char *fmt,
|
||||
...
|
||||
)
|
||||
#ifdef __GNUC__
|
||||
__attribute__ ((format (printf, 1, 2)))
|
||||
#endif
|
||||
;
|
||||
static inline void
|
||||
h5_info (
|
||||
const char* fmt,
|
||||
...
|
||||
) {
|
||||
if (h5_debug_level >= 3) {
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
h5priv_vprintf (stdout, "I", h5_get_funcname(), fmt, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_errorhandling
|
||||
|
||||
Print a debug message to \c stdout.
|
||||
*/
|
||||
static inline void
|
||||
h5_debug (
|
||||
const char *fmt,
|
||||
...
|
||||
)
|
||||
#ifdef __GNUC__
|
||||
__attribute__ ((format (printf, 1, 2)))
|
||||
#endif
|
||||
;
|
||||
|
||||
static inline void
|
||||
h5_debug (
|
||||
const char *fmt,
|
||||
...
|
||||
) {
|
||||
if (h5_debug_level >= 4) {
|
||||
char prefix[1024];
|
||||
snprintf (prefix, sizeof(prefix), "%*s %s",
|
||||
h5_call_stack_get_level(), "",
|
||||
h5_call_stack_get_name());
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
h5priv_vprintf (stdout, "D", prefix, fmt, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5CORE_H5_MODEL
|
||||
#define __H5CORE_H5_MODEL
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
h5_int64_t
|
||||
h5_set_step (
|
||||
const h5_file_t, const h5_int64_t);
|
||||
|
||||
h5_err_t
|
||||
h5_add_attachment (
|
||||
const h5_file_t, const char* const);
|
||||
|
||||
h5_ssize_t
|
||||
h5_get_num_attachments (
|
||||
const h5_file_t);
|
||||
|
||||
h5_err_t
|
||||
h5_get_attachment_info_by_idx (
|
||||
const h5_file_t, const h5_size_t, char* const, h5_size_t, h5_size_t* const);
|
||||
|
||||
h5_err_t
|
||||
h5_get_attachment_info_by_name (
|
||||
const h5_file_t, const char* const, h5_size_t* const);
|
||||
|
||||
h5_err_t
|
||||
h5_get_attachment (
|
||||
const h5_file_t, const char* const);
|
||||
|
||||
h5_err_t
|
||||
h5_delete_attachment (
|
||||
const h5_file_t, const char* const);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
extern int dont_use_parmetis; // Warning bad style! used for switching without makro and recompiling...
|
||||
extern int max_num_elems_p_chunk; // used for switching chunksize without recompiling
|
||||
extern int preferred_direction; // DITO used for choosing direction without recompiling
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5CORE_H5_SYSCALL_H
|
||||
#define __H5CORE_H5_SYSCALL_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_errorhandling.h"
|
||||
|
||||
#define MALLOC_WRAPPER_ENTER(type, fmt, ...) \
|
||||
__FUNC_ENTER(type, H5_DEBUG_MALLOC, fmt, __VA_ARGS__)
|
||||
#define MALLOC_WRAPPER_LEAVE(value) __FUNC_LEAVE(value)
|
||||
#define MALLOC_WRAPPER_RETURN(value) __FUNC_RETURN(value, H5_DEBUG_MALLOC)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
static inline h5_err_t
|
||||
h5_free (
|
||||
void* ptr
|
||||
) {
|
||||
MALLOC_WRAPPER_ENTER (h5_err_t, "ptr=%p", ptr);
|
||||
if (ptr) {
|
||||
free (ptr);
|
||||
}
|
||||
MALLOC_WRAPPER_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
static inline void_p
|
||||
h5_alloc (
|
||||
void* ptr,
|
||||
const size_t size
|
||||
) {
|
||||
MALLOC_WRAPPER_ENTER (void_p, "ptr=%p, size=%lu", ptr, size);
|
||||
if (size < 1) {
|
||||
ret_value = (void_p) h5_free (ptr);
|
||||
MALLOC_WRAPPER_LEAVE (NULL);
|
||||
}
|
||||
ptr = realloc (ptr, size);
|
||||
if (ptr == NULL) {
|
||||
MALLOC_WRAPPER_LEAVE (
|
||||
(void_p)h5_error (H5_ERR_NOMEM, "Out of memory. Tried to alloc %lld", (long long int)size));
|
||||
}
|
||||
MALLOC_WRAPPER_RETURN (ptr);
|
||||
}
|
||||
|
||||
static inline void_p
|
||||
h5_calloc (
|
||||
const size_t count,
|
||||
const size_t size
|
||||
) {
|
||||
MALLOC_WRAPPER_ENTER (void_p, "count=%zu , size=%zu", count, size);
|
||||
void* ptr = NULL;
|
||||
if (count * size < 1) {
|
||||
MALLOC_WRAPPER_LEAVE (ptr);
|
||||
}
|
||||
ptr = calloc (count, size);
|
||||
if (ptr == NULL) {
|
||||
MALLOC_WRAPPER_LEAVE (
|
||||
(void_p)h5_error (H5_ERR_NOMEM, "Out of memory. Tried to alloc %lld", (long long int)count* size));
|
||||
}
|
||||
MALLOC_WRAPPER_RETURN (ptr);
|
||||
}
|
||||
|
||||
|
||||
static inline char_p
|
||||
h5_strdup (
|
||||
const char* s1
|
||||
) {
|
||||
MALLOC_WRAPPER_ENTER (char_p, "s='%s'", s1);
|
||||
|
||||
char_p s2 = (char_p)h5_calloc (1, strlen (s1)+1 );
|
||||
if (s2 == NULL) {
|
||||
MALLOC_WRAPPER_LEAVE (
|
||||
(char_p)h5_error (H5_ERR_NOMEM, "Out of memory."));
|
||||
}
|
||||
MALLOC_WRAPPER_RETURN (strcpy (s2, s1));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5CORE_H5_TYPES_H
|
||||
#define __H5CORE_H5_TYPES_H
|
||||
|
||||
//#include <hdf5.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
file modes:
|
||||
H5_O_RDONLY: only reading allowed
|
||||
H5_O_WRONLY: create new file, dataset must not exist
|
||||
H5_O_APPEND: allows to append a new datasets to an existing file
|
||||
H5_O_RDWR: dataset may exist
|
||||
*/
|
||||
|
||||
#define H5_O_RDWR 0x001
|
||||
#define H5_O_RDONLY 0x002
|
||||
#define H5_O_WRONLY 0x004
|
||||
#define H5_O_APPEND 0x008
|
||||
|
||||
#define H5_VFD_MPIPOSIX 0x00000010
|
||||
#define H5_VFD_MPIIO_IND 0x00000020
|
||||
#define H5_VFD_CORE 0x00000040
|
||||
|
||||
#define H5_FLUSH_FILE 0x040
|
||||
#define H5_FLUSH_STEP 0x080
|
||||
#define H5_FLUSH_DATASET 0x100
|
||||
|
||||
#define H5_FS_LUSTRE 0x200
|
||||
|
||||
#define H5_ID_T H5T_NATIVE_INT64
|
||||
#define H5_FLOAT64_T H5T_NATIVE_DOUBLE
|
||||
#define H5_FLOAT32_T H5T_NATIVE_FLOAT
|
||||
#define H5_INT64_T H5T_NATIVE_INT64
|
||||
#define H5_INT32_T H5T_NATIVE_INT32
|
||||
#define H5_INT16_T H5T_NATIVE_INT16
|
||||
#define H5_UINT16_T H5T_NATIVE_UINT16
|
||||
#define H5_STRING_T H5T_NATIVE_CHAR
|
||||
#define H5_COMPOUND_T H5T_COMPOUND
|
||||
|
||||
#define H5_VER_STRING "2.0.0"
|
||||
|
||||
extern const char * const H5_O_MODES[];
|
||||
|
||||
#ifdef WIN32
|
||||
typedef __int64 int64_t;
|
||||
#endif /* WIN32 */
|
||||
|
||||
typedef int64_t h5_int64_t;
|
||||
typedef int32_t h5_int32_t;
|
||||
typedef uint64_t h5_uint64_t;
|
||||
typedef uint32_t h5_uint32_t;
|
||||
typedef int64_t h5_id_t;
|
||||
typedef int16_t h5_lvl_idx_t;
|
||||
typedef int64_t h5_glb_idx_t; // type for a global index
|
||||
typedef int64_t h5_glb_id_t; // type for a global ID
|
||||
|
||||
#if defined(USE_LARGE_INDICES)
|
||||
typedef int64_t h5_loc_idx_t; // type for a local index
|
||||
typedef int64_t h5_loc_id_t; // type for a local ID
|
||||
#else
|
||||
typedef int32_t h5_loc_idx_t; // type for a local index
|
||||
typedef int32_t h5_loc_id_t; // type for a local ID
|
||||
#endif
|
||||
|
||||
typedef int32_t h5_chk_idx_t; // type for a chunk index
|
||||
|
||||
typedef uint64_t h5_size_t; // size in number of elements
|
||||
typedef int64_t h5_ssize_t; // size in number of elements */
|
||||
typedef int64_t h5_err_t;
|
||||
typedef int64_t h5_chk_weight_t;// type for a chunk weight
|
||||
typedef uint16_t h5_chk_size_t; // type for number of elements in chunk
|
||||
typedef int32_t h5_weight_t; // type for weights
|
||||
typedef double h5_time_t; // type for storing a time
|
||||
|
||||
typedef char* char_p;
|
||||
typedef void* void_p;
|
||||
typedef double h5_float64_t;
|
||||
typedef float h5_float32_t;
|
||||
|
||||
typedef struct h5_complex {
|
||||
h5_float64_t r,i;
|
||||
} h5_complex_t;
|
||||
|
||||
typedef h5_float64_t h5_coord3d_t[3];
|
||||
|
||||
struct h5_prop;
|
||||
typedef struct h5_prop* h5_prop_p;
|
||||
typedef uintptr_t h5_prop_t;
|
||||
|
||||
struct h5_prop_file;
|
||||
typedef struct h5_prop_file* h5_prop_file_p;
|
||||
|
||||
struct h5_file;
|
||||
typedef struct h5_file* h5_file_p;
|
||||
typedef uintptr_t h5_file_t;
|
||||
|
||||
struct h5t_mesh;
|
||||
typedef struct h5t_mesh h5t_mesh_t;
|
||||
typedef h5t_mesh_t* h5t_mesh_p;
|
||||
|
||||
typedef h5_err_t (*h5_errorhandler_t)(
|
||||
const char*,
|
||||
va_list ap );
|
||||
|
||||
#ifndef PARALLEL_IO
|
||||
typedef int MPI_Comm;
|
||||
typedef int MPI_Datatype;
|
||||
#endif
|
||||
|
||||
typedef struct h5_loc_idlist {
|
||||
int32_t size; /* allocated space in number of items */
|
||||
int32_t num_items; /* stored items */
|
||||
int32_t flags;
|
||||
h5_loc_id_t items[1];
|
||||
} h5_loc_idlist_t;
|
||||
|
||||
typedef struct h5_glb_idlist {
|
||||
int32_t size; /* allocated space in number of items */
|
||||
int32_t num_items; /* stored items */
|
||||
h5_glb_id_t items[1];
|
||||
} h5_glb_idlist_t;
|
||||
|
||||
typedef struct h5_loc_idxlist {
|
||||
int32_t size; /* allocated space in number of items */
|
||||
int32_t num_items; /* stored items */
|
||||
h5_loc_idx_t items[1];
|
||||
} h5_loc_idxlist_t;
|
||||
|
||||
typedef struct h5_glb_idxlist {
|
||||
int32_t size; /* allocated space in number of items */
|
||||
int32_t num_items; /* stored items */
|
||||
h5_glb_idx_t items[1];
|
||||
} h5_glb_idxlist_t;
|
||||
|
||||
struct h5_idxmap;
|
||||
typedef struct h5_idxmap h5_idxmap_t;
|
||||
|
||||
#define H5_TRIANGLE_MESH (H5_OID_TRIANGLE)
|
||||
#define H5_TETRAHEDRAL_MESH (H5_OID_TETRAHEDRON)
|
||||
|
||||
#define H5_PROP_DEFAULT (0)
|
||||
#define H5_PROP_FILE (1)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5CORE_H5B_ATTRIBS_H
|
||||
#define __H5CORE_H5B_ATTRIBS_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5b_write_field_attrib (
|
||||
const h5_file_t,
|
||||
const char*, const char*, const hid_t, const void*, const h5_int64_t);
|
||||
|
||||
h5_err_t
|
||||
h5b_read_field_attrib (
|
||||
const h5_file_t,
|
||||
const char*, const char*, const h5_int64_t, void* const);
|
||||
|
||||
h5_ssize_t
|
||||
h5b_get_num_field_attribs (
|
||||
const h5_file_t,
|
||||
const char*);
|
||||
|
||||
h5_err_t
|
||||
h5b_get_field_attrib_info (
|
||||
const h5_file_t,
|
||||
const char*, const h5_size_t, char* const, const h5_size_t,
|
||||
h5_int64_t* const, h5_size_t*);
|
||||
|
||||
h5_err_t
|
||||
h5b_set_3d_field_coords (
|
||||
const h5_file_t,
|
||||
const int, const char* const, const char* const,
|
||||
const h5_float64_t* const, const h5_int64_t n_coords);
|
||||
|
||||
h5_err_t
|
||||
h5b_get_3d_field_coords (
|
||||
const h5_file_t,
|
||||
const int rank, const char* const, const char* const,
|
||||
h5_float64_t* const, const h5_int64_t);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5CORE_H5B_IO_H
|
||||
#define __H5CORE_H5B_IO_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5b_write_scalar_data (
|
||||
const h5_file_t,
|
||||
const char*, const void*, const hid_t);
|
||||
|
||||
h5_err_t
|
||||
h5b_write_vector3d_data (
|
||||
const h5_file_t,
|
||||
const char*, const void*, const void*, const void*, const hid_t);
|
||||
|
||||
h5_err_t
|
||||
h5b_read_scalar_data (
|
||||
const h5_file_t,
|
||||
const char*, void*, const hid_t);
|
||||
|
||||
h5_err_t
|
||||
h5b_read_vector3d_data (
|
||||
const h5_file_t,
|
||||
const char*, void*, void*, void*, const hid_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5CORE_H5B_MODEL_H
|
||||
#define __H5CORE_H5B_MODEL_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5b_has_field_data (
|
||||
const h5_file_t);
|
||||
|
||||
h5_int64_t
|
||||
h5b_3d_has_view (
|
||||
const h5_file_t f);
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_set_view (
|
||||
const h5_file_t,
|
||||
const h5_size_t, const h5_size_t,
|
||||
const h5_size_t, const h5_size_t,
|
||||
const h5_size_t, const h5_size_t);
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_get_view (
|
||||
const h5_file_t,
|
||||
h5_size_t* const, h5_size_t* const,
|
||||
h5_size_t* const, h5_size_t* const,
|
||||
h5_size_t* const, h5_size_t* const);
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_get_reduced_view (
|
||||
const h5_file_t,
|
||||
h5_size_t* const, h5_size_t* const,
|
||||
h5_size_t* const, h5_size_t* const,
|
||||
h5_size_t* const, h5_size_t* const);
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_set_chunk (
|
||||
const h5_file_t,
|
||||
const h5_size_t, const h5_size_t, const h5_size_t k);
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_get_chunk (
|
||||
const h5_file_t,
|
||||
const char*,
|
||||
h5_size_t* const, h5_size_t* const, h5_size_t* const);
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
h5_err_t
|
||||
h5b_3d_set_grid (
|
||||
const h5_file_t,
|
||||
const h5_size_t, const h5_size_t, const h5_size_t);
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_get_grid_coords (
|
||||
const h5_file_t,
|
||||
const int,
|
||||
h5_int64_t* const, h5_int64_t* const, h5_int64_t* const);
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_set_dims (
|
||||
const h5_file_t,
|
||||
const h5_size_t, const h5_size_t, const h5_size_t);
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_set_halo (
|
||||
const h5_file_t, const h5_size_t, const h5_size_t, const h5_size_t);
|
||||
|
||||
h5_ssize_t
|
||||
h5b_get_num_fields (
|
||||
const h5_file_t);
|
||||
|
||||
h5_err_t
|
||||
h5b_get_field_info_by_name (
|
||||
const h5_file_t,
|
||||
const char* name,
|
||||
h5_size_t* const, h5_size_t* const, h5_size_t* const, h5_int64_t* const);
|
||||
|
||||
h5_err_t
|
||||
h5b_get_field_info (
|
||||
const h5_file_t,
|
||||
const h5_size_t,
|
||||
char* const, const h5_size_t,
|
||||
h5_size_t* const, h5_size_t* const, h5_size_t* const, h5_int64_t* const);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5CORE_H5T_ADJACENCIES_H
|
||||
#define __H5CORE_H5T_ADJACENCIES_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5t_get_adjacencies (
|
||||
h5t_mesh_t* const m,
|
||||
const h5_loc_id_t entity_id,
|
||||
const h5_int32_t dim,
|
||||
h5_loc_idlist_t **list
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5t_release_list_of_adjacencies (
|
||||
h5t_mesh_t* const m,
|
||||
h5_loc_idlist_t **list
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5t_find_te2 (
|
||||
h5t_mesh_t* const m,
|
||||
h5_loc_idx_t face_idx,
|
||||
h5_loc_idx_t elem_idx,
|
||||
h5_loc_idlist_t** retval
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5T_MAP_H
|
||||
#define __H5T_MAP_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
h5_loc_idx_t
|
||||
h5t_map_global_vertex_idx2local (
|
||||
h5t_mesh_t* const m,
|
||||
h5_glb_idx_t glb_idx
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5t_map_global_vertex_indices2local (
|
||||
h5t_mesh_t* f,
|
||||
const h5_glb_id_t* const glb_indices,
|
||||
const h5_size_t size,
|
||||
h5_loc_idx_t* const loc_indices
|
||||
);
|
||||
|
||||
h5_loc_idx_t
|
||||
h5t_map_glb_elem_idx2loc (
|
||||
h5t_mesh_t* const m,
|
||||
const h5_glb_idx_t glb_idx
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5t_map_glb_elem_indices2loc (
|
||||
h5t_mesh_t* const m,
|
||||
const h5_glb_idx_t* glb_indices,
|
||||
const h5_size_t size,
|
||||
h5_loc_idx_t* loc_indices
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5t_get_loc_vertex_index_of_vertex (
|
||||
h5t_mesh_t* const m,
|
||||
const h5_loc_id_t entity_id,
|
||||
h5_loc_idx_t* vertex_index
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5t_get_loc_vertex_index_of_vertex2 (
|
||||
h5t_mesh_t* const m,
|
||||
const h5_loc_idx_t face_idx,
|
||||
const h5_loc_idx_t elem_idx,
|
||||
h5_loc_idx_t* vertex_indices
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5t_get_loc_vertex_indices_of_edge (
|
||||
h5t_mesh_t* const m,
|
||||
const h5_loc_id_t entity_id,
|
||||
h5_loc_idx_t *vertex_indices
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5t_get_loc_vertex_indices_of_edge2 (
|
||||
h5t_mesh_t* const m,
|
||||
const h5_loc_idx_t face_idx,
|
||||
const h5_loc_idx_t elem_id,
|
||||
h5_loc_idx_t* vertex_indices
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5t_get_loc_vertex_indices_of_triangle (
|
||||
h5t_mesh_t* const m,
|
||||
const h5_loc_id_t entity_id,
|
||||
h5_loc_idx_t* vertex_indices
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5t_get_loc_vertex_indices_of_triangle2 (
|
||||
h5t_mesh_t* const m,
|
||||
const h5_loc_idx_t face_idx,
|
||||
const h5_loc_idx_t elem_idx,
|
||||
h5_loc_idx_t* vertex_indices
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5t_get_loc_vertex_indices_of_tet (
|
||||
h5t_mesh_t* const m,
|
||||
const h5_loc_id_t entity_id,
|
||||
h5_loc_idx_t *vertex_indices
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5t_get_loc_vertex_indices_of_entity (
|
||||
h5t_mesh_t* const m,
|
||||
const h5_loc_id_t entity_id,
|
||||
h5_loc_idx_t *vertex_indices
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5t_get_glb_vertex_indices_of_entity (
|
||||
h5t_mesh_t* const m,
|
||||
const h5_loc_id_t entity_id,
|
||||
h5_glb_idx_t *vertex_indices
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5CORE_H5T_MODEL_H
|
||||
#define __H5CORE_H5T_MODEL_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define H5_GEOBORDER_ENTITY 1
|
||||
#define H5_INTERIOR_ENTITY 2
|
||||
#define H5_BORDER_ENTITY 4
|
||||
#define H5_OVERLAP_ENTITY 8
|
||||
#define H5_FRONT_ENTITY 16
|
||||
#define H5_GHOST_ENTITY 32
|
||||
#define H5_LEAF_ENTITY 64
|
||||
|
||||
h5_err_t h5t_open_tetrahedral_mesh (const h5_file_t, const char*, h5t_mesh_t**);
|
||||
h5_err_t h5t_open_tetrahedral_mesh_by_idx (const h5_file_t, const h5_id_t, h5t_mesh_t**);
|
||||
h5_err_t h5t_open_tetrahedral_mesh_part (const h5_file_p, const char*, h5t_mesh_t** mesh,
|
||||
h5_glb_idx_t*, h5_glb_idx_t);
|
||||
h5_ssize_t h5t_get_num_tetmeshes (const h5_file_t f);
|
||||
|
||||
|
||||
// TODO just removed svn comment, need to check if ok
|
||||
h5_err_t
|
||||
h5t_open_triangle_mesh (
|
||||
const h5_file_t, const char*, h5t_mesh_t**);
|
||||
|
||||
h5_err_t
|
||||
h5t_open_triangle_mesh_by_idx (
|
||||
const h5_file_t, const h5_id_t, h5t_mesh_t**);
|
||||
|
||||
h5_err_t
|
||||
h5t_open_triangle_mesh_part (
|
||||
const h5_file_t, const char*, h5t_mesh_t** mesh,
|
||||
h5_glb_idx_t*, h5_glb_idx_t);
|
||||
|
||||
h5_lvl_idx_t h5t_is_chunked (h5t_mesh_t* const);
|
||||
|
||||
h5_ssize_t h5t_get_num_trimeshes (const h5_file_t f);
|
||||
|
||||
h5_ssize_t h5t_get_num_leaf_levels (h5t_mesh_t* const);
|
||||
|
||||
h5_ssize_t h5t_get_num_vertices (h5t_mesh_t* const, const h5_id_t);
|
||||
|
||||
h5_ssize_t h5t_get_num_leaf_elems (h5t_mesh_t* const, const h5_id_t);
|
||||
|
||||
h5_id_t h5t_add_chunked_tetrahedral_mesh (const h5_file_t, const char* name, h5t_mesh_t**);
|
||||
|
||||
h5_id_t h5t_add_triangle_mesh (const h5_file_t, const char*, h5t_mesh_t**);
|
||||
|
||||
h5_id_t h5t_add_chunked_triangle_mesh (const h5_file_t, const char*, h5t_mesh_t**);
|
||||
|
||||
h5_lvl_idx_t h5t_get_level (h5t_mesh_t* const);
|
||||
|
||||
h5_err_t h5t_open_tetrahedral_mesh (const h5_file_t ,
|
||||
const char*, h5t_mesh_t**);
|
||||
h5_err_t h5t_open_tetrahedral_mesh_by_idx (const h5_file_t ,
|
||||
const h5_id_t, h5t_mesh_t**);
|
||||
|
||||
h5_err_t h5t_open_triangle_mesh (const h5_file_t,
|
||||
const char*, h5t_mesh_t**);
|
||||
h5_err_t h5t_open_triangle_mesh_by_idx (const h5_file_t,
|
||||
const h5_id_t, h5t_mesh_t**);
|
||||
h5_id_t h5t_add_tetrahedral_mesh (const h5_file_t,
|
||||
const char* name, h5t_mesh_t**);
|
||||
h5_id_t h5t_add_triangle_mesh (const h5_file_t,
|
||||
const char*, h5t_mesh_t**);
|
||||
|
||||
h5_err_t h5t_set_level (h5t_mesh_t* const, const h5_lvl_idx_t);
|
||||
|
||||
h5_err_t h5t_set_mesh_changed (h5t_mesh_t* const m);
|
||||
|
||||
h5_err_t h5t_close_mesh (h5t_mesh_t* const);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5T_OCTREE_H
|
||||
#define __H5T_OCTREE_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// it is very unlikely that there are more than 2^32 octants needed. since there is no id
|
||||
// we dont need that...
|
||||
//#if defined(USE_LARGE_INDICES)
|
||||
//typedef int64_t h5_oct_idx_t; // type for a octant
|
||||
//typedef h5_uint64_t h5_oct_userlev_t; // type for user defined levels
|
||||
//#define OCT_USERLEV_LENGTH 64
|
||||
//#else
|
||||
typedef h5_int32_t h5_oct_idx_t; // type for a octant
|
||||
typedef h5_uint32_t h5_oct_userlev_t; // type for user defined levels
|
||||
#define OCT_USERLEV_LENGTH 32
|
||||
//#endif
|
||||
|
||||
typedef h5_int32_t h5_oct_level_t;
|
||||
typedef int16_t h5_oct_orient_t; // orientation of an octant
|
||||
typedef int16_t h5_oct_dir_t; // direction to look for neighboring octants
|
||||
|
||||
|
||||
#define OCT_CHG_INTERNAL 11
|
||||
#define OCT_CHG_USERDATA 12
|
||||
#define OCT_X 13
|
||||
#define OCT_Y 14
|
||||
#define OCT_Z 15
|
||||
|
||||
struct h5_oct_point;
|
||||
typedef struct h5_oct_point h5_oct_point_t;
|
||||
|
||||
struct h5_octant;
|
||||
typedef struct h5_octant h5t_octant_t;
|
||||
|
||||
struct h5_octree;
|
||||
typedef struct h5_octree h5t_octree_t;
|
||||
|
||||
struct h5t_oct_iterator;
|
||||
typedef struct h5t_oct_iterator h5t_oct_iterator_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5CORE_H5T_RETRIEVE_H
|
||||
#define __H5CORE_H5T_RETRIEVE_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct h5t_ref_elem;
|
||||
struct h5t_tagset;
|
||||
struct h5t_iterator;
|
||||
|
||||
typedef struct {
|
||||
h5t_mesh_t* mesh;
|
||||
h5_loc_id_t (*iter)(struct h5t_iterator*);
|
||||
h5_lvl_idx_t leaf_level;
|
||||
const struct h5t_ref_elem* ref_elem;
|
||||
h5_loc_idx_t elem_idx;
|
||||
h5_loc_idx_t face_idx; // face according reference element
|
||||
int codim; // dimension of entities to traverse
|
||||
h5_err_t (*find)(h5t_mesh_t *const, h5_loc_id_t, h5_loc_id_t, h5_loc_idlist_t**);
|
||||
} h5t_leaf_iterator_t;
|
||||
|
||||
typedef struct {
|
||||
h5t_mesh_t* mesh;
|
||||
h5_loc_id_t (*iter)(struct h5t_iterator* iter);
|
||||
h5_lvl_idx_t refinement_level;
|
||||
const struct h5t_ref_elem* ref_elem;
|
||||
h5_loc_idx_t elem_idx;
|
||||
h5_loc_idx_t face_idx; // face according reference element
|
||||
int codim; // dimension of entities to traverse
|
||||
h5_err_t (*find)(h5t_mesh_t *const f, h5_loc_id_t face_idx,
|
||||
h5_loc_id_t elem_idx, h5_loc_idlist_t **retval);
|
||||
} h5t_level_iterator_t;
|
||||
|
||||
typedef struct {
|
||||
h5t_mesh_t* mesh;
|
||||
h5_loc_id_t (*iter)(struct h5t_iterator* iter);
|
||||
h5_lvl_idx_t level_idx;
|
||||
struct h5t_tagset* tagset;
|
||||
h5_loc_idx_t elem_idx;
|
||||
int subentity_idx;
|
||||
} h5t_tag_iterator_t;
|
||||
|
||||
typedef struct h5t_iterator {
|
||||
h5t_mesh_t* mesh;
|
||||
h5_loc_id_t (*iter)(struct h5t_iterator* iter);
|
||||
} h5t_iterator_t;
|
||||
|
||||
|
||||
typedef h5t_iterator_t* h5t_iterator_p;
|
||||
|
||||
h5_err_t
|
||||
h5t_init_leaf_iterator (h5t_iterator_t*, h5t_mesh_t*, const int);
|
||||
|
||||
h5_err_t
|
||||
h5t_init_boundary_face_iterator (h5t_iterator_t*, h5t_mesh_t*, const int);
|
||||
|
||||
h5_err_t
|
||||
h5t_init_mtag_iterator (h5t_iterator_t*, h5t_mesh_t*, const char*);
|
||||
|
||||
h5_err_t
|
||||
h5t_release_entity_iterator (h5t_iterator_t*);
|
||||
|
||||
h5_loc_id_t
|
||||
h5t_iterate_entities (h5t_iterator_t*);
|
||||
|
||||
h5_err_t
|
||||
h5t_end_iterate_entities (h5t_iterator_t*);
|
||||
|
||||
h5_err_t
|
||||
h5t_get_vertex_coords_by_index (h5t_mesh_t* const, h5_loc_idx_t, h5_float64_t[3]);
|
||||
|
||||
h5_err_t
|
||||
h5t_get_vertex_coords_by_id (h5t_mesh_t* const, h5_loc_id_t, h5_float64_t[3]);
|
||||
|
||||
h5_err_t
|
||||
h5t_get_vertex_by_id (h5t_mesh_t* const, const h5_loc_id_t, h5_glb_idx_t*, h5_float64_t*[]);
|
||||
|
||||
h5_err_t
|
||||
h5t_get_neighbor_indices (h5t_mesh_t* const, h5_loc_id_t, h5_loc_idx_t*);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5CORE_H5T_STORE_H
|
||||
#define __H5CORE_H5T_STORE_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5t_begin_store_vertices (
|
||||
h5t_mesh_t* const, const h5_size_t);
|
||||
|
||||
h5_loc_id_t
|
||||
h5t_store_vertex (
|
||||
h5t_mesh_t* const, const h5_glb_id_t, const h5_float64_t[3]);
|
||||
|
||||
h5_err_t
|
||||
h5t_end_store_vertices (
|
||||
h5t_mesh_t* const);
|
||||
|
||||
h5_err_t
|
||||
h5t_begin_store_elems (
|
||||
h5t_mesh_t* const, const h5_size_t, const h5_weight_t);
|
||||
|
||||
h5_loc_idx_t
|
||||
h5t_store_elem (
|
||||
h5t_mesh_t* const, const h5_loc_idx_t, const h5_loc_idx_t*, const h5_weight_t*);
|
||||
|
||||
h5_loc_idx_t
|
||||
h5t_store_elem2 (
|
||||
h5t_mesh_t* const, const h5_loc_idx_t, const h5_loc_idx_t*, const h5_weight_t*);
|
||||
|
||||
h5_err_t
|
||||
h5t_end_store_elems (
|
||||
h5t_mesh_t* const);
|
||||
|
||||
h5_err_t
|
||||
h5t_end_store_ckd_elems (
|
||||
h5t_mesh_t* const m);
|
||||
|
||||
h5_err_t
|
||||
h5t_begin_refine_elems (
|
||||
h5t_mesh_t* const);
|
||||
|
||||
h5_err_t
|
||||
h5t_refine_marked_elems (
|
||||
h5t_mesh_t* const);
|
||||
|
||||
h5_err_t
|
||||
h5t_end_refine_elems (
|
||||
h5t_mesh_t* const);
|
||||
|
||||
h5_err_t
|
||||
h5t_mark_entity (
|
||||
h5t_mesh_t* const, const h5_loc_id_t);
|
||||
|
||||
h5_err_t
|
||||
h5t_pre_refine (
|
||||
h5t_mesh_t* const);
|
||||
|
||||
h5_err_t
|
||||
h5t_refine (
|
||||
h5t_mesh_t* const);
|
||||
|
||||
h5_err_t
|
||||
h5t_post_refine (
|
||||
h5t_mesh_t* const);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5CORE_H5T_TAGS_H
|
||||
#define __H5CORE_H5T_TAGS_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct h5t_tagset h5t_tagset_t;
|
||||
typedef struct h5t_tagcontainer h5t_tagcontainer_t;
|
||||
|
||||
h5_ssize_t
|
||||
h5t_get_num_mtagsets (h5t_mesh_t* const);
|
||||
|
||||
h5_err_t
|
||||
h5t_get_mtagset_info (h5t_mesh_t* const, const h5_size_t, char[],
|
||||
const h5_size_t, h5_int64_t* const);
|
||||
|
||||
h5_err_t
|
||||
h5t_mtagset_exists (h5t_mesh_t* const, const char* const);
|
||||
|
||||
h5_err_t
|
||||
h5t_create_mtagset (h5t_mesh_t* const, const char[], const h5_id_t, h5t_tagset_t**);
|
||||
|
||||
h5_err_t
|
||||
h5t_open_mtagset (h5t_mesh_t* const, const char* const, h5t_tagset_t**);
|
||||
|
||||
h5_err_t
|
||||
h5t_close_mtagset (h5t_tagset_t*);
|
||||
|
||||
h5_err_t
|
||||
h5t_remove_mtagset (h5t_mesh_t* const, const char[]);
|
||||
|
||||
h5_err_t
|
||||
h5t_set_tag (h5t_tagset_t* const, const h5_loc_id_t, const h5_size_t, void*);
|
||||
|
||||
h5_loc_id_t
|
||||
h5t_get_tag (const h5t_tagset_t*, const h5_loc_id_t, h5_size_t* const, void* const);
|
||||
|
||||
h5_err_t
|
||||
h5t_remove_tag (h5t_tagset_t*, const h5_loc_id_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5CORE_H5U_IO_H
|
||||
#define __H5CORE_H5U_IO_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
h5_int64_t
|
||||
h5u_read_data (
|
||||
const h5_file_t,
|
||||
const char* const, void* const, const hid_t);
|
||||
|
||||
h5_int64_t
|
||||
h5u_write_data (
|
||||
const h5_file_t,
|
||||
const char* const, const void* const, const hid_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, 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 __H5CORE_H5U_MODEL_H
|
||||
#define __H5CORE_H5U_MODEL_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
h5_ssize_t
|
||||
h5u_get_num_particles (
|
||||
const h5_file_t);
|
||||
|
||||
h5_ssize_t
|
||||
h5u_get_num_particles_in_view (
|
||||
const h5_file_t);
|
||||
|
||||
h5_ssize_t
|
||||
h5u_get_totalnum_particles_by_name (
|
||||
const h5_file_t,
|
||||
const char* const);
|
||||
|
||||
h5_ssize_t
|
||||
h5u_get_totalnum_particles_by_idx (
|
||||
const h5_file_t,
|
||||
h5_id_t);
|
||||
|
||||
h5_err_t
|
||||
h5u_set_num_particles (
|
||||
const h5_file_t,
|
||||
const h5_size_t, const h5_size_t);
|
||||
|
||||
h5_err_t
|
||||
h5u_has_view (
|
||||
const const h5_file_t);
|
||||
|
||||
h5_err_t
|
||||
h5u_reset_view (
|
||||
const h5_file_t);
|
||||
|
||||
h5_err_t
|
||||
h5u_set_view (
|
||||
const h5_file_t, const h5_int64_t, const h5_int64_t);
|
||||
|
||||
h5_err_t
|
||||
h5u_set_view_indices (
|
||||
const h5_file_t,
|
||||
const h5_size_t* const, const h5_size_t);
|
||||
|
||||
h5_err_t
|
||||
h5u_get_view (
|
||||
const h5_file_t,
|
||||
h5_int64_t* const, h5_int64_t* const);
|
||||
|
||||
h5_err_t
|
||||
h5u_set_canonical_view (
|
||||
const h5_file_t);
|
||||
|
||||
h5_ssize_t
|
||||
h5u_get_num_datasets (
|
||||
const h5_file_t);
|
||||
|
||||
h5_err_t
|
||||
h5u_get_dataset_info (
|
||||
const h5_file_t,
|
||||
const h5_id_t, char* const, const h5_size_t, h5_int64_t* const,
|
||||
h5_size_t* const);
|
||||
|
||||
h5_err_t
|
||||
h5u_get_dataset_info_by_name (
|
||||
const h5_file_p f,
|
||||
const char* const dataset_name,
|
||||
h5_int64_t* const type,
|
||||
h5_size_t* const nelem
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5u_set_chunk (
|
||||
const h5_file_t,
|
||||
const h5_size_t);
|
||||
|
||||
h5_err_t
|
||||
h5u_get_chunk (
|
||||
const h5_file_t,
|
||||
const char*, h5_size_t*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user