continued merging H5Block: still some functionality missing (attribs, read, write); added H5Part regression tests; simplified several Makefile.am files and configure.ac; began merging new Fortran interface

This commit is contained in:
Marc Howison
2010-07-09 16:24:57 +00:00
parent b2dbc55839
commit 9f3fd3b053
65 changed files with 7708 additions and 2939 deletions
+5 -2
View File
@@ -16,8 +16,6 @@
#ifndef __H5_H
#define __H5_H
#include "H5_inquiry.h"
h5_file_t *
H5OpenFile (
const char * filename,
@@ -30,6 +28,11 @@ H5CloseFile (
h5_file_t * f
);
h5_err_t
H5CheckFile (
h5_file_t * f
);
h5_err_t
H5SetStepNameFormat (
h5_file_t *f,
+110 -133
View File
@@ -1,172 +1,149 @@
/*
Header file for declaring the H5Fed application programming
interface (API) in the C language.
Copyright 2006-2007
Paul Scherrer Institut, Villigen, Switzerland;
Benedikt Oswald;
Achim Gsell
All rights reserved.
Authors
Achim Gsell
Warning
This code is under development.
*/
#ifndef __H5Part_H
#define __H5Part_H
#ifndef __H5PART_H
#define __H5PART_H
#include <hdf5.h>
h5_err_t
H5PartSetNumParticles (
h5_file_t *f, /*!< [in] Handle to open file */
h5_int64_t nparticles /*!< [in] Number of particles */
);
#ifdef __cplusplus
extern "C" {
#endif
h5_err_t
H5PartSetNumParticlesStrided (
h5_file_t *f, /*!< [in] Handle to open file */
h5_int64_t nparticles, /*!< [in] Number of particles */
h5_int64_t stride /*!< [in] Stride value (e.g. number of fields in the particle array) */
);
#include "h5core/h5_core.h"
#include "H5.h"
#ifdef PARALLEL_IO
#include <mpi.h>
#endif
// #define H5PART_SUCCESS H5_SUCCESS
#define H5PART_ERR_NOMEM H5_ERR_NOMEM
#define H5PART_ERR_INVAL H5_ERR_INVAL
#define H5PART_ERR_BADFD H5_ERR_BADFD
#define H5PART_ERR_LAYOUT H5_ERR_LAYOUT
#define H5PART_ERR_NOENT H5_ERR_NOENT
#define H5PART_ERR_NOENTRY H5_ERR_NOENTRY
#define H5PART_ERR_MPI H5_ERR_MPI
#define H5PART_ERR_HDF5 H5_ERR_HDF5
#define H5PART_READ H5_O_RDONLY
#define H5PART_WRITE H5_O_WRONLY
#define H5PART_APPEND H5_O_APPEND
#define H5PART_INT64 ((h5_int64_t)H5T_NATIVE_INT64)
#define H5PART_FLOAT64 ((h5_int64_t)H5T_NATIVE_DOUBLE)
#define H5PART_CHAR ((h5_int64_t)H5T_NATIVE_CHAR)
/*============== File Writing Functions ==================== */
h5_int64_t
H5PartDefineStepName (
h5_err_t
H5PartSetChunkSize (
h5_file_t *f,
const char *name,
const h5_int64_t width
h5_int64_t size
);
h5_int64_t
H5PartSetNumParticles (
h5_file_t *f,
const h5_int64_t nparticles
);
h5_int64_t
h5_err_t
H5PartWriteDataFloat64 (
h5_file_t *f,
const char *name,
const h5_float64_t *array
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate array with */
const h5_float64_t *data /*!< [in] Array to commit to disk */
);
h5_int64_t
h5_err_t
H5PartWriteDataFloat32 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate array with */
const h5_float32_t *data /*!< [in] Array to commit to disk */
);
h5_err_t
H5PartWriteDataInt64 (
h5_file_t *f,
const char *name,
const h5_int64_t *array
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate array with */
const h5_int64_t *data /*!< [in] Array to commit to disk */
);
h5_err_t
H5PartWriteDataInt32 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate array with */
const h5_int32_t *data /*!< [in] Array to commit to disk */
);
h5_err_t
H5PartReadDataFloat64 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate dataset with */
h5_float64_t *data /*!< [out] Array of data */
);
h5_err_t
H5PartReadDataFloat32 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate dataset with */
h5_float32_t *data /*!< [out] Array of data */
);
h5_err_t
H5PartReadDataInt64 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate dataset with */
h5_int64_t *data /*!< [out] Array of data */
);
h5_err_t
H5PartReadDataInt32 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate dataset with */
h5_int32_t *data /*!< [out] Array of data */
);
/*================== File Reading Routines =================*/
h5_int64_t
H5PartGetNumDatasets (
h5_file_t *f
h5_file_t *f /*!< [in] Handle to open file */
);
h5_int64_t
H5PartGetDatasetName (
h5_file_t *f,
const h5_int64_t idx,
char *name,
const h5_int64_t maxlen
h5_file_t *f, /*!< [in] Handle to open file */
const h5_int64_t idx, /*!< [in] Index of the dataset */
char *name, /*!< [out] Name of dataset */
const h5_int64_t len /*!< [in] Size of buffer \c name */
);
h5_int64_t
H5PartGetDatasetInfo (
h5_file_t *f,
const h5_int64_t idx,
char *name,
const h5_int64_t maxlen,
h5_int64_t *type,
h5_int64_t *nelem);
h5_file_t *f, /*!< [in] Handle to open file */
const h5_int64_t idx,/*!< [in] Index of the dataset */
char *dataset_name, /*!< [out] Name of dataset */
const h5_int64_t len_dataset_name,
/*!< [in] Size of buffer \c dataset_name */
h5_int64_t *type, /*!< [out] Type of data in dataset */
h5_int64_t *nelem /*!< [out] Number of elements. */
);
h5_int64_t
H5PartGetNumParticles (
h5_file_t *f
h5_file_t *f /*!< [in] Handle to open file */
);
h5_int64_t
H5PartSetView (
h5_file_t *f,
const h5_int64_t start,
const h5_int64_t end
);
h5_int64_t
H5PartGetView (
h5_file_t *f,
h5_int64_t *start,
h5_int64_t *end
h5_err_t
H5PartResetView (
h5_file_t *f /*!< [in] Handle to open file */
);
h5_int64_t
H5PartHasView (
h5_file_t *f
h5_file_t *f /*!< [in] Handle to open file */
);
h5_int64_t
H5PartResetView (
h5_file_t *f
h5_err_t
H5PartSetView (
h5_file_t *f, /*!< [in] Handle to open file */
h5_int64_t start, /*!< [in] Start particle */
h5_int64_t end /*!< [in] End particle */
);
h5_int64_t
h5_err_t
H5PartSetViewIndices (
h5_file_t *f, /*!< [in] Handle to open file */
const h5_int64_t *indices, /*!< [in] List of indices */
h5_int64_t nelems /*!< [in] Size of list */
);
h5_err_t
H5PartSetViewEmpty (
h5_file_t *f /*!< [in] Handle to open file */
);
h5_err_t
H5PartGetView (
h5_file_t *f, /*!< [in] Handle to open file */
h5_int64_t *start, /*!< [out] Start particle */
h5_int64_t *end /*!< [out] End particle */
);
h5_err_t
H5PartSetCanonicalView (
h5_file_t *f
h5_file_t *f /*!< [in] Handle to open file */
);
h5_int64_t
H5PartReadDataFloat64(
h5_file_t *f,
const char *name,
h5_float64_t *array
);
h5_int64_t
H5PartReadDataInt64 (
h5_file_t *f,
const char *name,
h5_int64_t *array
);
h5_int64_t
H5PartReadParticleStep (
h5_file_t *f,
const h5_int64_t step,
h5_float64_t *x, /* particle positions */
h5_float64_t *y,
h5_float64_t *z,
h5_float64_t *px, /* particle momenta */
h5_float64_t *py,
h5_float64_t *pz,
h5_int64_t *id /* and phase */
);
#ifdef __cplusplus
}
#endif
#endif
+145 -6
View File
@@ -1,3 +1,6 @@
#ifndef __H5_ATTRIBS_H
#define __H5_ATTRIBS_H
h5_err_t
H5WriteFileAttribString (
h5_file_t *const f, /*!< [in] Handle to open file */
@@ -12,6 +15,140 @@ H5WriteStepAttribString (
const char *value /*!< [in] Value of attribute */
);
h5_err_t
H5WriteFileAttribFloat32 (
h5_file_t *const f, /*!< [in] Handle to open file */
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_err_t
H5WriteStepAttribFloat32 (
h5_file_t *const f, /*!< [in] Handle to open file */
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_err_t
H5WriteFileAttribFloat64 (
h5_file_t *const f, /*!< [in] Handle to open file */
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_err_t
H5WriteStepAttribFloat64 (
h5_file_t *const f, /*!< [in] Handle to open file */
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_err_t
H5WriteFileAttribInt32 (
h5_file_t *const f, /*!< [in] Handle to open file */
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_err_t
H5WriteStepAttribInt32 (
h5_file_t *const f, /*!< [in] Handle to open file */
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_err_t
H5WriteFileAttribInt64 (
h5_file_t *const f, /*!< [in] Handle to open file */
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_err_t
H5WriteStepAttribInt64 (
h5_file_t *const f, /*!< [in] Handle to open file */
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_err_t
H5ReadFileAttribString (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
char *buffer /*!< [out] Value of attribute */
);
h5_err_t
H5ReadStepAttribString (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
char *buffer /*!< [out] Value of attribute */
);
h5_err_t
H5ReadFileAttribInt32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_int32_t *buffer /*!< [out] Values of attribute */
);
h5_err_t
H5ReadStepAttribInt32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_int32_t *buffer /*!< [out] Values of attribute */
);
h5_err_t
H5ReadFileAttribInt64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_int64_t *buffer /*!< [out] Values of attribute */
);
h5_err_t
H5ReadStepAttribInt64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_int64_t *buffer /*!< [out] Values of attribute */
);
h5_err_t
H5ReadFileAttribFloat32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_float32_t *buffer /*!< [out] Values of attribute */
);
h5_err_t
H5ReadStepAttribFloat32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_float32_t *buffer /*!< [out] Values of attribute */
);
h5_err_t
H5ReadFileAttribFloat64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_float64_t *buffer /*!< [out] Values of attribute */
);
h5_err_t
H5ReadStepAttribFloat64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_float64_t *buffer /*!< [out] Values of attribute */
);
h5_int64_t
H5GetNumFileAttribs (
h5_file_t *const f /*!< [in] Handle to open file */
@@ -25,24 +162,26 @@ H5GetNumStepAttribs (
h5_int64_t
H5GetFileAttribInfo (
h5_file_t *const f, /*!< [in] Handle to open file */
const h5_int64_t attrib_idx, /*!< [in] Index of attribute to get
const h5_size_t attrib_idx, /*!< [in] Index of attribute to get
infos about */
char *attrib_name, /*!< [out] Name of attribute */
const h5_int64_t len_of_attrib_name,
const h5_size_t len_of_attrib_name,
/*!< [in] length of buffer \c name */
h5_int64_t *attrib_type, /*!< [out] Type of value. */
h5_int64_t *attrib_nelem /*!< [out] Number of elements */
h5_size_t *attrib_nelem /*!< [out] Number of elements */
);
h5_int64_t
H5GetStepAttribInfo (
h5_file_t *const f, /*!< [in] Handle to open file */
const h5_int64_t attrib_idx, /*!< [in] Index of attribute to
const h5_size_t attrib_idx, /*!< [in] Index of attribute to
get infos about */
char *attrib_name, /*!< [out] Name of attribute */
const h5_int64_t len_of_attrib_name,
const h5_size_t len_of_attrib_name,
/*!< [in] length of buffer \c name */
h5_int64_t *attrib_type, /*!< [out] Type of value. */
h5_int64_t *attrib_nelem /*!< [out] Number of elements */
h5_size_t *attrib_nelem /*!< [out] Number of elements */
);
#endif
+2
View File
@@ -16,4 +16,6 @@ H5HasStep (
h5_file_t * const f,
h5_id_t step
);
#endif
+10
View File
@@ -1,10 +1,20 @@
#ifndef __H5HUT_H
#define __H5HUT_H
#ifdef __cplusplus
extern "C" {
#endif
#include "h5core/h5_core.h"
#include "H5.h"
#include "H5_inquiry.h"
#include "H5_attribs.h"
#include "H5Part.h"
#include "H5Block.h"
#include "H5Fed.h"
#ifdef __cplusplus
}
#endif
#endif
+8
View File
@@ -0,0 +1,8 @@
#!/bin/sh
echo "#ifndef __H5_H"
echo "#define __H5_H"
echo ""
grep -P "(?s)^\w+\n[Hh]5\w+\s*\(.*?\)" $1 | sed 's/ {/;\n/'
echo ""
echo "#endif"
+12 -10
View File
@@ -3,40 +3,42 @@
#define H5_ATTRIB_FILE 0
#define H5_ATTRIB_STEP 1
#define H5_ATTRIB_FIELD 2
h5_int64_t
h5_err_t
h5_read_attrib (
h5_file_t * const f,
const char type,
const char mode,
const char *attrib_name,
const hid_t attrib_type,
void *attrib_value
);
h5_int64_t
h5_err_t
h5_write_attrib (
h5_file_t * const f,
const char type,
const char mode,
const char *attrib_name,
const hid_t attrib_type,
const void *attrib_value,
const hsize_t attrib_nelem
);
h5_int64_t
h5_err_t
h5_get_attrib_info (
h5_file_t *const f,
const char type,
const h5_int64_t attrib_idx,
const char mode,
const h5_size_t attrib_idx,
char *attrib_name,
const h5_int64_t len_attrib_name,
const h5_size_t len_attrib_name,
h5_int64_t *attrib_type,
h5_int64_t *attrib_nelem
h5_size_t *attrib_nelem
);
h5_ssize_t
h5_get_num_attribs (
h5_file_t *const f,
const char type
const char mode
);
#endif
+4
View File
@@ -10,9 +10,13 @@
#include "h5_maps.h"
#include "h5_openclose.h"
#include "h5_readwrite.h"
#include "h5u_readwrite.h"
#include "h5u_model.h"
#include "h5b_model.h"
#include "h5b_attribs.h"
#include "h5t_core.h"
#endif
+5
View File
@@ -44,6 +44,11 @@ h5_get_num_procs (
h5_file_t* const f
);
hid_t
h5_get_hdf5_file(
h5_file_t* const f
);
h5_size_t
h5_get_num_steps (
h5_file_t* const f
+2 -1
View File
@@ -18,7 +18,7 @@ h5_set_step (
const h5_int64_t step /*!< [in] Time-step to set. */
);
hid_t
h5_int64_t
h5_normalize_h5_type (
h5_file_t * const f,
hid_t type
@@ -39,6 +39,7 @@ h5_has_index (
h5_err_t
h5_normalize_dataset_name (
h5_file_t *const f,
const char *name,
char *name2
);
+3
View File
@@ -25,8 +25,11 @@
#define H5_FLOAT32_T H5T_NATIVE_FLOAT
#define H5_INT64_T H5T_NATIVE_INT64
#define H5_INT32_T H5T_NATIVE_INT32
#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
+31
View File
@@ -0,0 +1,31 @@
#ifndef __H5B_ATTRIBS_H
#define __H5B_ATTRIBS_H
h5_err_t
h5_write_field_attrib (
h5_file_t *const f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
const hid_t attrib_type, /*!< IN: attribute type */
const void *attrib_value, /*!< IN: attribute value */
const h5_int64_t attrib_nelem /*!< IN: number of elements */
);
h5_ssize_t
h5b_get_num_field_attribs (
h5_file_t *const f, /*<! IN: file handle */
const char *field_name /*<! IN: field name */
);
h5_err_t
h5b_get_field_attrib_info (
h5_file_t *const f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const h5_size_t attrib_idx, /*!< IN: attribute index */
char *attrib_name, /*!< OUT: attribute name */
const h5_size_t len_attrib_name, /*!< IN: buffer size */
h5_int64_t *attrib_type, /*!< OUT: attribute type */
h5_size_t *attrib_nelem /*!< OUT: number of elements */
);
#endif
+90
View File
@@ -0,0 +1,90 @@
#ifndef __H5B_MODEL_H
#define __H5B_MODEL_H
h5_err_t
h5b_3d_set_view (
h5_file_t *const f, /*!< IN: File handle */
const h5_size_t i_start, /*!< IN: start index of \c i */
const h5_size_t i_end, /*!< IN: end index of \c i */
const h5_size_t j_start, /*!< IN: start index of \c j */
const h5_size_t j_end, /*!< IN: end index of \c j */
const h5_size_t k_start, /*!< IN: start index of \c k */
const h5_size_t k_end /*!< IN: end index of \c k */
);
h5_err_t
h5b_3d_set_chunk (
h5_file_t *const 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_err_t
h5b_3d_get_chunk (
h5_file_t *const f, /*!< IN: File handle */
const char *field_name, /*!< IN: name of dataset */
h5_size_t *dims /*!< OUT: array containing the chunk dimensions */
);
h5_err_t
h5b_3d_get_view (
h5_file_t *const f, /*!< IN: File handle */
const int proc, /*!< IN: Processor to get partition from */
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_err_t
h5b_3d_get_reduced_view (
h5_file_t *const f, /*!< IN: File handle */
const int proc, /*!< IN: Processor to get partition from */
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 */
);
int
h5b_3d_get_proc (
h5_file_t *const f, /*!< IN: File handle */
const h5_int64_t i, /*!< IN: \c i coordinate */
const h5_int64_t j, /*!< IN: \c j coordinate */
const h5_int64_t k /*!< IN: \c k coordinate */
);
h5_ssize_t
h5b_get_num_fields (
h5_file_t *const f /*!< IN: File handle */
);
h5_err_t
h5b_get_field_info_by_name (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< OUT: field name */
h5_size_t *grid_rank, /*!< OUT: grid rank */
h5_size_t *grid_dims, /*!< OUT: grid dimensions */
h5_size_t *field_rank, /*!< OUT: field rank */
h5_int64_t *type /*!< OUT: datatype */
);
h5_err_t
h5b_get_field_info (
h5_file_t *const 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 *grid_rank, /*!< OUT: grid rank */
h5_size_t *grid_dims, /*!< OUT: grid dimensions */
h5_size_t *field_rank, /*!< OUT: field rank */
h5_int64_t *type /*!< OUT: datatype */
);
#endif
+7
View File
@@ -70,5 +70,12 @@ h5u_set_chunk (
const h5_size_t size
);
h5_err_t
h5u_get_chunk (
h5_file_t *const f,
const char *name,
h5_size_t *size
);
#endif