- re-organize file hierarchy

- years in copyright changed
This commit is contained in:
2016-04-29 16:34:07 +02:00
parent 3d6230629c
commit 52d44e3b3c
125 changed files with 1840 additions and 1744 deletions
+1 -2
View File
@@ -12,8 +12,7 @@
#include <string.h>
#include "h5core/h5_types.h"
#include "h5core/h5.h"
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5b_attribs.h"
+65 -150
View File
@@ -10,8 +10,7 @@
#ifndef __H5BLOCK_IO_H
#define __H5BLOCK_IO_H
#include "h5core/h5_types.h"
#include "h5core/h5.h"
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5b_io.h"
@@ -19,136 +18,12 @@
extern "C" {
#endif
/*
! _ _
! (_)_ __ __ _ _ _(_)_ __ ___
! | | '_ \ / _` | | | | | '__/ _ \
! | | | | | (_| | |_| | | | | __/
! |_|_| |_|\__, |\__,_|_|_| \___|
! |_|
!
*/
/**
\addtogroup h5block_io
@{
*/
/**
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));
}
/**
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 on success
\return \c H5_FAILURE on error
*/
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));
}
/**
Determines whether a field with a given name exists.
\return true (value \c >0) if atrribute exists
\return false (\c 0) if attribute does not exist
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5BlockHasField (
const h5_file_t f, ///< [in] file handle
const char* name ///< [in] field name
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s'",
(h5_file_p)f, name);
H5_API_RETURN (
h5b_has_field (
f,
name));
}
/**
Get the rank and dimensions of the field specified by its name.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
\see H5BlockGetFieldInfo.
*/
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));
}
/*
! _ _ _
! __ ___ __(_) |_ ___ ___ ___ __ _| | __ _ _ __
@@ -216,7 +91,9 @@ H5Block3dWriteScalarFieldFloat64 (
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 ));
H5_API_RETURN (
h5b_write_scalar_data (
f, name, (void*)buffer, H5T_NATIVE_DOUBLE ));
}
static inline h5_err_t
@@ -229,7 +106,9 @@ H5Block3dWriteScalarFieldFloat32 (
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 ));
H5_API_RETURN (
h5b_write_scalar_data (
f, name, buffer, H5T_NATIVE_FLOAT ));
}
static inline h5_err_t
@@ -242,7 +121,9 @@ H5Block3dWriteScalarFieldInt64 (
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 ));
H5_API_RETURN (
h5b_write_scalar_data (
f, name, buffer, H5T_NATIVE_INT64 ));
}
static inline h5_err_t
@@ -255,7 +136,9 @@ H5Block3dWriteScalarFieldInt32 (
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 ));
H5_API_RETURN (
h5b_write_scalar_data (
f, name, buffer, H5T_NATIVE_INT32 ));
}
/*
@@ -316,7 +199,9 @@ H5Block3dReadScalarFieldFloat64 (
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));
H5_API_RETURN (
h5b_read_scalar_data (
f, name, (void*)buffer, H5T_NATIVE_DOUBLE));
}
static inline h5_err_t
@@ -329,7 +214,9 @@ H5Block3dReadScalarFieldFloat32 (
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));
H5_API_RETURN (
h5b_read_scalar_data (
f, name, buffer, H5T_NATIVE_FLOAT));
}
static inline h5_err_t
@@ -342,7 +229,9 @@ H5Block3dReadScalarFieldInt64 (
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));
H5_API_RETURN (
h5b_read_scalar_data (
f, name, buffer, H5T_NATIVE_INT64));
}
static inline h5_err_t
@@ -355,7 +244,9 @@ H5Block3dReadScalarFieldInt32 (
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));
H5_API_RETURN (
h5b_read_scalar_data (
f, name, buffer, H5T_NATIVE_INT32));
}
/*
@@ -438,8 +329,11 @@ H5Block3dWriteVector3dFieldFloat64 (
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));
H5_API_RETURN (
h5b_write_vector3d_data(
f, name,
(void*)x_buf, (void*)y_buf, (void*)z_buf,
H5T_NATIVE_DOUBLE));
}
static inline h5_err_t
@@ -454,8 +348,11 @@ H5Block3dWriteVector3dFieldFloat32 (
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));
H5_API_RETURN(
h5b_write_vector3d_data (
f, name,
x_buf, y_buf, z_buf,
H5T_NATIVE_FLOAT));
}
static inline h5_err_t
@@ -470,8 +367,11 @@ H5Block3dWriteVector3dFieldInt64 (
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));
H5_API_RETURN (
h5b_write_vector3d_data (
f, name,
x_buf, y_buf, z_buf,
H5T_NATIVE_INT64));
}
static inline h5_err_t
@@ -486,8 +386,11 @@ H5Block3dWriteVector3dFieldInt32 (
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));
H5_API_RETURN (
h5b_write_vector3d_data(
f, name,
x_buf, y_buf, z_buf,
H5T_NATIVE_INT32));
}
/*
@@ -564,8 +467,11 @@ H5Block3dReadVector3dFieldFloat64 (
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));
H5_API_RETURN (
h5b_read_vector3d_data (
f, name,
x_buf, y_buf, z_buf,
H5T_NATIVE_DOUBLE));
}
static inline h5_err_t
@@ -580,8 +486,11 @@ H5Block3dReadVector3dFieldFloat32 (
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));
H5_API_RETURN (
h5b_read_vector3d_data (
f, name,
x_buf, y_buf, z_buf,
H5T_NATIVE_FLOAT));
}
static inline h5_err_t
@@ -596,8 +505,11 @@ H5Block3dReadVector3dFieldInt64 (
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));
H5_API_RETURN (
h5b_read_vector3d_data (
f, name,
x_buf, y_buf, z_buf,
H5T_NATIVE_INT64));
}
static inline h5_err_t
@@ -612,8 +524,11 @@ H5Block3dReadVector3dFieldInt32 (
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));
H5_API_RETURN (
h5b_read_vector3d_data (
f, name,
x_buf, y_buf, z_buf,
H5T_NATIVE_INT32));
}
///< @}
+128 -3
View File
@@ -10,8 +10,7 @@
#ifndef __H5BLOCK_MODEL
#define __H5BLOCK_MODEL
#include "h5core/h5_types.h"
#include "h5core/h5.h"
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5b_model.h"
@@ -24,7 +23,15 @@
extern "C" {
#endif
/********************** defining the layout **********************************/
/*
! _ _
! (_)_ __ __ _ _ _(_)_ __ ___
! | | '_ \ / _` | | | | | '__/ _ \
! | | | | | (_| | |_| | | | | __/
! |_|_| |_|\__, |\__,_|_|_| \___|
! |_|
!
*/
/**
Checks whether the current time-step has field data or not.
@@ -43,6 +50,124 @@ H5BlockHasFieldData (
H5_API_RETURN (h5b_has_field_data (f));
}
/**
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));
}
/**
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 on success
\return \c H5_FAILURE on error
*/
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));
}
/**
Determines whether a field with a given name exists.
\return true (value \c >0) if atrribute exists
\return false (\c 0) if attribute does not exist
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5BlockHasField (
const h5_file_t f, ///< [in] file handle
const char* name ///< [in] field name
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s'",
(h5_file_p)f, name);
H5_API_RETURN (
h5b_has_field (
f,
name));
}
/**
Get the rank and dimensions of the field specified by its name.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
\see H5BlockGetFieldInfo.
*/
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));
}
/********************** defining the layout **********************************/
/**
Tests whether a view has been set, either directly with
\ref H5Block3dSetView or indirectly with \ref H5Block3dSetGrid.
+1 -1
View File
@@ -11,7 +11,7 @@
#define __H5FED_ADJACENCY_H
#include "h5core/h5_types.h"
#include "h5core/h5.h"
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5t_adjacencies.h"
+1 -1
View File
@@ -11,7 +11,7 @@
#define __H5FED_MODEL_H
#include "h5core/h5_types.h"
#include "h5core/h5.h"
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5t_model.h"
+1 -1
View File
@@ -11,7 +11,7 @@
#define __H5FED_RETRIEVE_H
#include "h5core/h5_types.h"
#include "h5core/h5.h"
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5_syscall.h"
#include "h5core/h5t_map.h"
+1 -1
View File
@@ -11,7 +11,7 @@
#define __H5FED_STORE_H
#include "h5core/h5_types.h"
#include "h5core/h5.h"
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5t_store.h"
+1 -1
View File
@@ -11,7 +11,7 @@
#define __H5FED_TAGS_H
#include "h5core/h5_types.h"
#include "h5core/h5.h"
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5t_tags.h"
+1 -185
View File
@@ -10,203 +10,19 @@
#ifndef H5PART_IO
#define H5PART_IO
#include "h5core/h5_types.h"
#include "h5core/h5.h"
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5u_io.h"
#include "h5core/h5u_model.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
! _ _
! (_)_ __ __ _ _ _(_)_ __ ___
! | | '_ \ / _` | | | | | '__/ _ \
! | | | | | (_| | |_| | | | | __/
! |_|_| |_|\__, |\__,_|_|_| \___|
! |_|
!
*/
/**
\addtogroup h5part_io
@{
*/
/**
Get the number of datasets that are stored at the current step.
\return number of datasets in current timestep
\return \c H5_FAILURE on error
*/
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));
}
/**
Query the name of a dataset given by it's index in the current step.
If the number of datasets is \c n, the range of \c _index is \c 0 to \c n-1.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
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));
}
/**
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 on success
\return \c H5_FAILURE on error
\see H5PartGetNumDatasets()
\see H5PartGetDatasetInfoByName()
*/
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));
}
/**
Determines whether a dataset with given name exists in current step.
\return true (value \c >0) if step exists
\return false (\c 0) if step does not exist
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5PartHasDataset (
const h5_file_t f, ///< [in] file handle
const char* const name ///< [in] name of dataset
) {
H5_API_ENTER (h5_int64_t,
"f=%p, name='%s'",
(h5_file_p)f, name);
H5_API_RETURN (h5u_has_dataset (f, name));
}
/**
Gets the type and number of elements of a dataset based on its
name 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 on success
\return \c H5_FAILURE on error
\see H5PartHasDataset()
\see H5PartGetDatasetInfo()
*/
static inline h5_err_t
H5PartGetDatasetInfoByName (
const h5_file_t f, ///< [in] file handle
const char* const name, ///< [in] name of dataset
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, "
"name='%s', "
"type=%p, nelems=%p",
(h5_file_p)f,
name,
type, nelems);
H5_API_RETURN (h5u_get_dataset_info_by_name (
f, name, type, nelems));
}
/**
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 elements in datasets in current step.
\return \c H5_FAILURE on error.
*/
static inline h5_ssize_t
H5PartGetNumPoints (
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_points (f));
}
/**
\see H5PartGetNumPoints()
*/
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_points (f));
}
/*
! _ _
+186 -2
View File
@@ -10,8 +10,7 @@
#ifndef H5PART_MODEL
#define H5PART_MODEL
#include "h5core/h5_types.h"
#include "h5core/h5.h"
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5u_model.h"
@@ -24,6 +23,148 @@
extern "C" {
#endif
/*
! _ _
! (_)_ __ __ _ _ _(_)_ __ ___
! | | '_ \ / _` | | | | | '__/ _ \
! | | | | | (_| | |_| | | | | __/
! |_|_| |_|\__, |\__,_|_|_| \___|
! |_|
!
*/
/**
Get the number of datasets that are stored at the current step.
\return number of datasets in current timestep
\return \c H5_FAILURE on error
*/
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));
}
/**
Query the name of a dataset given by it's index in the current step.
If the number of datasets is \c n, the range of \c _index is \c 0 to \c n-1.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
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));
}
/**
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 on success
\return \c H5_FAILURE on error
\see H5PartGetNumDatasets()
\see H5PartGetDatasetInfoByName()
*/
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));
}
/**
Determines whether a dataset with given name exists in current step.
\return true (value \c >0) if step exists
\return false (\c 0) if step does not exist
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5PartHasDataset (
const h5_file_t f, ///< [in] file handle
const char* const name ///< [in] name of dataset
) {
H5_API_ENTER (h5_int64_t,
"f=%p, name='%s'",
(h5_file_p)f, name);
H5_API_RETURN (h5u_has_dataset (f, name));
}
/**
Gets the type and number of elements of a dataset based on its
name 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 on success
\return \c H5_FAILURE on error
\see H5PartHasDataset()
\see H5PartGetDatasetInfo()
*/
static inline h5_err_t
H5PartGetDatasetInfoByName (
const h5_file_t f, ///< [in] file handle
const char* const name, ///< [in] name of dataset
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, "
"name='%s', "
"type=%p, nelems=%p",
(h5_file_p)f,
name,
type, nelems);
H5_API_RETURN (h5u_get_dataset_info_by_name (
f, name, type, nelems));
}
/**
Set the number of points/particles for the current time-step.
After you call this subroutine, all subsequent
@@ -77,6 +218,49 @@ H5PartSetNumParticles (
H5_API_RETURN (h5u_set_num_points (f, nparticles, stride));
}
/**
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 elements in datasets in current step.
\return \c H5_FAILURE on error.
*/
static inline h5_ssize_t
H5PartGetNumPoints (
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_points (f));
}
/**
\see H5PartGetNumPoints()
*/
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_points (f));
}
/**
Set the number of particles for the current time-step.
After you call this subroutine, all subsequent
+155
View File
@@ -0,0 +1,155 @@
/*
Copyright (c) 2006-2016, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#ifndef __H5_ATTACHMENTS_H
#define __H5_ATTACHMENTS_H
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5_model.h"
#include "h5core/h5_attachments.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
\addtogroup h5_attach
@{
*/
/**
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));
}
/**
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 on success
\return \c H5_FAILURE on error
*/
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));
}
/**
Query whether a particular attachment exists in the file.
\return true (value \c >0) if attachment exists
\return false (\c 0) if attachment does not exist
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5HasAttachment (
const h5_file_t f, ///< [in] file handle.
const char* const fname ///< [in] original file name.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s'",
(h5_file_p)f, fname);
H5_API_RETURN (h5_has_attachment (f, fname));
}
/**
Get size of attached file with name \c fname.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
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));
}
/**
Attach file \c fname.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
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));
}
/**
Get attachment \c fname from H5hut file and write it to disk in
the current working directory.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
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));
}
/**
Delete attachment \c fname.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
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
+2 -1
View File
@@ -10,7 +10,8 @@
#ifndef __H5_DEBUG_H
#define __H5_DEBUG_H
#include "h5core/h5_types.h"
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
/**
\addtogroup h5_debug
+1 -2
View File
@@ -10,8 +10,7 @@
#ifndef __H5_ERROR_H
#define __H5_ERROR_H
#include "h5core/h5_types.h"
#include "h5core/h5.h"
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
/**
+4 -2
View File
@@ -10,9 +10,11 @@
#ifndef __H5_FILE_H
#define __H5_FILE_H
#include "h5core/h5_types.h"
#include "h5core/h5.h"
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5_file.h"
#include <hdf5.h>
#ifdef __cplusplus
extern "C" {
+2 -3
View File
@@ -12,10 +12,9 @@
#include <string.h>
#include "h5core/h5_types.h"
#include "h5core/h5.h"
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5_attribs.h"
#include "h5core/h5_file_attribs.h"
#ifdef __cplusplus
extern "C" {
+8 -173
View File
@@ -10,8 +10,7 @@
#ifndef __H5_MODEL_H
#define __H5_MODEL_H
#include "h5core/h5_types.h"
#include "h5core/h5.h"
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5_model.h"
@@ -97,22 +96,6 @@ H5GetStep (
H5_API_RETURN (h5_get_step (f));
}
/**
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));
}
/**
Get the number of time-steps that are currently stored in the file
\c f.
@@ -152,175 +135,27 @@ H5HasStep (
}
/**
Start traversing steps.
Get the number of processors.
\note This function is not yet implemented!
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5StartTraverseSteps (
\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_start_traverse_steps (f));
H5_API_RETURN (h5_get_num_procs(f));
}
/**
Go to next step.
\note This function is not yet implemented!
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
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));
}
/**
@}
*/
/**
\addtogroup h5_attach
@{
*/
/**
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));
}
/**
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 on success
\return \c H5_FAILURE on error
*/
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));
}
/**
Query whether a particular attachment exists in the file.
\return true (value \c >0) if attachment exists
\return false (\c 0) if attachment does not exist
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5HasAttachment (
const h5_file_t f, ///< [in] file handle.
const char* const fname ///< [in] original file name.
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s'",
(h5_file_p)f, fname);
H5_API_RETURN (h5_has_attachment (f, fname));
}
/**
Get size of attached file with name \c fname.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
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));
}
/**
Attach file \c fname.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
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));
}
/**
Get attachment \c fname from H5hut file and write it to disk in
the current working directory.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
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));
}
/**
Delete attachment \c fname.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
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
+2 -3
View File
@@ -12,10 +12,9 @@
#include <string.h>
#include "h5core/h5_types.h"
#include "h5core/h5.h"
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5_attribs.h"
#include "h5core/h5_step_attribs.h"
#ifdef __cplusplus
extern "C" {
+1 -1
View File
@@ -14,7 +14,7 @@
#define H5HUT_API_VERSION 2
#endif
#include "H5_attachments.h"
#include "H5_file.h"
#include "H5_model.h"
#include "H5_file_attribs.h"
+5 -2
View File
@@ -1,10 +1,13 @@
otherincludedir = $(includedir)/h5core
include_HEADERS = \
h5.h \
h5_attribs.h \
h5_attachments.h \
h5_debug.h \
h5_errorhandling.h \
h5_file.h \
h5_file_attribs.h \
h5_step_attribs.h \
h5_init.h \
h5_model.h \
h5_syscall.h \
h5_types.h \
+56
View File
@@ -0,0 +1,56 @@
/*
Copyright (c) 2006-2016, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#ifndef __H5CORE_H5_ATTACHMENTS
#define __H5CORE_H5_ATTACHMENTS
#include "h5core/h5_types.h"
#ifdef __cplusplus
extern "C" {
#endif
h5_err_t
h5_add_attachment (
const h5_file_t, const char* const);
h5_err_t
h5_has_attachments (
const h5_file_t);
h5_err_t
h5_has_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
#endif
+227
View File
@@ -10,6 +10,9 @@
#ifndef __H5CORE_H5_DEBUG_H
#define __H5CORE_H5_DEBUG_H
#include <stdio.h>
#include <stddef.h>
#include "h5core/h5_types.h"
#include "h5core/h5_errorhandling.h"
@@ -37,6 +40,221 @@ extern "C" {
#define H5_DEBUG_ALL (-1 & ~0x3)
extern char* h5_rfmts[];
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;
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;
}
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);
}
}
//////////////////////////////////////////////////////////////////////////////
// function enter macro
@@ -142,6 +360,15 @@ done: \
goto done; \
}
h5_err_t
h5_set_debuglevel (
const h5_id_t);
h5_err_t
h5_get_debuglevel (
void);
#ifdef __cplusplus
}
#endif
-222
View File
@@ -48,44 +48,6 @@ extern "C" {
/** @}*/
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() \
@@ -101,14 +63,6 @@ extern h5_err_t h5_errno;
__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);
@@ -125,68 +79,6 @@ 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 (
@@ -200,120 +92,6 @@ h5_abort_errorhandler (
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
@@ -7,36 +7,22 @@
License: see file COPYING in top level of source distribution.
*/
#ifndef __H5CORE_H5_H
#define __H5CORE_H5_H
#ifndef __H5CORE_H5_FILE_H
#define __H5CORE_H5_FILE_H
#if defined(PARALLEL_IO)
#include <mpi.h>
#endif
#include "h5core/h5_types.h"
#include <hdf5.h>
// dummy MPI calls for serial code
#if !defined (PARALLEL_IO)
typedef int MPI_Comm;
#define MPI_Init(argc, argv)
#define MPI_Comm_size(comm, nprocs) {(void)comm; *nprocs = 1; }
#define MPI_Comm_rank(comm, myproc) {(void)comm; *myproc = 0; }
#define MPI_Finalize()
#define MPI_COMM_WORLD (0)
#define MPI_COMM_SELF (1)
#endif
#include "h5core/h5_types.h"
#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);
@@ -97,36 +83,8 @@ 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 (
hid_t
h5_get_hdf5_file(
const h5_file_t);
#ifdef __cplusplus
@@ -7,10 +7,11 @@
License: see file COPYING in top level of source distribution.
*/
#ifndef __H5CORE_H5_ATTRIBS_H
#define __H5CORE_H5_ATTRIBS_H
#ifndef __H5CORE_H5_FILE_ATTRIBS_H
#define __H5CORE_H5_FILE_ATTRIBS_H
#include "h5core/h5_types.h"
#include <hdf5.h>
#ifdef __cplusplus
extern "C" {
@@ -20,52 +21,27 @@ h5_err_t
h5_has_file_attrib (
const h5_file_t, const char* const);
h5_err_t
h5_has_step_attrib (
const h5_file_t, const char* const);
h5_err_t
h5_get_file_attrib_info_by_name (
const h5_file_t, const char* const, h5_int64_t* const, h5_size_t*);
h5_err_t
h5_get_step_attrib_info_by_name (
const h5_file_t, const char* const, 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);
h5_err_t
h5_get_file_attrib_info_by_idx (
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_by_idx (
const h5_file_t, const h5_size_t, char*, const h5_size_t, h5_int64_t*,
h5_size_t*);
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);
#ifdef __cplusplus
}
#endif
+40
View File
@@ -0,0 +1,40 @@
/*
Copyright (c) 2006-2016, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#ifndef __H5CORE_H5_H
#define __H5CORE_H5_H
#include "h5core/h5_types.h"
// dummy MPI calls for serial code
#if !defined (PARALLEL_IO)
typedef int MPI_Comm;
#define MPI_Init(argc, argv)
#define MPI_Comm_size(comm, nprocs) {(void)comm; *nprocs = 1; }
#define MPI_Comm_rank(comm, myproc) {(void)comm; *myproc = 0; }
#define MPI_Finalize()
#define MPI_COMM_WORLD (0)
#define MPI_COMM_SELF (1)
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern int h5_initialized;
h5_err_t
h5_initialize (void);
#ifdef __cplusplus
}
#endif
#endif
+20 -27
View File
@@ -7,8 +7,8 @@
License: see file COPYING in top level of source distribution.
*/
#ifndef __H5CORE_H5_MODEL
#define __H5CORE_H5_MODEL
#ifndef __H5CORE_H5_MODEL_H
#define __H5CORE_H5_MODEL_H
#include "h5core/h5_types.h"
@@ -18,42 +18,35 @@ extern "C" {
#define H5_MAX_NAME_LEN 64
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);
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_err_t
h5_has_attachments (
h5_int64_t
h5_get_step (
const h5_file_t);
h5_err_t
h5_has_attachment (
const h5_file_t, const char* const);
h5_ssize_t
h5_get_num_attachments (
h5_get_num_steps (
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);
h5_int64_t
h5_has_step (
const h5_file_t, const h5_int64_t);
int
h5_get_num_procs (
const h5_file_t);
#ifdef __cplusplus
}
+49
View File
@@ -0,0 +1,49 @@
/*
Copyright (c) 2006-2016, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#ifndef __H5CORE_H5_STEP_ATTRIBS_H
#define __H5CORE_H5_STEP_ATTRIBS_H
#include "h5core/h5_types.h"
#include <hdf5.h>
#ifdef __cplusplus
extern "C" {
#endif
h5_err_t
h5_has_step_attrib (
const h5_file_t, const char* const);
h5_err_t
h5_get_step_attrib_info_by_name (
const h5_file_t, const char* const, h5_int64_t*, h5_size_t*);
h5_ssize_t
h5_get_num_step_attribs (
const h5_file_t f);
h5_err_t
h5_get_step_attrib_info_by_idx (
const h5_file_t, const h5_size_t, char*, const h5_size_t, h5_int64_t*,
h5_size_t*);
h5_err_t
h5_read_step_attrib (
const h5_file_t, const char*, const hid_t, void*);
h5_err_t
h5_write_step_attrib (
const h5_file_t, const char*, const hid_t, const void*, const hsize_t);
#ifdef __cplusplus
}
#endif
#endif
-1
View File
@@ -15,7 +15,6 @@
#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__)
-1
View File
@@ -52,7 +52,6 @@ extern "C" {
#define H5_COMPOUND_T H5T_COMPOUND
extern const char* H5_VER_STRING;
extern const char* const H5_O_MODES[];
#ifdef WIN32
typedef __int64 int64_t;
+12 -11
View File
@@ -11,6 +11,7 @@
#define __H5CORE_H5B_ATTRIBS_H
#include "h5core/h5_types.h"
#include <hdf5.h>
/*
:TODO: move macros to private include file
@@ -25,15 +26,16 @@
extern "C" {
#endif
h5_err_t
h5b_write_field_attrib (
h5_ssize_t
h5b_get_num_field_attribs (
const h5_file_t,
const char*, const char*, const hid_t, const void*, const h5_int64_t);
const char*);
h5_err_t
h5b_read_field_attrib (
h5b_get_field_attrib_info_by_idx (
const h5_file_t,
const char*, const char*, const h5_int64_t, void* const);
const char*, const h5_size_t, char* const, const h5_size_t,
h5_int64_t* const, h5_size_t*);
h5_err_t
h5b_has_field_attrib (
@@ -49,16 +51,15 @@ h5b_get_field_attrib_info_by_name (
h5_int64_t*,
h5_size_t*);
h5_ssize_t
h5b_get_num_field_attribs (
h5_err_t
h5b_write_field_attrib (
const h5_file_t,
const char*);
const char*, const char*, const hid_t, const void*, const h5_int64_t);
h5_err_t
h5b_get_field_attrib_info_by_idx (
h5b_read_field_attrib (
const h5_file_t,
const char*, const h5_size_t, char* const, const h5_size_t,
h5_int64_t* const, h5_size_t*);
const char*, const char*, const h5_int64_t, void* const);
h5_err_t
h5b_set_3d_field_coords (
+1
View File
@@ -11,6 +11,7 @@
#define __H5CORE_H5B_IO_H
#include "h5core/h5_types.h"
#include <hdf5.h>
#ifdef __cplusplus
extern "C" {
+22 -22
View File
@@ -20,6 +20,28 @@ h5_err_t
h5b_has_field_data (
const h5_file_t);
h5_ssize_t
h5b_get_num_fields (
const h5_file_t);
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);
h5_err_t
h5b_has_field (
const h5_file_t,
const char*);
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_int64_t
h5b_3d_has_view (
const h5_file_t f);
@@ -78,28 +100,6 @@ 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_has_field (
const h5_file_t,
const char*);
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
+1
View File
@@ -11,6 +11,7 @@
#define __H5CORE_H5U_IO_H
#include "h5core/h5_types.h"
#include <hdf5.h>
#ifdef __cplusplus
extern "C" {
+24 -24
View File
@@ -16,6 +16,30 @@
extern "C" {
#endif
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_has_dataset (
const h5_file_t fh,
const char* const name
);
h5_err_t
h5u_get_dataset_info_by_name (
const h5_file_t f,
const char* const dataset_name,
h5_int64_t* const type,
h5_size_t* const nelem
);
h5_ssize_t
h5u_get_num_points (
const h5_file_t);
@@ -65,30 +89,6 @@ 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_has_dataset (
const h5_file_t fh,
const char* const name
);
h5_err_t
h5u_get_dataset_info_by_name (
const h5_file_t 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,