this commits includes several changes which should have been done in
multiple steps: - the functions for inquiring datasets and attributes do not return an HDF5 type any more but an enum of type h5_types_t. This change was required for the Python module. - bugfix in reading attributes: See https://git.psi.ch/H5hut/src/issues/4 - several consts and macros have been moved from the public C-API to the core API - more consitent file naming - several 'private' function have been moved to their 'private' header files as 'static inline'. - minor formatting changes
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5b_attribs.h"
|
||||
|
||||
@@ -192,7 +191,7 @@ H5Block3dSetFieldOrigin (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_ORIGIN_NAME,
|
||||
(hid_t)H5_FLOAT64_T,
|
||||
(hid_t)H5_FLOAT64,
|
||||
origin,
|
||||
3));
|
||||
}
|
||||
@@ -220,7 +219,7 @@ H5Block3dGetFieldOrigin (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_ORIGIN_NAME,
|
||||
H5_FLOAT64_T,
|
||||
H5_FLOAT64,
|
||||
origin));
|
||||
|
||||
*x_origin = origin[0];
|
||||
@@ -254,7 +253,7 @@ H5Block3dSetFieldSpacing (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_SPACING_NAME,
|
||||
(hid_t)H5_FLOAT64_T,
|
||||
(hid_t)H5_FLOAT64,
|
||||
spacing,
|
||||
3));
|
||||
}
|
||||
@@ -282,7 +281,7 @@ H5Block3dGetFieldSpacing (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_SPACING_NAME,
|
||||
H5_FLOAT64_T,
|
||||
H5_FLOAT64,
|
||||
spacing));
|
||||
*x_spacing = spacing[0];
|
||||
*y_spacing = spacing[1];
|
||||
@@ -751,7 +750,7 @@ H5BlockReadFieldAttribString (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5_STRING_T,
|
||||
H5_STRING,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#ifndef __H5BLOCK_IO_H
|
||||
#define __H5BLOCK_IO_H
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5b_io.h"
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#ifndef __H5BLOCK_MODEL
|
||||
#define __H5BLOCK_MODEL
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5b_model.h"
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#define __H5FED_ADJACENCY_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5t_adjacencies.h"
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#define __H5FED_MODEL_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5t_model.h"
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#define __H5FED_RETRIEVE_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_syscall.h"
|
||||
#include "h5core/h5t_map.h"
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#define __H5FED_STORE_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5t_store.h"
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#define __H5FED_TAGS_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5t_tags.h"
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#ifndef H5PART_IO
|
||||
#define H5PART_IO
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5u_io.h"
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#ifndef H5PART_MODEL
|
||||
#define H5PART_MODEL
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5u_model.h"
|
||||
|
||||
@@ -71,7 +70,7 @@ H5PartGetDatasetName (
|
||||
(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));
|
||||
H5_API_RETURN (h5u_get_dataset_info_by_idx(f, idx, name, len, NULL, NULL));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,7 +108,7 @@ H5PartGetDatasetInfo (
|
||||
(long long)idx,
|
||||
name, (long long unsigned)len_name,
|
||||
type, nelems);
|
||||
H5_API_RETURN (h5u_get_dataset_info (
|
||||
H5_API_RETURN (h5u_get_dataset_info_by_idx (
|
||||
f, idx, name, len_name, type, nelems));
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#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"
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#ifndef __H5_DEBUG_H
|
||||
#define __H5_DEBUG_H
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#ifndef __H5_ERROR_H
|
||||
#define __H5_ERROR_H
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
|
||||
/**
|
||||
@@ -10,7 +10,6 @@
|
||||
#ifndef __H5_FILE_H
|
||||
#define __H5_FILE_H
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_file.h"
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_file_attribs.h"
|
||||
|
||||
@@ -369,7 +368,7 @@ H5ReadFileAttribString (
|
||||
H5_API_RETURN (h5_read_file_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_STRING_T,
|
||||
H5T_C_S1,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
@@ -385,7 +384,7 @@ H5ReadFileAttribFloat64 (
|
||||
H5_API_RETURN (h5_read_file_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_FLOAT64_T,
|
||||
H5_FLOAT64,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
@@ -401,7 +400,7 @@ H5ReadFileAttribFloat32 (
|
||||
H5_API_RETURN (h5_read_file_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_FLOAT32_T,
|
||||
H5_FLOAT32,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
@@ -417,7 +416,7 @@ H5ReadFileAttribInt64 (
|
||||
H5_API_RETURN (h5_read_file_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_INT64_T,
|
||||
H5_INT64,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
@@ -433,7 +432,7 @@ H5ReadFileAttribInt32 (
|
||||
H5_API_RETURN (h5_read_file_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_INT32_T,
|
||||
H5_INT32,
|
||||
(void*)buffer));
|
||||
}
|
||||
///< @}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#ifndef __H5_MODEL_H
|
||||
#define __H5_MODEL_H
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_model.h"
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_step_attribs.h"
|
||||
|
||||
@@ -366,7 +365,7 @@ H5ReadStepAttribString (
|
||||
H5_API_RETURN (h5_read_step_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_STRING_T,
|
||||
H5_STRING,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
@@ -382,7 +381,7 @@ H5ReadStepAttribFloat64 (
|
||||
H5_API_RETURN (h5_read_step_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_FLOAT64_T,
|
||||
H5_FLOAT64,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
@@ -398,7 +397,7 @@ H5ReadStepAttribFloat32 (
|
||||
H5_API_RETURN (h5_read_step_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_FLOAT32_T,
|
||||
H5_FLOAT32,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
@@ -414,7 +413,7 @@ H5ReadStepAttribInt64 (
|
||||
h5_err_t h5err = h5_read_step_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_INT64_T,
|
||||
H5_INT64,
|
||||
(void*)buffer);
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
@@ -431,7 +430,7 @@ H5ReadStepAttribInt32 (
|
||||
H5_API_RETURN (h5_read_step_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_INT32_T,
|
||||
H5_INT32,
|
||||
(void*)buffer));
|
||||
}
|
||||
///< @}
|
||||
|
||||
@@ -15,7 +15,7 @@ MODULE H5hut
|
||||
include 'H5_step_attribs.f90'
|
||||
include 'H5_log.f90'
|
||||
include 'H5_debug.f90'
|
||||
include 'H5_error.f90'
|
||||
include 'H5_err.f90'
|
||||
|
||||
include 'H5Part_model.f90'
|
||||
include 'H5Part_io.f90'
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
#include "H5_step_attribs.h"
|
||||
#include "H5_log.h"
|
||||
#include "H5_debug.h"
|
||||
#include "H5_error.h"
|
||||
#include "H5_err.h"
|
||||
|
||||
#include "H5Part_io.h"
|
||||
#include "H5Part_model.h"
|
||||
|
||||
@@ -3,11 +3,10 @@ otherincludedir = $(includedir)/h5core
|
||||
include_HEADERS = \
|
||||
h5_attachments.h \
|
||||
h5_debug.h \
|
||||
h5_errorhandling.h \
|
||||
h5_err.h \
|
||||
h5_file.h \
|
||||
h5_file_attribs.h \
|
||||
h5_step_attribs.h \
|
||||
h5_init.h \
|
||||
h5_model.h \
|
||||
h5_syscall.h \
|
||||
h5_types.h \
|
||||
|
||||
@@ -13,12 +13,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5_errorhandling.h"
|
||||
extern const char* H5_VER_STRING;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5_err.h"
|
||||
|
||||
#define H5_VERBOSE_NONE (0)
|
||||
#define H5_VERBOSE_ERROR (1)
|
||||
@@ -79,6 +77,10 @@ struct call_stack {
|
||||
extern h5_int32_t h5_debug_level;
|
||||
extern struct call_stack h5_call_stack;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
h5_call_stack_init (
|
||||
const char* fname,
|
||||
@@ -305,7 +307,6 @@ h5_debug (
|
||||
ret_value = expr; \
|
||||
goto done; \
|
||||
done: \
|
||||
h5_call_stack_reset (); \
|
||||
return ret_value;
|
||||
|
||||
#define __FUNC_RETURN(expr, mask) \
|
||||
@@ -347,9 +348,6 @@ done: \
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#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);
|
||||
@@ -368,7 +366,6 @@ h5_err_t
|
||||
h5_get_debuglevel (
|
||||
void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#ifndef __H5CORE_H5_ERRORHANDLING_H
|
||||
#define __H5CORE_H5_ERRORHANDLING_H
|
||||
#ifndef __H5CORE_H5_ERROR_H
|
||||
#define __H5CORE_H5_ERROR_H
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
@@ -18,6 +18,26 @@
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
|
||||
/*
|
||||
file modes:
|
||||
|
||||
H5_O_RDONLY:
|
||||
read data from existing file
|
||||
|
||||
H5_O_WRONLY:
|
||||
create new file, if file not exists; write new or overwrite
|
||||
existing data
|
||||
|
||||
H5_O_APPENDONLY:
|
||||
allows to append new data to an existing file
|
||||
|
||||
H5_O_RDWR:
|
||||
create new file, if file not exists; read and (over-)write data
|
||||
*/
|
||||
#define H5_O_RDWR 0x00000001
|
||||
#define H5_O_RDONLY 0x00000002
|
||||
#define H5_O_WRONLY 0x00000004
|
||||
#define H5_O_APPENDONLY 0x00000008
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
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
|
||||
@@ -10,49 +10,35 @@
|
||||
#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: read data from existing file
|
||||
H5_O_WRONLY: create new file, if file not exists; write new or overwrite existing data
|
||||
H5_O_APPENDONLY: allows to append new data to an existing file
|
||||
H5_O_RDWR: create new file, if file not exists; read and (over-)write data
|
||||
*/
|
||||
#define H5_O_RDWR 0x00000001
|
||||
#define H5_O_RDONLY 0x00000002
|
||||
#define H5_O_WRONLY 0x00000004
|
||||
#define H5_O_APPENDONLY 0x00000008
|
||||
|
||||
#define H5_VFD_MPIO_POSIX 0x00000010
|
||||
#define H5_VFD_MPIO_INDEPENDENT 0x00000020
|
||||
#define H5_VFD_MPIO_COLLECTIVE 0x00000040
|
||||
#define H5_VFD_CORE 0x00000080
|
||||
|
||||
#define H5_FLUSH_FILE 0x00001000
|
||||
#define H5_FLUSH_STEP 0x00002000
|
||||
#define H5_FLUSH_DATASET 0x00004000
|
||||
|
||||
#define H5_FS_LUSTRE 0x00010000
|
||||
|
||||
#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
|
||||
|
||||
extern const char* H5_VER_STRING;
|
||||
#define H5_STRING H5T_C_S1
|
||||
#define H5_INT16 H5T_NATIVE_INT16
|
||||
#define H5_UINT16 H5T_NATIVE_UINT16
|
||||
#define H5_INT32 H5T_NATIVE_INT32
|
||||
#define H5_UINT32 H5T_NATIVE_UINT32
|
||||
#define H5_INT64 H5T_NATIVE_INT64
|
||||
#define H5_UINT64 H5T_NATIVE_UINT64
|
||||
#define H5_FLOAT32 H5T_NATIVE_FLOAT
|
||||
#define H5_FLOAT64 H5T_NATIVE_DOUBLE
|
||||
#define H5_ID H5T_NATIVE_INT64
|
||||
#define H5_COMPOUND H5T_COMPOUND
|
||||
|
||||
typedef enum {
|
||||
H5_STRING_T,
|
||||
H5_INT16_T,
|
||||
H5_UINT16_T,
|
||||
H5_INT32_T,
|
||||
H5_UINT32_T,
|
||||
H5_INT64_T,
|
||||
H5_UINT64_T,
|
||||
H5_FLOAT32_T,
|
||||
H5_FLOAT64_T,
|
||||
H5_ID_T,
|
||||
H5_COMPOUND_T
|
||||
} h5_types_t;
|
||||
|
||||
#ifdef WIN32
|
||||
typedef __int64 int64_t;
|
||||
#endif /* WIN32 */
|
||||
@@ -155,14 +141,7 @@ typedef struct {
|
||||
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
|
||||
|
||||
@@ -21,7 +21,7 @@ h5u_get_num_datasets (
|
||||
const h5_file_t);
|
||||
|
||||
h5_err_t
|
||||
h5u_get_dataset_info (
|
||||
h5u_get_dataset_info_by_idx (
|
||||
const h5_file_t,
|
||||
const h5_id_t, char* const, const h5_size_t, h5_int64_t* const,
|
||||
h5_size_t* const);
|
||||
|
||||
Reference in New Issue
Block a user