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:
2016-06-17 10:44:25 +02:00
parent bbbaa6a21b
commit bdcc8f2089
89 changed files with 1105 additions and 1050 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ include_HEADERS = \
$(top_srcdir)/src/include/H5Part_model.h \
$(top_srcdir)/src/include/H5_attachments.h \
$(top_srcdir)/src/include/H5_debug.h \
$(top_srcdir)/src/include/H5_error.h \
$(top_srcdir)/src/include/H5_err.h \
$(top_srcdir)/src/include/H5_file.h \
$(top_srcdir)/src/include/H5_file_attribs.h \
$(top_srcdir)/src/include/H5_log.h \
-1
View File
@@ -9,7 +9,6 @@
#include "h5_private.h"
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5_file.h"
+6 -6
View File
@@ -11,10 +11,10 @@
#include "h5core/h5_debug.h"
#include "h5core/h5b_attribs.h"
#define H5_R8_T H5_FLOAT64_T
#define H5_R4_T H5_FLOAT32_T
#define H5_I8_T H5_INT64_T
#define H5_I4_T H5_INT32_T
#define H5_R8_T H5_FLOAT64
#define H5_R4_T H5_FLOAT32
#define H5_I8_T H5_INT64
#define H5_I4_T H5_INT32
/*
__ _ _ _ ___ _ __ _ _
@@ -163,7 +163,7 @@ h5bl_writefieldattrib_string (
f,
field_name, l_field_name,
attrib_name, l_attrib_name,
H5_STRING_T,
H5_STRING,
attrib_value2, strlen(attrib_value2)+1 );
free (attrib_value2);
H5_API_RETURN (h5err);
@@ -193,7 +193,7 @@ h5bl_readfieldattrib_string (
f,
field_name, l_field_name,
attrib_name, l_attrib_name,
H5_STRING_T, attrib_value);
H5_STRING, attrib_value);
h5_strc2for (attrib_value, l_attrib_value);
H5_API_RETURN (h5err);
+2 -2
View File
@@ -189,7 +189,7 @@ h5pt_getdatasetname (
H5_API_ENTER (h5_int64_t,
"fh=%p, index=%lld, name='%s', l_name=%d",
(h5_file_p)f, (long long)*index, name, l_name);
h5_int64_t herr = h5u_get_dataset_info (
h5_int64_t herr = h5u_get_dataset_info_by_idx (
f, *index - 1, name, l_name, NULL, NULL );
h5_strc2for (name, l_name);
H5_API_RETURN (herr);
@@ -217,7 +217,7 @@ h5pt_getdatasetinfo (
(h5_file_p)f,
(long long)*dataset_idx,
dataset_name, dataset_type, dataset_nelem);
h5_int64_t h5err = h5u_get_dataset_info (
h5_int64_t h5err = h5u_get_dataset_info_by_idx (
f,
*dataset_idx - 1,
dataset_name, l_dataset_name,
+20 -20
View File
@@ -160,7 +160,7 @@ h5_writefileattrib_string (
(h5_file_p)f, l_name, name, l_buffer, buffer);
char *buffer2 = h5_strdupfor2c (buffer, l_buffer);
h5_int64_t herr = write_file_attrib (
f, name, l_name, H5_STRING_T, buffer2, strlen(buffer2)+1 );
f, name, l_name, H5_STRING, buffer2, strlen(buffer2)+1 );
free (buffer2);
H5_API_RETURN (herr);
}
@@ -180,7 +180,7 @@ h5_readfileattrib_string (
H5_API_ENTER (h5_int64_t,
"fh=%p, name='%.*s', buffer='%.*s'",
(h5_file_p)f, l_name, name, l_buffer, buffer);
h5_int64_t herr = read_file_attrib (f, name, l_name, H5_STRING_T, buffer);
h5_int64_t herr = read_file_attrib (f, name, l_name, H5_STRING, buffer);
h5_strc2for (buffer, l_buffer);
H5_API_RETURN (herr);
}
@@ -203,7 +203,7 @@ h5_writefileattrib_r8 (
H5_API_RETURN (write_file_attrib(
f,
name, l_name,
H5_FLOAT64_T,
H5_FLOAT64,
buffer, (hsize_t)*nelem));
}
@@ -224,7 +224,7 @@ h5_readfileattrib_r8 (
H5_API_RETURN (read_file_attrib(
f,
name, l_name,
H5_FLOAT64_T,
H5_FLOAT64,
(void*)buffer));
}
@@ -246,7 +246,7 @@ h5_writefileattrib_r4 (
H5_API_RETURN (write_file_attrib(
f,
name, l_name,
H5_FLOAT32_T,
H5_FLOAT32,
buffer, (hsize_t)*nelem));
}
@@ -267,7 +267,7 @@ h5_readfileattrib_r4 (
H5_API_RETURN (read_file_attrib(
f,
name, l_name,
H5_FLOAT32_T,
H5_FLOAT32,
buffer));
}
@@ -289,7 +289,7 @@ h5_writefileattrib_i8 (
H5_API_RETURN (write_file_attrib(
f,
name, l_name,
H5_INT64_T,
H5T_NATIVE_INT64,
buffer, (hsize_t)*nelem));
}
@@ -310,7 +310,7 @@ h5_readfileattrib_i8 (
H5_API_RETURN (read_file_attrib(
f,
name, l_name,
H5_INT64_T,
H5T_NATIVE_INT64,
buffer));
}
@@ -332,7 +332,7 @@ h5_writefileattrib_i4 (
H5_API_RETURN (write_file_attrib(
f,
name, l_name,
H5_INT32_T,
H5T_NATIVE_INT32,
buffer, (hsize_t)*nelem));
}
@@ -353,7 +353,7 @@ h5_readfileattrib_i4 (
H5_API_RETURN (read_file_attrib(
f,
name, l_name,
H5_INT32_T,
H5T_NATIVE_INT32,
buffer));
}
@@ -508,7 +508,7 @@ h5_writestepattrib_string (
(h5_file_p)f, l_name, name, l_buffer, buffer);
char *buffer2 = h5_strdupfor2c (buffer, l_buffer);
h5_int64_t herr = write_step_attrib (
f, name, l_name, H5_STRING_T, buffer2, strlen(buffer2)+1 );
f, name, l_name, H5_STRING, buffer2, strlen(buffer2)+1 );
free (buffer2);
H5_API_RETURN (herr);
}
@@ -528,7 +528,7 @@ h5_readstepattrib_string (
H5_API_ENTER (h5_int64_t,
"f=%p, name='%.*s', buffer='%.*s'",
(h5_file_p)f, l_name, name, l_buffer, buffer);
h5_int64_t herr = read_step_attrib (f, name, l_name, H5_STRING_T, buffer);
h5_int64_t herr = read_step_attrib (f, name, l_name, H5_STRING, buffer);
h5_strc2for (buffer, l_buffer);
H5_API_RETURN (herr);
}
@@ -551,7 +551,7 @@ h5_writestepattrib_r8 (
H5_API_RETURN (write_step_attrib(
f,
name, l_name,
H5_FLOAT64_T,
H5_FLOAT64,
buffer, (hsize_t)*nelem));
}
@@ -572,7 +572,7 @@ h5_readstepattrib_r8 (
H5_API_RETURN (read_step_attrib(
f,
name, l_name,
H5_FLOAT64_T,
H5_FLOAT64,
(void*)buffer));
}
@@ -594,7 +594,7 @@ h5_writestepattrib_r4 (
H5_API_RETURN (write_step_attrib(
f,
name, l_name,
H5_FLOAT32_T,
H5_FLOAT32,
buffer, (hsize_t)*nelem));
}
@@ -615,7 +615,7 @@ h5_readstepattrib_r4 (
H5_API_RETURN (read_step_attrib(
f,
name, l_name,
H5_FLOAT32_T,
H5_FLOAT32,
buffer));
}
@@ -637,7 +637,7 @@ h5_writestepattrib_i8 (
H5_API_RETURN (write_step_attrib(
f,
name, l_name,
H5_INT64_T,
H5T_NATIVE_INT64,
buffer, (hsize_t)*nelem));
}
@@ -658,7 +658,7 @@ h5_readstepattrib_i8 (
H5_API_RETURN (read_step_attrib(
f,
name, l_name,
H5_INT64_T,
H5T_NATIVE_INT64,
buffer));
}
@@ -680,7 +680,7 @@ h5_writestepattrib_i4 (
H5_API_RETURN (write_step_attrib(
f,
name, l_name,
H5_INT32_T,
H5T_NATIVE_INT32,
buffer, (hsize_t)*nelem));
}
@@ -701,6 +701,6 @@ h5_readstepattrib_i4 (
H5_API_RETURN (read_step_attrib(
f,
name, l_name,
H5_INT32_T,
H5T_NATIVE_INT32,
buffer));
}
-1
View File
@@ -9,7 +9,6 @@
#include "h5_private.h"
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5_model.h"
+1 -1
View File
@@ -10,7 +10,7 @@ F90_FILES = \
$(top_srcdir)/src/include/H5_file_attribs.f90 \
$(top_srcdir)/src/include/H5_step_attribs.f90 \
$(top_srcdir)/src/include/H5_debug.f90 \
$(top_srcdir)/src/include/H5_error.f90 \
$(top_srcdir)/src/include/H5_err.f90 \
$(top_srcdir)/src/include/H5_log.f90 \
$(top_srcdir)/src/include/H5Part_model.f90 \
$(top_srcdir)/src/include/H5Part_io.f90 \
+19 -19
View File
@@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
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.
@@ -13,7 +13,7 @@
#include <stdlib.h>
#include <string.h>
#include "h5core/h5_init.h"
#include "h5core/h5_types.h"
#if defined(FC_MANGLING_LOWERCASE_NO_UNDERSCORE)
# define FC_MANGLING(a,b) a
@@ -31,23 +31,23 @@
# error "Unknown Fortran symbol mangling"
#endif
#define convert_type2for(type) \
if (*type == H5_STRING_T) { \
*type = 1; \
} else if (*type == H5_INT16_T) { \
*type = 2; \
} else if (*type == H5_INT32_T) { \
*type = 3; \
} else if (*type == H5_INT64_T) { \
*type = 4; \
} else if (*type == H5_FLOAT32_T) { \
*type = 5; \
} else if (*type == H5_FLOAT64_T) { \
*type = 6; \
} else { \
H5_API_LEAVE ( \
h5_error ( \
H5_ERR_H5, \
#define convert_type2for(type) \
if (*type == H5_STRING) { \
*type = 1; \
} else if (*type == H5_INT16) { \
*type = 2; \
} else if (*type == H5_INT32) { \
*type = 3; \
} else if (*type == H5_INT64) { \
*type = 4; \
} else if (*type == H5_FLOAT32) { \
*type = 5; \
} else if (*type == H5_FLOAT64) { \
*type = 6; \
} else { \
H5_API_LEAVE ( \
h5_error ( \
H5_ERR_H5, \
"Unknown attribute type")); \
}
+3 -3
View File
@@ -3,6 +3,7 @@ AUTOMAKE_OPTIONS = subdir-objects
AM_CPPFLAGS = -I$(top_srcdir)/src/include @AM_CPPFLAGS@
EXTRA_HEADERS = \
private/h5_file.h \
private/h5_hdf5.h \
private/h5_hsearch.h \
private/h5_init.h \
@@ -10,7 +11,6 @@ EXTRA_HEADERS = \
private/h5_maps.h \
private/h5_model.h \
private/h5_mpi.h \
private/h5.h \
private/h5_qsort.h \
private/h5_io.h \
private/h5_types.h \
@@ -21,7 +21,7 @@ EXTRA_HEADERS = \
private/h5t_access.h \
private/h5t_adjacencies.h \
private/h5t_core.h \
private/h5t_errorhandling.h \
private/h5t_err.h \
private/h5t_map.h \
private/h5t_model.h \
private/h5t_octree.h \
@@ -35,7 +35,7 @@ EXTRA_HEADERS = \
private/h5u_types.h \
private/h5_attribs.h \
private/h5_debug.h \
private/h5_errorhandling.h \
private/h5_err.h \
private/h5_fcmp.h
# Extra files that I wish to include in the dist tar ball.
+10 -12
View File
@@ -7,15 +7,16 @@
License: see file COPYING in top level of source distribution.
*/
#include "h5core/h5_init.h"
#include "private/h5_types.h"
#include "private/h5_errorhandling.h"
#include "private/h5_err.h"
#include "private/h5_hdf5.h"
#include "private/h5_model.h"
#include "h5core/h5_syscall.h"
#include "private/h5_va_macros.h"
#include "h5core/h5_file.h"
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -133,9 +134,8 @@ h5_has_attachments (
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
h5_err_t exists;
TRY (exists = hdf5_link_exists (f->file, H5_ATTACHMENT));
H5_CORE_API_RETURN (exists);
TRY (ret_value = hdf5_link_exists (f->file, H5_ATTACHMENT));
H5_CORE_API_RETURN (ret_value);
}
h5_ssize_t
@@ -151,10 +151,9 @@ h5_get_num_attachments (
}
hid_t group_id;
TRY (group_id = hdf5_open_group (f->file, H5_ATTACHMENT));
h5_ssize_t num = 0;
TRY (num = hdf5_get_num_datasets (group_id));
TRY (ret_value = hdf5_get_num_datasets (group_id));
TRY (hdf5_close_group (group_id));
H5_CORE_API_RETURN (num);
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
@@ -197,9 +196,8 @@ h5_has_attachment (
H5_CORE_API_ENTER (h5_err_t, "f=%p, fname='%s'", f, fname);
hid_t loc_id;
TRY (loc_id = hdf5_open_group (f->file, H5_ATTACHMENT));
h5_err_t exists;
TRY (exists = hdf5_link_exists (f->file, fname));
H5_CORE_API_RETURN (exists);
TRY (ret_value = hdf5_link_exists (f->file, fname));
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
@@ -243,7 +241,7 @@ h5_get_attachment (
// read dataset
hid_t dataset_id, diskspace_id;
h5_ssize_t fsize;
TRY (dataset_id = hdf5_open_dataset (loc_id, fname));
TRY (dataset_id = hdf5_open_dataset_by_name (loc_id, fname));
TRY (diskspace_id = hdf5_get_dataset_space (dataset_id));
TRY (fsize = hdf5_get_npoints_of_dataspace (diskspace_id));
+100 -220
View File
@@ -7,145 +7,12 @@
License: see file COPYING in top level of source distribution.
*/
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "private/h5_types.h"
#include "private/h5.h"
#include "private/h5_io.h"
#include "private/h5_hdf5.h"
#include "private/h5_attribs.h"
h5_err_t
h5priv_get_attrib_info_by_idx (
const hid_t id, /*!< HDF5 object ID */
const h5_size_t attrib_idx, /*!< index of attribute */
char* attrib_name, /*!< OUT: name of attribute */
const h5_size_t len_attrib_name,/*!< buffer length */
h5_int64_t* attrib_type, /*!< OUT: H5 type of attribute */
h5_size_t* attrib_nelem /*!< OUT: number of elements */
) {
H5_PRIV_API_ENTER (h5_err_t,
"id=%lld, "
"attrib_idx=%llu, "
"attrib_name=%p, len_attrib_name=%llu, "
"attrib_type=%p, attrib_nelem=%p",
(long long int)id,
(long long unsigned)attrib_idx,
attrib_name,
(long long unsigned)len_attrib_name,
attrib_type,
attrib_nelem);
hid_t attrib_id;
TRY (attrib_id = hdf5_open_attribute_idx (
id,
(unsigned int)attrib_idx));
if (attrib_name) {
TRY (hdf5_get_attribute_name (
attrib_id,
(size_t)len_attrib_name,
attrib_name));
}
H5_PRIV_API_RETURN (get_attrib_info (attrib_id, attrib_type, attrib_nelem));
}
h5_err_t
h5priv_read_attrib (
const hid_t id, /*!< HDF5 object ID */
const char* attrib_name, /*!< name of HDF5 attribute to read */
const hid_t attrib_type, /*!< HDF5 type of attribute */
void* const attrib_value /*!< OUT: attribute value */
) {
H5_PRIV_API_ENTER (h5_err_t,
"id=%lld, attrib_name='%s', attrib_type=%lld, attrib_value=%p",
(long long int)id,
attrib_name,
(long long int)attrib_type,
attrib_value);
hid_t attrib_id;
hid_t type_id;
hid_t space_id;
TRY (attrib_id = hdf5_open_attribute (id, attrib_name));
TRY (type_id = hdf5_get_attribute_type (attrib_id));
hid_t h5type_id;
TRY (h5type_id = h5priv_normalize_h5_type (type_id));
if (h5type_id != attrib_type)
H5_PRIV_API_LEAVE (
h5_error (
H5_ERR_HDF5,
"Attribute '%s' has type '%s' but was requested as '%s'.",
attrib_name,
hdf5_get_type_name (h5type_id),
hdf5_get_type_name (attrib_type)));
TRY (space_id = hdf5_get_attribute_dataspace (attrib_id));
TRY (hdf5_read_attribute (attrib_id, type_id, attrib_value));
TRY (hdf5_close_dataspace(space_id));
TRY (hdf5_close_type (type_id));
TRY (hdf5_close_attribute (attrib_id));
H5_PRIV_API_RETURN (H5_SUCCESS);
}
h5_err_t
h5priv_write_attrib (
const hid_t id, /*!< HDF5 object ID */
const char* attrib_name, /*!< name of HDF5 attribute to write */
const hid_t attrib_type, /*!< HDF5 type of attribute */
const void* attrib_value, /*!< value of attribute */
const hsize_t attrib_nelem, /*!< number of elements (dimension) */
const int overwrite
) {
H5_PRIV_API_ENTER (h5_err_t,
"id=%lld, attrib_name='%s', attrib_type=%lld, "
"attrib_value=%p, attrib_nelem=%llu, overwrite=%d",
(long long int)id,
attrib_name,
(long long int)attrib_type,
attrib_value,
attrib_nelem,
overwrite);
hid_t space_id;
hid_t attrib_id;
hid_t type_id;
if ( attrib_type == H5T_NATIVE_CHAR ) {
TRY (type_id = hdf5_create_string_type (attrib_nelem));
TRY (space_id = hdf5_create_dataspace_scalar ());
} else {
type_id = attrib_type;
TRY (space_id = hdf5_create_dataspace (1, &attrib_nelem, NULL));
}
h5_err_t exists;
TRY (exists = hdf5_attribute_exists (id, attrib_name));
if (exists) {
if (overwrite) {
TRY (hdf5_delete_attribute (id, attrib_name));
} else {
H5_PRIV_API_LEAVE (
h5_error (H5_ERR_H5, "Cannot overwrite attribute %s/%s",
hdf5_get_objname (id), attrib_name));
}
}
TRY (attrib_id = hdf5_create_attribute (
id,
attrib_name,
type_id,
space_id,
H5P_DEFAULT, H5P_DEFAULT));
TRY (hdf5_write_attribute (attrib_id, type_id, attrib_value));
TRY (hdf5_close_attribute (attrib_id));
TRY (hdf5_close_dataspace (space_id));
if (attrib_type == H5T_NATIVE_CHAR)
TRY (hdf5_close_type (type_id));
H5_PRIV_API_RETURN (H5_SUCCESS);
}
h5_err_t
h5_has_file_attrib (
const h5_file_t f_,
@@ -158,7 +25,8 @@ h5_has_file_attrib (
f,
attrib_name);
CHECK_FILEHANDLE (f);
H5_CORE_API_RETURN (hdf5_attribute_exists(f->root_gid, attrib_name));
TRY (ret_value = hdf5_attribute_exists(f->root_gid, attrib_name));
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
@@ -173,54 +41,8 @@ h5_has_step_attrib (
f,
attrib_name);
CHECK_FILEHANDLE (f);
H5_CORE_API_RETURN (hdf5_attribute_exists(f->step_gid, attrib_name));
}
h5_err_t
h5_get_file_attrib_info_by_name (
const h5_file_t f_, /*!< IN: handle to open file */
char* attrib_name, /*!< IN: name of attribute */
h5_int64_t* attrib_type, /*!< OUT: H5 type of attribute */
h5_size_t* attrib_nelem /*!< OUT: number of elements */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, "
"attrib_name=%s, "
"attrib_type=%p, attrib_nelem=%p",
f,
attrib_name,
attrib_type,
attrib_nelem);
CHECK_FILEHANDLE (f);
TRY (h5priv_get_attrib_info_by_name (
f->root_gid, attrib_name,
attrib_type, attrib_nelem));
H5_CORE_API_RETURN (H5_SUCCESS);
}
h5_err_t
h5_get_step_attrib_info_by_name (
const h5_file_t f_, /*!< handle to open file */
char* attrib_name, /*!< OUT: name of attribute */
h5_int64_t* attrib_type, /*!< OUT: H5 type of attribute */
h5_size_t* attrib_nelem /*!< OUT: number of elements */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, "
"attrib_name=%p, "
"attrib_type=%p, attrib_nelem=%p",
f,
attrib_name,
attrib_type, attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (h5priv_get_attrib_info_by_name (
f->step_gid,
attrib_name,
attrib_type, attrib_nelem));
H5_CORE_API_RETURN (H5_SUCCESS);
TRY (ret_value = hdf5_attribute_exists (f->step_gid, attrib_name));
H5_CORE_API_RETURN (ret_value);
}
h5_ssize_t
@@ -230,7 +52,8 @@ h5_get_num_file_attribs (
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_FILEHANDLE (f);
H5_CORE_API_RETURN (hdf5_get_num_attribute (f->root_gid));
TRY (ret_value = hdf5_get_num_attribute (f->root_gid));
H5_CORE_API_RETURN (ret_value);
}
h5_ssize_t
@@ -241,7 +64,8 @@ h5_get_num_step_attribs (
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
H5_CORE_API_RETURN (hdf5_get_num_attribute (f->step_gid));
TRY (ret_value = hdf5_get_num_attribute (f->step_gid));
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
@@ -264,12 +88,38 @@ h5_get_file_attrib_info_by_idx (
attrib_name, (long long unsigned)len_attrib_name,
attrib_type, attrib_nelem);
CHECK_FILEHANDLE (f);
TRY (h5priv_get_attrib_info_by_idx (
f->root_gid, attrib_idx, attrib_name, len_attrib_name,
attrib_type, attrib_nelem));
H5_CORE_API_RETURN (H5_SUCCESS);
TRY (ret_value = h5priv_get_attrib_info_by_idx (
f->root_gid,
attrib_idx,
attrib_name, len_attrib_name,
attrib_type, attrib_nelem));
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
h5_get_file_attrib_info_by_name (
const h5_file_t f_, /*!< IN: handle to open file */
char* attrib_name, /*!< IN: name of attribute */
h5_int64_t* attrib_type, /*!< OUT: H5 type of attribute */
h5_size_t* attrib_nelem /*!< OUT: number of elements */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, "
"attrib_name=%s, "
"attrib_type=%p, attrib_nelem=%p",
f,
attrib_name,
attrib_type, attrib_nelem);
CHECK_FILEHANDLE (f);
TRY (ret_value = h5priv_get_attrib_info_by_name (
f->root_gid,
attrib_name,
attrib_type, attrib_nelem));
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
h5_get_step_attrib_info_by_idx (
const h5_file_t f_, /*!< handle to open file */
@@ -282,20 +132,45 @@ h5_get_step_attrib_info_by_idx (
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, "
"attrib_idx=%llu, attrib_name=%p, len_attrib_name=%llu, "
"attrib_idx=%llu, "
"attrib_name=%p, len_attrib_name=%llu, "
"attrib_type=%p, attrib_nelem=%p",
f,
(long long unsigned)attrib_idx,
attrib_name,
(long long unsigned)len_attrib_name,
attrib_type,
attrib_nelem);
attrib_name, (long long unsigned)len_attrib_name,
attrib_type, attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (h5priv_get_attrib_info_by_idx (
f->step_gid, attrib_idx, attrib_name, len_attrib_name,
TRY (ret_value = h5priv_get_attrib_info_by_idx (
f->step_gid,
attrib_idx,
attrib_name, len_attrib_name,
attrib_type, attrib_nelem));
H5_CORE_API_RETURN (H5_SUCCESS);
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
h5_get_step_attrib_info_by_name (
const h5_file_t f_, /*!< handle to open file */
char* attrib_name, /*!< OUT: name of attribute */
h5_int64_t* attrib_type, /*!< OUT: H5 type of attribute */
h5_size_t* attrib_nelem /*!< OUT: number of elements */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, "
"attrib_name=%p, "
"attrib_type=%p, attrib_nelem=%p",
f,
attrib_name,
attrib_type, attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (ret_value = h5priv_get_attrib_info_by_name (
f->step_gid,
attrib_name,
attrib_type, attrib_nelem));
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
@@ -314,11 +189,12 @@ h5_read_file_attrib (
(long long int)attrib_type,
attrib_value);
CHECK_FILEHANDLE (f);
H5_CORE_API_RETURN (h5priv_read_attrib (
f->root_gid,
attrib_name,
attrib_type,
attrib_value));
TRY (ret_value = h5priv_read_attrib (
f->root_gid,
attrib_name,
attrib_type,
attrib_value));
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
@@ -338,11 +214,13 @@ h5_read_step_attrib (
attrib_value);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
H5_CORE_API_RETURN (h5priv_read_attrib (
f->step_gid,
attrib_name,
attrib_type,
attrib_value));
TRY (ret_value = h5priv_read_attrib (
f->step_gid,
attrib_name,
attrib_type,
attrib_value));
H5_CORE_API_RETURN (ret_value);
}
@@ -365,13 +243,14 @@ h5_write_file_attrib (
attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_WRITABLE_MODE (f);
H5_CORE_API_RETURN (h5priv_write_attrib (
f->root_gid,
attrib_name,
attrib_type,
attrib_value,
attrib_nelem,
!is_appendonly (f)));
TRY (ret_value = h5priv_write_attrib (
f->root_gid,
attrib_name,
attrib_type,
attrib_value,
attrib_nelem,
!is_appendonly (f)));
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
@@ -394,13 +273,14 @@ h5_write_step_attrib (
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
CHECK_WRITABLE_MODE (f);
H5_CORE_API_RETURN (h5priv_write_attrib (
f->step_gid,
attrib_name,
attrib_type,
attrib_value,
attrib_nelem,
!is_appendonly (f)));
TRY (ret_value = h5priv_write_attrib (
f->step_gid,
attrib_name,
attrib_type,
attrib_value,
attrib_nelem,
!is_appendonly (f)));
H5_CORE_API_RETURN (ret_value);
}
+1 -1
View File
@@ -7,7 +7,7 @@
License: see file COPYING in top level of source distribution.
*/
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "private/h5_init.h"
h5_int32_t h5_debug_level = H5_VERBOSE_ERROR;
+2 -1
View File
@@ -7,7 +7,8 @@
License: see file COPYING in top level of source distribution.
*/
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5_err.h"
#include "private/h5_init.h"
static h5_errorhandler_t h5_errhandler = h5_report_errorhandler;
+13 -10
View File
@@ -11,10 +11,9 @@
#include <errno.h>
#include <fcntl.h>
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "private/h5.h"
#include "private/h5_file.h"
#include "private/h5_hdf5.h"
#include "private/h5_model.h"
@@ -22,7 +21,7 @@
#include "private/h5u_io.h"
#include "private/h5b_io.h"
#include "h5core/h5_errorhandling.h"
#include "h5core/h5_err.h"
#include "h5core/h5_syscall.h"
/*!
@@ -60,7 +59,7 @@ h5_get_hdf5_file(
}
/*!
Initialize H5Part
Initialize H5hut
*/
static herr_t
hdf5_error_handler (
@@ -583,7 +582,8 @@ h5_close_hdf5 (
void
) {
H5_CORE_API_ENTER (h5_err_t, "%s", "");
H5_CORE_API_RETURN (hdf5_close ());
TRY (ret_value = hdf5_close ());
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
@@ -592,7 +592,8 @@ h5_flush_step (
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
H5_CORE_API_RETURN (hdf5_flush (f->step_gid, H5F_SCOPE_LOCAL));
TRY (ret_value = hdf5_flush (f->step_gid, H5F_SCOPE_LOCAL));
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
@@ -601,7 +602,8 @@ h5_flush_file (
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
H5_CORE_API_RETURN (hdf5_flush (f->file, H5F_SCOPE_GLOBAL));
TRY (ret_value = hdf5_flush (f->file, H5F_SCOPE_GLOBAL));
H5_CORE_API_RETURN (ret_value);
}
@@ -703,9 +705,10 @@ h5_get_num_steps(
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (int, "f=%p", f);
H5_CORE_API_RETURN (hdf5_get_num_groups_matching_prefix (
f->root_gid,
f->props->prefix_step_name));
TRY (ret_value = hdf5_get_num_groups_matching_prefix (
f->root_gid,
f->props->prefix_step_name));
H5_CORE_API_RETURN (ret_value);
}
/*!
+42 -45
View File
@@ -14,15 +14,12 @@
#include "config.h"
#include "h5core/h5_init.h"
#include "private/h5_hdf5.h"
#include "private/h5_mpi.h"
#include "private/h5t_types.h"
#include "private/h5t_tags.h"
int h5_initialized = 0;
h5_dta_types_t h5_dta_types; // type ids' for base & compound data types
int h5_myproc = 0; // proc id
@@ -39,33 +36,33 @@ create_array_types (
hsize_t dims[1] = { 3 };
TRY(
h5_dta_types.h5_coord3d_t = hdf5_create_array_type (
H5_FLOAT64_T,
H5_FLOAT64,
1,
dims)
);
TRY(
h5_dta_types.h5_3glb_idx_t = hdf5_create_array_type (
H5_ID_T,
H5_ID,
1,
dims)
);
dims[0] = 4;
TRY(
h5_dta_types.h5_4glb_idx_t = hdf5_create_array_type (
H5_ID_T,
H5_ID,
1,
dims)
);
TRY(
h5_dta_types.h5_4chk_idx_t = hdf5_create_array_type (
H5_INT32_T,
H5_INT32,
1,
dims)
);
dims[0] = 6;
TRY(
h5_dta_types.h5_coord6d_t = hdf5_create_array_type (
H5_FLOAT64_T,
H5_FLOAT64,
1,
dims)
);
@@ -80,14 +77,14 @@ create_vertex_type (
TRY(
h5_dta_types.h5_vertex_t = hdf5_create_type (
H5_COMPOUND_T,
H5_COMPOUND,
sizeof (h5_glb_vertex_t)) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_vertex_t,
"idx",
HOFFSET (h5_glb_vertex_t, idx),
H5_ID_T) );
H5_ID) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_vertex_t,
@@ -106,44 +103,44 @@ create_triangle_type (
TRY(
h5_dta_types.h5_triangle_t = hdf5_create_type (
H5_COMPOUND_T,
H5_COMPOUND,
sizeof (h5_glb_tri_t)) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_triangle_t,
"idx",
HOFFSET (h5_glb_tri_t, idx),
H5_ID_T) );
H5_ID) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_triangle_t,
"parent_idx",
HOFFSET (h5_glb_tri_t, parent_idx),
H5_ID_T) );
H5_ID) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_triangle_t,
"child_idx",
HOFFSET(h5_glb_tri_t, child_idx),
H5_ID_T) );
H5_ID) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_triangle_t,
"level_idx",
HOFFSET(h5_glb_tri_t, level_idx),
H5_INT16_T) );
H5_INT16) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_triangle_t,
"refinement",
HOFFSET(h5_glb_tri_t, refinement),
H5_INT16_T) );
H5_INT16) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_triangle_t,
"flags",
HOFFSET(h5_glb_tri_t, flags),
H5_INT32_T) );
H5_INT32) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_triangle_t,
@@ -168,20 +165,20 @@ create_tag_types (
TRY (
h5_dta_types.h5t_glb_tag_idx_t = hdf5_create_type (
H5_COMPOUND_T,
H5_COMPOUND,
sizeof (h5t_glb_tag_idx_t)) );
TRY (
hdf5_insert_type (
h5_dta_types.h5t_glb_tag_idx_t,
"eid",
HOFFSET (h5t_glb_tag_idx_t, eid),
H5_ID_T) );
H5_ID) );
TRY (
hdf5_insert_type (
h5_dta_types.h5t_glb_tag_idx_t,
"idx",
HOFFSET (h5t_glb_tag_idx_t, idx),
H5_ID_T) );
H5_ID) );
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
}
@@ -194,20 +191,20 @@ create_tet_type (
TRY(
h5_dta_types.h5_tet_t = hdf5_create_type (
H5_COMPOUND_T,
H5_COMPOUND,
sizeof (h5_glb_tet_t)) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_tet_t,
"idx",
HOFFSET (h5_glb_tet_t, idx),
H5_ID_T) );
H5_ID) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_tet_t,
"parent_idx",
HOFFSET (h5_glb_tet_t, parent_idx),
H5_ID_T) );
H5_ID) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_tet_t,
@@ -219,19 +216,19 @@ create_tet_type (
h5_dta_types.h5_tet_t,
"level_idx",
HOFFSET(h5_glb_tet_t, level_idx),
H5_INT16_T) );
H5_INT16) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_tet_t,
"refinement",
HOFFSET(h5_glb_tet_t, refinement),
H5_INT16_T) );
H5_INT16) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_tet_t,
"flags",
HOFFSET(h5_glb_tet_t, flags),
H5_INT32_T) );
H5_INT32) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_tet_t,
@@ -257,50 +254,50 @@ create_chunk_type (
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
TRY(
h5_dta_types.h5_chunk_t = hdf5_create_type (
H5_COMPOUND_T,
H5_COMPOUND,
sizeof (h5t_chunk_t)) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_chunk_t,
"idx",
HOFFSET (h5t_chunk_t, idx),
H5_INT32_T) );
H5_INT32) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_chunk_t,
"oct_idx",
HOFFSET (h5t_chunk_t, oct_idx),
H5_INT32_T) );
H5_INT32) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_chunk_t,
"elem",
HOFFSET (h5t_chunk_t, elem),
H5_ID_T) );
H5_ID) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_chunk_t,
"weight",
HOFFSET (h5t_chunk_t, weight),
H5_ID_T) );
H5_ID) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_chunk_t,
"num_elems",
HOFFSET (h5t_chunk_t, num_elems),
H5_UINT16_T) );
H5_UINT16) );
// TRY(
// hdf5_insert_type (
// h5_dta_types.h5_chunk_t,
// "vtx",
// HOFFSET (h5t_chunk_t, vtx),
// H5_INT64_T) );
// H5_INT64) );
// TRY(
// hdf5_insert_type (
// h5_dta_types.h5_chunk_t,
// "num_vtx",
// HOFFSET (h5t_chunk_t, num_vtx),
// H5_INT64_T) );
// H5_INT64) );
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
}
@@ -311,32 +308,32 @@ create_octree_type (
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
TRY(
h5_dta_types.h5_octree_t = hdf5_create_type (
H5_COMPOUND_T,
H5_COMPOUND,
sizeof (h5t_octant_t)) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_octree_t,
"idx",
HOFFSET (h5t_octant_t, idx),
H5_INT32_T) );
H5_INT32) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_octree_t,
"parent_idx",
HOFFSET (h5t_octant_t, parent_idx),
H5_INT32_T) );
H5_INT32) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_octree_t,
"child_idx",
HOFFSET (h5t_octant_t, child_idx),
H5_INT32_T) );
H5_INT32) );
TRY(
hdf5_insert_type (
h5_dta_types.h5_octree_t,
"level_idx",
HOFFSET (h5t_octant_t, level_idx),
H5_INT16_T) );
H5_INT16) );
// TRY(
// hdf5_insert_type (
// h5_dta_types.h5_octree_t,
@@ -348,7 +345,7 @@ create_octree_type (
h5_dta_types.h5_octree_t,
"userlevels",
HOFFSET (h5t_octant_t, userlevels),
H5_INT32_T) );
H5_INT32) );
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
}
@@ -360,7 +357,7 @@ create_userdata_type (
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
TRY(
h5_dta_types.h5_userdata_t = hdf5_create_type (
H5_COMPOUND_T,
H5_COMPOUND,
sizeof (h5t_oct_userdata_t)) );
TRY(
hdf5_insert_type (
@@ -678,10 +675,10 @@ h5_initialize (
exit (42);
}
#endif
h5_dta_types.h5_glb_idx_t = H5_INT64_T;
h5_dta_types.h5_int64_t = H5_INT64_T;
h5_dta_types.h5_float64_t = H5_FLOAT64_T;
h5_dta_types.h5_int32_t = H5_INT32_T;
h5_dta_types.h5_glb_idx_t = H5_INT64;
h5_dta_types.h5_int64_t = H5_INT64;
h5_dta_types.h5_float64_t = H5_FLOAT64;
h5_dta_types.h5_int32_t = H5_INT32;
TRY (create_array_types ());
TRY (create_vertex_type ());
+3 -67
View File
@@ -9,7 +9,6 @@
#include <string.h>
#include "h5core/h5_init.h"
#include "private/h5_types.h"
#include "private/h5_hdf5.h"
#include "private/h5_model.h"
@@ -59,67 +58,6 @@ h5_set_step (
H5_CORE_API_RETURN (H5_SUCCESS);
}
/*!
Normalize HDF5 type
*/
h5_int64_t
h5priv_normalize_h5_type (
hid_t type
) {
H5_CORE_API_ENTER (h5_int64_t,
"type=%lld",
(long long int)type);
H5T_class_t tclass;
int size;
TRY (tclass = H5Tget_class (type));
TRY (size = H5Tget_size (type));
switch (tclass){
case H5T_INTEGER:
if (size==8) {
H5_CORE_API_LEAVE (H5_INT64_T);
} else if (size==4) {
H5_CORE_API_LEAVE (H5_INT32_T);
} else if (size==2) {
H5_CORE_API_LEAVE (H5_INT16_T);
}
break;
case H5T_FLOAT:
if ( size==8 ) {
H5_CORE_API_LEAVE (H5_FLOAT64_T);
}
else if ( size==4 ) {
H5_CORE_API_LEAVE (H5_FLOAT32_T);
}
break;
case H5T_STRING:
H5_CORE_API_LEAVE (H5_STRING_T);
default:
; /* NOP */
}
H5_CORE_API_RETURN (h5_warn ("Unknown type %d", (int)type));
}
h5_int64_t
h5priv_get_dataset_type(
const hid_t group_id,
const char* dset_name
) {
H5_CORE_API_ENTER (h5_int64_t,
"group_id=%lld, dset_name='%s'",
(long long int)group_id, dset_name);
hid_t dset_id;
hid_t hdf5_type;
h5_int64_t type;
TRY (dset_id = hdf5_open_dataset (group_id, dset_name));
TRY (hdf5_type = hdf5_get_dataset_type (dset_id));
TRY (type = h5priv_normalize_h5_type (hdf5_type));
TRY (hdf5_close_type (hdf5_type));
TRY (hdf5_close_dataset (dset_id));
H5_CORE_API_RETURN (type);
}
/*
returns:
TRUE (value > 0): if step exists
@@ -138,9 +76,8 @@ h5_has_step (
"%s#%0*lld",
f->props->prefix_step_name, f->props->width_step_idx,
(long long)step_idx);
h5_err_t exists;
TRY (exists = hdf5_link_exists (f->file, name));
H5_CORE_API_RETURN (exists);
TRY (ret_value = hdf5_link_exists (f->file, name));
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
@@ -154,7 +91,7 @@ h5priv_normalize_dataset_name (
name2[H5_DATANAME_LEN-1] = '\0';
h5_warn ("Truncated name '%s' to '%s'.", name, name2);
} else {
strcpy ( name2, name );
strcpy (name2, name);
}
if ( strcmp( name2, H5BLOCK_GROUPNAME_BLOCK ) == 0 ) {
@@ -167,4 +104,3 @@ h5priv_normalize_dataset_name (
}
H5_CORE_API_RETURN (H5_SUCCESS);
}
+50 -62
View File
@@ -6,11 +6,9 @@
License: see file COPYING in top level of source distribution.
*/
#include "h5core/h5_init.h"
#include "private/h5_debug.h"
#include "private/h5.h"
#include "private/h5_file.h"
#include "private/h5_hdf5.h"
#include "private/h5_attribs.h"
@@ -75,13 +73,13 @@ h5b_read_field_attrib (
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY( h5bpriv_open_field_group(f, field_name) );
TRY (h5bpriv_open_field_group(f, field_name));
TRY( h5priv_read_attrib (
f->b->field_gid,
attrib_name,
attrib_type,
buffer) );
TRY (h5priv_read_attrib (
f->b->field_gid,
attrib_name,
attrib_type,
buffer));
H5_CORE_API_RETURN (H5_SUCCESS);
}
@@ -105,43 +103,10 @@ h5b_has_field_attrib (
TRY (h5bpriv_open_field_group(f, field_name));
H5_CORE_API_RETURN (
hdf5_attribute_exists (
f->b->field_gid,
attrib_name) );
}
h5_err_t
h5b_get_field_attrib_info_by_name (
const h5_file_t fh, /*!< IN: file handle */
const char* const field_name, /*!< IN: field name */
const char* const attrib_name, /*!< IN: attribute name */
h5_int64_t* attrib_type, /*!< OUT: attribute type */
h5_size_t* attrib_nelem /*!< OUT: number of elements */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, "
"field_name='%s', "
"attrib_name=%s, "
"attrib_type=%p, "
"attrib_nelem=%p",
f,
field_name,
attrib_name,
attrib_type,
attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (h5bpriv_open_field_group(f, field_name));
H5_CORE_API_RETURN (
h5priv_get_attrib_info_by_name (
f->b->field_gid,
attrib_name,
attrib_type,
attrib_nelem));
TRY (ret_value = hdf5_attribute_exists (
f->b->field_gid,
attrib_name));
H5_CORE_API_RETURN (ret_value);
}
h5_ssize_t
@@ -156,7 +121,8 @@ h5b_get_num_field_attribs (
TRY (h5bpriv_open_field_group(f, field_name));
H5_CORE_API_RETURN (hdf5_get_num_attribute (f->b->field_gid));
TRY (ret_value = hdf5_get_num_attribute (f->b->field_gid));
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
@@ -175,27 +141,49 @@ h5b_get_field_attrib_info_by_idx (
"field_name='%s', "
"attrib_idx=%llu, "
"attrib_name=%p, len_attrib_name=%llu, "
"attrib_type=%p, "
"attrib_nelem=%p",
"attrib_type=%p, attrib_nelem=%p",
f,
field_name,
(long long unsigned)attrib_idx,
attrib_name, (long long unsigned)len_attrib_name,
attrib_type,
attrib_nelem);
attrib_type, attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (h5bpriv_open_field_group(f, field_name));
TRY (ret_value = h5priv_get_attrib_info_by_idx (
f->b->field_gid,
attrib_idx,
attrib_name, len_attrib_name,
attrib_type, attrib_nelem));
H5_CORE_API_RETURN (ret_value);
}
H5_CORE_API_RETURN (
h5priv_get_attrib_info_by_idx (
f->b->field_gid,
attrib_idx,
attrib_name,
len_attrib_name,
attrib_type,
attrib_nelem));
h5_err_t
h5b_get_field_attrib_info_by_name (
const h5_file_t fh, /*!< IN: file handle */
const char* const field_name, /*!< IN: field name */
const char* const attrib_name, /*!< IN: attribute name */
h5_int64_t* attrib_type, /*!< OUT: attribute type */
h5_size_t* attrib_nelem /*!< OUT: number of elements */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, "
"field_name='%s', "
"attrib_name=%s, "
"attrib_type=%p, attrib_nelem=%p",
f,
field_name,
attrib_name,
attrib_type, attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (h5bpriv_open_field_group(f, field_name));
TRY (ret_value = h5priv_get_attrib_info_by_name (
f->b->field_gid,
attrib_name,
attrib_type, attrib_nelem));
H5_CORE_API_RETURN (ret_value);
}
static inline h5_err_t
@@ -264,7 +252,7 @@ h5b_set_3d_field_coords (
(h5_file_t)f,
field_name,
attrib_name,
H5_FLOAT64_T,
H5_FLOAT64,
coords,
n_coords));
@@ -300,7 +288,7 @@ h5b_get_3d_field_coords (
(h5_file_t)f,
field_name,
attrib_name,
H5_FLOAT64_T,
H5_FLOAT64,
coords));
H5_CORE_API_RETURN (H5_SUCCESS);
+10 -10
View File
@@ -7,7 +7,6 @@
License: see file COPYING in top level of source distribution.
*/
#include "h5core/h5_init.h"
#include "private/h5_types.h"
#include "private/h5_hdf5.h"
@@ -209,17 +208,18 @@ _write_data (
h5_err_t exists;
TRY (exists = hdf5_link_exists (b->field_gid, data_name));
if ( exists > 0 ) {
TRY (dataset = hdf5_open_dataset (b->field_gid, data_name));
TRY (dataset = hdf5_open_dataset_by_name (b->field_gid, data_name));
hid_t type_file;
TRY( type_file = hdf5_get_dataset_type (dataset) );
if ( type != type_file ) {
H5_PRIV_FUNC_LEAVE (h5_error(
H5_ERR_HDF5,
"Field '%s' already has type '%s' "
"but was written as '%s'.",
field_name,
hdf5_get_type_name (type_file),
hdf5_get_type_name (type)));
H5_PRIV_FUNC_LEAVE (
h5_error(
H5_ERR_HDF5,
"Field '%s' already has type '%s' "
"but was written as '%s'.",
field_name,
hdf5_get_type_name (type_file),
hdf5_get_type_name (type)));
}
} else {
TRY (dataset = hdf5_create_dataset(
@@ -388,7 +388,7 @@ read_data (
hid_t dataset;
h5b_fdata_t *b = f->b;
TRY (dataset = hdf5_open_dataset (b->field_gid, dataset_name));
TRY (dataset = hdf5_open_dataset_by_name (b->field_gid, dataset_name));
TRY (_select_hyperslab_for_reading (f, dataset) );
TRY (h5priv_start_throttle (f));
TRY (hdf5_read_dataset(
+32 -30
View File
@@ -10,10 +10,9 @@
#include <string.h>
#include <stdlib.h>
#include "h5core/h5_init.h"
#include "h5core/h5_syscall.h"
#include "private/h5.h"
#include "private/h5_file.h"
#include "private/h5_hdf5.h"
#include "private/h5_model.h"
@@ -43,9 +42,8 @@ h5b_has_field_data (
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
CHECK_FILEHANDLE (f);
h5_err_t exists;
TRY (exists = hdf5_link_exists (f->step_gid, H5BLOCK_GROUPNAME_BLOCK));
H5_CORE_API_RETURN (exists);
TRY (ret_value = hdf5_link_exists (f->step_gid, H5BLOCK_GROUPNAME_BLOCK));
H5_CORE_API_RETURN (ret_value);
}
static void
@@ -729,7 +727,7 @@ h5b_3d_get_chunk (
hid_t plist_id;
hsize_t hdims[3];
TRY (dataset_id = hdf5_open_dataset (b->field_gid, H5_BLOCKNAME_X));
TRY (dataset_id = hdf5_open_dataset_by_name (b->field_gid, H5_BLOCKNAME_X));
TRY (plist_id = hdf5_get_dataset_create_plist (dataset_id));
TRY (hdf5_get_chunk_property (plist_id, 3, hdims));
TRY (hdf5_close_property (plist_id));
@@ -920,10 +918,11 @@ h5b_get_num_fields (
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_TIMEGROUP( f );
CHECK_TIMEGROUP (f);
TRY (h5bpriv_open_block_group(f));
H5_CORE_API_RETURN (hdf5_get_num_objs_in_group (f->b->block_gid));
TRY (ret_value = hdf5_get_num_objs_in_group (f->b->block_gid));
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
@@ -936,10 +935,10 @@ h5b_has_field (
"f=%p, name='%s'",
f, name);
CHECK_TIMEGROUP (f);
CHECK_TIMEGROUP (f);
const char* path[] = { H5BLOCK_GROUPNAME_BLOCK, name };
H5_CORE_API_RETURN (h5priv_link_exists_(f->step_gid, path, 2));
TRY (ret_value = h5priv_link_exists_(f->step_gid, path, 2));
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
@@ -956,37 +955,39 @@ h5b_get_field_info_by_name (
"f=%p, name='%s', "
"field_rank=%p, field_dims=%p, elem_rank=%p, type=%p",
f, name, field_rank, field_dims, elem_rank, type);
CHECK_TIMEGROUP( f );
CHECK_TIMEGROUP (f);
hsize_t dims[16]; /* give it plenty of space even though we don't expect rank > 3 */
hsize_t _field_rank, _elem_rank;
h5_size_t i, j;
/* give it plenty of space even though we don't expect rank > 3 */
hsize_t dims[16];
TRY( h5bpriv_open_field_group(f, name) );
hid_t dataset_id;
hid_t dataspace_id;
TRY (dataset_id = hdf5_open_dataset (f->b->field_gid, H5_BLOCKNAME_X));
TRY (dataset_id = hdf5_open_dataset_by_name (
f->b->field_gid, H5_BLOCKNAME_X));
TRY (dataspace_id = hdf5_get_dataset_space (dataset_id) );
TRY (_field_rank = hdf5_get_dims_of_dataspace (dataspace_id, dims, NULL));
if (field_rank) *field_rank = (h5_size_t) _field_rank;
hsize_t rank;
TRY (rank = hdf5_get_dims_of_dataspace (dataspace_id, dims, NULL));
if (field_rank) *field_rank = (h5_size_t)rank;
if (field_dims) {
for ( i = 0, j = _field_rank-1; i < _field_rank; i++, j-- )
size_t i, j;
for (i = 0, j = rank-1; i < rank; i++, j-- )
field_dims[i] = (h5_size_t)dims[j];
}
TRY (_elem_rank = hdf5_get_num_objs_in_group (f->b->field_gid));
if (elem_rank) *elem_rank = (h5_size_t) _elem_rank;
hid_t h5type;
TRY (h5type = hdf5_get_dataset_type (dataset_id));
if ( type )
TRY( *type = h5priv_normalize_h5_type(h5type) );
if (elem_rank) {
hsize_t _elem_rank;
TRY (_elem_rank = hdf5_get_num_objs_in_group (f->b->field_gid));
*elem_rank = (h5_size_t) _elem_rank;
}
if (type) {
TRY (*type = h5priv_get_native_dataset_type (dataset_id));
TRY (*type = h5priv_map_hdf5_type_to_enum(*type));
}
TRY (hdf5_close_dataspace (dataspace_id));
TRY (hdf5_close_dataset (dataset_id));
@@ -1022,8 +1023,9 @@ h5b_get_field_info (
name,
(size_t)len_name) );
H5_CORE_API_RETURN (h5b_get_field_info_by_name (
(h5_file_t)f,
name, field_rank, field_dims, elem_rank, type));
TRY (h5b_get_field_info_by_name (
(h5_file_t)f,
name, field_rank, field_dims, elem_rank, type));
H5_CORE_API_RETURN (H5_SUCCESS);
}
+7 -6
View File
@@ -7,13 +7,11 @@
License: see file COPYING in top level of source distribution.
*/
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "private/h5.h"
#include "private/h5_file.h"
#include "private/h5t_types.h"
#include "private/h5t_adjacencies.h"
#include "private/h5t_map.h"
#include "private/h5t_core.h"
#include <time.h>
@@ -28,7 +26,8 @@ h5t_get_adjacencies (
H5_CORE_API_ENTER (h5_err_t,
"m=%p, entity_id=%llu, dim=%d, list=%p",
m, (long long unsigned)entity_id, dim, list);
H5_CORE_API_RETURN (h5tpriv_get_adjacencies (m, entity_id, dim, list));
TRY (ret_value = h5tpriv_get_adjacencies (m, entity_id, dim, list));
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
@@ -38,7 +37,8 @@ h5t_release_list_of_adjacencies (
) {
H5_CORE_API_ENTER (h5_err_t, "m=%p, list=%p", m, list);
UNUSED_ARGUMENT (m);
H5_CORE_API_RETURN (h5priv_free_loc_idlist (list));
TRY (ret_value = h5priv_free_loc_idlist (list));
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
@@ -54,5 +54,6 @@ h5t_find_te2 (
(long long)face_idx,
(long long)elem_idx,
retval);
H5_CORE_API_RETURN (h5tpriv_find_te2 (m,face_idx,elem_idx,retval));
TRY (ret_value = h5tpriv_find_te2 (m,face_idx,elem_idx,retval));
H5_CORE_API_RETURN (ret_value);
}
+27 -28
View File
@@ -7,7 +7,6 @@
License: see file COPYING in top level of source distribution.
*/
#include "h5core/h5_init.h"
#include "private/h5_types.h"
#include <stdlib.h>
@@ -37,7 +36,6 @@ int dont_use_parmetis = 0;
// 2 distribute geometrically with preferred direction
#include "h5core/h5_init.h"
#include "private/h5t_types.h"
#include "private/h5t_model.h"
#include "private/h5t_map.h"
@@ -422,7 +420,7 @@ write_vertices_chk (
H5_PRIV_FUNC_ENTER (h5_err_t, "m=%p", m);
assert (m->num_leaf_levels > 0);
hid_t dset_id;
TRY (dset_id = hdf5_open_dataset (m->mesh_gid, m->dsinfo_vertices.name));
TRY (dset_id = hdf5_open_dataset_by_name (m->mesh_gid, m->dsinfo_vertices.name));
hid_t mspace_id;
hid_t dspace_id;
@@ -625,7 +623,7 @@ write_elems_chk (
// could check here that glb_elems are in correct order
hid_t dset_id;
TRY (dset_id = hdf5_open_dataset (m->mesh_gid, m->dsinfo_elems.name));
TRY (dset_id = hdf5_open_dataset_by_name (m->mesh_gid, m->dsinfo_elems.name));
hid_t dspace_id;
hid_t mspace_id;
hsize_t hstart = 0;
@@ -800,7 +798,7 @@ write_chunks (
TRY (h5priv_write_attrib (
m->mesh_gid,
"__num_chunks__",
H5_INT32_T,
H5_INT32,
&m->chunks->num_alloc,
1,
1));
@@ -808,7 +806,7 @@ write_chunks (
TRY (h5priv_write_attrib (
m->mesh_gid,
"__num_chk_levels__",
H5_INT16_T, // WARNING should maybe be uint
H5_INT16, // WARNING should maybe be uint
&m->chunks->num_levels,
1,
1));
@@ -816,7 +814,7 @@ write_chunks (
TRY (h5priv_write_attrib (
m->mesh_gid,
"__num_chk_p_level__",
H5_INT32_T,
H5_INT32,
m->chunks->num_chunks_p_level,
m->chunks->num_levels,
1));
@@ -908,7 +906,7 @@ write_octree (
TRY (h5priv_write_attrib (
m->mesh_gid,
"__curr_oct_idx__",
H5_INT32_T,
H5_INT32,
&m->octree->current_oct_idx,
1,
1));
@@ -916,21 +914,21 @@ write_octree (
TRY (h5priv_write_attrib (
m->mesh_gid,
"__oct_maxpoints__",
H5_INT32_T,
H5_INT32,
&m->octree->maxpoints,
1,
1));
TRY (h5priv_write_attrib (
m->mesh_gid,
"__oct_size_userdata__",
H5_INT32_T,
H5_INT32,
&m->octree->size_userdata,
1,
1));
TRY (h5priv_write_attrib (
m->mesh_gid,
"__oct_bounding_box__",
H5_FLOAT64_T,
H5_FLOAT64,
m->octree->bounding_box,
6,
1));
@@ -1039,7 +1037,7 @@ write_weights (
TRY (h5priv_write_attrib (
m->mesh_gid,
"__num_weights__",
H5_INT32_T,
H5_INT32,
&m->num_weights,
1,
1));
@@ -1104,7 +1102,7 @@ read_vertices (
) {
H5_PRIV_FUNC_ENTER (h5_err_t, "m=%p", m);
hid_t dset_id;
TRY (dset_id = hdf5_open_dataset (m->mesh_gid, m->dsinfo_vertices.name));
TRY (dset_id = hdf5_open_dataset_by_name (m->mesh_gid, m->dsinfo_vertices.name));
hid_t mspace_id = H5S_ALL;
hid_t dspace_id = H5S_ALL;
@@ -1169,7 +1167,7 @@ read_elems (
m, (long long)start, (long long)count);
hid_t dset_id;
TRY (dset_id = hdf5_open_dataset (m->mesh_gid, m->dsinfo_elems.name));
TRY (dset_id = hdf5_open_dataset_by_name (m->mesh_gid, m->dsinfo_elems.name));
hid_t mspace_id;
hsize_t hcount = (hsize_t)count;
TRY (mspace_id = hdf5_create_dataspace (1, &hcount, NULL));
@@ -1720,7 +1718,7 @@ read_octree (
) {
H5_PRIV_FUNC_ENTER (h5_err_t, "m=%p", m);
hid_t dset_id, dset_id2;
TRY (dset_id = hdf5_open_dataset (m->mesh_gid, m->dsinfo_octree.name));
TRY (dset_id = hdf5_open_dataset_by_name (m->mesh_gid, m->dsinfo_octree.name));
hid_t mspace_id = H5S_ALL;
hid_t dspace_id = H5S_ALL;
@@ -1732,22 +1730,22 @@ read_octree (
TRY (h5priv_read_attrib (
m->mesh_gid,
"__curr_oct_idx__",
H5_INT32_T,
H5_INT32,
&oct_size));
TRY (h5priv_read_attrib (
m->mesh_gid,
"__oct_maxpoints__",
H5_INT32_T,
H5_INT32,
&maxpoints));
TRY (h5priv_read_attrib (
m->mesh_gid,
"__oct_size_userdata__",
H5_INT32_T,
H5_INT32,
&size_userdata));
TRY (h5priv_read_attrib (
m->mesh_gid,
"__oct_bounding_box__",
H5_FLOAT64_T,
H5_FLOAT64,
bounding_box))
h5t_octant_t* octants;
h5t_oct_userdata_t* userdata;
@@ -1771,7 +1769,8 @@ read_octree (
octants));
if (size_userdata > 0) {
TRY (dset_id2 = hdf5_open_dataset (m->mesh_gid, m->dsinfo_userdata.name));
TRY (dset_id2 = hdf5_open_dataset_by_name (
m->mesh_gid, m->dsinfo_userdata.name));
TRY (hdf5_read_dataset (
dset_id2,
m->dsinfo_userdata.type_id,
@@ -1798,7 +1797,7 @@ read_weights (
) {
H5_PRIV_FUNC_ENTER (h5_err_t, "m=%p", m);
hid_t dset_id;
TRY (dset_id = hdf5_open_dataset (m->mesh_gid, m->dsinfo_weights.name));
TRY (dset_id = hdf5_open_dataset_by_name (m->mesh_gid, m->dsinfo_weights.name));
hid_t mspace_id = H5S_ALL;
hid_t dspace_id = H5S_ALL;
@@ -1806,7 +1805,7 @@ read_weights (
TRY (h5priv_read_attrib (
m->mesh_gid,
"__num_weights__",
H5_INT32_T,
H5_INT32,
&m->num_weights));
TRY (m->weights =
h5_calloc (m->num_weights * m->num_glb_elems[m->num_leaf_levels-1], sizeof (*m->weights)));
@@ -1848,7 +1847,7 @@ read_chunks (
) {
H5_PRIV_FUNC_ENTER (h5_err_t, "m=%p", m);
hid_t dset_id;
TRY (dset_id = hdf5_open_dataset (m->mesh_gid, m->dsinfo_chunks.name));
TRY (dset_id = hdf5_open_dataset_by_name (m->mesh_gid, m->dsinfo_chunks.name));
hid_t mspace_id = H5S_ALL;
hid_t dspace_id = H5S_ALL;
@@ -1856,13 +1855,13 @@ read_chunks (
TRY (h5priv_read_attrib (
m->mesh_gid,
"__num_chunks__",
H5_INT32_T,
H5_INT32,
&m->chunks->num_alloc));
m->chunks->curr_idx = m->chunks->num_alloc -1;
TRY (h5priv_read_attrib (
m->mesh_gid,
"__num_chk_levels__",
H5_INT16_T,
H5_INT16,
&m->chunks->num_levels));
TRY (m->chunks->num_chunks_p_level =
@@ -1871,7 +1870,7 @@ read_chunks (
TRY (h5priv_read_attrib (
m->mesh_gid,
"__num_chk_p_level__",
H5_INT32_T,
H5_INT32,
m->chunks->num_chunks_p_level));
TRY (m->chunks->chunks =
h5_calloc (m->chunks->num_alloc, sizeof (*m->chunks->chunks)));
@@ -2587,7 +2586,7 @@ read_chunked_elements (
TRY (get_list_of_proc (m, *my_procs, list_of_chunks, num_interior_chunks));
hid_t dset_id;
TRY (dset_id = hdf5_open_dataset (m->mesh_gid, m->dsinfo_elems.name));
TRY (dset_id = hdf5_open_dataset_by_name (m->mesh_gid, m->dsinfo_elems.name));
hid_t mspace_id;
// create memspace
@@ -2838,7 +2837,7 @@ read_elems_part (
seloper = H5S_SELECT_OR;
}
hid_t dset_id;
TRY (dset_id = hdf5_open_dataset (m->mesh_gid, m->dsinfo_elems.name));
TRY (dset_id = hdf5_open_dataset_by_name (m->mesh_gid, m->dsinfo_elems.name));
TRY (hdf5_read_dataset (
dset_id,
m->dsinfo_elems.type_id,
+17 -9
View File
@@ -109,11 +109,15 @@ h5t_map_global_vertex_idx2local (
H5_CORE_API_ENTER (h5_loc_idx_t, "m=%p, glb_idx=%lld", m, (long long)glb_idx);
if (glb_idx < 0) return -1;
h5_loc_idx_t loc_idx = h5priv_search_idxmap (&m->map_vertex_g2l, glb_idx); // loc_idx is position in map
// loc_idx is position in map
h5_loc_idx_t loc_idx = h5priv_search_idxmap (&m->map_vertex_g2l, glb_idx);
if (loc_idx < 0) {
H5_CORE_API_LEAVE (h5tpriv_error_global_id_nexist ("vertex", glb_idx));
H5_CORE_API_LEAVE (
h5tpriv_error_global_id_nexist ("vertex", glb_idx));
}
H5_CORE_API_RETURN (m->map_vertex_g2l.items[loc_idx].loc_idx); // loc_idx is position in m->vertices!
// loc_idx is position in m->vertices!
TRY (ret_value = m->map_vertex_g2l.items[loc_idx].loc_idx);
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
@@ -315,8 +319,9 @@ h5tpriv_get_loc_vtx_idx_of_vtx (
(long long unsigned)*vertex_index);
h5_loc_idx_t face_idx = h5tpriv_get_face_idx (entity_id);
h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id);
H5_CORE_API_RETURN (h5tpriv_get_loc_vtx_idx_of_vtx2 (
m, face_idx, elem_idx, vertex_index));
TRY (ret_value = h5tpriv_get_loc_vtx_idx_of_vtx2 (
m, face_idx, elem_idx, vertex_index));
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
@@ -352,8 +357,10 @@ h5t_get_loc_vertex_indices_of_edge (
vertex_indices);
h5_loc_idx_t face_idx = h5tpriv_get_face_idx (entity_id);
h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id);
H5_CORE_API_RETURN (h5t_get_loc_vertex_indices_of_edge2 (
m, face_idx, elem_idx, vertex_indices));
TRY (ret_value = h5t_get_loc_vertex_indices_of_edge2 (
m, face_idx, elem_idx, vertex_indices));
H5_CORE_API_RETURN (ret_value);
}
/*!
@@ -399,8 +406,9 @@ h5t_get_loc_vertex_indices_of_triangle (
vertex_indices);
h5_loc_idx_t face_idx = h5tpriv_get_face_idx (entity_id);
h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id);
H5_CORE_API_RETURN (h5t_get_loc_vertex_indices_of_triangle2 (
m, face_idx, elem_idx, vertex_indices));
TRY (ret_value = h5t_get_loc_vertex_indices_of_triangle2 (
m, face_idx, elem_idx, vertex_indices));
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
+7 -6
View File
@@ -7,18 +7,17 @@
License: see file COPYING in top level of source distribution.
*/
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "private/h5.h"
#include "private/h5_file.h"
#include "private/h5_mpi.h"
#include "private/h5_errorhandling.h"
#include "private/h5_err.h"
#include "private/h5_attribs.h"
#include "private/h5_hdf5.h"
#include "private/h5t_types.h"
#include "private/h5t_errorhandling.h"
#include "private/h5t_err.h"
#include "private/h5t_model.h"
#include "private/h5t_adjacencies.h"
#include "private/h5t_io.h"
@@ -491,7 +490,8 @@ h5t_get_num_tetmeshes (
const h5_file_t fh
) {
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", (h5_file_p)fh);
H5_CORE_API_RETURN (get_num_meshes (fh, TETRAHEDRAL_MESHES_GRPNAME));
TRY (ret_value = get_num_meshes (fh, TETRAHEDRAL_MESHES_GRPNAME));
H5_CORE_API_RETURN (ret_value);
}
h5_ssize_t
@@ -499,7 +499,8 @@ h5t_get_num_trimeshes (
const h5_file_t fh
) {
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", (h5_file_p)fh);
H5_CORE_API_RETURN (get_num_meshes (fh, TRIANGLE_MESHES_GRPNAME));
TRY (ret_value = get_num_meshes (fh, TRIANGLE_MESHES_GRPNAME));
H5_CORE_API_RETURN (ret_value);
}
/*!
+3 -1
View File
@@ -2079,8 +2079,10 @@ get_sibling(
) {
H5_PRIV_FUNC_ENTER (h5_err_t, "octree=%p, oct_idx=%d", octree, oct_idx);
assert (oct_idx >0);
H5_PRIV_FUNC_RETURN (octree->octants[octree->octants[oct_idx].parent_idx].child_idx);
H5_PRIV_FUNC_RETURN (
octree->octants[octree->octants[oct_idx].parent_idx].child_idx);
}
h5_oct_idx_t H5t_get_sibling(h5t_octree_t* octree, h5_oct_idx_t oct_idx) {
return get_sibling(octree, oct_idx);
}
+6 -5
View File
@@ -7,13 +7,12 @@
License: see file COPYING in top level of source distribution.
*/
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "private/h5.h"
#include "private/h5_file.h"
#include "private/h5t_types.h"
#include "private/h5t_errorhandling.h"
#include "private/h5t_err.h"
#include "private/h5t_map.h"
#include "private/h5t_model.h"
#include "private/h5t_access.h"
@@ -93,7 +92,8 @@ iterate_boundary_facets (
}
} while (!h5tpriv_is_boundary_facet (it->mesh, it->elem_idx, it->face_idx));
int type = h5tpriv_ref_elem_get_entity_type (it, dim);
H5_PRIV_FUNC_RETURN (h5tpriv_build_entity_id (type, it->face_idx, it->elem_idx));
TRY (ret_value = h5tpriv_build_entity_id (type, it->face_idx, it->elem_idx));
H5_PRIV_FUNC_RETURN (ret_value);
}
/*!
@@ -271,7 +271,8 @@ h5t_release_entity_iterator (
h5t_iterator_t* iter
) {
H5_CORE_API_ENTER (h5_err_t, "iter=%p", iter);
H5_CORE_API_RETURN (h5_free (iter));
TRY (ret_value = h5_free (iter));
H5_CORE_API_RETURN (ret_value);
}
h5_loc_id_t
+11 -7
View File
@@ -7,9 +7,9 @@
License: see file COPYING in top level of source distribution.
*/
#include "private/h5_errorhandling.h"
#include "private/h5_err.h"
#include "private/h5t_types.h"
#include "private/h5t_errorhandling.h"
#include "private/h5t_err.h"
#include "private/h5t_access.h"
#include "private/h5t_core.h"
#include "private/h5t_map.h"
@@ -18,7 +18,7 @@
#include "private/h5t_core.h"
#include "private/h5t_io.h"
#include "private/h5_init.h"
#include "private/h5.h"
#include "private/h5_file.h"
#include "private/h5_mpi.h"
#include "h5core/h5t_map.h"
@@ -487,7 +487,8 @@ h5t_begin_store_vertices (
m->last_stored_vid_before_ref = m->last_stored_vid;
m->num_loc_vertices[m->leaf_level] = cur_num_loc_vertices+num;
m->dsinfo_vertices.dims[0] = cur_num_loc_vertices+num;
H5_CORE_API_RETURN (h5tpriv_alloc_loc_vertices (m, cur_num_loc_vertices+num));
TRY (ret_value = h5tpriv_alloc_loc_vertices (m, cur_num_loc_vertices+num));
H5_CORE_API_RETURN (ret_value);
}
h5_loc_idx_t
@@ -564,7 +565,8 @@ h5t_begin_store_elems (
m->last_stored_eid_before_ref = m->last_stored_eid;
H5_CORE_API_RETURN (h5tpriv_alloc_loc_elems (m, cur, new));
TRY (ret_value = h5tpriv_alloc_loc_elems (m, cur, new));
H5_CORE_API_RETURN (ret_value);
}
@@ -1228,7 +1230,9 @@ h5t_mark_entity (
) {
H5_CORE_API_ENTER (h5_err_t, "m=%p, entity_id=%llu",
m, (long long unsigned)entity_id);
H5_CORE_API_RETURN (h5priv_insert_into_loc_idlist (&m->marked_entities, entity_id, -1));
TRY (ret_value = h5priv_insert_into_loc_idlist (
&m->marked_entities, entity_id, -1));
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
@@ -2784,7 +2788,7 @@ h5t_create_index_set (
int codim;
int dim = h5tpriv_ref_elem_get_dim (m);
// todo: check tagset already exist
TRY (h5t_add_mtagset (m, "__IndexSet__", H5_INT64_T));
TRY (h5t_add_mtagset (m, "__IndexSet__", H5_INT64));
for (codim = 0; codim <= dim; codim++) {
h5_glb_idx_t idx = 0;
+20 -24
View File
@@ -10,8 +10,6 @@
#include "private/h5t_types.h"
#include "h5core/h5t_map.h"
#include "h5core/h5_init.h"
#include "private/h5_va_macros.h"
#include "private/h5_attribs.h"
@@ -117,10 +115,8 @@ get_tagset_info (
// open this tag
TRY (tag_id = hdf5_open_group (tags_id, name));
// determine type of dataset with values
TRY (dset_id = hdf5_open_dataset (tag_id, "values"));
hid_t type_;
TRY (type_ = hdf5_get_dataset_type (dset_id));
TRY (*type = h5priv_normalize_h5_type (type_));
TRY (dset_id = hdf5_open_dataset_by_name (tag_id, "values"));
TRY (*type = h5priv_get_native_dataset_type (dset_id));
TRY (hdf5_close_dataset (dset_id));
TRY (hdf5_close_group (tag_id));
@@ -145,9 +141,8 @@ h5t_get_mtagset_info (
"m=%p, idx=%llu, name=%p, len_name=%llu, type=%p",
m, (long long unsigned)idx, name,
(long long unsigned)len_name, type);
H5_CORE_API_RETURN (get_tagset_info(m->mesh_gid, idx, name, len_name, type));
TRY (ret_value = get_tagset_info(m->mesh_gid, idx, name, len_name, type));
H5_CORE_API_RETURN (ret_value);
}
/*!
@@ -159,7 +154,8 @@ h5t_mtagset_exists (
const char name[]
) {
H5_CORE_API_ENTER (h5_err_t, "m=%p, name=%s", m, name);
H5_CORE_API_RETURN (h5priv_link_exists (m->mesh_gid, "Tags", name));
TRY (ret_value = h5priv_link_exists (m->mesh_gid, "Tags", name));
H5_CORE_API_RETURN (ret_value);
}
static h5_err_t
@@ -212,7 +208,7 @@ h5t_create_mtagset (
}
// validate type
if (type != H5_INT64_T && type != H5_FLOAT64_T) {
if (type != H5_INT64 && type != H5_FLOAT64) {
H5_PRIV_FUNC_LEAVE (
h5_error (H5_ERR_INVAL, "Unsupported data type." ));
}
@@ -225,9 +221,8 @@ h5t_create_mtagset (
h5_error (
H5_ERR_H5FED,
"Cannot create tagset '%s': Tagset exists", name));
H5_CORE_API_RETURN (new_tagset (m, m->mesh_gid, name, type, set));
TRY (ret_value = new_tagset (m, m->mesh_gid, name, type, set));
H5_CORE_API_RETURN (ret_value);
}
static int
@@ -414,7 +409,7 @@ read_tagset (
size_t num_interior_elems = 0;
hid_t dset_id;
TRY (dset_id = hdf5_open_dataset (loc_id, "elems"));
TRY (dset_id = hdf5_open_dataset_by_name (loc_id, "elems"));
TRY (num_interior_elems = hdf5_get_npoints_of_dataset (dset_id));
TRY (elems = h5_calloc (num_interior_elems, sizeof(*elems)));
@@ -436,7 +431,7 @@ read_tagset (
h5t_glb_tag_idx_t* entities;
size_t ent_idx = 0;
size_t num_entities = 0;
TRY (dset_id = hdf5_open_dataset (loc_id, "entities"));
TRY (dset_id = hdf5_open_dataset_by_name (loc_id, "entities"));
TRY (num_entities = hdf5_get_npoints_of_dataset (dset_id));
TRY (entities = h5_calloc (num_entities, sizeof(*entities)));
TRY (read_dataset (
@@ -452,10 +447,10 @@ read_tagset (
// "values"
h5_int64_t* vals;
size_t num_vals = 0;
TRY (dset_id = hdf5_open_dataset (loc_id, "values"));
TRY (dset_id = hdf5_open_dataset_by_name (loc_id, "values"));
TRY (num_vals = hdf5_get_npoints_of_dataset (dset_id));
TRY (vals = h5_calloc (num_vals, sizeof (*vals)));
TRY (dsinfo.type_id = hdf5_get_dataset_type (dset_id));
TRY (dsinfo.type_id = h5priv_get_native_dataset_type (dset_id));
TRY (read_dataset (
tagset->m,
tagset->m->f,
@@ -464,16 +459,16 @@ read_tagset (
open_space_all, open_space_all,
vals));
TRY (hdf5_close_dataset (dset_id ));
tagset->type = h5priv_normalize_h5_type (dsinfo.type_id);
tagset->type = dsinfo.type_id;
/*
add tagset and set values
*/
h5_int64_t scope;
TRY (h5priv_read_attrib (loc_id, "__scope_min__", H5_INT64_T, &scope));
TRY (h5priv_read_attrib (loc_id, "__scope_min__", H5_INT64, &scope));
tagset->scope.min_level = scope;
TRY (h5priv_read_attrib (loc_id, "__scope_max__", H5_INT64_T, &scope));
TRY (h5priv_read_attrib (loc_id, "__scope_max__", H5_INT64, &scope));
tagset->scope.max_level = scope;
for (ent_idx = 0; ent_idx < num_entities; ent_idx++) {
@@ -661,9 +656,9 @@ write_tagset (
open_space_all, open_space_all,
values));
h5_int64_t scope = tagset->scope.min_level;
TRY (h5priv_write_attrib (group_id, "__scope_min__", H5_INT64_T, &scope, 1, 1));
TRY (h5priv_write_attrib (group_id, "__scope_min__", H5_INT64, &scope, 1, 1));
scope = tagset->scope.max_level;
TRY (h5priv_write_attrib (group_id, "__scope_max__", H5_INT64_T, &scope, 1, 1));
TRY (h5priv_write_attrib (group_id, "__scope_max__", H5_INT64, &scope, 1, 1));
TRY (hdf5_close_group (group_id));
TRY (h5_free (elems));
@@ -891,6 +886,7 @@ h5t_remove_tag (
tagset, (long long)entity_id);
h5_loc_idx_t face_id = h5tpriv_get_face_id (entity_id);
h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id);
H5_CORE_API_RETURN (remove_tag (tagset, face_id, elem_idx));
TRY (ret_value = remove_tag (tagset, face_id, elem_idx));
H5_CORE_API_RETURN (ret_value);
}
+1 -4
View File
@@ -7,14 +7,12 @@
License: see file COPYING in top level of source distribution.
*/
#include "h5core/h5_init.h"
#include "private/h5_types.h"
#include "private/h5_hdf5.h"
#include "private/h5_model.h"
#include "private/h5_io.h"
#include "private/h5u_types.h"
#include "h5core/h5_init.h"
#include "h5core/h5_model.h"
#include "h5core/h5_syscall.h"
@@ -103,7 +101,7 @@ h5u_read_data (
char name2[H5_DATANAME_LEN];
TRY (h5priv_normalize_dataset_name (name, name2));
TRY (dataset_id = hdf5_open_dataset (f->step_gid, name2));
TRY (dataset_id = hdf5_open_dataset_by_name (f->step_gid, name2));
/* default spaces, if not using a view selection */
memspace_id = H5S_ALL;
@@ -235,4 +233,3 @@ h5u_write_data (
H5_CORE_API_RETURN (H5_SUCCESS);
}
+158 -81
View File
@@ -7,12 +7,11 @@
License: see file COPYING in top level of source distribution.
*/
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5u_model.h"
#include "h5core/h5u_io.h"
#include "private/h5.h"
#include "private/h5_file.h"
#include "private/h5_hdf5.h"
#include "private/h5_model.h"
@@ -20,6 +19,7 @@
#include "private/h5_io.h"
#include "private/h5u_types.h"
#include <string.h>
h5_ssize_t
h5u_get_num_points (
@@ -62,15 +62,18 @@ h5u_get_num_points_in_view (
h5_ssize_t
h5u_get_totalnum_particles_by_name (
const h5_file_t fh, ///< [in] Handle to open file
const char* const name ///< [in] Index of dataset to query
const h5_file_t fh, ///< [in] Handle to open file
const char* const dataset_name ///< [in] dataset to query
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p, name=%s", f, name);
H5_CORE_API_ENTER (h5_ssize_t,
"f=%p, dataset_name=%s",
f, dataset_name);
h5_ssize_t nparticles;
TRY (nparticles = hdf5_get_npoints_of_dataset_by_name (f->step_gid, name));
h5_debug ("Found %lld particles in dataset %s.", (long long)nparticles, name);
TRY (nparticles = hdf5_get_npoints_of_dataset_by_name (
f->step_gid, dataset_name));
h5_debug ("Found %lld particles in dataset %s.",
(long long)nparticles, dataset_name);
H5_CORE_API_RETURN (nparticles);
}
@@ -91,7 +94,12 @@ h5u_get_totalnum_particles_by_idx (
H5_DATANAME_LEN));
if (h5err == H5_NOK)
H5_CORE_API_LEAVE (H5_NOK);
H5_CORE_API_RETURN (h5u_get_totalnum_particles_by_name (fh, dataset_name));
h5_ssize_t nparticles;
TRY (nparticles = hdf5_get_npoints_of_dataset_by_name (
f->step_gid, dataset_name));
h5_debug ("Found %lld particles in dataset %s.",
(long long)nparticles, dataset_name);
H5_CORE_API_RETURN (nparticles);
}
h5_err_t
@@ -280,7 +288,8 @@ h5u_set_view (
H5_CORE_API_LEAVE (
h5_error(
H5_ERR_INVAL,
"Start of selection '%lld' out of range: must be >= 0",
"Start of selection '%lld' out of range: "
"must be >= 0",
(long long)start)
);
}
@@ -288,7 +297,8 @@ h5u_set_view (
H5_CORE_API_LEAVE (
h5_error(
H5_ERR_INVAL,
"End of selection '%lld' out of range: must be >= %lld",
"End of selection '%lld' out of range: "
"must be >= %lld",
(long long)end,
(long long)start)
);
@@ -315,13 +325,15 @@ h5u_set_view (
H5_CORE_API_LEAVE (
h5_error(
H5_ERR_INVAL,
"Start of selection '%lld' out of range: must be in [0..%lld]",
"Start of selection '%lld' out of range: "
"must be in [0..%lld]",
(long long)start, (long long)total-1));
} else if (end < 0 || end >= total) {
H5_CORE_API_LEAVE (
h5_error(
H5_ERR_INVAL,
"End of selection '%lld' out of range: must be in [0..%lld]",
"End of selection '%lld' out of range: "
"must be in [0..%lld]",
(long long)end, (long long)total-1));
} else if (end+1 < start) {
H5_CORE_API_LEAVE (
@@ -400,7 +412,8 @@ h5u_set_view_length (
h5_error(
H5_ERR_INVAL,
"Invalid view: start=%lld, length=%lld, total=%lld",
(long long)start, (long long)length, (long long)total));
(long long)start, (long long)length,
(long long)total));
/* setting up the new view */
u->viewstart = start;
@@ -530,7 +543,7 @@ h5u_get_view (
H5_CORE_API_RETURN (viewend - viewstart + 1); // view range is *inclusive*
}
h5_int64_t
h5_err_t
h5u_set_canonical_view (
const h5_file_t fh
) {
@@ -562,7 +575,8 @@ h5u_set_canonical_view (
#endif // PARALLEL_IO
h5_int64_t length = u->nparticles;
H5_CORE_API_RETURN (h5u_set_view_length (fh, start, length));
TRY (h5u_set_view_length (fh, start, length));
H5_CORE_API_RETURN (H5_SUCCESS);
}
h5_ssize_t
@@ -570,41 +584,9 @@ h5u_get_num_datasets (
const h5_file_t fh /*!< [in] Handle to open file */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_int64_t, "f=%p", f);
H5_CORE_API_RETURN (hdf5_get_num_datasets (f->step_gid));
}
/*!
Get information about dataset in current index given by its index
*/
h5_err_t
h5u_get_dataset_info (
const h5_file_t fh, /*!< [in] Handle to open file */
const h5_id_t idx, /*!< [in] Index of the dataset */
char *dataset_name, /*!< [out] Name of dataset */
const h5_size_t len_dataset_name,
/*!< [in] Size of buffer \c dataset_name */
h5_int64_t *type, /*!< [out] Type of data in dataset */
h5_size_t *nelem /*!< [out] Number of elements. */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, "
"idx=%lld, "
"dataset_name='%s', len_dataset_name=%llu, "
"type=%p, nelem=%p",
f,
(long long)idx,
dataset_name,
(long long unsigned)len_dataset_name,
type, nelem);
TRY (hdf5_get_name_of_dataset_by_idx (
f->step_gid,
idx,
dataset_name, len_dataset_name) );
H5_CORE_API_RETURN (
h5u_get_dataset_info_by_name(fh, dataset_name, type, nelem));
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
TRY (ret_value = hdf5_get_num_datasets (f->step_gid));
H5_CORE_API_RETURN (ret_value);
}
h5_err_t
@@ -616,44 +598,138 @@ h5u_has_dataset (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, name='%s'",
f, name);
h5_err_t exists;
TRY (exists = hdf5_link_exists (f->step_gid, name));
H5_CORE_API_RETURN (exists);
TRY (ret_value = hdf5_link_exists (f->step_gid, name));
H5_CORE_API_RETURN (ret_value);
}
static inline h5_err_t
get_dataset_info (
hid_t dataset_id,
h5_int64_t* dataset_type,
h5_size_t* dataset_nelem
) {
H5_INLINE_FUNC_ENTER (h5_err_t);
if (dataset_type) {
h5_int64_t type_;
TRY (type_ = h5priv_get_native_dataset_type (dataset_id));
TRY (*dataset_type = h5priv_map_hdf5_type_to_enum (type_));
}
if (dataset_nelem) {
h5_ssize_t nelem_;
TRY (nelem_ = hdf5_get_npoints_of_dataset (dataset_id));
*dataset_nelem = nelem_;
}
H5_INLINE_FUNC_RETURN (H5_SUCCESS);
}
h5_err_t
h5priv_get_dataset_info_by_idx (
const hid_t id, /*!< [in] group ID */
const h5_id_t dataset_idx, /*!< [in] Index of the dataset */
char* dataset_name, /*!< [out] Name of dataset */
const h5_size_t len_dataset_name,/*!<[in] Size of buffer */
h5_int64_t* dataset_type, /*!< [out] Type of data in dataset */
h5_size_t* dataset_nelem /*!< [out] Number of elements. */
) {
H5_PRIV_API_ENTER (h5_err_t,
"id=%lld, "
"dataset_idx=%lld, "
"dataset_name='%s', len_dataset_name=%llu, "
"dataset_type=%p, dataset_nelem=%p",
(long long)id,
(long long)dataset_idx,
dataset_name,
(long long unsigned)len_dataset_name,
dataset_type, dataset_nelem);
char dataset_name_[H5_DATANAME_LEN];
TRY (hdf5_get_name_of_dataset_by_idx (
id,
dataset_idx,
dataset_name_, sizeof(dataset_name_)));
hid_t dataset_id;
TRY (dataset_id = hdf5_open_dataset_by_name (id, dataset_name_));
if (dataset_name) {
strncpy (dataset_name, dataset_name_, len_dataset_name);
}
TRY (get_dataset_info (dataset_id, dataset_type, dataset_nelem));
H5_PRIV_API_RETURN (H5_SUCCESS);
}
/*!
Get information about dataset in current index given by its index
*/
h5_err_t
h5u_get_dataset_info_by_idx (
const h5_file_t fh, /*!< [in] Handle to open file */
const h5_id_t idx, /*!< [in] Index of the dataset */
char *dataset_name, /*!< [out] Name of dataset */
const h5_size_t len_dataset_name,/*!< [in] Size of buffer */
h5_int64_t *dataset_type, /*!< [out] Type of data in dataset */
h5_size_t *dataset_nelem /*!< [out] Number of elements. */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, "
"idx=%lld, "
"dataset_name='%s', len_dataset_name=%llu, "
"dataset_type=%p, dataset_nelem=%p",
f,
(long long)idx,
dataset_name,
(long long unsigned)len_dataset_name,
dataset_type, dataset_nelem);
CHECK_FILEHANDLE (f);
TRY (h5priv_get_dataset_info_by_idx (
f->step_gid,
idx,
dataset_name, len_dataset_name,
dataset_type, dataset_nelem));
H5_CORE_API_RETURN (H5_SUCCESS);
}
h5_err_t
h5priv_get_dataset_info_by_name (
const hid_t id, /*!< [in] group ID */
const char* const dataset_name, /*!< [out] Name of dataset */
h5_int64_t* dataset_type, /*!< [out] Type of data in dataset */
h5_size_t* dataset_nelem /*!< [out] Number of elements. */
) {
H5_PRIV_API_ENTER (h5_err_t,
"id=%lld, "
"dataset_name='%s' "
"dataset_type=%p, dataset_nelem=%p",
(long long)id,
dataset_name,
dataset_type, dataset_nelem);
hid_t dataset_id;
TRY (dataset_id = hdf5_open_dataset_by_name (id, dataset_name));
TRY (get_dataset_info (dataset_id, dataset_type, dataset_nelem));
H5_PRIV_API_RETURN (H5_SUCCESS);
}
/*!
Get information about dataset in current index given by its index
*/
h5_err_t
h5u_get_dataset_info_by_name (
const h5_file_t fh, /*!< [in] Handle to open file */
const h5_file_t fh, /*!< [in] Handle to open file */
const char* const dataset_name, /*!< [in] Name of dataset */
h5_int64_t* const type, /*!< [out] Type of data in dataset */
h5_size_t* const nelem /*!< [out] Number of elements. */
h5_int64_t* const dataset_type, /*!< [out] Type of data in dataset */
h5_size_t* const dataset_nelem /*!< [out] Number of elements. */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, "
"dataset_name='%s', "
"type=%p, nelem=%p",
"dataset_type=%p, dataset_nelem=%p",
f,
dataset_name,
type, nelem);
if (nelem) {
h5_ssize_t nelem_;
TRY (nelem_ = hdf5_get_npoints_of_dataset_by_name (
f->step_gid,
dataset_name) );
if ( nelem_ < 0 ) H5_CORE_API_LEAVE (nelem_);
*nelem = nelem_;
}
if (type) {
*type = h5priv_get_dataset_type (f->step_gid, dataset_name);
if (*type < 0) H5_CORE_API_LEAVE (*type);
}
dataset_type, dataset_nelem);
CHECK_FILEHANDLE (f);
TRY (h5priv_get_dataset_info_by_name (
f->step_gid,
dataset_name,
dataset_type, dataset_nelem));
H5_CORE_API_RETURN (H5_SUCCESS);
}
@@ -663,14 +739,15 @@ h5u_set_chunk (
const h5_size_t size
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_int64_t, "f=%p, size=%llu", f, (long long unsigned)size);
if ( size == 0 )
{
H5_CORE_API_ENTER (
h5_int64_t,
"f=%p, size=%llu",
f, (long long unsigned)size);
if (size == 0) {
h5_info ("Disabling chunking" );
TRY (hdf5_set_layout_property (
f->u->dcreate_prop, H5D_CONTIGUOUS));
} else
{
} else {
h5_info ("Setting chunk size to %lld particles", (long long)size);
TRY (hdf5_set_chunk_property(
f->u->dcreate_prop, 1, (hsize_t*)&size));
@@ -690,7 +767,7 @@ h5u_get_chunk (
hid_t plist_id;
hsize_t hsize;
TRY (dataset_id = hdf5_open_dataset (f->step_gid, name) );
TRY (dataset_id = hdf5_open_dataset_by_name (f->step_gid, name) );
TRY (plist_id = hdf5_get_dataset_create_plist (dataset_id) );
TRY (hdf5_get_chunk_property (plist_id, 1, &hsize) );
TRY (hdf5_close_property ( plist_id) );
+152 -36
View File
@@ -14,24 +14,116 @@
#include "private/h5_model.h"
#include "private/h5_hdf5.h"
h5_err_t
static inline hid_t
h5priv_get_native_attribute_type (
hid_t attr_id
) {
H5_PRIV_FUNC_ENTER (
hid_t,
"attr_id=%lld (%s)",
(long long int)attr_id, hdf5_get_objname (attr_id));
TRY (ret_value = hdf5_get_attribute_type (attr_id));
TRY (ret_value = h5priv_get_native_type (ret_value));
H5_PRIV_FUNC_RETURN (ret_value);
}
static inline h5_err_t
h5priv_read_attrib (
const hid_t id,
const char* attrib_name,
const hid_t attrib_type,
void* const attrib_value
);
const hid_t id, /*!< HDF5 object ID */
const char* attrib_name, /*!< name of HDF5 attribute to read */
const hid_t attrib_type, /*!< HDF5 type of attribute */
void* const attrib_value /*!< OUT: attribute value */
) {
H5_PRIV_API_ENTER (h5_err_t,
"id=%lld, attrib_name='%s', attrib_type=%lld, "
"attrib_value=%p",
(long long int)id,
attrib_name,
(long long int)attrib_type,
attrib_value);
hid_t attrib_id;
hid_t mem_type;
hid_t space_id;
TRY (attrib_id = hdf5_open_attribute_by_name (id, attrib_name));
TRY (mem_type = h5priv_get_native_attribute_type (attrib_id));
if (mem_type != attrib_type)
H5_PRIV_API_LEAVE (
h5_error (
H5_ERR_HDF5,
"Attribute '%s' has type '%s' but "
"was requested as '%s'.",
attrib_name,
hdf5_get_type_name (mem_type),
hdf5_get_type_name (attrib_type)));
h5_err_t
TRY (space_id = hdf5_get_attribute_dataspace (attrib_id));
TRY (hdf5_read_attribute (attrib_id, mem_type, attrib_value));
TRY (hdf5_close_dataspace(space_id));
TRY (hdf5_close_attribute (attrib_id));
H5_PRIV_API_RETURN (H5_SUCCESS);
}
static inline h5_err_t
h5priv_write_attrib (
const hid_t id,
const char* attrib_name,
const hid_t attrib_type,
const void* attrib_value,
const hsize_t attrib_nelem,
const int overwrite
);
const hid_t id, /*!< HDF5 object ID */
const char* attrib_name, /*!< name of HDF5 attribute to write */
const hid_t attrib_type, /*!< HDF5 type of attribute */
const void* attrib_value, /*!< value of attribute */
const hsize_t attrib_nelem, /*!< number of elements (dimension) */
const int overwrite
) {
H5_PRIV_API_ENTER (h5_err_t,
"id=%lld, attrib_name='%s', attrib_type=%lld, "
"attrib_value=%p, attrib_nelem=%llu, overwrite=%d",
(long long int)id,
attrib_name,
(long long int)attrib_type,
attrib_value,
attrib_nelem,
overwrite);
hid_t space_id;
hid_t attrib_id;
hid_t type_id;
if ( attrib_type == H5T_NATIVE_CHAR ) {
TRY (type_id = hdf5_create_string_type (attrib_nelem));
TRY (space_id = hdf5_create_dataspace_scalar ());
} else {
type_id = attrib_type;
TRY (space_id = hdf5_create_dataspace (1, &attrib_nelem, NULL));
}
h5_err_t exists;
TRY (exists = hdf5_attribute_exists (id, attrib_name));
if (exists) {
if (overwrite) {
TRY (hdf5_delete_attribute (id, attrib_name));
} else {
H5_PRIV_API_LEAVE (
h5_error (H5_ERR_H5,
"Cannot overwrite attribute %s/%s",
hdf5_get_objname (id), attrib_name));
}
}
TRY (attrib_id = hdf5_create_attribute (
id,
attrib_name,
type_id,
space_id,
H5P_DEFAULT, H5P_DEFAULT));
TRY (hdf5_write_attribute (attrib_id, type_id, attrib_value));
TRY (hdf5_close_attribute (attrib_id));
TRY (hdf5_close_dataspace (space_id));
H5_PRIV_API_RETURN (H5_SUCCESS);
}
/*
This is a helper function for
- h5priv_get_attrib_info_by_name()
- h5priv_get_attrib_info_by_idx()
*/
static inline h5_err_t
get_attrib_info (
hid_t attrib_id,
@@ -39,26 +131,23 @@ get_attrib_info (
h5_size_t* attrib_nelem /*!< OUT: number of elements */
) {
H5_INLINE_FUNC_ENTER (h5_err_t);
hid_t mytype;
TRY (mytype = hdf5_get_attribute_type (attrib_id));
H5T_class_t type_class;
TRY (type_class = hdf5_get_class_type (mytype));
hid_t datatype_id;
TRY (datatype_id = h5priv_get_native_attribute_type (attrib_id));
if (attrib_nelem) {
if (type_class == H5T_STRING) {
*attrib_nelem = H5Tget_size(mytype);
if (datatype_id == H5_STRING) {
*attrib_nelem = H5Tget_size (datatype_id);
} else {
hid_t space_id;
TRY (space_id = hdf5_get_attribute_dataspace (attrib_id));
TRY (*attrib_nelem = hdf5_get_npoints_of_dataspace (space_id));
TRY (*attrib_nelem = hdf5_get_npoints_of_dataspace (
space_id));
TRY (hdf5_close_dataspace (space_id));
}
}
if (attrib_type) {
TRY (*attrib_type = h5priv_normalize_h5_type (mytype));
TRY (*attrib_type = h5priv_map_hdf5_type_to_enum (datatype_id));
}
TRY (hdf5_close_type (mytype));
TRY (hdf5_close_attribute (attrib_id));
H5_INLINE_FUNC_RETURN (H5_SUCCESS);
}
@@ -76,20 +165,47 @@ h5priv_get_attrib_info_by_name (
"attrib_type=%p, attrib_nelem=%p",
(long long int)id,
attrib_name,
attrib_type,
attrib_nelem);
attrib_type, attrib_nelem);
hid_t attrib_id;
TRY (attrib_id = hdf5_open_attribute (id, attrib_name));
H5_PRIV_API_RETURN (get_attrib_info (attrib_id, attrib_type, attrib_nelem));
TRY (attrib_id = hdf5_open_attribute_by_name (id, attrib_name));
H5_PRIV_API_RETURN (
get_attrib_info (
attrib_id, attrib_type, attrib_nelem));
}
h5_err_t
static inline h5_err_t
h5priv_get_attrib_info_by_idx (
const hid_t id,
const h5_size_t attrib_idx,
char* attrib_name,
const h5_size_t len_attrib_name,
h5_int64_t* attrib_type,
h5_size_t* attrib_nelem
);
const hid_t id, /*!< HDF5 object ID */
const h5_size_t attrib_idx, /*!< index of attribute */
char* attrib_name, /*!< OUT: name of attribute */
const h5_size_t len_attrib_name,/*!< buffer length */
h5_int64_t* attrib_type, /*!< OUT: H5 type of attribute */
h5_size_t* attrib_nelem /*!< OUT: number of elements */
) {
H5_PRIV_API_ENTER (h5_err_t,
"id=%lld, "
"attrib_idx=%llu, "
"attrib_name=%p, len_attrib_name=%llu, "
"attrib_type=%p, attrib_nelem=%p",
(long long int)id,
(long long unsigned)attrib_idx,
attrib_name,
(long long unsigned)len_attrib_name,
attrib_type, attrib_nelem);
hid_t attrib_id;
TRY (attrib_id = hdf5_open_attribute_by_idx (
id,
(unsigned int)attrib_idx));
if (attrib_name) {
TRY (hdf5_get_attribute_name (
attrib_id,
(size_t)len_attrib_name,
attrib_name));
}
H5_PRIV_API_RETURN (
get_attrib_info (
attrib_id, attrib_type, attrib_nelem));
}
#endif
+16
View File
@@ -0,0 +1,16 @@
/*
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 __PRIVATE_H5_CONST_H
#define __PRIVATE_H5_CONST_H
#endif
+5
View File
@@ -10,9 +10,14 @@
#ifndef __PRIVATE_H5_DEBUG_H
#define __PRIVATE_H5_DEBUG_H
#include "h5core/h5_types.h"
#include "h5core/h5_debug.h"
#include "private/h5_init.h"
#define H5_CORE_API_ENTER(type, fmt, ...) \
if (!h5_initialized) { \
h5_initialize(); \
} \
__FUNC_ENTER(type, H5_DEBUG_CORE_API, fmt, __VA_ARGS__)
#define H5_CORE_API_LEAVE(value) __FUNC_LEAVE(value)
#define H5_CORE_API_RETURN(value) __FUNC_RETURN(value, H5_DEBUG_CORE_API)
@@ -1,7 +1,7 @@
#ifndef __PRIVATE_H5_ERRORHANDLING_H
#define __PRIVATE_H5_ERRORHANDLING_H
#ifndef __PRIVATE_H5_ERROR_H
#define __PRIVATE_H5_ERROR_H
#include "h5core/h5_errorhandling.h"
#include "h5core/h5_err.h"
extern const char* const H5_O_MODES[];
@@ -1,11 +1,21 @@
#ifndef __PRIVATE_H5_H
#define __PRIVATE_H5_H
#ifndef __PRIVATE_H5_FILE_H
#define __PRIVATE_H5_FILE_H
#include "private/h5_types.h"
#include "private/h5_debug.h"
#include "private/h5_errorhandling.h"
#include "private/h5_err.h"
#include "h5core/h5_file.h"
#define UNUSED_ARGUMENT(x) (void)x
#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
static inline h5_err_t
check_filehandle (
+78 -106
View File
@@ -13,7 +13,7 @@
#include <hdf5.h>
#include "h5core/h5_types.h"
#include "h5core/h5_errorhandling.h"
#include "h5core/h5_err.h"
#include "private/h5_debug.h"
#include "private/h5_va_macros.h"
@@ -177,16 +177,12 @@ h5priv_link_exists_ (
const char const* path[],
size_t size
);
#define h5priv_link_exists(loc_id, ...) \
(h5priv_link_exists_ (loc_id, (const char const*[]){__VA_ARGS__}, PP_NARG(__VA_ARGS__)))
#define h5priv_link_exists(loc_id, ...) \
(h5priv_link_exists_ (loc_id, \
(const char const*[]){__VA_ARGS__}, \
PP_NARG(__VA_ARGS__)))
/*!
Close group.
\param[in] f file handle
\param[in] group_id id of group to close
*/
static inline h5_err_t
hdf5_close_group (
const hid_t group_id
@@ -228,10 +224,6 @@ hdf5_get_num_objs_in_group (
}
/*
Get name of object given by index \c idx in group \c loc_id. If name is \c NULL,
return size of name.
*/
static inline h5_ssize_t
hdf5_get_objname_by_idx (
hid_t loc_id,
@@ -265,12 +257,7 @@ hdf5_get_objname_by_idx (
/****** D a t a s p a c e ****************************************************/
/*!
Create dataspace for dataset. H5Screate_simple wrapper.
\param[in] rank rank of dataspace
\param[in] dims dimensions of dataspace
\param[in] maxdims maximum dimensions of dataspace
H5Screate_simple wrapper.
*/
static inline hid_t
hdf5_create_dataspace (
@@ -426,10 +413,7 @@ hdf5_get_dims_of_dataspace (
/*!
Close space.
\param[in] f file handle
\param[in] dataspace_id id of space to close
H5Sclose() wrapper
*/
static inline h5_err_t
hdf5_close_dataspace (
@@ -451,14 +435,10 @@ hdf5_close_dataspace (
/****** D a t a s e t ********************************************************/
/*!
Open dataset. H5Dopen wrapper.
\param[in] f file handle
\param[in] loc_id location id
\param[in] dataset_name name of dataset to open
H5Dopen wrapper.
*/
static inline hid_t
hdf5_open_dataset (
hdf5_open_dataset_by_name (
const hid_t loc_id,
const char* const dataset_name
) {
@@ -482,15 +462,7 @@ hdf5_open_dataset (
}
/*!
Create new dataset
\param[in] f file handle
\param[in] loc_id id of group or file
\param[in] dataset_name name of dataset
\param[in] type_id type used in dataset
\param[in] dataspace_id dataspace of dataset
\param[in] create_prop property list for dataset creation
H5Dcreate() wrapper.
*/
static inline hid_t
hdf5_create_dataset (
@@ -528,10 +500,7 @@ hdf5_create_dataset (
}
/*!
Close dataset.
\param[in] f file handle
\param[in] dataset_id id of dataset to close
H5Dclose() wrapper.
*/
static inline h5_err_t
hdf5_close_dataset (
@@ -555,11 +524,7 @@ hdf5_close_dataset (
}
/*!
Get dataspace of existing dataset
\param[in] f file handle
\param[in] dataset_id id of dataset
H5Dget_space() wrapper.
*/
static inline hid_t
hdf5_get_dataset_space (
@@ -580,16 +545,7 @@ hdf5_get_dataset_space (
}
/*!
Wrapper for H5Dwrite.
\param[in] f file handle
\param[in] dataset_id id of dataset
\param[in] type_id type used in dataset
\param[in] memspace_id id of memory space
\param[in] diskspace_id id of disk space
\param[in] xfer_prop transfer property list
\param[in] buf buffer with date to write
H5Dwrite() wrapper
*/
static inline h5_err_t
hdf5_write_dataset (
@@ -624,7 +580,7 @@ hdf5_write_dataset (
}
/*
Wrapper for H5Dread
H5Dread() write
*/
static inline h5_err_t
hdf5_read_dataset (
@@ -722,34 +678,77 @@ hdf5_get_npoints_of_dataset_by_name (
name);
hid_t dset_id;
hsize_t size;
TRY (dset_id = hdf5_open_dataset (loc_id, name));
TRY (dset_id = hdf5_open_dataset_by_name (loc_id, name));
TRY (size = hdf5_get_npoints_of_dataset (dset_id));
TRY (hdf5_close_dataset (dset_id));
HDF5_WRAPPER_RETURN (size);
}
/****** D a t a t y p e ******************************************************/
/*!
Create array type. Wrapper for "H5Tarray_create".
\param[in] f file handle
\param[in] base_type_id base type
\param[in] rank rank of array
\param[in] dims dimensions
/*!
Map HDF5 type to native HDF5 type.
*/
static inline h5_int64_t
hdf5_get_native_type (
hid_t type
) {
HDF5_WRAPPER_ENTER (h5_int64_t,
"type=%lld",
(long long int)type);
H5T_class_t tclass;
int size;
TRY (tclass = H5Tget_class (type));
TRY (size = H5Tget_size (type));
switch (tclass){
case H5T_INTEGER:
if (size==8) {
HDF5_WRAPPER_LEAVE (H5T_NATIVE_INT64);
} else if (size==4) {
HDF5_WRAPPER_LEAVE (H5T_NATIVE_INT32);
} else if (size==2) {
HDF5_WRAPPER_LEAVE (H5T_NATIVE_INT16);
}
break;
case H5T_FLOAT:
if (size==8) {
HDF5_WRAPPER_LEAVE (H5T_NATIVE_FLOAT);
}
else if (size==4) {
HDF5_WRAPPER_LEAVE (H5T_NATIVE_DOUBLE);
}
break;
case H5T_STRING:
HDF5_WRAPPER_LEAVE (H5T_NATIVE_CHAR);
default:
; /* NOP */
}
HDF5_WRAPPER_RETURN (
h5_error (
H5_ERR_INVAL,
"Unknown data type %lld",
(long long int)type));
}
/*!
H5Tarray_create() write
*/
static inline char_p
hdf5_get_type_name (
hid_t type_id
) {
if (type_id == H5_INT32_T)
if (type_id == H5_INT32)
return "H5_INT32_T";
if (type_id == H5_INT64_T)
if (type_id == H5_INT64)
return "H5_INT64_T";
if (type_id == H5_FLOAT32_T)
if (type_id == H5_FLOAT32)
return "H5_FLOAT32_T";
if (type_id == H5_FLOAT64_T)
if (type_id == H5_FLOAT64)
return "H5_FLOAT64_T";
if (type_id == H5_STRING_T)
if (type_id == H5_STRING)
return "H5_STRING_T";
h5_warn ("Unknown type id %lld", (long long int)type_id);
@@ -933,11 +932,7 @@ hdf5_create_property (
}
/*!
Get create properties of existing dataset
\param[in] f file handle
\param[in] dataset_id id of dataset
H5Dget_create_plist() wrapper.
*/
static inline hid_t
hdf5_get_dataset_create_plist (
@@ -1131,7 +1126,8 @@ hdf5_set_alignment_property (
HDF5_WRAPPER_LEAVE (
h5_error (
H5_ERR_HDF5,
"Cannot set alignment property to %llu and threshold %llu",
"Cannot set alignment property to %llu "
"and threshold %llu",
alignment, threshold));
HDF5_WRAPPER_RETURN (H5_SUCCESS);
}
@@ -1261,7 +1257,8 @@ hdf5_attribute_exists (
) {
HDF5_WRAPPER_ENTER (hid_t,
"loc_id=%lld (%s), attr_name='%s'",
(long long int)loc_id, hdf5_get_objname (loc_id), attrib_name);
(long long int)loc_id,
hdf5_get_objname (loc_id), attrib_name);
htri_t exists = H5Aexists (loc_id, attrib_name);
if (exists < 0)
HDF5_WRAPPER_LEAVE (
@@ -1274,13 +1271,14 @@ hdf5_attribute_exists (
}
static inline hid_t
hdf5_open_attribute (
hdf5_open_attribute_by_name (
hid_t loc_id,
const char* attrib_name
) {
HDF5_WRAPPER_ENTER (hid_t,
"loc_id=%lld (%s), attr_name='%s'",
(long long int)loc_id, hdf5_get_objname (loc_id), attrib_name);
(long long int)loc_id,
hdf5_get_objname (loc_id), attrib_name);
hid_t attrib_id = H5Aopen (loc_id, attrib_name, H5P_DEFAULT);
if (attrib_id < 0)
HDF5_WRAPPER_LEAVE (
@@ -1293,7 +1291,7 @@ hdf5_open_attribute (
}
static inline hid_t
hdf5_open_attribute_idx (
hdf5_open_attribute_by_idx (
hid_t loc_id,
unsigned int idx
) {
@@ -1311,32 +1309,6 @@ hdf5_open_attribute_idx (
HDF5_WRAPPER_RETURN (attr_id);
}
static inline hid_t
hdf5_open_attribute_by_name (
hid_t loc_id,
const char* obj_name,
const char* attr_name
) {
HDF5_WRAPPER_ENTER (hid_t,
"loc_id=%lld (%s), obj_name='%s', attr_name='%s'",
(long long int)loc_id, hdf5_get_objname (loc_id),
obj_name, attr_name);
hid_t attr_id = H5Aopen_by_name (
loc_id,
obj_name,
attr_name,
H5P_DEFAULT,
H5P_DEFAULT);
if (attr_id < 0)
HDF5_WRAPPER_LEAVE (
h5_error (
H5_ERR_HDF5,
"Cannot open attribute '%s' of '%s'.",
attr_name,
obj_name));
HDF5_WRAPPER_RETURN (attr_id);
}
static inline hid_t
hdf5_create_attribute (
hid_t loc_id,
+18
View File
@@ -13,10 +13,28 @@
#include "h5core/h5_types.h"
#include "private/h5t_types.h"
#define UNUSED_ARGUMENT(x) (void)x
// 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);
extern h5_dta_types_t h5_dta_types;
extern int h5_myproc;
+10 -8
View File
@@ -7,10 +7,8 @@
License: see file COPYING in top level of source distribution.
*/
#include "h5core/h5_init.h"
#include "private/h5_types.h"
#include "private/h5_errorhandling.h"
#include "private/h5_err.h"
#include "private/h5_hdf5.h"
#include "private/h5_model.h"
#include "private/h5_io.h"
@@ -34,7 +32,8 @@ h5priv_write_dataset_by_name (
const void* const data
) {
H5_PRIV_API_ENTER (h5_err_t,
"m=%p, f=%p, loc_id=%lld (%s), dsinfo=%p, set_memspace=%p, "
"m=%p, f=%p, loc_id=%lld (%s), dsinfo=%p, "
"set_memspace=%p, "
"set_diskspace=%p, data=%p",
m, f, (long long int)loc_id, hdf5_get_objname(loc_id),
dsinfo,
@@ -61,7 +60,7 @@ h5priv_write_dataset_by_name (
if (exists) {
/* overwrite dataset */
TRY (dset_id = hdf5_open_dataset (loc_id, dsinfo->name));
TRY (dset_id = hdf5_open_dataset_by_name (loc_id, dsinfo->name));
TRY (dataspace_id = hdf5_get_dataset_space (dset_id));
TRY (hdf5_set_dataset_extent (dset_id, dsinfo->dims));
/* exten dataset? */
@@ -104,7 +103,8 @@ h5priv_write_dataset_by_name (
- Check existance dataset
- Write data
is needed if dset, mspace, dspace can't be set by the callback functions above
is needed if dset, mspace, dspace can't be set by the callback
functions above
*/
h5_err_t
h5priv_write_dataset_by_name_id (
@@ -117,12 +117,14 @@ h5priv_write_dataset_by_name_id (
const void* const data
) {
H5_PRIV_API_ENTER (h5_err_t,
"f=%p, loc_id=%lld (%s), dsinfo=%p, dset_id=%lld, memspace_id=%lld, "
"f=%p, loc_id=%lld (%s), dsinfo=%p, dset_id=%lld, "
"memspace_id=%lld, "
"diskspace_id=%lld, data=%p",
f, (long long int)loc_id, hdf5_get_objname(loc_id),
dsinfo,
(long long int)dset_id,
(long long int)memspace_id, (long long int)diskspace_id, data);
(long long int)memspace_id,
(long long int)diskspace_id, data);
h5_info ("Writing dataset %s/%s.",
hdf5_get_objname (loc_id), dsinfo->name);
-6
View File
@@ -56,12 +56,6 @@ h5priv_read_dataset (
hid_t (*)(h5t_mesh_t* const, const hid_t),
void* const);
h5_int64_t
h5priv_get_dataset_type(
const hid_t group_id,
const char *dataset_name
);
h5_err_t
h5priv_normalize_dataset_name (
const char *name,
-2
View File
@@ -7,8 +7,6 @@
License: see file COPYING in top level of source distribution.
*/
#include "h5core/h5_init.h"
#ifdef H5_USE_LUSTRE
#include <stdio.h>
+1 -3
View File
@@ -7,9 +7,7 @@
License: see file COPYING in top level of source distribution.
*/
#include "h5core/h5_init.h"
#include "private/h5_errorhandling.h"
#include "private/h5_err.h"
#include "private/h5_maps.h"
/*
+1 -7
View File
@@ -12,16 +12,10 @@
#include "private/h5_types.h"
#include "h5core/h5_debug.h"
#include "h5core/h5_errorhandling.h"
#include "h5core/h5_err.h"
#include "h5core/h5_syscall.h"
#include "private/h5_debug.h"
typedef struct {
size_t size;
size_t num_items;
char* items[1];
} h5_strlist_t;
// Allocate new list
#define h5priv_alloc_xlist( type ) \
static inline h5_err_t \
+108 -8
View File
@@ -26,8 +26,10 @@
#include "h5core/h5_types.h"
#include "h5core/h5_model.h"
#include "private/h5.h"
#include "private/h5_const.h"
#include "private/h5_file.h"
#include "private/h5_mpi.h"
#include "private/h5_hdf5.h"
#ifdef PARALLEL_IO
static inline h5_err_t
@@ -60,8 +62,10 @@ h5priv_start_throttle (
// wait to receive token before continuing with read
TRY( h5priv_mpi_recv(
&token, 1, MPI_INT,
f->myproc - f->props->throttle, // receive from previous proc
f->myproc, // use this proc id as message tag
// receive from previous proc
f->myproc - f->props->throttle,
// use this proc id as message tag
f->myproc,
f->props->comm
) );
}
@@ -84,8 +88,10 @@ h5priv_end_throttle (
(long long int)(f->myproc + f->props->throttle));
TRY (h5priv_mpi_send(
&token, 1, MPI_INT,
f->myproc + f->props->throttle, // send to next proc
f->myproc + f->props->throttle, // use the id of the target as tag
// send to next proc
f->myproc + f->props->throttle,
// use the id of the target as tag
f->myproc + f->props->throttle,
f->props->comm
));
}
@@ -113,9 +119,103 @@ h5priv_close_step (
const h5_file_p f
);
h5_int64_t
h5priv_normalize_h5_type (
static inline h5_int64_t
h5priv_map_hdf5_type_to_enum (
hid_t hdf5_type_id
) {
if (hdf5_type_id == H5_STRING) {
return H5_STRING_T;
} else if (hdf5_type_id == H5_INT16) {
return H5_INT16_T;
} else if (hdf5_type_id == H5_UINT16) {
return H5_UINT16_T;
} else if (hdf5_type_id == H5_INT32) {
return H5_INT32_T;
} else if (hdf5_type_id == H5_UINT32) {
return H5_UINT32_T;
} else if (hdf5_type_id == H5_INT64) {
return H5_INT64_T;
} else if (hdf5_type_id == H5_UINT64) {
return H5_UINT64_T;
} else if (hdf5_type_id == H5_FLOAT32) {
return H5_FLOAT32_T;
} else if (hdf5_type_id == H5_FLOAT64) {
return H5_FLOAT64_T;
} else if (hdf5_type_id == H5_ID) {
return H5_ID_T;
} else if (hdf5_type_id == H5_COMPOUND) {
return H5_COMPOUND_T;
}
return H5_FAILURE;
}
static inline hid_t
h5priv_get_native_type (
hid_t type
);
) {
H5_PRIV_API_ENTER (h5_int64_t,
"type=%lld",
(long long int)type);
H5T_class_t tclass;
TRY (tclass = H5Tget_class (type));
int tsize;
TRY (tsize = H5Tget_size (type));
H5T_sign_t tsign;
TRY (tsign = H5Tget_sign (type));
switch (tclass){
case H5T_INTEGER:
if (tsize==8) {
if (tsign == H5T_SGN_2) {
ret_value = H5T_NATIVE_INT64;
} else {
ret_value = H5T_NATIVE_UINT64;
}
} else if (tsize==4) {
if (tsign == H5T_SGN_2) {
ret_value = H5T_NATIVE_INT32;
} else {
ret_value = H5T_NATIVE_UINT32;
}
} else if (tsize==2) {
if (tsign == H5T_SGN_2) {
ret_value = H5T_NATIVE_INT16;
} else {
ret_value = H5T_NATIVE_UINT16;
}
}
break;
case H5T_FLOAT:
if (tsize==8) {
ret_value = H5T_NATIVE_DOUBLE;
}
else if (tsize==4) {
ret_value = H5T_NATIVE_FLOAT;
}
break;
case H5T_STRING:
ret_value = H5T_C_S1;
break;
default:
break;
}
if (ret_value < 0)
H5_PRIV_API_LEAVE (
h5_error (
H5_ERR_INVAL,
"Unknown type %d", (int)type));
H5_CORE_API_RETURN (ret_value);
}
static inline hid_t
h5priv_get_native_dataset_type (
hid_t dataset
) {
H5_PRIV_API_ENTER (hid_t,
"dataset=%lld",
(long long)dataset);
TRY (ret_value = hdf5_get_dataset_type (dataset));
TRY (ret_value = h5priv_get_native_type (ret_value));
H5_PRIV_API_RETURN (ret_value);
}
#endif
+1 -1
View File
@@ -13,7 +13,7 @@
#ifdef PARALLEL_IO
#include "h5core/h5_types.h"
#include "h5core/h5_errorhandling.h"
#include "h5core/h5_err.h"
#include "private/h5_debug.h"
static inline h5_err_t
+7
View File
@@ -75,4 +75,11 @@ struct h5_idxmap {
h5_size_t num_items; /* stored items */
h5_idxmap_el_t* items;
};
typedef struct {
size_t size;
size_t num_items;
char* items[1];
} h5_strlist_t;
#endif
+2 -2
View File
@@ -7,10 +7,10 @@
License: see file COPYING in top level of source distribution.
*/
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5_syscall.h"
#include "private/h5.h"
#include "private/h5_file.h"
#include "private/h5_types.h"
#include "private/h5_init.h"
#include "private/h5t_types.h"
+2 -2
View File
@@ -7,10 +7,10 @@
License: see file COPYING in top level of source distribution.
*/
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5_syscall.h"
#include "private/h5.h"
#include "private/h5_file.h"
#include "private/h5_init.h"
#include "private/h5t_types.h"
#include "private/h5t_model.h"
+1 -1
View File
@@ -6,7 +6,7 @@
#include "private/h5t_map.h"
#include "private/h5t_core.h"
#include "private/h5t_access.h"
#include "private/h5t_errorhandling.h"
#include "private/h5t_err.h"
h5_err_t
h5tpriv_grow_te_htab (
+1 -2
View File
@@ -33,13 +33,12 @@
#include "private/h5t_retrieve.h"
#include "private/h5t_store.h"
#include "private/h5t_errorhandling.h"
#include "private/h5t_err.h"
#include "private/h5t_octree.h"
#include <assert.h>
typedef struct h5t_te_entry_key {
h5_loc_idx_t vids[2];
} h5t_te_entry_key_t;
@@ -7,11 +7,11 @@
License: see file COPYING in top level of source distribution.
*/
#ifndef __PRIVATE_H5T_ERRORHANDLING_H
#define __PRIVATE_H5T_ERRORHANDLING_H
#ifndef __PRIVATE_H5T_ERR_H
#define __PRIVATE_H5T_ERR_H
#include "h5core/h5_types.h"
#include "h5core/h5_errorhandling.h"
#include "h5core/h5_err.h"
#include "private/h5_debug.h"
#define ERR_ELEM_NEXIST "Element with local vertex IDs (%s) doesn't exist!"
+2 -1
View File
@@ -12,9 +12,10 @@
#include "private/h5_types.h"
#include "h5core/h5_debug.h"
#include "h5core/h5_errorhandling.h"
#include "h5core/h5_err.h"
#include "h5core/h5_syscall.h"
#include "private/h5_debug.h"
#include "private/h5_maps.h"
#include "private/h5t_model.h"
/*
+1 -1
View File
@@ -20,7 +20,7 @@
#include "private/h5t_retrieve.h"
#include "private/h5t_store.h"
#include "private/h5.h"
#include "private/h5_file.h"
#include "private/h5_init.h"
#include "private/h5t_core.h"
+1 -1
View File
@@ -8,7 +8,7 @@
*/
#include "private/h5t_types.h"
#include "private/h5.h"
#include "private/h5_file.h"
#include "private/h5_hdf5.h"
#include "private/h5_mpi.h"
#include "private/h5_va_macros.h"
-4
View File
@@ -31,10 +31,6 @@ typedef struct h5t_ref_elem h5t_ref_elem_t;
extern const h5t_ref_elem_t h5t_tet_ref_elem;
extern const h5t_ref_elem_t h5t_tri_ref_elem;
#ifdef __cplusplus
}
#endif
#define h5tpriv_ref_elem_get_num_vertices(this) (this->ref_elem->num_faces[0])
#define h5tpriv_ref_elem_get_num_edges(this) (this->ref_elem->num_faces[1])
+1 -1
View File
@@ -8,7 +8,7 @@
*/
#include "private/h5t_types.h"
#include "private/h5t_errorhandling.h"
#include "private/h5t_err.h"
#include "private/h5t_core.h"
#include "private/h5t_map.h"
#include "private/h5t_model.h"
+1 -1
View File
@@ -8,7 +8,7 @@
*/
#include "private/h5t_types.h"
#include "private/h5t_errorhandling.h"
#include "private/h5t_err.h"
#include "private/h5t_core.h"
#include "private/h5t_map.h"
#include "private/h5t_model.h"
+1 -1
View File
@@ -8,7 +8,7 @@
*/
#include "private/h5t_types.h"
#include "private/h5t_errorhandling.h"
#include "private/h5t_err.h"
#include "private/h5t_access.h"
#include "private/h5t_adjacencies.h"
#include "private/h5t_core.h"
+1 -1
View File
@@ -8,7 +8,7 @@
*/
#include "private/h5t_types.h"
#include "private/h5t_errorhandling.h"
#include "private/h5t_err.h"
#include "private/h5t_access.h"
#include "private/h5t_adjacencies.h"
#include "private/h5t_core.h"
+1 -1
View File
@@ -13,7 +13,7 @@
#include "h5core/h5_types.h"
#include "private/h5_types.h"
#include "private/h5_hsearch.h"
#include "private/h5_maps.h"
//#include "private/h5_maps.h"
#include "private/h5t_ref_elements.h"
@@ -1,5 +1,5 @@
#ifndef __PRIVATE_H5U_ERRORHANDLING_H
#define __PRIVATE_H5U_ERRORHANDLING_H
#ifndef __PRIVATE_H5U_ERR_H
#define __PRIVATE_H5U_ERR_H
#define HANDLE_H5_SET_VIEW_ERR( f, rc, start, end ) \
h5_error( \
+5 -6
View File
@@ -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));
}
-1
View File
@@ -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"
-1
View File
@@ -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"
-1
View File
@@ -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"
-1
View File
@@ -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"
-1
View File
@@ -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"
-1
View File
@@ -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"
-1
View File
@@ -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"
-1
View File
@@ -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"
+2 -3
View File
@@ -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));
}
/**
-1
View File
@@ -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"
-1
View File
@@ -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"
/**
-1
View File
@@ -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"
+5 -6
View File
@@ -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));
}
///< @}
-1
View File
@@ -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"
+5 -6
View File
@@ -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));
}
///< @}
+1 -1
View File
@@ -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
View File
@@ -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"
+1 -2
View File
@@ -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 \
+7 -10
View File
@@ -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>
+20
View File
@@ -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" {
-40
View File
@@ -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
+25 -46
View File
@@ -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
+1 -1
View File
@@ -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);
+11 -7
View File
@@ -471,6 +471,7 @@ void h5u_test_read2(void)
RETURN(status, H5_SUCCESS, "H5CloseFile");
}
#if H5_VERSION_LE(1,8,12)
void h5u_test_read3(void)
{
h5_file_t file1;
@@ -478,7 +479,11 @@ void h5u_test_read3(void)
h5_int64_t status;
TEST("Opening file once, read-only, MPI-POSIX VFD");
file1 = H5OpenFile(FILENAME, H5_O_RDONLY | H5_VFD_MPIO_POSIX, H5_PROP_DEFAULT);
h5_prop_t props = H5CreateFileProp ();
status = H5SetPropFileMPIOPosix (props, &comm);
RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOPosix");
file1 = H5OpenFile(FILENAME, H5_O_RDONLY, prop);
status = H5CheckFile(file1);
RETURN(status, H5_SUCCESS, "H5CheckFile");
@@ -492,6 +497,7 @@ void h5u_test_read3(void)
status = H5CloseFile(file1);
RETURN(status, H5_SUCCESS, "H5CloseFile");
}
#endif
void h5u_test_read4(void)
{
@@ -503,16 +509,14 @@ void h5u_test_read4(void)
TEST("Opening file twice, read-only, MPI-IO Independent VFD");
h5_prop_t props = H5CreateFileProp ();
status = H5SetPropFileMPIOCollective (props, &comm);
RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOCollective");
status = H5SetPropFileThrottle (props, 2);
RETURN(status, H5_SUCCESS, "H5SetPropFileThrottle");
status = H5SetPropFileMPIOIndependent (props, &comm);
RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOIndependent");
file1 = H5OpenFile(FILENAME, H5_O_RDONLY | H5_VFD_MPIO_INDEPENDENT, props);
file1 = H5OpenFile(FILENAME, H5_O_RDONLY, props);
status = H5CheckFile(file1);
RETURN(status, H5_SUCCESS, "H5CheckFile");
file2 = H5OpenFile(FILENAME, H5_O_RDONLY | H5_VFD_MPIO_INDEPENDENT, props);
file2 = H5OpenFile(FILENAME, H5_O_RDONLY, props);
status = H5CheckFile(file2);
RETURN(status, H5_SUCCESS, "H5CheckFile");
+4
View File
@@ -7,7 +7,9 @@
/* from write.c */
void h5u_test_write1(void);
void h5u_test_write2(void);
#if H5_VERSION_LE(1,8,12)
void h5u_test_write3(void);
#endif
void h5u_test_write4(void);
/* from read.c */
@@ -38,8 +40,10 @@ int main(int argc, char **argv)
AddTest("read1", h5u_test_read1, NULL, "Read 32-bit data", NULL);
AddTest("write2", h5u_test_write2, NULL, "Write 32-bit strided data", NULL);
AddTest("read2", h5u_test_read2, NULL, "Read 32-bit strided data", NULL);
#if H5_VERSION_LE(1,8,12)
AddTest("write3", h5u_test_write3, NULL, "Write 64-bit strided data", NULL);
AddTest("read3", h5u_test_read3, NULL, "Read 64-bit strided data", NULL);
#endif
AddTest("write4", h5u_test_write4, NULL, "Write 64-bit data", NULL);
AddTest("read4", h5u_test_read4, NULL, "Read 64-bit data", NULL);
+9 -15
View File
@@ -360,8 +360,6 @@ void h5u_test_write1(void)
h5_prop_t props = H5CreateFileProp ();
status = H5SetPropFileMPIOCollective (props, &comm);
RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOCollective");
status = H5SetPropFileThrottle (props, 2);
RETURN(status, H5_SUCCESS, "H5SetPropFileThrottle");
file1 = H5OpenFile(FILENAME, H5_O_WRONLY, props);
status = H5CheckFile(file1);
@@ -388,8 +386,6 @@ void h5u_test_write2(void)
h5_prop_t props = H5CreateFileProp ();
status = H5SetPropFileMPIOCollective (props, &comm);
RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOCollective");
status = H5SetPropFileThrottle (props, 2);
RETURN(status, H5_SUCCESS, "H5SetPropFileThrottle");
file1 = H5OpenFile(FILENAME, H5_O_APPENDONLY, props);
status = H5CheckFile(file1);
@@ -411,6 +407,7 @@ void h5u_test_write2(void)
RETURN(status, H5_SUCCESS, "H5CloseFile");
}
#if H5_VERSION_LE(1,8,12)
void h5u_test_write3(void)
{
h5_file_t file1;
@@ -420,12 +417,10 @@ void h5u_test_write3(void)
TEST("Opening file once, write-truncate, MPI-POSIX VFD");
h5_prop_t props = H5CreateFileProp ();
status = H5SetPropFileMPIOCollective (props, &comm);
RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOCollective");
status = H5SetPropFileThrottle (props, 2);
RETURN(status, H5_SUCCESS, "H5SetPropFileThrottle");
status = H5SetPropFileMPIOPosix (props, &comm);
RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOPosix");
file1 = H5OpenFile(FILENAME, H5_O_WRONLY | H5_VFD_MPIO_POSIX, props);
file1 = H5OpenFile(FILENAME, H5_O_WRONLY, props);
status = H5CheckFile(file1);
RETURN(status, H5_SUCCESS, "H5CheckFile");
@@ -443,6 +438,7 @@ void h5u_test_write3(void)
status = H5CloseFile(file1);
RETURN(status, H5_SUCCESS, "H5CloseFile");
}
#endif
void h5u_test_write4(void)
{
@@ -455,16 +451,14 @@ void h5u_test_write4(void)
TEST("Opening file twice, write-append + read-only, MPI-IO Independent VFD");
props = H5CreateFileProp ();
status = H5SetPropFileMPIOCollective (props, &comm);
RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOCollective");
status = H5SetPropFileThrottle (props, 2);
RETURN(status, H5_SUCCESS, "H5SetPropFileThrottle");
status = H5SetPropFileMPIOIndependent (props, &comm);
RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOIndependent");
file1 = H5OpenFile(FILENAME, H5_O_APPENDONLY | H5_VFD_MPIO_INDEPENDENT, props);
file1 = H5OpenFile(FILENAME, H5_O_APPENDONLY, props);
status = H5CheckFile(file1);
RETURN(status, H5_SUCCESS, "H5CheckFile");
file2 = H5OpenFile(FILENAME, H5_O_RDONLY | H5_VFD_MPIO_INDEPENDENT, props);
file2 = H5OpenFile(FILENAME, H5_O_RDONLY, props);
status = H5CheckFile(file2);
RETURN(status, H5_SUCCESS, "H5CheckFile");