tag implementation, bugfixes ...

This commit is contained in:
2009-11-13 21:46:15 +00:00
parent c4961753a9
commit 22a1fa33eb
37 changed files with 1299 additions and 1023 deletions
+42 -35
View File
@@ -544,13 +544,13 @@ _release_hyperslab (
) {
struct h5b_fdata *b = f->b;
TRY( _h5_close_dataspace( f, b->shape ) );
TRY( _hdf_close_dataspace( f, b->shape ) );
f->b->shape = -1;
TRY( _h5_close_dataspace( f, b->diskshape ) );
TRY( _hdf_close_dataspace( f, b->diskshape ) );
f->b->diskshape = -1;
TRY( _h5_close_dataspace( f, f->b->memshape ) );
TRY( _hdf_close_dataspace( f, f->b->memshape ) );
f->b->memshape = -1;
return H5_SUCCESS;
@@ -773,7 +773,7 @@ _open_block_group (
struct h5b_fdata *b = f->b;
if ( (f->step_idx != b->step_idx) && (b->blockgroup > 0) ) {
TRY( _h5_close_group( f, b->blockgroup ) );
TRY( _hdf_close_group( f, b->blockgroup ) );
f->b->blockgroup = -1;
}
@@ -850,7 +850,7 @@ _close_field_group (
h5_file_t *f /*!< IN: file handle */
) {
return _h5_close_group ( f, f->b->field_group_id );
return _hdf_close_group ( f, f->b->field_group_id );
}
/*!
@@ -888,10 +888,11 @@ _select_hyperslab_for_reading (
p->i_end - p->i_start + 1 };
TRY( _release_hyperslab ( f ) );
TRY ( b->diskshape = _h5_get_dataset_space ( f, dataset ) );
TRY ( rank = _h5_get_dims_of_space ( f, b->diskshape, NULL, NULL ) );
TRY ( b->diskshape = _hdf_get_dataset_space ( f, dataset ) );
TRY ( rank = _hdf_get_dims_of_dataspace ( f, b->diskshape, NULL, NULL ) );
if ( rank != 3 ) return HANDLE_H5_DATASET_RANK_ERR ( f, rank, 3 );
TRY ( rank = _h5_get_dims_of_space ( f, b->diskshape, field_dims, NULL ) );
TRY ( rank = _hdf_get_dims_of_dataspace (
f, b->diskshape, field_dims, NULL ) );
if ( (field_dims[0] < (hsize_t)b->k_max) ||
(field_dims[1] < (hsize_t)b->j_max) ||
@@ -906,9 +907,11 @@ _select_hyperslab_for_reading (
(long long)field_dims[1],
(long long)field_dims[0] );
TRY ( b->diskshape = _h5_create_space ( f, rank, field_dims,field_dims ) );
TRY ( b->memshape = _h5_create_space ( f, rank, part_dims, part_dims ) );
TRY ( _h5_select_hyperslab_of_space (
TRY ( b->diskshape = _hdf_create_dataspace (
f, rank, field_dims,field_dims ) );
TRY ( b->memshape = _hdf_create_dataspace (
f, rank, part_dims, part_dims ) );
TRY ( _hdf_select_hyperslab_of_dataspace (
f,
b->diskshape,
H5S_SELECT_SET,
@@ -954,7 +957,7 @@ _read_data (
struct h5b_fdata *b = f->b;
hid_t dataset_id;
TRY(
dataset_id = _h5_open_dataset (
dataset_id = _hdf_open_dataset (
f,
b->field_group_id, name
)
@@ -962,7 +965,7 @@ _read_data (
TRY(
_select_hyperslab_for_reading ( f, dataset_id ) );
TRY(
_h5_read_dataset(
_hdf_read_dataset(
f,
dataset_id,
type,
@@ -972,7 +975,7 @@ _read_data (
data )
);
TRY(
_h5_close_dataset( f, dataset_id )
_hdf_close_dataset( f, dataset_id )
);
return H5_SUCCESS;
@@ -991,7 +994,7 @@ h5b_read_scalar_field (
TRY ( _open_field_group ( f, field_name ) );
TRY ( _read_data ( f, dataset_name, data, type ) );
TRY ( _h5_close_group ( f, f->b->field_group_id ) );
TRY ( _hdf_close_group ( f, f->b->field_group_id ) );
return H5_SUCCESS;
}
@@ -1085,7 +1088,7 @@ h5b_3d_read_3d_vectorfield (
TRY ( _read_data ( f, "0", x_data, type ) );
TRY ( _read_data ( f, "1", y_data, type ) );
TRY ( _read_data ( f, "2", z_data, type ) );
TRY ( _h5_close_group ( f, f->b->field_group_id ) );
TRY ( _hdf_close_group ( f, f->b->field_group_id ) );
return H5_SUCCESS;
}
@@ -1170,8 +1173,10 @@ _select_hyperslab_for_writing (
};
TRY ( b->shape = _h5_create_space ( f, rank, field_dims, field_dims ) );
TRY ( b->diskshape = _h5_create_space ( f, rank, field_dims,field_dims ) );
TRY ( b->shape = _hdf_create_dataspace (
f, rank, field_dims, field_dims ) );
TRY ( b->diskshape = _hdf_create_dataspace (
f, rank, field_dims,field_dims ) );
h5_debug (
f,
@@ -1190,7 +1195,7 @@ _select_hyperslab_for_writing (
(long long)part_dims[1],
(long long)part_dims[0] );
TRY ( _h5_select_hyperslab_of_space (
TRY ( _hdf_select_hyperslab_of_dataspace (
f,
b->diskshape,
H5S_SELECT_SET,
@@ -1203,7 +1208,8 @@ _select_hyperslab_for_writing (
field_dims[1] = q->j_end - q->j_start + 1;
field_dims[2] = q->i_end - q->i_start + 1;
TRY ( b->memshape = _h5_create_space ( f, rank, field_dims, field_dims ) );
TRY ( b->memshape = _hdf_create_dataspace (
f, rank, field_dims, field_dims ) );
start[0] = p->k_start - q->k_start;
start[1] = p->j_start - q->j_start;
@@ -1226,7 +1232,7 @@ _select_hyperslab_for_writing (
(long long)part_dims[1],
(long long)part_dims[0] );
TRY ( _h5_select_hyperslab_of_space (
TRY ( _hdf_select_hyperslab_of_dataspace (
f,
b->memshape,
H5S_SELECT_SET,
@@ -1316,7 +1322,7 @@ H5Block3dWriteScalarField (
f,
"0",
data ) );
TRY ( _h5_close_group ( f, f->b->field_group_id ) );
TRY ( _hdf_close_group ( f, f->b->field_group_id ) );
return H5_SUCCESS;
}
@@ -1352,7 +1358,7 @@ H5Block3dWrite3dVectorField (
TRY ( _write_field_data ( f, "0", x_data ) );
TRY ( _write_field_data ( f, "1", y_data ) );
TRY ( _write_field_data ( f, "2", z_data ) );
TRY ( _h5_close_group ( f, f->b->field_group_id ) );
TRY ( _hdf_close_group ( f, f->b->field_group_id ) );
return H5_SUCCESS;
}
@@ -1404,10 +1410,11 @@ _get_field_info (
hid_t dataspace_id;
TRY ( _open_block_group ( f ) );
TRY ( group_id = _h5_open_group( f, f->b->blockgroup, field_name ) );
TRY ( dataset_id = _h5_open_dataset ( f, group_id, "0" ) );
TRY ( dataspace_id = _h5_get_dataset_space ( f, dataset_id ) );
TRY ( *grid_rank = _h5_get_dims_of_space ( f, dataspace_id, dims, NULL ) );
TRY ( group_id = _hdf_open_group( f, f->b->blockgroup, field_name ) );
TRY ( dataset_id = _hdf_open_dataset ( f, group_id, "0" ) );
TRY ( dataspace_id = _hdf_get_dataset_space ( f, dataset_id ) );
TRY ( *grid_rank = _hdf_get_dims_of_dataspace (
f, dataspace_id, dims, NULL ) );
for ( i = 0, j = *grid_rank-1; i < *grid_rank; i++, j-- )
grid_dims[i] = (h5_int64_t)dims[j];
@@ -1416,9 +1423,9 @@ _get_field_info (
f->b->blockgroup,
field_name,
H5G_DATASET ) );
TRY( _h5_close_dataspace( f, dataspace_id ) );
TRY( _h5_close_dataset( f, dataset_id ) );
TRY( _h5_close_group( f, group_id ) );
TRY( _hdf_close_dataspace( f, dataspace_id ) );
TRY( _hdf_close_dataset( f, dataset_id ) );
TRY( _hdf_close_group( f, group_id ) );
return H5_SUCCESS;
}
@@ -1512,7 +1519,7 @@ _write_field_attrib (
attrib_type,
attrib_value,
attrib_nelem ) );
TRY ( _h5_close_group ( f, f->b->field_group_id ) );
TRY ( _hdf_close_group ( f, f->b->field_group_id ) );
return H5_SUCCESS;
}
@@ -1591,8 +1598,8 @@ H5BlockGetNumFieldAttribs (
CHECK_TIMEGROUP( f );
TRY ( _open_field_group ( f, field_name ) );
TRY ( nattribs = _h5_get_num_attributes ( f, f->b->field_group_id ) );
TRY ( _h5_close_group ( f, f->b->field_group_id ) );
TRY ( nattribs = _hdf_get_num_attributes ( f, f->b->field_group_id ) );
TRY ( _hdf_close_group ( f, f->b->field_group_id ) );
return nattribs;
}
@@ -1630,7 +1637,7 @@ H5BlockGetFieldAttribInfo (
len_of_attrib_name,
attrib_type,
attrib_nelem ) );
TRY ( _h5_close_group ( f, f->b->field_group_id ) );
TRY ( _hdf_close_group ( f, f->b->field_group_id ) );
return H5_SUCCESS;
}
@@ -1660,7 +1667,7 @@ _read_field_attrib (
b->field_group_id,
attrib_name,
attrib_value ) );
TRY ( _h5_close_group ( f, f->b->field_group_id ) );
TRY ( _hdf_close_group ( f, f->b->field_group_id ) );
return H5_SUCCESS;
}
+1
View File
@@ -26,6 +26,7 @@
#include "H5Fed_map.h"
#include "H5Fed_retrieve.h"
#include "H5Fed_store.h"
#include "H5Fed_tags.h"
/****** General routines *****************************************************/
+8 -1
View File
@@ -75,7 +75,7 @@ H5FedBeginRefineElements (
h5_id_t
H5FedRefineElement (
h5_file_t * const f,
const h5_id_t local_eid
const h5_id_t eid
);
h5_err_t
@@ -83,4 +83,11 @@ H5FedEndRefineElements (
h5_file_t * const f
);
h5_err_t
H5FedMarkRefineElement (
h5_file_t * const f,
const h5_id_t eid
);
#endif
+6 -6
View File
@@ -49,6 +49,7 @@ include_HEADERS = \
H5Fed_boundaries.h \
H5Fed_map.h \
H5Fed_store.h \
H5Fed_tags.h \
H5Part.h
# Listing of all possible headers that I may include
@@ -66,6 +67,7 @@ libH5_a_SOURCES = \
H5Fed_map.c \
H5Fed_retrieve.c \
H5Fed_store.c \
H5Fed_tags.c \
H5Part.c
SUBDIRS = h5_core bindings
@@ -82,10 +84,8 @@ H5Block.o: H5Block.c H5Part.h H5Block.h
clean: clean-recursive
$(RM) -f *~ *.o *.a *.so
distclean:
$(RM) -f *.a
distclean: clean
$(RM) -f Underscore.h
# $(RM) -rf .deps
# $(RM) -rf .libs
# $(RM) -f Makefile
$(RM) -rf .deps
$(RM) -rf .libs
$(RM) -f Makefile
+3
View File
@@ -62,6 +62,8 @@ EXTRA_HEADERS = \
h5t_retrieve_private.h \
h5t_storemesh.h \
h5t_storemesh_private.h \
h5t_tags.h \
h5t_tags_private.h \
h5u_errorhandling_private.h \
h5u_readwrite.h \
hdf5_misc.h
@@ -106,6 +108,7 @@ libH5_core_a_SOURCES = \
h5t_readwrite.c \
h5t_retrieve.c \
h5t_storemesh.c \
h5t_tags.c \
h5u_readwrite.c \
hdf5_misc.c
+23 -22
View File
@@ -38,15 +38,15 @@ h5_read_attrib (
hid_t mytype;
hsize_t nelem;
TRY ( attrib_id = _h5_open_attribute ( f, id, attrib_name ) );
TRY ( mytype = _h5_get_attribute_type ( f, attrib_id ) );
TRY ( space_id = _h5_get_attribute_space ( f, attrib_id ) );
TRY ( nelem = _h5_get_npoints_of_space ( f, space_id ) );
TRY ( attrib_id = _hdf_open_attribute ( f, id, attrib_name ) );
TRY ( mytype = _hdf_get_attribute_type ( f, attrib_id ) );
TRY ( space_id = _hdf_get_attribute_dataspace ( f, attrib_id ) );
TRY ( nelem = _hdf_get_npoints_of_dataspace ( f, space_id ) );
TRY ( type_id = h5_normalize_h5_type ( f, mytype ) );
TRY ( _h5_read_attribute ( f, attrib_id, type_id, attrib_value ) );
TRY ( _h5_close_dataspace( f, space_id ) );
TRY ( _h5_close_type( f, mytype ) );
TRY ( _h5_close_attribute ( f, attrib_id ) );
TRY ( _hdf_read_attribute ( f, attrib_id, type_id, attrib_value ) );
TRY ( _hdf_close_dataspace( f, space_id ) );
TRY ( _hdf_close_type( f, mytype ) );
TRY ( _hdf_close_attribute ( f, attrib_id ) );
return H5_SUCCESS;
}
@@ -70,8 +70,8 @@ h5_write_attrib (
hid_t space_id;
hid_t attrib_id;
TRY ( space_id = _h5_create_space ( f, 1, &attrib_nelem, NULL) );
TRY ( attrib_id = _h5_create_attribute (
TRY ( space_id = _hdf_create_dataspace ( f, 1, &attrib_nelem, NULL) );
TRY ( attrib_id = _hdf_create_attribute (
f,
id,
attrib_name,
@@ -79,9 +79,9 @@ h5_write_attrib (
space_id,
H5P_DEFAULT, H5P_DEFAULT ) );
TRY ( _h5_write_attribute ( f, attrib_id, attrib_type, attrib_value ) );
TRY ( _h5_close_attribute ( f, attrib_id ) );
TRY ( _h5_close_dataspace ( f, space_id ) );
TRY ( _hdf_write_attribute ( f, attrib_id, attrib_type, attrib_value ) );
TRY ( _hdf_close_attribute ( f, attrib_id ) );
TRY ( _hdf_close_dataspace ( f, space_id ) );
return H5_SUCCESS;
}
@@ -107,29 +107,30 @@ h5_get_attrib_info (
hid_t mytype;
hid_t space_id;
TRY ( attrib_id = _h5_open_attribute_idx (
TRY ( attrib_id = _hdf_open_attribute_idx (
f,
id,
(unsigned int)attrib_idx ) );
if ( attrib_nelem ) {
TRY ( space_id = _h5_get_attribute_space ( f, attrib_id ) );
TRY ( *attrib_nelem = _h5_get_npoints_of_space ( f, space_id ) );
TRY( _h5_close_dataspace( f, space_id ) );
TRY ( space_id = _hdf_get_attribute_dataspace ( f, attrib_id ) );
TRY ( *attrib_nelem = _hdf_get_npoints_of_dataspace (
f, space_id ) );
TRY( _hdf_close_dataspace( f, space_id ) );
}
if ( attrib_name ) {
TRY ( _h5_get_attribute_name (
TRY ( _hdf_get_attribute_name (
f,
attrib_id,
(size_t)len_attrib_name,
attrib_name ) );
}
if ( attrib_type ) {
TRY ( mytype = _h5_get_attribute_type ( f, attrib_id ) );
TRY ( mytype = _hdf_get_attribute_type ( f, attrib_id ) );
TRY ( *attrib_type = h5_normalize_h5_type ( f, mytype ) );
TRY ( _h5_close_type( f, mytype ) );
TRY ( _hdf_close_type( f, mytype ) );
}
TRY ( _h5_close_attribute ( f, attrib_id ) );
TRY ( _hdf_close_attribute ( f, attrib_id ) );
return H5_SUCCESS;
}
@@ -147,5 +148,5 @@ h5_get_num_attribs (
const hid_t id
) {
CHECK_FILEHANDLE ( f );
return _h5_get_num_attributes ( f, id );
return _hdf_get_num_attributes ( f, id );
}
+2 -8
View File
@@ -9,15 +9,9 @@
#include "h5_maps.h"
#include "h5_openclose.h"
#include "h5_readwrite.h"
#include "h5t_adjacencies.h"
#include "h5t_boundaries.h"
#include "h5t_inquiry.h"
#include "h5t_map.h"
#include "h5t_openclose.h"
#include "h5t_readwrite.h"
#include "h5t_retrieve.h"
#include "h5t_storemesh.h"
#include "h5u_readwrite.h"
#include "hdf5_misc.h"
#include "h5t_core.h"
#endif
+4 -75
View File
@@ -2,9 +2,6 @@
#define __H5_CORE_PRIVATE_H
#include "h5_types_private.h"
#include "h5b_types_private.h"
#include "h5t_types_private.h"
#include "h5u_types_private.h"
#include "h5_errorhandling_private.h"
#include "h5_fcmp_private.h"
@@ -15,17 +12,12 @@
#include "h5_readwrite_private.h"
#include "h5_syscall_private.h"
#include "h5b_types_private.h"
#include "h5u_types_private.h"
#include "h5b_errorhandling_private.h"
#include "h5t_adjacencies_private.h"
#include "h5t_boundaries_private.h"
#include "h5t_consts_private.h"
#include "h5t_errorhandling_private.h"
#include "h5t_hsearch_private.h"
#include "h5t_map_private.h"
#include "h5t_readwrite_private.h"
#include "h5t_retrieve_private.h"
#include "h5t_storemesh_private.h"
#include "h5t_core_private.h"
#include "h5u_errorhandling_private.h"
#include "h5u_types_private.h"
@@ -33,64 +25,8 @@
#define H5PART_GROUPNAME_STEP "Step"
#define H5B_CONTAINER_GRPNAME "Block"
#define H5T_CONTAINER_GRPNAME "Topo"
#define H5BLOCK_GROUPNAME_BLOCK H5B_CONTAINER_GRPNAME
/*
ID's: 64bit
Vertices:
000100vv tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt
3V TT TT TT TT TT TT
Edges:
00100eee tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt
2E TT TT TT TT TT TT
Trinagles:
001100dd tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt
1D TT TT TT TT TT TT
Tets:
01000000 tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt
00 TT TT TT TT TT TT
*/
#define H5T_ELEM_MASK ( (h5_id_t) (ULLONG_MAX >> 8) )
#define H5T_ELEM_TYPE_MASK ( 7ull << (sizeof(h5_id_t)*8-4) )
#define H5T_FACE_MASK (15ull << (sizeof(h5_id_t)*7) )
#define H5T_ELEM_TYPE_VERTEX ((h5_id_t)1 << (sizeof(h5_id_t)*8-4))
#define H5T_ELEM_TYPE_EDGE ((h5_id_t)2 << (sizeof(h5_id_t)*8-4))
#define H5T_ELEM_TYPE_TRIANGLE ((h5_id_t)3 << (sizeof(h5_id_t)*8-4))
#define H5T_ELEM_TYPE_TET ((h5_id_t)4 << (sizeof(h5_id_t)*8-4))
#define _h5t_build_vertex_id( face_id, elem_id ) \
( H5T_ELEM_TYPE_VERTEX | \
((h5_id_t)(face_id) << (sizeof(h5_id_t)*7)) | \
((elem_id) & H5T_ELEM_MASK))
#define _h5t_build_edge_id( face_id, elem_id ) \
( H5T_ELEM_TYPE_EDGE | \
((h5_id_t)(face_id) << (sizeof(h5_id_t)*7)) | \
((elem_id) & H5T_ELEM_MASK))
#define _h5t_build_triangle_id( face_id, elem_id ) \
( H5T_ELEM_TYPE_TRIANGLE | \
((h5_id_t)(face_id) << (sizeof(h5_id_t)*7)) | \
((elem_id) & H5T_ELEM_MASK))
#define _h5t_get_entity_type( entity_id ) \
( entity_id & H5T_ELEM_TYPE_MASK )
#define _h5t_get_face_id( entity_id ) \
( (entity_id & H5T_FACE_MASK) >> (sizeof(h5_id_t)*7) )
#define _h5t_get_elem_id( entity_id ) \
( entity_id & H5T_ELEM_MASK )
#define TRY( func ) \
if ( (int64_t)(ptrdiff_t)(func) <= (int64_t)H5_ERR ) \
@@ -105,13 +41,6 @@
Don't use them in applications!
*/
h5_int64_t
h5_set_step (
h5_file_t *f,
const h5_int64_t step
);
h5_int64_t
h5_get_num_particles (
h5_file_t *f
+1 -2
View File
@@ -156,8 +156,7 @@ h5_abort_errorhandler (
) {
if ( _h5_debuglevel > 0 ) {
fprintf ( stderr, "%s: ", f->__funcname );
vfprintf ( stderr, fmt, ap );
h5_verror ( f, fmt, ap );
}
exit (-(int)f->__errno);
}
-6
View File
@@ -15,12 +15,6 @@
"%s: Internal error: %s line %d!", \
file, func, lino )
#define HANDLE_H5_NOENT_ERR( f, name ) \
h5_error( \
f, \
H5_ERR_NOENT, \
"Object \"%s\" doesn't exists.", name );
#define HANDLE_H5_DATASET_RANK_ERR( f, m, n ) \
h5_error( \
f, \
+214 -83
View File
@@ -4,6 +4,41 @@
#include "h5_core/h5_core_private.h"
/****** G r o u p ************************************************************/
hid_t
_hdf_open_group (
h5_file_t * f,
const hid_t loc_id,
const char * const group_name
) {
hid_t group_id = H5Gopen ( loc_id, group_name, H5P_DEFAULT );
if ( group_id < 0 )
return h5_error (
f,
H5_ERR_HDF5,
"Cannot open group \"%s/%s\".",
h5_get_objname ( loc_id ),
group_name );
return group_id;
}
hid_t
_hdf_create_group (
h5_file_t * f,
const hid_t loc_id,
const char * const group_name
) {
hid_t group_id = H5Gcreate ( loc_id, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
if ( group_id < 0 )
return h5_error (
f,
H5_ERR_HDF5,
"Cannot create group \"%s/%s\".",
h5_get_objname ( loc_id ),
group_name );
return group_id;
}
/*!
Open HDF5 group. If group doesn't exist create it.
@@ -65,22 +100,64 @@ _h5_open_group (
\param[in] group_id id of group to close
*/
h5_err_t
_h5_close_group (
_hdf_close_group (
h5_file_t * const f,
const hid_t group_id
) {
if ( group_id <= 0 ) return H5_SUCCESS;
const char *group_name = h5_get_objname( group_id );
if ( H5Gclose ( group_id ) < 0 ) {
return h5_error (
f,
H5_ERR_HDF5,
"Cannot terminate access to group \"%s\".",
group_name );
h5_get_objname( group_id ) );
}
return H5_SUCCESS;
}
hsize_t
_hdf_get_num_objs_in_group (
h5_file_t * const f,
const hid_t group_id
) {
H5G_info_t group_info;
if ( H5Gget_info( group_id, &group_info ) < 0 ) {
return h5_error (
f,
H5_ERR_HDF5,
"Cannot get number of objects in group %s.",
h5_get_objname( group_id ) );
}
return group_info.nlinks;
}
h5_err_t
_hdf_get_objname_by_idx_in_group (
h5_file_t * const f,
hid_t loc_id,
hsize_t idx,
char **name ) {
size_t size;
size = H5Gget_objname_by_idx ( loc_id, idx, NULL, 0 ) + 1;
if ( size < 0 ) goto error;
*name = _h5_calloc ( f, 1, size );
if ( *name == NULL ) goto error;
size = H5Gget_objname_by_idx ( loc_id, idx, *name, size );
if ( size < 0 ) goto error;
return H5_SUCCESS;
error:
return h5_error (
f,
H5_ERR_HDF5,
"Cannot get name of object %ld in group %s.",
(long)idx,
h5_get_objname( loc_id ) );
}
/****** D a t a s e t ********************************************************/
/*!
@@ -91,7 +168,7 @@ _h5_close_group (
\param[in] dataset_name name of dataset to open
*/
hid_t
_h5_open_dataset (
_hdf_open_dataset (
h5_file_t * const f,
const hid_t loc_id,
const char * const dataset_name
@@ -111,28 +188,6 @@ _h5_open_dataset (
return dataset_id;
}
/*!
Get dataspace of existing dataset
\param[in] f file handle
\param[in] dataset_id id of dataset
*/
hid_t
_h5_get_dataset_space (
h5_file_t * const f,
const hid_t dataset_id
) {
hid_t dataspace_id = H5Dget_space ( dataset_id );
if ( dataspace_id < 0 )
return h5_error (
f,
H5_ERR_HDF5,
"Cannot get dataspace for dataset \"%s\".",
h5_get_objname ( dataset_id ) );
return dataspace_id;
}
/*!
Create new dataset
@@ -145,7 +200,7 @@ _h5_get_dataset_space (
*/
hid_t
_h5_create_dataset (
_hdf_create_dataset (
h5_file_t * const f,
hid_t loc_id,
const char * dataset_name,
@@ -165,13 +220,60 @@ _h5_create_dataset (
return h5_error(
f,
H5_ERR_HDF5,
"Cannot create dataset name \"%s\"",
"Cannot create dataset %s/%s",
h5_get_objname ( loc_id ),
dataset_name );
return dataset_id;
}
/*!
Write dataset.
Close dataset.
\param[in] f file handle
\param[in] dataset_id id of dataset to close
*/
herr_t
_hdf_close_dataset (
h5_file_t * const f,
const hid_t dset_id
) {
if ( dset_id == 0 || dset_id == -1 ) return H5_SUCCESS;
const char *dset_name = h5_get_objname( dset_id );
if ( H5Dclose ( dset_id ) < 0 ) {
return h5_error(
f,
H5_ERR_HDF5,
"Close of dataset \"%s\" failed.", dset_name );
}
return H5_SUCCESS;
}
/*!
Get dataspace of existing dataset
\param[in] f file handle
\param[in] dataset_id id of dataset
*/
hid_t
_hdf_get_dataset_space (
h5_file_t * const f,
const hid_t dataset_id
) {
hid_t dataspace_id = H5Dget_space ( dataset_id );
if ( dataspace_id < 0 )
return h5_error (
f,
H5_ERR_HDF5,
"Cannot get dataspace for dataset \"%s\".",
h5_get_objname ( dataset_id ) );
return dataspace_id;
}
/*!
Wrapper for H5Dwrite.
\param[in] f file handle
\param[in] dataset_id id of dataset
@@ -183,7 +285,7 @@ _h5_create_dataset (
*/
herr_t
_h5_write_dataset (
_hdf_write_dataset (
h5_file_t * const f,
const hid_t dataset_id,
const hid_t type_id,
@@ -209,8 +311,11 @@ _h5_write_dataset (
return H5_SUCCESS;
}
/*
Wrapper for H5Dread
*/
h5_err_t
_h5_read_dataset (
_hdf_read_dataset (
h5_file_t * const f,
const hid_t dataset_id,
const hid_t type_id,
@@ -230,50 +335,74 @@ _h5_read_dataset (
return h5_error(
f,
H5_ERR_HDF5,
"Read from dataset \"%s\".", \
"Error reading dataset \"%s\".", \
h5_get_objname ( dataset_id ) );
return H5_SUCCESS;
}
hid_t
_h5_get_dataset_type (
_hdf_get_dataset_type (
h5_file_t * const f,
const hid_t dataset_id
) {
hid_t datatype_id = H5Dget_type ( dataset_id );
if ( datatype_id < 0 )
h5_error(
return h5_error(
f,
H5_ERR_HDF5,
"Cannot determine dataset type.");
return H5_SUCCESS;
return datatype_id;
}
/*!
Close dataset.
\param[in] f file handle
\param[in] dataset_id id of dataset to close
*/
herr_t
_h5_close_dataset (
_hdf_set_dataset_extent (
h5_file_t * const f,
const hid_t dataset_id
hid_t dset_id,
const hsize_t *size
) {
if ( dataset_id == 0 || dataset_id == -1 ) return H5_SUCCESS;
const char *dataset_name = h5_get_objname( dataset_id );
const char *dset_name = h5_get_objname( dset_id );
if ( H5Dclose ( dataset_id ) < 0 ) {
if ( H5Dset_extent( dset_id, size ) < 0 ) {
return h5_error(
f,
H5_ERR_HDF5,
"Close of dataset \"%s\" failed.", dataset_name );
"Changing size of dataset \"%s\" dimensions failed.",
dset_name );
}
return H5_SUCCESS;
}
hssize_t
_hdf_get_npoints_of_dataset (
h5_file_t * const f,
hid_t dset_id
) {
hid_t dspace_id;
hsize_t size;
TRY ( dspace_id = _hdf_get_dataset_space ( f, dset_id ) );
TRY ( size = _hdf_get_npoints_of_dataspace ( f, dspace_id ) );
TRY ( _hdf_close_dataspace( f, dspace_id ) );
return size;
}
hssize_t
_hdf_get_npoints_of_dataset_by_name (
h5_file_t * const f,
hid_t loc_id,
char * name
) {
hid_t dset_id;
hsize_t size;
TRY ( dset_id = _hdf_open_dataset ( f, loc_id, name ) );
TRY ( size = _hdf_get_npoints_of_dataset ( f, dset_id ) );
TRY ( _hdf_close_dataset ( f, dset_id ) );
return size;
}
/****** D a t a s p a c e ****************************************************/
/*!
Create dataspace for dataset. H5Screate_simple wrapper.
@@ -285,7 +414,7 @@ _h5_close_dataset (
*/
hid_t
_h5_create_space (
_hdf_create_dataspace (
h5_file_t * const f,
const int rank,
const hsize_t * dims,
@@ -302,7 +431,7 @@ _h5_create_space (
}
herr_t
_h5_select_hyperslab_of_space (
_hdf_select_hyperslab_of_dataspace (
h5_file_t * const f,
hid_t space_id,
H5S_seloper_t op,
@@ -328,7 +457,7 @@ _h5_select_hyperslab_of_space (
}
hssize_t
_h5_get_selected_npoints_of_space (
_hdf_get_selected_npoints_of_dataspace (
h5_file_t * const f,
hid_t space_id
) {
@@ -342,7 +471,7 @@ _h5_get_selected_npoints_of_space (
}
hssize_t
_h5_get_npoints_of_space (
_hdf_get_npoints_of_dataspace (
h5_file_t * const f,
hid_t space_id
) {
@@ -356,7 +485,7 @@ _h5_get_npoints_of_space (
}
int
_h5_get_dims_of_space (
_hdf_get_dims_of_dataspace (
h5_file_t * const f,
hid_t space_id,
hsize_t *dims,
@@ -379,7 +508,7 @@ _h5_get_dims_of_space (
\param[in] dataspace_id id of space to close
*/
herr_t
_h5_close_dataspace (
_hdf_close_dataspace (
h5_file_t * const f,
const hid_t dataspace_id
) {
@@ -399,8 +528,8 @@ _h5_close_dataspace (
/****** D a t a t y p e ******************************************************/
const char*
_h5_get_base_type_name (
static const char*
_get_base_type_name (
h5_file_t * const f,
hid_t base_type_id
) {
@@ -412,8 +541,8 @@ _h5_get_base_type_name (
return "[unknown]";
}
const char*
_h5_get_class_type_name (
static const char*
_get_class_type_name (
h5_file_t * const f,
hid_t base_type_id
) {
@@ -431,7 +560,7 @@ _h5_get_class_type_name (
\param[in] dims dimensions
*/
hid_t
_h5_create_array_type (
_hdf_create_array_type (
h5_file_t * const f,
hid_t base_type_id,
int rank,
@@ -444,14 +573,14 @@ _h5_create_array_type (
H5_ERR_HDF5,
"Can't create array datatype object with base "
"type %s and rank %d",
_h5_get_base_type_name ( f, base_type_id ),
_get_base_type_name ( f, base_type_id ),
rank );
}
return type_id;
}
hid_t
_h5_create_type (
_hdf_create_type (
h5_file_t * const f,
H5T_class_t class,
const size_t size
@@ -462,14 +591,14 @@ _h5_create_type (
f,
H5_ERR_HDF5,
"Can't create datatype object of class %s.",
_h5_get_class_type_name ( f, class )
_get_class_type_name ( f, class )
);
}
return type_id;
}
herr_t
_h5_insert_type (
_hdf_insert_type (
h5_file_t * const f,
hid_t dtype_id,
const char * name,
@@ -487,7 +616,7 @@ _h5_insert_type (
}
herr_t
_h5_close_type (
_hdf_close_type (
h5_file_t * const f,
hid_t dtype_id
) {
@@ -503,7 +632,7 @@ _h5_close_type (
/****** P r o p e r t y ******************************************************/
hid_t
_h5_create_property (
_hdf_create_property (
h5_file_t * const f,
hid_t cls_id
) {
@@ -517,14 +646,13 @@ _h5_create_property (
}
herr_t
_h5_set_chunk_property (
_hdf_set_chunk_property (
h5_file_t * const f,
hid_t plist,
int ndims,
const hsize_t * dim
int rank,
const hsize_t * dims
) {
herr_t herr = H5Pset_chunk ( plist, ndims, dim );
if ( herr < 0 )
if ( H5Pset_chunk ( plist, rank, dims ) < 0 )
return h5_error (
f,
H5_ERR_HDF5,
@@ -535,7 +663,7 @@ _h5_set_chunk_property (
#ifdef PARALLEL_IO
h5_err_t
_h5_set_fapl_mpio_property (
_hdf_set_fapl_mpio_property (
h5_file_t * const f,
hid_t fapl_id,
MPI_Comm comm,
@@ -553,7 +681,7 @@ _h5_set_fapl_mpio_property (
#endif
h5_err_t
_h5_close_property (
_hdf_close_property (
h5_file_t * const f,
hid_t prop
) {
@@ -569,7 +697,7 @@ _h5_close_property (
/****** F i l e **************************************************************/
herr_t
_h5_close_file (
_hdf_close_file (
h5_file_t * const f,
hid_t fileid
) {
@@ -585,7 +713,7 @@ _h5_close_file (
/****** E r r o r h a n d l i n g ********************************************/
herr_t
_h5_set_errorhandler (
_hdf_set_errorhandler (
h5_file_t * const f,
hid_t estack_id,
H5E_auto_t func,
@@ -602,7 +730,7 @@ _h5_set_errorhandler (
/****** A t t r i b u t e ****************************************************/
hid_t
_h5_open_attribute (
_hdf_open_attribute (
h5_file_t * const f,
hid_t loc_id,
const char *attr_name
@@ -619,7 +747,7 @@ _h5_open_attribute (
}
hid_t
_h5_open_attribute_idx (
_hdf_open_attribute_idx (
h5_file_t * const f,
hid_t loc_id,
unsigned int idx
@@ -636,7 +764,7 @@ _h5_open_attribute_idx (
}
hid_t
_h5_open_attribute_by_name (
_hdf_open_attribute_by_name (
h5_file_t * const f,
hid_t loc_id,
const char *obj_name,
@@ -659,7 +787,7 @@ _h5_open_attribute_by_name (
}
hid_t
_h5_create_attribute (
_hdf_create_attribute (
h5_file_t * const f,
hid_t loc_id,
const char *attr_name,
@@ -686,7 +814,7 @@ _h5_create_attribute (
}
herr_t
_h5_read_attribute (
_hdf_read_attribute (
h5_file_t * const f,
hid_t attr_id,
hid_t mem_type_id,
@@ -703,8 +831,11 @@ _h5_read_attribute (
return H5_SUCCESS;
}
/*
Wrapper for H5Awrite.
*/
herr_t
_h5_write_attribute (
_hdf_write_attribute (
h5_file_t * const f,
hid_t attr_id,
hid_t mem_type_id,
@@ -722,7 +853,7 @@ _h5_write_attribute (
}
ssize_t
_h5_get_attribute_name (
_hdf_get_attribute_name (
h5_file_t * const f,
hid_t attr_id,
size_t buf_size,
@@ -738,7 +869,7 @@ _h5_get_attribute_name (
}
hid_t
_h5_get_attribute_type (
_hdf_get_attribute_type (
h5_file_t * const f,
hid_t attr_id
) {
@@ -753,7 +884,7 @@ _h5_get_attribute_type (
}
hid_t
_h5_get_attribute_space (
_hdf_get_attribute_dataspace (
h5_file_t * const f,
hid_t attr_id
) {
@@ -768,7 +899,7 @@ _h5_get_attribute_space (
}
int
_h5_get_num_attributes (
_hdf_get_num_attributes (
h5_file_t * const f,
hid_t loc_id
) {
@@ -784,7 +915,7 @@ _h5_get_num_attributes (
herr_t
_h5_close_attribute (
_hdf_close_attribute (
h5_file_t * const f,
hid_t attr_id
) {
+138 -88
View File
@@ -1,86 +1,57 @@
#ifndef __H5_HDF5_H
#define __H5_HDF5_H
/*** group ***/
hid_t
_hdf_open_group (
h5_file_t *f,
const hid_t loc_id,
const char * const group_name
);
hid_t
_hdf_create_group (
h5_file_t * f,
const hid_t loc_id,
const char * const group_name
);
hid_t
_h5_open_group (
h5_file_t *f,
const hid_t parent_group_id,
const hid_t loc_id,
const char * const group_name
);
h5_err_t
_h5_close_group (
_hdf_close_group (
h5_file_t * const f,
const hid_t group_id
);
hsize_t
_hdf_get_num_objs_in_group (
h5_file_t * const f,
const hid_t group_id
);
h5_err_t
_hdf_get_objname_by_idx_in_group (
h5_file_t * const f,
hid_t loc_id,
hsize_t idx,
char **name );
/*** dataset ***/
hid_t
_h5_open_dataset (
_hdf_open_dataset (
h5_file_t * const f,
const hid_t gid,
const char * const dataset_name
);
hid_t
_h5_open_dataset (
h5_file_t * const f,
const hid_t loc_id,
const char * const dataset_name
);
hid_t
_h5_create_space (
h5_file_t * const f,
const int rank,
const hsize_t * dims,
const hsize_t * maxdims
);
hid_t
_h5_get_dataset_space (
h5_file_t * const f,
const hid_t dataset_id
);
herr_t
_h5_select_hyperslab_of_space (
h5_file_t * const f,
hid_t space_id,
H5S_seloper_t op,
const hsize_t *start,
const hsize_t *stride,
const hsize_t *count,
const hsize_t *block
);
hssize_t
_h5_get_selected_npoints_of_space (
h5_file_t * const f,
hid_t space_id
);
hssize_t
_h5_get_npoints_of_space (
h5_file_t * const f,
hid_t space_id
);
herr_t
_h5_close_dataspace (
h5_file_t * const f,
const hid_t dataspace_id
);
int
_h5_get_dims_of_space (
h5_file_t * const f,
hid_t space_id,
hsize_t *dims,
hsize_t *maxdims
);
hid_t
_h5_create_dataset (
_hdf_create_dataset (
h5_file_t * const f,
hid_t loc_id,
const char * dataset_name,
@@ -90,7 +61,14 @@ _h5_create_dataset (
);
herr_t
_h5_write_dataset (
_hdf_close_dataset (
h5_file_t * const f,
const hid_t dataset_id
);
herr_t
_hdf_write_dataset (
h5_file_t * const f,
const hid_t dataset_id,
const hid_t type_id,
@@ -101,7 +79,7 @@ _h5_write_dataset (
);
h5_err_t
_h5_read_dataset (
_hdf_read_dataset (
h5_file_t * const f,
const hid_t dataset_id,
const hid_t type_id,
@@ -111,19 +89,86 @@ _h5_read_dataset (
void * const buf );
hid_t
_h5_get_dataset_type (
_hdf_get_dataset_type (
h5_file_t * const f,
const hid_t dataset_id
);
herr_t
_h5_close_dataset (
_hdf_set_dataset_extent (
h5_file_t * const f,
hid_t dset_id,
const hsize_t *size
);
hssize_t
_hdf_get_npoints_of_dataset (
h5_file_t * const f,
hid_t dset_id
);
hssize_t
_hdf_get_npoints_of_dataset_by_name (
h5_file_t * const f,
hid_t loc_id,
char * name
);
/*** dataspace ***/
hid_t
_hdf_create_dataspace (
h5_file_t * const f,
const int rank,
const hsize_t * dims,
const hsize_t * maxdims
);
hid_t
_hdf_get_dataset_space (
h5_file_t * const f,
const hid_t dataset_id
);
herr_t
_hdf_select_hyperslab_of_dataspace (
h5_file_t * const f,
hid_t space_id,
H5S_seloper_t op,
const hsize_t *start,
const hsize_t *stride,
const hsize_t *count,
const hsize_t *block
);
hssize_t
_hdf_get_selected_npoints_of_dataspace (
h5_file_t * const f,
hid_t space_id
);
hssize_t
_hdf_get_npoints_of_dataspace (
h5_file_t * const f,
hid_t space_id
);
herr_t
_hdf_close_dataspace (
h5_file_t * const f,
const hid_t dataspace_id
);
int
_hdf_get_dims_of_dataspace (
h5_file_t * const f,
hid_t space_id,
hsize_t *dims,
hsize_t *maxdims
);
/*** type ***/
hid_t
_h5_create_array_type (
_hdf_create_array_type (
h5_file_t * const f,
hid_t base_type_id,
int rank,
@@ -131,14 +176,14 @@ _h5_create_array_type (
);
hid_t
_h5_create_type (
_hdf_create_type (
h5_file_t * const f,
H5T_class_t _class,
const size_t size
);
herr_t
_h5_insert_type (
_hdf_insert_type (
h5_file_t * const f,
hid_t dtype_id,
const char * name,
@@ -147,19 +192,20 @@ _h5_insert_type (
);
herr_t
_h5_close_type (
_hdf_close_type (
h5_file_t * const f,
hid_t dtype_id
);
/*** property ***/
hid_t
_h5_create_property (
_hdf_create_property (
h5_file_t * const f,
hid_t cls_id
);
herr_t
_h5_set_chunk_property (
_hdf_set_chunk_property (
h5_file_t * const f,
hid_t plist,
int ndims,
@@ -168,7 +214,7 @@ _h5_set_chunk_property (
#ifdef PARALLEL_IO
h5_err_t
_h5_set_fapl_mpio_property (
_hdf_set_fapl_mpio_property (
h5_file_t * const f,
hid_t fapl_id,
MPI_Comm comm,
@@ -177,41 +223,44 @@ _h5_set_fapl_mpio_property (
#endif
h5_err_t
_h5_close_property (
_hdf_close_property (
h5_file_t * const f,
hid_t prop
);
/*** file ***/
herr_t
_h5_close_file (
_hdf_close_file (
h5_file_t * const f,
hid_t fileid
);
/*** error handling ***/
herr_t
_h5_set_errorhandler (
_hdf_set_errorhandler (
h5_file_t * const f,
hid_t estack_id,
H5E_auto_t func,
void *client_data
);
/*** attributes ***/
hid_t
_h5_open_attribute (
_hdf_open_attribute (
h5_file_t * const f,
hid_t loc_id,
const char *attr_name
);
hid_t
_h5_open_attribute_idx (
_hdf_open_attribute_idx (
h5_file_t * const f,
hid_t loc_id,
unsigned int idx
);
hid_t
_h5_open_attribute_by_name (
_hdf_open_attribute_by_name (
h5_file_t * const f,
hid_t loc_id,
const char *obj_name,
@@ -219,7 +268,7 @@ _h5_open_attribute_by_name (
);
hid_t
_h5_open_attribute_by_idx (
_hdf_open_attribute_by_idx (
h5_file_t * const f,
hid_t loc_id,
const char *obj_name,
@@ -231,7 +280,7 @@ _h5_open_attribute_by_idx (
);
hid_t
_h5_create_attribute (
_hdf_create_attribute (
h5_file_t * const f,
hid_t loc_id,
const char *attr_name,
@@ -242,7 +291,7 @@ _h5_create_attribute (
);
herr_t
_h5_read_attribute (
_hdf_read_attribute (
h5_file_t * const f,
hid_t attr_id,
hid_t mem_type_id,
@@ -250,7 +299,7 @@ _h5_read_attribute (
);
herr_t
_h5_write_attribute (
_hdf_write_attribute (
h5_file_t * const f,
hid_t attr_id,
hid_t mem_type_id,
@@ -258,7 +307,7 @@ _h5_write_attribute (
);
ssize_t
_h5_get_attribute_name (
_hdf_get_attribute_name (
h5_file_t * const f,
hid_t attr_id,
size_t buf_size,
@@ -266,24 +315,25 @@ _h5_get_attribute_name (
);
hid_t
_h5_get_attribute_type (
_hdf_get_attribute_type (
h5_file_t * const f,
hid_t attr_id
);
hid_t
_h5_get_attribute_space (
_hdf_get_attribute_dataspace (
h5_file_t * const f,
hid_t attr_id
);
int _h5_get_num_attributes (
int
_hdf_get_num_attributes (
h5_file_t * const f,
hid_t loc_id
);
herr_t
_h5_close_attribute (
_hdf_close_attribute (
h5_file_t * const f,
hid_t attr_id
);
+94 -19
View File
@@ -43,7 +43,7 @@ typedef struct _ENTRY {
a) the code is (most probably) called a few times per program run and
b) the number is small because the table must fit in the core */
static int
isprime (unsigned int number) {
isprime (const unsigned int number) {
/* no even number will be passed */
unsigned int div = 3;
@@ -60,12 +60,12 @@ isprime (unsigned int number) {
The contents of the table is zeroed, especially the field used
becomes zero. */
h5_err_t
_h5_hcreate_r (
_h5_hcreate (
h5_file_t * const f,
size_t nel,
h5_hashtable_t *htab,
int (*compare)(void*, void*),
unsigned int (*compute_hash)(void*)
int (*compare)(const void*, const void*),
unsigned int (*compute_hash)(const void*)
) {
/* Test for correct arguments. */
if (htab == NULL || htab->table != NULL) {
@@ -94,7 +94,7 @@ _h5_hcreate_r (
or equal the current size.
*/
h5_err_t
_h5_hresize_r (
_h5_hresize (
h5_file_t * const f,
size_t nel,
h5_hashtable_t *htab
@@ -108,28 +108,28 @@ _h5_hresize_r (
nel += htab->size;
h5_debug ( f, "Resize hash table from %u to %lu elements.",
htab->size, nel );
TRY ( _h5_hcreate_r (
TRY ( _h5_hcreate (
f, nel, &__htab, htab->compare, htab->compute_hash ) );
unsigned int idx;
for ( idx = 1; idx <= htab->size; idx++ ) {
if ( htab->table[idx].used ) {
void *ventry;
TRY ( _h5_hsearch_r (
_h5_hsearch (
f,
htab->table[idx].entry,
H5_ENTER,
&ventry,
&__htab ) );
&__htab );
}
}
TRY ( _h5_hdestroy_r ( f, htab ) );
TRY ( _h5_hdestroy ( f, htab ) );
*htab = __htab;
return H5_SUCCESS;
}
/* After using the hash table it has to be destroyed. The used memory can
be freed and the local static variable can be marked as not used. */
h5_err_t
_h5_hdestroy_r (
_h5_hdestroy (
h5_file_t * const f,
struct hsearch_data *htab
) {
@@ -162,10 +162,10 @@ _h5_hdestroy_r (
equality of the stored and the parameter value. This helps to prevent
unnecessary expensive calls of strcmp. */
h5_err_t
_h5_hsearch_r (
_h5_hsearch (
h5_file_t * const f,
void *item,
h5_action_t action,
const h5_action_t action,
void **retval,
struct hsearch_data *htab
) {
@@ -206,7 +206,8 @@ _h5_hsearch_r (
/* If entry is found use it. */
if (htab->table[idx].used == hval
&& ((*htab->compare) (item, htab->table[idx].entry) == 0) ) {
&& ((*htab->compare) (
item, htab->table[idx].entry) == 0) ) {
*retval = htab->table[idx].entry;
return H5_SUCCESS;
}
@@ -231,21 +232,95 @@ _h5_hsearch_r (
*retval = htab->table[idx].entry;
return H5_SUCCESS;
}
*retval = NULL;
h5_error ( f, H5_ERR_INVAL, "Key not found in hash table." );
return H5_ERR;
}
void
_h5_hwalk_r (
h5_err_t
_h5_hwalk (
h5_file_t* f,
struct hsearch_data *htab,
void (*visit)(const void *item)
h5_err_t (*visit)(h5_file_t*const f, const void *item)
) {
unsigned int idx = 1;
for ( idx = 1; idx < htab->size; idx++ ) {
if ( htab->table[idx].used ) {
(*visit)( &htab->table[idx].entry );
TRY ( (*visit)( f, &htab->table[idx].entry ) );
}
}
}
return H5_SUCCESS;
}
typedef struct {
char *key;
} h5_hitem_string_keyed_t;
static int
_hcmp_string_keyed (
const void *__a,
const void *__b
) {
h5_hitem_string_keyed_t *a = (h5_hitem_string_keyed_t*) __a;
h5_hitem_string_keyed_t *b = (h5_hitem_string_keyed_t*) __b;
return strcmp ( a->key, b->key );
}
static unsigned int
_hcompute_string_keyed (
const void *__item
) {
h5_hitem_string_keyed_t *item = (h5_hitem_string_keyed_t*) __item;
unsigned int len = strlen (item->key);
unsigned int hval = len;
unsigned int count = len;
while (count-- > 0) {
hval <<= 4;
hval += item->key[count];
}
return hval;
}
h5_err_t
_h5_hcreate_string_keyed (
h5_file_t * const f,
size_t nel,
h5_hashtable_t *htab
) {
return _h5_hcreate ( f, nel, htab,
_hcmp_string_keyed, _hcompute_string_keyed );
}
static int
_hcmp_id_keyed (
const void *__a,
const void *__b
) {
return memcmp ( __a, __b, sizeof(h5_id_t) );
}
static unsigned int
_hcompute_id_keyed (
const void *__item
) {
char *key = (char*)__item;
unsigned int count = sizeof ( h5_id_t );
unsigned int hval = count;
while ( count-- > 0 ) {
if ( key[count] ) {
hval <<= 4;
hval += key[count];
}
}
return hval;
}
h5_err_t
_h5_hcreate_id_keyed (
h5_file_t * const f,
size_t nel,
h5_hashtable_t *htab
) {
return _h5_hcreate ( f, nel, htab,
_hcmp_id_keyed, _hcompute_id_keyed );
}
+37 -14
View File
@@ -1,6 +1,14 @@
#ifndef __H5_HSEARCH_PRIVATE_H
#define __H5_HSEARCH_PRIVATE_H
typedef struct hsearch_data {
struct _ENTRY *table;
unsigned int size;
unsigned int filled;
int (*compare)(const void*, const void*);
unsigned int (*compute_hash)(const void*);
} h5_hashtable_t;
/* Action which shall be performed in the call to hsearch. */
typedef enum {
H5_FIND,
@@ -14,40 +22,55 @@ typedef struct h5_entry {
/* Reentrant versions which can handle multiple hashing tables at the
same time. */
extern h5_err_t
_h5_hsearch_r (
_h5_hsearch (
h5_file_t * const f,
void *item,
h5_action_t action,
const h5_action_t action,
void **retval,
struct hsearch_data *htab
h5_hashtable_t *htab
);
extern h5_err_t
_h5_hcreate_r (
_h5_hcreate (
h5_file_t* const f,
size_t __nel,
struct hsearch_data *__htab,
int (*compare)(void*, void*),
unsigned int (*compute_hash)(void*)
h5_hashtable_t *__htab,
int (*compare)(const void*, const void*),
unsigned int (*compute_hash)(const void*)
);
extern h5_err_t
_h5_hresize_r (
_h5_hresize (
h5_file_t * const f,
size_t nel,
h5_hashtable_t *htab
);
extern h5_err_t
_h5_hdestroy_r (
_h5_hdestroy (
h5_file_t* f,
struct hsearch_data *__htab
h5_hashtable_t *__htab
);
extern void
_h5_hwalk_r (
extern h5_err_t
_h5_hwalk (
h5_file_t* f,
struct hsearch_data *__htab,
void (*visit)(const void *__item)
h5_hashtable_t *__htab,
h5_err_t (*visit)(h5_file_t*const f, const void *__item)
);
extern h5_err_t
_h5_hcreate_string_keyed (
h5_file_t * const f,
size_t nel,
h5_hashtable_t *htab
);
h5_err_t
_h5_hcreate_id_keyed (
h5_file_t * const f,
size_t nel,
h5_hashtable_t *htab
);
#endif
+2 -2
View File
@@ -82,8 +82,8 @@ _h5_cmp_ids_by_eid (
const void *_id1,
const void *_id2
) {
h5_id_t id1 = _h5t_get_elem_id ( *(h5_id_t*)_id1 );
h5_id_t id2 = _h5t_get_elem_id ( *(h5_id_t*)_id2 );
h5_id_t id1 = _h5t_get_elem_idx ( *(h5_id_t*)_id1 );
h5_id_t id2 = _h5t_get_elem_idx ( *(h5_id_t*)_id2 );
if ( id1 < id2 ) return -1;
if ( id1 > id2 ) return 1;
+23 -21
View File
@@ -134,7 +134,7 @@ _h5_open_file (
) {
h5_info ( f, "Opening file %s.", filename );
TRY ( _h5_set_errorhandler ( f, H5E_DEFAULT, _h5_error_handler, NULL ) );
TRY ( _hdf_set_errorhandler ( f, H5E_DEFAULT, _h5_error_handler, NULL ) );
TRY ( h5_set_stepname_fmt ( f, H5PART_GROUPNAME_STEP, 0 ) );
f->xfer_prop = f->create_prop = f->access_prop = H5P_DEFAULT;
@@ -154,17 +154,17 @@ _h5_open_file (
/* ks: IBM_large_block_io */
MPI_Info_create(&info);
MPI_Info_set(info, "IBM_largeblock_io", "true" );
TRY ( _h5_set_fapl_mpio_property ( f, f->access_prop, comm, info ) );
TRY ( _hdf_set_fapl_mpio_property ( f, f->access_prop, comm, info ) );
MPI_Info_free(&info);
TRY ( f->access_prop = _h5_create_property ( f, H5P_FILE_ACCESS ) );
TRY ( f->access_prop = _hdf_create_property ( f, H5P_FILE_ACCESS ) );
/*TRY ( f->create_prop = _h5_create_property ( f, H5P_FILE_CREATE) );*/
/*TRY ( f->create_prop = _hdf_create_property ( f, H5P_FILE_CREATE) );*/
f->create_prop = H5P_DEFAULT;
/* xfer_prop: also used for parallel I/O, during actual writes
rather than the access_prop which is for file creation. */
TRY ( f->xfer_prop = _h5_create_property ( f, H5P_DATASET_XFER ) );
TRY ( f->xfer_prop = _hdf_create_property ( f, H5P_DATASET_XFER ) );
#ifdef COLLECTIVE_IO
if (H5Pset_dxpl_mpio (f->xfer_prop,H5FD_MPIO_COLLECTIVE) < 0) {
@@ -247,9 +247,11 @@ h5_open_file (
f->__funcname = funcname;
if ( _h5_open_file( f, filename, flags, comm ) < 0 ) {
if (f != NULL ) {
if (f->u->pnparticles != NULL) {
free (f->u->pnparticles);
}
/* Oops, cannot open file. We release the memory allocated for
f only, there is most likely more allocated memory we do
*not* release.
We don't use the wrapper function because we don't know
wheter it will work or not! */
free (f);
}
return NULL;
@@ -275,15 +277,15 @@ _h5u_close_file (
f->__errno = H5_SUCCESS;
if( u->shape > 0 ) {
TRY( _h5_close_dataspace( f, u->shape ) );
TRY( _hdf_close_dataspace( f, u->shape ) );
u->shape = 0;
}
if( u->diskshape != H5S_ALL ) {
TRY( _h5_close_dataspace( f, u->diskshape ) );
TRY( _hdf_close_dataspace( f, u->diskshape ) );
u->diskshape = 0;
}
if( u->memshape != H5S_ALL ) {
TRY( _h5_close_dataspace( f, u->memshape ) );
TRY( _hdf_close_dataspace( f, u->memshape ) );
u->memshape = 0;
}
if( u->pnparticles ) {
@@ -308,10 +310,10 @@ _h5b_close_file (
) {
struct h5b_fdata *b = f->b;
TRY ( _h5_close_group( f, b->blockgroup ) );
TRY ( _h5_close_dataspace( f, b->shape ) );
TRY ( _h5_close_dataspace( f, b->diskshape ) );
TRY ( _h5_close_dataspace( f, b->memshape ) );
TRY ( _hdf_close_group( f, b->blockgroup ) );
TRY ( _hdf_close_dataspace( f, b->shape ) );
TRY ( _hdf_close_dataspace( f, b->diskshape ) );
TRY ( _hdf_close_dataspace( f, b->memshape ) );
free ( f->b );
f->b = NULL;
@@ -339,12 +341,12 @@ h5_close_file (
TRY( _h5u_close_file ( f ) );
TRY( _h5b_close_file ( f ) );
TRY( _h5t_close_file ( f ) );
TRY( _h5_close_group( f, f->step_gid ) );
TRY( _h5_close_property ( f, f->xfer_prop ) );
TRY( _h5_close_property ( f, f->access_prop ) );
TRY( _h5_close_property ( f, f->create_prop ) );
TRY( _h5_close_group ( f, f->root_gid ) );
TRY( _h5_close_file ( f, f->file ) );
TRY( _hdf_close_group( f, f->step_gid ) );
TRY( _hdf_close_property ( f, f->xfer_prop ) );
TRY( _hdf_close_property ( f, f->access_prop ) );
TRY( _hdf_close_property ( f, f->create_prop ) );
TRY( _hdf_close_group ( f, f->root_gid ) );
TRY( _hdf_close_file ( f, f->file ) );
free( f );
+82 -61
View File
@@ -23,25 +23,25 @@ h5_write_data (
const hid_t memspace_id,
const hid_t diskspace_id
) {
hid_t dataset_id;
hid_t dset_id;
h5_info ( f, "Writing dataset %s/%s.", h5_get_objname(group_id), name );
TRY ( dataset_id = _h5_create_dataset (
TRY ( dset_id = _hdf_create_dataset (
f,
group_id,
name,
type_id,
diskspace_id,
H5P_DEFAULT ) );
TRY ( _h5_write_dataset (
TRY ( _hdf_write_dataset (
f,
dataset_id,
dset_id,
type_id,
memspace_id,
diskspace_id,
f->xfer_prop,
array ) );
TRY ( _h5_close_dataset( f, dataset_id ) );
TRY ( _hdf_close_dataset( f, dset_id ) );
f->empty = 0;
@@ -57,77 +57,81 @@ h5_write_data (
- Close dataset
*/
h5_err_t
_h5_write (
_h5_write_dataset_by_name (
h5_file_t * const f,
const hid_t loc_id,
h5_dataset_info_t *ds_info,
h5_dsinfo_t *dsinfo,
hid_t (*set_memspace)(h5_file_t*,hid_t),
hid_t (*set_diskspace)(h5_file_t*,hid_t),
const void * const data
) {
h5_info ( f, "Writing dataset %s/%s.",
h5_get_objname ( loc_id ), ds_info->name );
h5_get_objname ( loc_id ), dsinfo->name );
H5O_info_t obj_info;
herr_t herr = H5Oget_info_by_name(
loc_id,
ds_info->name,
dsinfo->name,
&obj_info,
H5P_DEFAULT );
if ( (herr >= 0) && ( (f->mode==H5_O_WRONLY) || (f->mode==H5_O_APPEND) ) ) {
h5_warn ( f,
"Dataset %s/%s already exist.",
h5_get_objname ( loc_id ), ds_info->name );
h5_get_objname ( loc_id ), dsinfo->name );
return _h5_handle_file_mode_error( f, f->mode );
}
/*
open/create dataset
*/
hid_t dataset_id;
hid_t dset_id;
hid_t dataspace_id;
hid_t diskspace_id;
hid_t memspace_id;
if ( herr >= 0 ) {
TRY( (dataset_id = _h5_open_dataset (
/* overwrite dataset */
TRY ( (dset_id = _hdf_open_dataset (
f,
loc_id,
ds_info->name ) ) );
TRY( (dataspace_id = _h5_get_dataset_space (
dsinfo->name ) ) );
TRY ( (dataspace_id = _hdf_get_dataset_space (
f,
dataset_id ) ) );
/*
extend dataset?
*/
dset_id ) ) );
TRY ( _hdf_set_dataset_extent (
f,
dset_id,
dsinfo->dims ) );
/* exten dataset? */
} else {
TRY ( dataspace_id = _h5_create_space (
/* create dataset */
TRY ( dataspace_id = _hdf_create_dataspace (
f,
ds_info->rank,
ds_info->dims,
ds_info->maxdims ) );
TRY ( dataset_id = _h5_create_dataset (
dsinfo->rank,
dsinfo->dims,
dsinfo->max_dims ) );
TRY ( dset_id = _hdf_create_dataset (
f,
loc_id,
ds_info->name,
*ds_info->type_id,
dsinfo->name,
dsinfo->type_id,
dataspace_id,
ds_info->create_prop ) );
dsinfo->create_prop ) );
}
TRY ( memspace_id = (*set_memspace)( f, 0 ) );
TRY ( diskspace_id = (*set_diskspace)( f, dataspace_id ) );
TRY ( _h5_write_dataset (
TRY ( _hdf_write_dataset (
f,
dataset_id,
*ds_info->type_id,
dset_id,
dsinfo->type_id,
memspace_id,
diskspace_id,
f->xfer_prop,
data ) );
TRY ( _h5_close_dataspace ( f, diskspace_id ) );
TRY ( _h5_close_dataspace ( f, memspace_id ) );
TRY ( _h5_close_dataset( f, dataset_id ) );
TRY ( _hdf_close_dataspace ( f, diskspace_id ) );
TRY ( _hdf_close_dataspace ( f, memspace_id ) );
TRY ( _hdf_close_dataset( f, dset_id ) );
f->empty = 0;
@@ -135,40 +139,57 @@ _h5_write (
}
h5_err_t
_h5_read (
_h5_read_dataset (
h5_file_t * const f,
hid_t loc_id,
h5_dataset_info_t *ds_info,
hid_t (*set_memspace)(h5_file_t*,hid_t),
hid_t (*set_diskspace)(h5_file_t*,hid_t),
hid_t dset_id,
h5_dsinfo_t *dsinfo,
hid_t (*set_mspace)(h5_file_t*,hid_t),
hid_t (*set_dspace)(h5_file_t*,hid_t),
void * const data
) {
hid_t dataset_id;
hid_t memspace_id;
hid_t diskspace_id;
hid_t mspace_id;
hid_t dspace_id;
TRY ( (dataset_id = _h5_open_dataset (
f,
loc_id,
ds_info->name ) ) );
TRY ( (memspace_id = (*set_memspace)( f, dataset_id ) ) );
TRY ( (diskspace_id = (*set_diskspace)( f, dataset_id ) ) );
TRY ( _h5_read_dataset (
TRY ( (mspace_id = (*set_mspace)( f, dset_id ) ) );
TRY ( (dspace_id = (*set_dspace)( f, dset_id ) ) );
TRY ( _hdf_read_dataset (
f,
dataset_id,
*ds_info->type_id,
memspace_id,
diskspace_id,
dset_id,
dsinfo->type_id,
mspace_id,
dspace_id,
f->xfer_prop,
data ) );
TRY ( _h5_close_dataspace ( f, diskspace_id ) );
TRY ( _h5_close_dataspace ( f, memspace_id ) );
TRY ( _h5_close_dataset ( f, dataset_id ) );
TRY ( _hdf_close_dataspace ( f, dspace_id ) );
TRY ( _hdf_close_dataspace ( f, mspace_id ) );
return H5_SUCCESS;
}
h5_err_t
_h5_read_dataset_by_name (
h5_file_t * const f,
hid_t loc_id,
h5_dsinfo_t *dsinfo,
hid_t (*set_mspace)(h5_file_t*,hid_t),
hid_t (*set_dspace)(h5_file_t*,hid_t),
void * const data
) {
hid_t dset_id;
TRY ( (dset_id = _hdf_open_dataset (
f,
loc_id,
dsinfo->name ) ) );
TRY ( _h5_read_dataset ( f, dset_id, dsinfo, set_mspace, set_dspace,
data ) );
TRY ( _hdf_close_dataset ( f, dset_id ) );
return H5_SUCCESS;
}
static h5_err_t
_init_step (
h5_file_t * f
@@ -185,7 +206,7 @@ _h5_close_step (
if ( f->step_gid < 0 ) return H5_SUCCESS;
TRY ( _h5t_close_step ( f ) );
TRY ( _h5_close_group ( f, f->step_gid ) );
TRY ( _hdf_close_group ( f, f->step_gid ) );
f->step_gid = -1;
@@ -262,16 +283,16 @@ h5_int64_t
h5_get_dataset_type(
h5_file_t * const f,
hid_t group_id,
const char *dataset_name
const char *dset_name
) {
hid_t dataset_id;
hid_t dset_id;
hid_t hdf5_type;
TRY( dataset_id = _h5_open_dataset ( f, group_id, dataset_name ) );
TRY ( hdf5_type = _h5_get_dataset_type ( f, dataset_id ) );
TRY( dset_id = _hdf_open_dataset ( f, group_id, dset_name ) );
TRY ( hdf5_type = _hdf_get_dataset_type ( f, dset_id ) );
h5_int64_t type = (h5_int64_t) h5_normalize_h5_type ( f, hdf5_type );
TRY( _h5_close_type( f, hdf5_type ) );
TRY( _h5_close_dataset( f, dataset_id ) );
TRY( _hdf_close_type( f, hdf5_type ) );
TRY( _hdf_close_dataset( f, dset_id ) );
return type;
}
+30 -5
View File
@@ -1,23 +1,48 @@
#ifndef __H5_READWRITE_PRIVATE_H
#define __H5_READWRITE_PRIVATE_H
/*
information about HDF5 dataset
*/
typedef struct h5_dataset_info {
char name[256];
int rank;
hsize_t dims[4];
hsize_t max_dims[4];
hsize_t chunk_dims[4];
hid_t type_id;
hid_t create_prop;
hid_t access_prop;
} h5_dsinfo_t;
h5_err_t
_h5_write (
_h5_write_dataset_by_name (
h5_file_t * const f,
hid_t loc_id,
struct h5_dataset_info *ds_info,
h5_dsinfo_t *ds_info,
hid_t (*set_memspace)(h5_file_t*,hid_t),
hid_t (*set_diskspace)(h5_file_t*,hid_t),
const void * const data
);
h5_err_t
_h5_read (
_h5_read_dataset (
h5_file_t * const f,
hid_t loc_id,
h5_dataset_info_t *ds_info,
hid_t dset_id,
h5_dsinfo_t *ds_info,
hid_t (*set_memspace)(h5_file_t*,hid_t),
hid_t (*set_diskspace)(h5_file_t*,hid_t),
void * const data
);
h5_err_t
_h5_read_dataset_by_name (
h5_file_t * const f,
hid_t loc_id,
h5_dsinfo_t *ds_info,
hid_t (*set_memspace)(h5_file_t*,hid_t),
hid_t (*set_diskspace)(h5_file_t*,hid_t),
void * const data
);
#endif
+3 -3
View File
@@ -59,12 +59,12 @@ typedef h5_err_t (*h5_errorhandler_t)(
typedef unsigned long MPI_Comm;
#endif
struct h5_idlist {
typedef struct h5_idlist {
h5_size_t size; /* allocated space in number of items */
h5_size_t num_items; /* stored items */
h5_id_t *items;
};
typedef struct h5_idlist h5_idlist_t;
} h5_idlist_t;
struct h5_idmap;
typedef struct h5_idmap h5_idmap_t;
-1
View File
@@ -1,7 +1,6 @@
#ifndef __H5_TYPES_PRIVATE_H
#define __H5_TYPES_PRIVATE_H
struct h5_idmap_el {
h5_id_t global_id;
h5_id_t local_id;
+32 -24
View File
@@ -54,7 +54,7 @@ _compute_tets_of_edges (
h5_id_t eid = (t->cur_level <= 0 ) ? 0 : t->num_elems[t->cur_level-1];
h5_elem_ldta_t *tet = tet = &t->elems_ldta[eid];
h5_id_t num_elems = t->num_elems[t->num_levels-1];
h5_te_entry_t *retval = NULL;
h5t_te_entry_t *retval = NULL;
TRY ( _h5t_resize_te_htab ( f, 4*(num_elems-eid) ) );
for ( ; eid < num_elems; eid++, tet++ ) {
h5_id_t face;
@@ -73,7 +73,7 @@ _compute_tets_of_triangles (
h5_id_t eid = (t->cur_level <= 0 ) ? 0 : t->num_elems[t->cur_level-1];
h5_elem_ldta_t *tet = tet = &t->elems_ldta[eid];
h5_id_t num_elems = t->num_elems[t->num_levels-1];
h5_td_entry_t *retval = NULL;
h5t_td_entry_t *retval = NULL;
TRY ( _h5t_resize_td_htab ( f, 4*(num_elems-eid) ) );
for ( ; eid < num_elems; eid++, tet++ ) {
h5_id_t face;
@@ -114,18 +114,18 @@ _compute_children_of_edge (
h5_idlist_t *children
) {
h5t_fdata_t *t = f->t;
h5_te_entry_t *te;
h5t_te_entry_t *te;
TRY ( _h5t_find_te2 (
f,
_h5t_get_face_id ( kid ),
_h5t_get_elem_id ( kid ),
_h5t_get_elem_idx ( kid ),
&te )
);
h5_id_t *edge = te->value.items;
h5_id_t *end = te->value.items+te->value.num_items;
for ( ; edge < end; edge++ ) {
h5_id_t eid = _h5t_get_elem_id ( *edge );
h5_id_t eid = _h5t_get_elem_idx ( *edge );
h5_id_t face_id = _h5t_get_face_id ( *edge );
h5_elem_ldta_t *tet = &t->elems_ldta[eid];
if ( _h5t_elem_is_on_cur_level ( f, tet ) == H5_OK ) {
@@ -158,19 +158,19 @@ _compute_sections_of_edge (
h5_idlist_t *children
) {
h5t_fdata_t *t = f->t;
h5_te_entry_t *te;
h5t_te_entry_t *te;
TRY ( _h5t_find_te2 (
f,
_h5t_get_face_id ( kid ),
_h5t_get_elem_id ( kid ),
_h5t_get_elem_idx ( kid ),
&te )
);
h5_id_t *edge = te->value.items;
h5_id_t *end = te->value.items+te->value.num_items;
int refined = 0;
for ( ; edge < end; edge++ ) {
h5_id_t eid = _h5t_get_elem_id ( *edge );
h5_id_t eid = _h5t_get_elem_idx ( *edge );
h5_id_t face_id = _h5t_get_face_id ( *edge );
h5_elem_ldta_t *tet = &t->elems_ldta[eid];
if ( ! _h5t_elem_is_on_cur_level ( f, tet ) == H5_OK ) {
@@ -220,18 +220,18 @@ _compute_children_of_triangle (
) {
h5t_fdata_t *t = f->t;
h5_td_entry_t *td;
h5t_td_entry_t *td;
TRY ( _h5t_find_td2 (
f,
_h5t_get_face_id ( did ),
_h5t_get_elem_id ( did ),
_h5t_get_elem_idx ( did ),
&td
) );
h5_id_t *tri = td->value.items;
h5_id_t *end = td->value.items+td->value.num_items;
for ( ; tri < end; tri++ ) {
h5_id_t eid = _h5t_get_elem_id ( *tri );
h5_id_t eid = _h5t_get_elem_idx ( *tri );
h5_id_t face_id = _h5t_get_face_id ( *tri );
h5_elem_ldta_t *tet = &t->elems_ldta[eid];
if ( _h5t_elem_is_on_cur_level ( f, tet ) == H5_OK ) {
@@ -265,17 +265,17 @@ _compute_sections_of_triangle (
h5_idlist_t *children
) {
h5t_fdata_t *t = f->t;
h5_td_entry_t *td;
h5t_td_entry_t *td;
TRY ( _h5t_find_td2 (
f,
_h5t_get_face_id ( did ),
_h5t_get_elem_id ( did ), &td ) );
_h5t_get_elem_idx ( did ), &td ) );
h5_id_t *tri = td->value.items;
h5_id_t *end = td->value.items+td->value.num_items;
int refined = 0;
for ( ; tri < end; tri++ ) {
h5_id_t eid = _h5t_get_elem_id ( *tri );
h5_id_t eid = _h5t_get_elem_idx ( *tri );
h5_id_t face_id = _h5t_get_face_id ( *tri );
h5_elem_ldta_t *tet = &t->elems_ldta[eid];
if ( ! _h5t_elem_is_on_cur_level ( f, tet ) == H5_OK ) {
@@ -313,7 +313,7 @@ _add_edge (
h5_id_t face_id,
h5_id_t eid
) {
h5_te_entry_t *te;
h5t_te_entry_t *te;
TRY ( _h5t_find_te2 ( f, face_id, eid, &te ) );
TRY ( _h5_search_idlist ( f, list, te->value.items[0] ) );
return H5_SUCCESS;
@@ -334,7 +334,7 @@ h5t_get_edges_upadjacent_to_vertex (
h5_id_t *vidp = tv->items;
for ( i = 0; i < tv->num_items; i++, vidp++ ) {
h5_id_t eid = _h5t_get_elem_id ( *vidp );
h5_id_t eid = _h5t_get_elem_idx ( *vidp );
h5_id_t face = _h5t_get_face_id ( *vidp );
h5_elem_ldta_t *tet = &t->elems_ldta[eid];
@@ -356,7 +356,7 @@ _add_triangle (
h5_id_t face,
h5_id_t eid
) {
h5_td_entry_t *td;
h5t_td_entry_t *td;
TRY ( _h5t_find_td2 ( f, face, eid, &td ) );
TRY ( _h5_search_idlist ( f, list, td->value.items[0] ) );
@@ -376,7 +376,7 @@ h5t_get_triangles_upadjacent_to_vertex (
h5_size_t i;
h5_id_t *vidp = tv->items;
for ( i = 0; i < tv->num_items; i++, vidp++ ) {
h5_id_t eid = _h5t_get_elem_id ( *vidp );
h5_id_t eid = _h5t_get_elem_idx ( *vidp );
h5_id_t face = _h5t_get_face_id ( *vidp );
h5_elem_ldta_t *tet = &t->elems_ldta[eid];
@@ -404,7 +404,7 @@ h5t_get_tets_upadjacent_to_vertex (
h5_size_t i;
h5_id_t *vidp = tv->items;
for ( i = 0; i < tv->num_items; i++, vidp++ ) {
h5_id_t eid = _h5t_get_elem_id ( *vidp );
h5_id_t eid = _h5t_get_elem_idx ( *vidp );
h5_elem_ldta_t *tet = &t->elems_ldta[eid];
if ( _h5t_elem_is_on_cur_level ( f, tet ) == H5_NOK ) {
@@ -429,7 +429,7 @@ h5t_get_triangles_upadjacent_to_edge (
h5_id_t *end = children->items+children->num_items;
int map[6][2] = { {2,3}, {0,3}, {1,3}, {1,2}, {0,2}, {0,1} };
for ( ; edge < end; edge++ ) {
h5_id_t eid = _h5t_get_elem_id ( *edge );
h5_id_t eid = _h5t_get_elem_idx ( *edge );
h5_id_t face_id = _h5t_get_face_id ( *edge );
TRY ( _add_triangle ( f, *list, map[face_id][0], eid ) );
TRY ( _add_triangle ( f, *list, map[face_id][1], eid ) );
@@ -452,7 +452,7 @@ h5t_get_tets_upadjacent_to_edge (
int i;
h5_id_t *kidp = children->items;
for ( i = 0; i < children->num_items; i++, kidp++ ) {
h5_id_t eid = _h5t_get_elem_id ( *kidp );
h5_id_t eid = _h5t_get_elem_idx ( *kidp );
TRY ( _h5_search_idlist ( f, *list, eid ) );
}
TRY ( _h5_free_idlist( f, &children ) );
@@ -472,7 +472,7 @@ h5t_get_tets_upadjacent_to_triangle (
int i;
h5_id_t *didp = children->items;
for ( i = 0; i < children->num_items; i++ , didp++) {
h5_id_t eid = _h5t_get_elem_id ( *didp );
h5_id_t eid = _h5t_get_elem_idx ( *didp );
TRY ( _h5_search_idlist ( f, *list, eid ) );
}
TRY ( _h5_free_idlist( f, &children ) );
@@ -516,7 +516,7 @@ h5t_get_vertices_downadjacent_to_triangle (
int map[4][3] = { {1,4,5}, {2,3,5}, {0,3,4}, {0,1,2} };
h5_id_t face = _h5t_get_face_id ( did );
h5_id_t eid = _h5t_get_elem_id ( did );
h5_id_t eid = _h5t_get_elem_idx ( did );
h5_id_t i;
for ( i = 0; i < 3; i++ ) {
@@ -579,7 +579,7 @@ h5t_get_edges_downadjacent_to_triangle (
int map[4][3] = { {1,4,5}, {2,3,5}, {0,3,4}, {0,1,2} };
h5_id_t face_id = _h5t_get_face_id ( did );
h5_id_t eid = _h5t_get_elem_id ( did );
h5_id_t eid = _h5t_get_elem_idx ( did );
h5_id_t i;
for ( i = 0; i < 3; i++ ) {
@@ -655,3 +655,11 @@ h5t_release_list_of_adjacencies (
TRY ( _h5_free_idlist ( f, list ) );
return H5_SUCCESS;
}
h5_err_t
_h5t_release_adjacencies (
h5_file_t * const f
) {
/* TO BE WRITTEN @@@ */
return H5_SUCCESS;
}
+2 -5
View File
@@ -1,9 +1,6 @@
#ifndef __H5T_ADJACENCIES_PRIVATE_H
#define __H5T_ADJACENCIES_PRIVATE_H
h5_err_t
_h5t_rebuild_adj_data (
h5_file_t * const f
);
h5_err_t _h5t_rebuild_adj_data ( h5_file_t * const f );
h5_err_t _h5t_release_adjacencies ( h5_file_t * const f );
#endif
+10 -10
View File
@@ -120,14 +120,14 @@ _h5t_read_boundaryfaces (
const char * const dataset_name = "Faces";
hid_t dataset_id;
h5_size_t num_faces;
TRY ( dataset_id = _h5_open_dataset ( f, boundary->gid, dataset_name ) );
TRY ( diskspace_id = _h5_get_dataset_space ( f, dataset_id ) );
TRY ( num_faces = _h5_get_npoints_of_space ( f, diskspace_id ) );
TRY ( _h5_close_dataspace( f, diskspace_id ) );
TRY ( _h5_close_dataset( f, dataset_id ) );
TRY ( dataset_id = _hdf_open_dataset ( f, boundary->gid, dataset_name ) );
TRY ( diskspace_id = _hdf_get_dataset_space ( f, dataset_id ) );
TRY ( num_faces = _hdf_get_npoints_of_dataspace ( f, diskspace_id ) );
TRY ( _hdf_close_dataspace( f, diskspace_id ) );
TRY ( _hdf_close_dataset( f, dataset_id ) );
TRY ( h5t_add_num_boundaryfaces ( f, num_faces ) );
TRY ( _h5_read_dataset (
TRY ( _hdf_read_dataset (
f,
dataset_id,
H5T_NATIVE_INT32,
@@ -135,7 +135,7 @@ _h5t_read_boundaryfaces (
H5S_ALL,
f->xfer_prop,
boundary->faces ) );
TRY ( _h5_close_dataset( f, dataset_id ) );
TRY ( _hdf_close_dataset( f, dataset_id ) );
return H5_SUCCESS;
}
@@ -155,7 +155,7 @@ _h5t_write_boundary (
struct h5t_fdata *t = f->t;
boundary_t *boundary = &t->boundary;
return _h5_write (
return _h5_write_dataset_by_name (
f,
boundary->gid,
&boundary->dsinfo,
@@ -183,7 +183,7 @@ h5t_close_boundary (
bzero ( boundary, sizeof(*boundary) );
TRY( _h5_close_group( f, boundary->gid ) );
TRY( _hdf_close_group( f, boundary->gid ) );
boundary->id = -1;
boundary->gid = -1;
@@ -263,7 +263,7 @@ h5t_store_boundaryface_local_id (
switch ( t->mesh_type ) {
case H5_OID_TETRAHEDRON: {
h5_id_t local_tet_id = _h5t_get_elem_id ( local_fid );
h5_id_t local_tet_id = _h5t_get_elem_idx ( local_fid );
if ( t->elems.tets[local_tet_id].global_parent_eid != -1 ) {
return _h5t_error_store_boundaryface_local_id (
f,
+8 -5
View File
@@ -1,8 +1,9 @@
#include "h5_types.h"
#include "h5_types_private.h"
#include "h5_core.h"
#include "h5_core_private.h"
#include "h5t_types_private.h"
const char * _h5t_oid_names[] = {
const char *
_h5t_oid_names[] = {
"N.N.",
"vertex",
"edge",
@@ -10,7 +11,8 @@ const char * _h5t_oid_names[] = {
"tetrahedron"
};
const char * _h5t_meshes_grpnames[] = {
const char *
_h5t_meshes_grpnames[] = {
"N.N.",
"N.N.",
"N.N.",
@@ -18,7 +20,8 @@ const char * _h5t_meshes_grpnames[] = {
"TetMeshes"
};
const size_t _h5t_sizeof_elem[] = {
const size_t
_h5t_sizeof_elem[] = {
0,
0,
0,
+4 -7
View File
@@ -1,13 +1,10 @@
#ifndef __H5T_CONSTS_PRIVATE_H
#define __H5T_CONSTS_PRIVATE_H
extern char * _h5t_oid_names[];
extern char * _h5t_meshes_grpnames[];
extern size_t _h5t_sizeof_elem[];
extern const char * _h5t_oid_names[];
extern const char * _h5t_meshes_grpnames[];
extern const size_t _h5t_sizeof_elem[];
const char *
_h5t_map_oid2str (
h5_id_t oid
);
const char *_h5t_map_oid2str ( h5_oid_t oid );
#endif
+48 -32
View File
@@ -5,17 +5,17 @@
static int
_cmp_te_entries (
void *__a,
void *__b
const void *__a,
const void *__b
) {
return memcmp ( __a, __b, sizeof(h5_2id_t) );
}
static unsigned int
_compute_te_hashval (
void *__item
const void *__item
) {
h5_te_entry_t *item = (h5_te_entry_t*)__item;
h5t_te_entry_t *item = (h5t_te_entry_t*)__item;
char *key = (char *)item->key.vids;
unsigned int count = 2 * sizeof ( item->key.vids[0] );
unsigned int hval = count;
@@ -34,7 +34,7 @@ _h5t_create_te_htab (
size_t nel
) {
h5t_adjacencies_t *a = &f->t->adjacencies;
return _h5_hcreate_r (
return _h5_hcreate (
f,
nel,
&a->te_hash,
@@ -51,7 +51,7 @@ _h5t_resize_te_htab (
if ( a->te_hash.size == 0 ) {
TRY ( _h5t_create_te_htab ( f, nel ) );
} else if ( a->te_hash.size < nel ) {
TRY ( _h5_hresize_r ( f, nel, &a->te_hash ) );
TRY ( _h5_hresize ( f, nel, &a->te_hash ) );
}
return H5_SUCCESS;
}
@@ -61,7 +61,7 @@ _h5t_search_te2 (
h5_file_t * const f,
h5_id_t face,
h5_id_t eid,
h5_te_entry_t **entry
h5t_te_entry_t **entry
) {
h5t_fdata_t *t = f->t;
h5t_adjacencies_t *a = &t->adjacencies;
@@ -79,18 +79,18 @@ _h5t_search_te2 (
*/
if ( (a->te_hash.size*6) <= (a->te_hash.filled<<3) ) {
h5_id_t num_elems = t->num_elems[t->num_levels-1];
TRY ( _h5_hresize_r (
TRY ( _h5_hresize (
f,
3*(num_elems - eid),
&a->te_hash ) );
}
TRY ( _h5_hsearch_r (
TRY ( _h5_hsearch (
f,
*entry,
H5_ENTER,
&__retval,
&a->te_hash ) );
h5_te_entry_t *retval = (h5_te_entry_t *)__retval;
h5t_te_entry_t *retval = (h5t_te_entry_t *)__retval;
TRY ( _h5_search_idlist (
f,
&retval->value,
@@ -110,17 +110,17 @@ _h5t_search_te2 (
h5_err_t
_h5t_find_te (
h5_file_t * const f,
h5_te_entry_t *item,
h5_te_entry_t **retval
h5t_te_entry_t *item,
h5t_te_entry_t **retval
) {
void *__ret;
TRY ( _h5_hsearch_r (
TRY ( _h5_hsearch (
f,
item,
H5_FIND,
&__ret,
&f->t->adjacencies.te_hash ) );
*retval = (h5_te_entry_t *)__ret;
*retval = (h5t_te_entry_t *)__ret;
return H5_SUCCESS;
}
@@ -134,9 +134,9 @@ _h5t_find_te2 (
h5_file_t * const f,
h5_id_t face_id,
h5_id_t local_eid,
h5_te_entry_t **retval
h5t_te_entry_t **retval
) {
h5_te_entry_t item;
h5t_te_entry_t item;
TRY ( h5t_get_local_vids_of_edge2 (
f,
face_id,
@@ -148,17 +148,17 @@ _h5t_find_te2 (
static int
_cmp_td_entries (
void *__a,
void *__b
const void *__a,
const void *__b
) {
return memcmp ( __a, __b, sizeof(h5_3id_t) );
}
static unsigned int
_compute_td_hashval (
void *__item
const void *__item
) {
h5_te_entry_t *item = (h5_te_entry_t*)__item;
h5t_te_entry_t *item = (h5t_te_entry_t*)__item;
char *key = (char *)item->key.vids;
unsigned int count = sizeof ( h5_3id_t );
unsigned int hval = count;
@@ -177,7 +177,7 @@ _h5t_create_td_htab (
size_t nel
) {
h5t_adjacencies_t *a = &f->t->adjacencies;
return _h5_hcreate_r (
return _h5_hcreate (
f,
nel,
&a->td_hash,
@@ -194,7 +194,7 @@ _h5t_resize_td_htab (
if ( a->td_hash.size == 0 ) {
TRY ( _h5t_create_td_htab ( f, nel ) );
} else if ( a->td_hash.size < nel ) {
TRY ( _h5_hresize_r ( f, nel, &a->td_hash ) );
TRY ( _h5_hresize ( f, nel, &a->td_hash ) );
}
return H5_SUCCESS;
}
@@ -204,7 +204,7 @@ _h5t_search_td2 (
h5_file_t * const f,
h5_id_t face,
h5_id_t eid,
h5_td_entry_t **entry
h5t_td_entry_t **entry
) {
h5t_fdata_t *t = f->t;
h5t_adjacencies_t *a = &f->t->adjacencies;
@@ -222,19 +222,19 @@ _h5t_search_td2 (
*/
if ( (a->td_hash.size*6) <= (a->td_hash.filled<<3) ) {
h5_id_t num_elems = t->num_elems[t->num_levels-1];
TRY ( _h5_hresize_r (
TRY ( _h5_hresize (
f,
3*(num_elems-eid),
&a->td_hash ) );
}
TRY ( _h5_hsearch_r (
TRY ( _h5_hsearch (
f,
*entry,
H5_ENTER,
&__retval,
&a->td_hash ) );
h5_td_entry_t *retval = (h5_td_entry_t *)__retval;
h5t_td_entry_t *retval = (h5t_td_entry_t *)__retval;
TRY ( _h5_search_idlist (
f,
&retval->value,
@@ -248,11 +248,11 @@ _h5t_search_td2 (
h5_err_t
_h5t_find_td (
h5_file_t * const f,
h5_td_entry_t *item,
h5_td_entry_t **retval
h5t_td_entry_t *item,
h5t_td_entry_t **retval
) {
void *__ret;
_h5_hsearch_r (
_h5_hsearch (
f,
item,
H5_FIND,
@@ -261,7 +261,7 @@ _h5t_find_td (
if ( __ret == NULL ) {
return _h5t_error_local_triangle_nexist( f, item->key.vids );
}
*retval = (h5_td_entry_t *)__ret;
*retval = (h5t_td_entry_t *)__ret;
return H5_SUCCESS;
}
@@ -270,9 +270,9 @@ _h5t_find_td2 (
h5_file_t * const f,
h5_id_t face_id,
h5_id_t local_eid,
h5_td_entry_t **retval
h5t_td_entry_t **retval
) {
h5_td_entry_t item;
h5t_td_entry_t item;
TRY ( h5t_get_local_vids_of_triangle2 (
f,
face_id,
@@ -280,3 +280,19 @@ _h5t_find_td2 (
item.key.vids ) );
return _h5t_find_td ( f, &item, retval );
}
h5_err_t
_h5t_find_tv2 (
h5_file_t * const f,
h5_id_t cid,
h5_id_t el_idx,
h5_idlist_t **retval
) {
/*
map (cid,el_idx) to local index of vertex
*/
h5_id_t vidx = f->t->elems_ldta[el_idx].local_vids[cid];
*retval = &f->t->vertices_data[vidx].tv;
return H5_SUCCESS;
}
+34 -8
View File
@@ -1,6 +1,25 @@
#ifndef __H5T_HSEARCH_PRIVATE_H
#define __H5T_HSEARCH_PRIVATE_H
typedef struct h5t_te_entry_key {
h5_id_t vids[2];
} h5t_te_entry_key_t;
typedef struct h5_te_entry {
h5t_te_entry_key_t key;
h5_idlist_t value;
} h5t_te_entry_t;
typedef struct h5t_td_entry_key {
h5_3id_t vids;
} h5t_td_entry_key_t;
typedef struct h5_td_entry {
h5t_td_entry_key_t key;
h5_idlist_t value;
} h5t_td_entry_t;
h5_err_t
_h5t_create_te_htab (
h5_file_t * const f,
@@ -18,14 +37,14 @@ _h5t_search_te2 (
h5_file_t * const f,
h5_id_t face_id,
h5_id_t local_eid,
h5_te_entry_t **entry
h5t_te_entry_t **entry
);
h5_err_t
_h5t_find_te (
h5_file_t * const f,
h5_te_entry_t *item,
h5_te_entry_t **retval
h5t_te_entry_t *item,
h5t_te_entry_t **retval
);
h5_err_t
@@ -33,7 +52,7 @@ _h5t_find_te2 (
h5_file_t * const f,
h5_id_t face_id,
h5_id_t local_eid,
h5_te_entry_t **retval
h5t_te_entry_t **retval
);
@@ -54,14 +73,14 @@ _h5t_search_td2 (
h5_file_t * const f,
h5_id_t face_id,
h5_id_t local_eid,
h5_td_entry_t **entry
h5t_td_entry_t **entry
);
h5_err_t
_h5t_find_td (
h5_file_t * const f,
h5_td_entry_t *item,
h5_td_entry_t **retval
h5t_td_entry_t *item,
h5t_td_entry_t **retval
);
h5_err_t
@@ -69,7 +88,14 @@ _h5t_find_td2 (
h5_file_t * const f,
h5_id_t face_id,
h5_id_t local_eid,
h5_td_entry_t **rentry
h5t_td_entry_t **rentry
);
h5_err_t
_h5t_find_tv2 (
h5_file_t * const f,
h5_id_t cid,
h5_id_t el_idx,
h5_idlist_t **retval
);
#endif
+4 -4
View File
@@ -421,7 +421,7 @@ h5t_map_global_triangle_id2local (
struct h5t_fdata *t = f->t;
switch ( t->mesh_type ) {
case H5_OID_TETRAHEDRON: {
h5_id_t global_tet_id = _h5t_get_elem_id ( global_tri_id );
h5_id_t global_tet_id = _h5t_get_elem_idx ( global_tri_id );
h5_id_t local_tet_id = h5t_map_global_eid2local (
f, global_tet_id );
if ( local_tet_id < 0 )
@@ -449,7 +449,7 @@ h5t_map_local_triangle_id2global (
struct h5t_fdata *t = f->t;
switch ( t->mesh_type ) {
case H5_OID_TETRAHEDRON: {
h5_id_t local_tet_id = _h5t_get_elem_id ( local_tri_id );
h5_id_t local_tet_id = _h5t_get_elem_idx ( local_tri_id );
h5_id_t global_tet_id = h5t_map_local_eid2global (
f, local_tet_id );
if ( global_tet_id < 0 )
@@ -522,7 +522,7 @@ h5t_get_local_vids_of_edge (
h5_id_t *edge
) {
h5_id_t face_id = _h5t_get_face_id ( id );
h5_id_t el_id = _h5t_get_elem_id ( id );
h5_id_t el_id = _h5t_get_elem_idx ( id );
return h5t_get_local_vids_of_edge2 ( f, face_id, el_id, edge );
}
@@ -547,7 +547,7 @@ h5t_get_local_vids_of_triangle (
h5_id_t *vids
) {
h5_id_t face = _h5t_get_face_id ( id );
h5_id_t el_id = _h5t_get_elem_id ( id );
h5_id_t el_id = _h5t_get_elem_idx ( id );
return h5t_get_local_vids_of_triangle2 ( f, face, el_id, vids );
}
+233 -80
View File
@@ -34,14 +34,14 @@ _create_array_types (
hsize_t dims[1] = { 3 };
TRY(
dtypes->h5_coord3d_t = _h5_create_array_type (
dtypes->h5_coord3d_t = _hdf_create_array_type (
f,
H5_FLOAT64_T,
1,
dims )
);
TRY(
dtypes->h5_3id_t = _h5_create_array_type (
dtypes->h5_3id_t = _hdf_create_array_type (
f,
H5_ID_T,
1,
@@ -49,7 +49,7 @@ _create_array_types (
);
dims[0] = 4;
TRY(
dtypes->h5_4id_t = _h5_create_array_type (
dtypes->h5_4id_t = _hdf_create_array_type (
f,
H5_ID_T,
1,
@@ -66,19 +66,19 @@ _create_vertex_type (
h5_dtypes_t *dtypes = &f->t->dtypes;
TRY(
dtypes->h5_vertex_t = _h5_create_type (
dtypes->h5_vertex_t = _hdf_create_type (
f,
H5_COMPOUND_T,
sizeof(struct h5_vertex) ) );
TRY(
_h5_insert_type (
_hdf_insert_type (
f,
dtypes->h5_vertex_t,
"global_vid",
HOFFSET(struct h5_vertex, global_vid),
H5_ID_T ) );
TRY(
_h5_insert_type (
_hdf_insert_type (
f,
dtypes->h5_vertex_t,
"P",
@@ -95,33 +95,33 @@ _create_triangle_type (
h5_dtypes_t *dtypes = &f->t->dtypes;
TRY(
dtypes->h5_triangle_t = _h5_create_type (
dtypes->h5_triangle_t = _hdf_create_type (
f,
H5_COMPOUND_T,
sizeof(struct h5_triangle) ) );
TRY(
_h5_insert_type (
_hdf_insert_type (
f,
dtypes->h5_triangle_t,
"global_eid",
HOFFSET(struct h5_triangle, global_eid),
H5_ID_T ) );
TRY(
_h5_insert_type (
_hdf_insert_type (
f,
dtypes->h5_triangle_t,
"global_parent_eid",
HOFFSET(struct h5_triangle, global_parent_eid),
H5_ID_T ) );
TRY(
_h5_insert_type (
_hdf_insert_type (
f,
dtypes->h5_triangle_t,
"global_child_eid",
HOFFSET(struct h5_triangle, global_child_eid),
H5_ID_T ) );
TRY(
_h5_insert_type (
_hdf_insert_type (
f,
dtypes->h5_triangle_t,
"global_vids",
@@ -131,6 +131,35 @@ _create_triangle_type (
return H5_SUCCESS;
}
static h5_err_t
_create_tag_types (
h5_file_t * f
) {
h5_dtypes_t *dtypes = &f->t->dtypes;
TRY (
dtypes->h5t_tag_idx_t = _hdf_create_type (
f,
H5_COMPOUND_T,
sizeof(h5t_tag_idx_t) ) );
TRY (
_hdf_insert_type (
f,
dtypes->h5t_tag_idx_t,
"eid",
HOFFSET(h5t_tag_idx_t, eid),
H5_ID_T ) );
TRY (
_hdf_insert_type (
f,
dtypes->h5t_tag_idx_t,
"idx",
HOFFSET(h5t_tag_idx_t, idx),
H5_ID_T ) );
return H5_SUCCESS;
}
static h5_err_t
_create_tet_type (
h5_file_t * f
@@ -138,33 +167,33 @@ _create_tet_type (
h5_dtypes_t *dtypes = &f->t->dtypes;
TRY(
dtypes->h5_tet_t = _h5_create_type (
dtypes->h5_tet_t = _hdf_create_type (
f,
H5_COMPOUND_T,
sizeof(struct h5_tetrahedron) ) );
TRY(
_h5_insert_type (
_hdf_insert_type (
f,
dtypes->h5_tet_t,
"global_eid",
HOFFSET(struct h5_tetrahedron, global_eid),
H5_ID_T ) );
TRY(
_h5_insert_type (
_hdf_insert_type (
f,
dtypes->h5_tet_t,
"global_parent_eid",
HOFFSET(struct h5_tetrahedron, global_parent_eid),
H5_ID_T ) );
TRY(
_h5_insert_type (
_hdf_insert_type (
f,
dtypes->h5_tet_t,
"global_child_eid",
HOFFSET(struct h5_tetrahedron, global_child_eid),
H5T_NATIVE_INT32 ) );
TRY(
_h5_insert_type (
_hdf_insert_type (
f,
dtypes->h5_tet_t,
"global_vids",
@@ -174,16 +203,17 @@ _create_tet_type (
return H5_SUCCESS;
}
#if 0
h5_err_t
_h5_set_dataset_properties (
h5_dataset_info_t *dsinfo,
h5_dsinfo_t *dsinfo,
const char *name,
const hid_t type,
const int rank,
const hsize_t *dims,
const hsize_t *maxdims,
const hsize_t chunk_size
const hsize_t chunk_dims
) {
return H5_SUCCESS;
@@ -213,85 +243,84 @@ _init_fdata (
strcpy( t->dsinfo_vertices.name, "Vertices" );
t->dsinfo_vertices.rank = 1;
t->dsinfo_vertices.dims[0] = 0;
t->dsinfo_vertices.maxdims[0] = H5S_UNLIMITED;
t->dsinfo_vertices.chunk_size[0] = 4096;
t->dsinfo_vertices.type_id = &t->dtypes.h5_vertex_t;
TRY( t->dsinfo_vertices.create_prop = _h5_create_property (
t->dsinfo_vertices.max_dims[0] = H5S_UNLIMITED;
t->dsinfo_vertices.chunk_dims[0] = 4096;
t->dsinfo_vertices.type_id = t->dtypes.h5_vertex_t;
TRY( t->dsinfo_vertices.create_prop = _hdf_create_property (
f,
H5P_DATASET_CREATE ) );
TRY( _h5_set_chunk_property (
TRY( _hdf_set_chunk_property (
f,
t->dsinfo_vertices.create_prop,
t->dsinfo_vertices.rank,
t->dsinfo_vertices.chunk_size ) );
t->dsinfo_vertices.chunk_dims ) );
t->dsinfo_vertices.access_prop = H5P_DEFAULT;
/* NumVertices */
strcpy( t->dsinfo_num_vertices.name, "NumVertices" );
t->dsinfo_num_vertices.rank = 1;
t->dsinfo_num_vertices.dims[0] = 0;
t->dsinfo_num_vertices.maxdims[0] = H5S_UNLIMITED;
t->dsinfo_num_vertices.chunk_size[0] = 4096;
t->dsinfo_num_vertices.type_id = &t->dtypes.h5_id_t;
TRY( t->dsinfo_num_vertices.create_prop = _h5_create_property (
t->dsinfo_num_vertices.max_dims[0] = H5S_UNLIMITED;
t->dsinfo_num_vertices.chunk_dims[0] = 4096;
t->dsinfo_num_vertices.type_id = t->dtypes.h5_id_t;
TRY( t->dsinfo_num_vertices.create_prop = _hdf_create_property (
f,
H5P_DATASET_CREATE ) );
TRY( _h5_set_chunk_property (
TRY( _hdf_set_chunk_property (
f,
t->dsinfo_num_vertices.create_prop,
t->dsinfo_num_vertices.rank,
t->dsinfo_num_vertices.chunk_size ) );
t->dsinfo_num_vertices.chunk_dims ) );
t->dsinfo_num_vertices.access_prop = H5P_DEFAULT;
/* Elems */
strcpy( t->dsinfo_elems.name, "Elems" );
t->dsinfo_elems.rank = 1;
t->dsinfo_elems.dims[0] = 0;
t->dsinfo_elems.maxdims[0] = H5S_UNLIMITED;
t->dsinfo_elems.chunk_size[0] = 4096;
t->dsinfo_elems.type_id = &t->elem_tid;
TRY( t->dsinfo_elems.create_prop = _h5_create_property (
t->dsinfo_elems.max_dims[0] = H5S_UNLIMITED;
t->dsinfo_elems.chunk_dims[0] = 4096;
TRY( t->dsinfo_elems.create_prop = _hdf_create_property (
f,
H5P_DATASET_CREATE ) );
TRY( _h5_set_chunk_property (
TRY( _hdf_set_chunk_property (
f,
t->dsinfo_elems.create_prop,
t->dsinfo_elems.rank,
t->dsinfo_elems.chunk_size ) );
t->dsinfo_elems.chunk_dims ) );
t->dsinfo_elems.access_prop = H5P_DEFAULT;
/* NumElems */
strcpy( t->dsinfo_num_elems.name, "NumElems" );
t->dsinfo_num_elems.rank = 1;
t->dsinfo_num_elems.dims[0] = 0;
t->dsinfo_num_elems.maxdims[0] = H5S_UNLIMITED;
t->dsinfo_num_elems.chunk_size[0] = 4096;
t->dsinfo_num_elems.type_id = &t->dtypes.h5_id_t;
TRY( t->dsinfo_num_elems.create_prop = _h5_create_property (
t->dsinfo_num_elems.max_dims[0] = H5S_UNLIMITED;
t->dsinfo_num_elems.chunk_dims[0] = 4096;
t->dsinfo_num_elems.type_id = t->dtypes.h5_id_t;
TRY( t->dsinfo_num_elems.create_prop = _hdf_create_property (
f,
H5P_DATASET_CREATE ) );
TRY( _h5_set_chunk_property (
TRY( _hdf_set_chunk_property (
f,
t->dsinfo_num_elems.create_prop,
t->dsinfo_num_elems.rank,
t->dsinfo_num_elems.chunk_size ) );
t->dsinfo_num_elems.chunk_dims ) );
t->dsinfo_num_elems.access_prop = H5P_DEFAULT;
/* NumElemsOnLevel */
strcpy( t->dsinfo_num_elems_on_level.name, "NumElemsOnLevel" );
t->dsinfo_num_elems_on_level.rank = 1;
t->dsinfo_num_elems_on_level.dims[0] = 0;
t->dsinfo_num_elems_on_level.maxdims[0] = H5S_UNLIMITED;
t->dsinfo_num_elems_on_level.chunk_size[0] = 4096;
t->dsinfo_num_elems_on_level.type_id = &t->dtypes.h5_id_t;
TRY( t->dsinfo_num_elems_on_level.create_prop = _h5_create_property (
t->dsinfo_num_elems_on_level.max_dims[0] = H5S_UNLIMITED;
t->dsinfo_num_elems_on_level.chunk_dims[0] = 4096;
t->dsinfo_num_elems_on_level.type_id = t->dtypes.h5_id_t;
TRY( t->dsinfo_num_elems_on_level.create_prop = _hdf_create_property (
f,
H5P_DATASET_CREATE ) );
TRY( _h5_set_chunk_property (
TRY( _hdf_set_chunk_property (
f,
t->dsinfo_num_elems_on_level.create_prop,
t->dsinfo_num_elems_on_level.rank,
t->dsinfo_num_elems_on_level.chunk_size ) );
t->dsinfo_num_elems_on_level.chunk_dims ) );
t->dsinfo_num_elems_on_level.access_prop = H5P_DEFAULT;
return H5_SUCCESS;
@@ -316,12 +345,14 @@ _h5t_open_file (
h5t_fdata_t *t = f->t;
t->dtypes.h5_id_t = H5_INT64_T;
t->dtypes.h5_int64_t = H5_INT64_T;
t->dtypes.h5_float64_t = H5_FLOAT64_T;
TRY( _create_array_types ( f ) );
TRY( _create_vertex_type ( f ) );
TRY( _create_triangle_type ( f ) );
TRY( _create_tet_type ( f ) );
TRY( _create_tag_types ( f ) );
TRY( _init_fdata ( f ) );
return H5_SUCCESS;
@@ -341,12 +372,9 @@ h5_err_t
_h5t_close_file (
h5_file_t *f /*!< IN: file handle */
) {
TRY ( _h5t_close_mesh ( f ) );
h5_err_t h5err = H5_SUCCESS;
h5err = _h5t_close_mesh ( f );
return h5err;
return H5_SUCCESS;
}
h5_err_t
@@ -442,11 +470,11 @@ h5t_open_mesh (
switch( type ) {
case H5_OID_TETRAHEDRON:
t->elem_tid = t->dtypes.h5_tet_t;
t->dsinfo_elems.type_id = t->dtypes.h5_tet_t;
t->methods = tet_funcs;
break;
case H5_OID_TRIANGLE:
t->elem_tid = t->dtypes.h5_triangle_t;
t->dsinfo_elems.type_id = t->dtypes.h5_triangle_t;
t->methods = tri_funcs;
break;
default:
@@ -469,12 +497,31 @@ h5t_open_mesh (
return H5_SUCCESS;
}
static h5_err_t
_close_hdf5_objs (
_release_elems (
h5_file_t * const f
) {
h5t_fdata_t *t = f->t;
TRY ( _h5_free ( f, t->elems.data ) );
TRY( _h5_free ( f, t->num_elems ) );
TRY ( _h5_free ( f, t->elems_ldta ) );
TRY ( _h5_free ( f, t->num_elems_on_level ) );
TRY ( _h5_free ( f, t->map_elem_g2l.items ) );
return H5_SUCCESS;
}
static h5_err_t
_release_vertices (
h5_file_t * const f
) {
h5t_fdata_t *t = f->t;
TRY ( _h5_free ( f, t->vertices ) );
TRY ( _h5_free ( f, t->vertices_data ) );
TRY ( _h5_free ( f, t->num_vertices ) );
TRY ( _h5_free ( f, t->map_vertex_g2l.items ) );
return H5_SUCCESS;
}
@@ -482,37 +529,20 @@ static h5_err_t
_release_memory (
h5_file_t * const f
) {
struct h5t_fdata *t = f->t;
_h5_free ( f, t->vertices );
t->vertices = NULL;
_h5_free ( f, t->vertices_data );
t->vertices_data = NULL;
_h5_free ( f, t->num_vertices );
t->num_vertices = NULL;
_h5_free ( f, t->map_vertex_g2l.items );
_h5_free ( f, t->elems.data );
t->elems.data = NULL;
_h5_free ( f, t->num_elems );
_h5_free ( f, t->elems_ldta );
t->elems_ldta = NULL;
_h5_free ( f, t->num_elems_on_level );
t->num_elems_on_level = NULL;
_h5_free ( f, t->map_elem_g2l.items );
t->map_elem_g2l.items = NULL;
TRY ( _h5t_release_tags ( f ) );
TRY ( _h5t_release_adjacencies ( f ) );
TRY ( _release_elems ( f ) );
TRY ( _release_vertices ( f ) );
return H5_SUCCESS;
}
h5_err_t
_h5t_close_mesh (
h5_file_t * const f /*!< file handle */
h5_file_t * const f
) {
TRY( _h5t_write_mesh ( f ) );
TRY( _close_hdf5_objs ( f ) );
TRY( _release_memory ( f ) );
TRY( h5t_close_boundary ( f ) );
TRY( _init_fdata ( f ) );
return H5_SUCCESS;
@@ -533,9 +563,132 @@ h5t_open_level (
}
herr_t
_h5_set_chunk_property (
_hdf_set_chunk_property (
h5_file_t * const f,
hid_t plist,
int ndims,
const hsize_t * dim
);
h5_err_t
_h5t_alloc_num_vertices (
h5_file_t * const f,
const h5_size_t num_vertices
) {
h5t_fdata_t *t = f->t;
ssize_t size = num_vertices * sizeof ( t->vertices[0] );
TRY ( t->vertices = _h5_alloc ( f, t->vertices, size ) );
size = num_vertices * sizeof ( t->vertices_data[0] );
TRY ( t->vertices_data = _h5_alloc ( f, t->vertices_data, size ) );
TRY( _h5_alloc_idmap ( f, &t->map_vertex_g2l, num_vertices ) );
TRY( _h5_alloc_idlist_items ( f, &t->sorted_lvertices, num_vertices ) );
return H5_SUCCESS;
}
h5_err_t
_h5t_alloc_tris (
h5_file_t * const f,
const size_t cur,
const size_t new
) {
h5t_fdata_t *t = f->t;
const size_t nvertices = 3;
/* alloc mem for elements */
TRY ( t->elems.tris = _h5_alloc (
f,
t->elems.tris,
new * sizeof(t->elems.tris[0]) ) );
memset (
t->elems.tris + cur,
-1,
(new-cur) * sizeof(t->elems.tris[0]) );
/* alloc mem for local data of elements */
TRY ( t->elems_ldta = _h5_alloc (
f,
t->elems_ldta,
new * sizeof (t->elems_ldta[0]) ) );
memset (
t->elems_ldta + cur,
-1,
(new-cur) * sizeof (t->elems_ldta[0]) );
/* alloc mem for local vertex IDs of elements */
TRY ( t->elems_lvids = _h5_alloc (
f,
t->elems_lvids,
new * sizeof(t->elems_lvids[0]) * nvertices ) );
memset (
t->elems_lvids + cur * sizeof(t->elems_lvids[0]) * nvertices,
-1,
(new-cur) * sizeof(t->elems_lvids[0]) * nvertices );
/* re-init pointer to local vertex id in local data structure */
h5_id_t *p = t->elems_lvids;
h5_id_t id;
for ( id = 0; id < new; id++, p+=nvertices ) {
t->elems_ldta[id].local_vids = p;
}
/* alloc mem for global to local ID mapping */
TRY ( _h5_alloc_idmap ( f, &t->map_elem_g2l, new ) );
return H5_SUCCESS;
}
h5_err_t
_h5t_alloc_tets (
h5_file_t * const f,
const size_t cur,
const size_t new
) {
h5t_fdata_t *t = f->t;
const size_t nvertices = 4;
/* alloc mem for elements */
TRY ( t->elems.tets = _h5_alloc (
f,
t->elems.tets,
new * sizeof(t->elems.tets[0]) ) );
memset (
t->elems.tets + cur,
-1,
(new-cur) * sizeof(t->elems.tets[0]) );
/* alloc mem for local data of elements */
TRY ( t->elems_ldta = _h5_alloc (
f,
t->elems_ldta,
new * sizeof (t->elems_ldta[0]) ) );
memset (
t->elems_ldta + cur,
-1,
(new-cur) * sizeof (t->elems_ldta[0]) );
/* alloc mem for local vertex IDs of elements */
TRY ( t->elems_lvids = _h5_alloc (
f,
t->elems_lvids,
new * sizeof(t->elems_lvids[0]) * nvertices ) );
memset (
t->elems_lvids + cur * nvertices,
-1,
(new-cur) * sizeof(t->elems_lvids[0]) * nvertices );
/* re-init pointer to local vertex id in local data structure */
h5_id_t *p = t->elems_lvids;
h5_id_t id;
for ( id = 0; id < new; id++, p+=nvertices ) {
t->elems_ldta[id].local_vids = p;
}
/* alloc mem for global to local ID mapping */
TRY ( _h5_alloc_idmap ( f, &t->map_elem_g2l, new ) );
return H5_SUCCESS;
}
+18 -52
View File
@@ -1,61 +1,27 @@
#ifndef __H5T_OPENCLOSE_H
#define __H5T_OPENCLOSE_H
h5_err_t
_h5t_open_file (
h5_file_t * const f
);
h5_err_t
_h5t_close_file (
h5_file_t * const f
);
h5_err_t h5t_open_mesh ( h5_file_t * const f, const h5_id_t id,
const h5_oid_t type );
h5_err_t h5t_open_level ( h5_file_t * const f, const h5_id_t id );
h5_err_t
_h5t_init_fdata (
h5_file_t * const f
);
h5_err_t _h5t_open_file ( h5_file_t * const f );
h5_err_t _h5t_close_file ( h5_file_t * const f );
h5_err_t _h5t_open_topo_group ( h5_file_t * const f );
h5_err_t _h5t_open_meshes_group ( h5_file_t * const f );
h5_err_t _h5t_open_mesh_group ( h5_file_t * const f );
h5_err_t _h5t_close_mesh ( h5_file_t * const f );
h5_err_t _h5t_close_step ( h5_file_t * const f );
h5_err_t
h5t_open_mesh (
h5_file_t * const f,
const h5_id_t id,
const h5_oid_t type
);
h5_err_t _h5t_init_fdata ( h5_file_t * const f );
h5_err_t _h5t_init_step ( h5_file_t * const f );
h5_err_t
_h5t_open_topo_group (
h5_file_t * const f
);
h5_err_t _h5t_alloc_num_vertices ( h5_file_t * const f,
const h5_size_t num_vertices );
h5_err_t _h5t_alloc_tris ( h5_file_t * const f, const size_t cur,
const size_t new_size );
h5_err_t _h5t_alloc_tets ( h5_file_t * const f, const size_t cur,
const size_t new_size );
h5_err_t
_h5t_open_meshes_group (
h5_file_t * const f
);
h5_err_t
_h5t_open_mesh_group (
h5_file_t * const f
);
h5_err_t
_h5t_close_mesh (
h5_file_t * const f
);
h5_err_t
h5t_open_level (
h5_file_t * const f,
const h5_id_t id
);
h5_err_t
_h5t_init_step (
h5_file_t * const f
);
h5_err_t
_h5t_close_step (
h5_file_t * const f
);
#endif
+31 -19
View File
@@ -18,7 +18,6 @@ _open_space_all (
}
/*
Write vertices:
* either we write a new dataset
* or we append data to this dataset
@@ -38,14 +37,14 @@ _write_vertices (
TRY( _h5t_open_mesh_group ( f ) );
}
t->dsinfo_vertices.dims[0] = t->num_vertices[t->cur_level];
TRY( _h5_write (
TRY( _h5_write_dataset_by_name (
f,
t->mesh_gid,
&t->dsinfo_vertices,
_open_space_all,
_open_space_all,
t->vertices ) );
TRY( _h5_write (
TRY( _h5_write_dataset_by_name (
f,
t->mesh_gid,
&t->dsinfo_num_vertices,
@@ -68,7 +67,7 @@ _write_elems (
TRY( _h5t_open_mesh_group ( f ) );
}
TRY ( _h5_write (
TRY ( _h5_write_dataset_by_name (
f,
t->mesh_gid,
&t->dsinfo_elems,
@@ -76,7 +75,7 @@ _write_elems (
_open_space_all,
t->elems.data ) );
TRY ( _h5_write (
TRY ( _h5_write_dataset_by_name (
f,
t->mesh_gid,
&t->dsinfo_num_elems,
@@ -84,7 +83,7 @@ _write_elems (
_open_space_all,
t->num_elems ) );
TRY ( _h5_write (
TRY ( _h5_write_dataset_by_name (
f,
t->mesh_gid,
&t->dsinfo_num_elems_on_level,
@@ -100,10 +99,13 @@ _h5t_write_mesh (
h5_file_t * f
) {
h5t_fdata_t *t = f->t;
if ( ! t->mesh_changed ) return 0;
TRY( _write_vertices( f ) );
TRY( _write_elems( f ) );
if ( t->mesh_changed ) {
TRY( _write_vertices( f ) );
TRY( _write_elems( f ) );
}
if ( t->mtags.changed ) {
TRY ( _h5t_write_mtags ( f ) );
}
return H5_SUCCESS;
}
@@ -120,10 +122,10 @@ _read_num_levels (
if ( t->cur_mesh < 0 ) {
return _h5t_error_undef_mesh ( f );
}
TRY ( dataset_id = _h5_open_dataset ( f, t->mesh_gid, "NumVertices" ) );
TRY ( diskspace_id = _h5_get_dataset_space ( f, dataset_id ) );
TRY ( size = _h5_get_npoints_of_space ( f, diskspace_id ) );
TRY ( _h5_close_dataspace( f, diskspace_id ) );
TRY ( dataset_id = _hdf_open_dataset ( f, t->mesh_gid, "NumVertices" ) );
TRY ( diskspace_id = _hdf_get_dataset_space ( f, dataset_id ) );
TRY ( size = _hdf_get_npoints_of_dataspace ( f, diskspace_id ) );
TRY ( _hdf_close_dataspace( f, diskspace_id ) );
t->num_levels = size;
return size;
@@ -157,7 +159,7 @@ _read_num_vertices (
}
ssize_t num_bytes = t->num_levels*sizeof ( t->num_vertices[0] );
TRY ( t->num_vertices = _h5_alloc ( f, t->num_vertices, num_bytes ) );
TRY ( _h5_read (
TRY ( _h5_read_dataset_by_name (
f,
t->mesh_gid,
&t->dsinfo_num_vertices,
@@ -176,7 +178,7 @@ _read_vertices (
TRY( _h5t_alloc_num_vertices ( f, t->num_vertices[t->num_levels-1] ) );
TRY( _h5_read (
TRY( _h5_read_dataset_by_name (
f,
t->mesh_gid,
&t->dsinfo_vertices,
@@ -203,7 +205,7 @@ _read_num_elems (
size_t size = t->num_levels * sizeof ( t->num_elems[0] );
TRY( t->num_elems = _h5_alloc ( f, NULL, size ) );
TRY( t->num_elems_on_level = _h5_alloc ( f, NULL, size ) );
TRY( _h5_read (
TRY( _h5_read_dataset_by_name (
f,
t->mesh_gid,
&t->dsinfo_num_elems,
@@ -211,7 +213,7 @@ _read_num_elems (
_open_space_all,
t->num_elems ) );
TRY( _h5_read (
TRY( _h5_read_dataset_by_name (
f,
t->mesh_gid,
&t->dsinfo_num_elems_on_level,
@@ -295,7 +297,7 @@ _read_elems (
h5t_fdata_t *t = f->t;
TRY( (*t->methods._alloc_elems)( f, 0, t->num_elems[t->num_levels-1] ) );
TRY( _h5_read (
TRY( _h5_read_dataset_by_name (
f,
t->mesh_gid,
&t->dsinfo_elems,
@@ -311,6 +313,15 @@ _read_elems (
return H5_SUCCESS;
}
static h5_err_t
_read_mtags (
h5_file_t *const f
) {
h5t_fdata_t *t = f->t;
TRY ( t->mtags.group_id = _h5_open_group ( f, t->mesh_gid, "Tags" ) );
return _h5t_read_tag_container ( f, &f->t->mtags );
}
h5_err_t
_h5t_read_mesh (
h5_file_t *f
@@ -323,6 +334,7 @@ _h5t_read_mesh (
TRY ( _read_num_elems ( f ) );
TRY ( _read_vertices ( f ) );
TRY ( _read_elems ( f ) );
TRY ( _read_mtags ( f ) );
return H5_SUCCESS;
}
+100 -75
View File
@@ -9,44 +9,26 @@
#include "h5_core/h5_core.h"
#include "h5_core/h5_core_private.h"
h5_err_t
h5t_begin_traverse_vertices (
h5_file_t * f
/*
Skip elements which have been refined on a level <= the current one.
*/
static h5_id_t
_skip_to_next_elem_on_level (
h5_file_t * f,
h5_id_t *eid
) {
h5t_fdata_t *t = f->t;
h5t_vertex_iterator_t *iter = &t->iters.vertex;
h5_elem_ldta_t *el_dta;
iter->cur_vid = -1;
return H5_SUCCESS;
}
h5_id_t
h5t_traverse_vertices (
h5_file_t * const f, /*!< file handle */
h5_float64_t P[3] /*!< OUT: coordinates */
) {
h5t_fdata_t *t = f->t;
h5t_vertex_iterator_t *iter = &t->iters.vertex;
if ( iter->cur_vid+1 >= t->num_vertices[t->cur_level] ) {
h5_debug ( f, "Traversing done!" );
return H5_NOK;
}
h5_vertex_t *vertex = &t->vertices[++iter->cur_vid];
memcpy ( P, &vertex->P, sizeof ( vertex->P ) );
return iter->cur_vid;
}
h5_err_t
h5t_end_traverse_vertices (
h5_file_t * f
) {
h5t_fdata_t *t = f->t;
h5t_vertex_iterator_t *iter = &t->iters.vertex;
iter->cur_vid = -1;
return H5_SUCCESS;
do {
(*eid)++;
if ( *eid >= t->num_elems[t->cur_level] ) {
return h5_error_internal (
f, __FILE__, __func__, __LINE__ );
}
el_dta = &t->elems_ldta[*eid];
} while ( _h5t_elem_is_on_cur_level ( f, el_dta ) == H5_NOK );
return *eid;
}
/*
@@ -68,27 +50,68 @@ _h5t_elem_is_on_cur_level (
return H5_SUCCESS;
}
/*
Skip elements which have been refined on a level <= the current one.
*/
h5_id_t
_skip_to_next_elem_on_level (
h5_file_t * f,
h5_id_t *eid
h5_err_t
h5t_begin_traverse_vertices (
h5_file_t * f
) {
h5t_fdata_t *t = f->t;
h5_elem_ldta_t *el_dta;
h5t_entity_iterator_t *iter = &t->iters.vertex;
iter->cur_cid = -1;
iter->cur_eid = -1;
TRY ( _skip_to_next_elem_on_level ( f, &iter->cur_eid ) );
return H5_SUCCESS;
}
h5_id_t
h5t_traverse_vertices (
h5_file_t * const f, /*!< file handle */
h5_float64_t P[3] /*!< OUT: coordinates */
) {
h5t_fdata_t *t = f->t;
h5t_entity_iterator_t *iter = &t->iters.vertex;
h5_idlist_t *tv;
size_t i;
do {
(*eid)++;
if ( *eid >= t->num_elems[t->cur_level] ) {
return h5_error_internal (
f, __FILE__, __func__, __LINE__ );
if ( iter->cur_cid >= 3 ) {
if ( iter->cur_eid+1 >= t->num_elems[t->cur_level] ) {
h5_debug ( f, "Traversing done!" );
return H5_NOK;
}
TRY ( _skip_to_next_elem_on_level (
f, &iter->cur_eid ) );
iter->cur_cid = 0;
} else {
iter->cur_cid++;
}
el_dta = &t->elems_ldta[*eid];
}
while ( _h5t_elem_is_on_cur_level ( f, el_dta ) == H5_NOK );
return *eid;
TRY ( _h5t_find_tv2 ( f, iter->cur_cid, iter->cur_eid, &tv ) );
/* skip to first element which is on current level */
i = -1;
h5_elem_ldta_t *el_dta;
do {
i++;
h5_id_t eid = _h5t_get_elem_idx ( tv->items[i] );
el_dta = &t->elems_ldta[eid];
} while ( _h5t_elem_is_on_cur_level ( f, el_dta ) == H5_NOK );
} while ( iter->cur_eid != _h5t_get_elem_idx(tv->items[i]) );
h5_id_t vidx = t->elems_ldta[iter->cur_eid].local_vids[iter->cur_cid];
h5_vertex_t *vertex = &t->vertices[vidx];
memcpy ( P, &vertex->P, sizeof ( vertex->P ) );
return _h5t_build_vertex_id ( iter->cur_cid, iter->cur_eid );
}
h5_err_t
h5t_end_traverse_vertices (
h5_file_t * f
) {
h5t_fdata_t *t = f->t;
h5t_entity_iterator_t *iter = &t->iters.vertex;
iter->cur_cid = -1;
iter->cur_eid = -1;
return H5_SUCCESS;
}
h5_err_t
@@ -98,9 +121,9 @@ h5t_begin_traverse_edges (
h5t_fdata_t *t = f->t;
h5t_entity_iterator_t *iter = &t->iters.edge;
iter->cur_cid = -1;
iter->cur_eid = -1;
TRY ( _skip_to_next_elem_on_level ( f, &iter->cur_eid ) );
iter->cur_fid = -1;
return H5_SUCCESS;
}
@@ -111,31 +134,31 @@ h5t_traverse_edges (
) {
h5t_fdata_t *t = f->t;
h5t_entity_iterator_t *iter = &t->iters.edge;
h5_te_entry_t *te;
h5t_te_entry_t *te;
h5_size_t i;
do {
if ( iter->cur_fid >= 5 ) {
if ( iter->cur_cid >= 5 ) {
if ( iter->cur_eid+1 >= t->num_elems[t->cur_level] ) {
h5_debug ( f, "Traversing done!" );
return H5_NOK;
}
TRY ( _skip_to_next_elem_on_level (
f, &iter->cur_eid ) );
iter->cur_fid = 0;
iter->cur_cid = 0;
} else {
iter->cur_fid++;
iter->cur_cid++;
}
TRY ( _h5t_find_te2 (
f, iter->cur_fid, iter->cur_eid, &te ) );
f, iter->cur_cid, iter->cur_eid, &te ) );
/* skip to first element which is on current level */
i = -1;
h5_elem_ldta_t *el_dta;
do {
i++;
h5_id_t eid = _h5t_get_elem_id ( te->value.items[i] );
h5_id_t eid = _h5t_get_elem_idx ( te->value.items[i] );
el_dta = &t->elems_ldta[eid];
} while ( _h5t_elem_is_on_cur_level ( f, el_dta ) == H5_NOK );
} while ( iter->cur_eid != _h5t_get_elem_id(te->value.items[i]) );
} while ( iter->cur_eid != _h5t_get_elem_idx(te->value.items[i]) );
memcpy ( local_vids, te->key.vids, 2*sizeof(h5_id_t) );
return te->value.items[0];
@@ -148,8 +171,8 @@ h5t_end_traverse_edges (
h5t_fdata_t *t = f->t;
h5t_entity_iterator_t *iter = &t->iters.edge;
iter->cur_eid = 0;
iter->cur_fid = -1;
iter->cur_cid = -1;
iter->cur_eid = -1;
return H5_SUCCESS;
}
@@ -160,9 +183,9 @@ h5t_begin_traverse_triangles (
h5t_fdata_t *t = f->t;
h5t_entity_iterator_t *iter = &t->iters.triangle;
iter->cur_cid = -1;
iter->cur_eid = -1;
TRY ( _skip_to_next_elem_on_level ( f, &iter->cur_eid ) );
iter->cur_fid = -1;
return H5_SUCCESS;
}
@@ -173,30 +196,30 @@ h5t_traverse_triangles (
) {
h5t_fdata_t *t = f->t;
h5t_entity_iterator_t *iter = &t->iters.triangle;
h5_td_entry_t *td;
h5t_td_entry_t *td;
h5_size_t i;
do {
if ( iter->cur_fid >= 3 ) {
if ( iter->cur_cid >= 3 ) {
if ( iter->cur_eid+1 >= t->num_elems[t->cur_level] ) {
h5_debug ( f, "Traversing done!" );
return H5_NOK;
}
TRY ( _skip_to_next_elem_on_level (
f, &iter->cur_eid ) );
iter->cur_fid = 0;
iter->cur_cid = 0;
} else {
iter->cur_fid++;
iter->cur_cid++;
}
TRY ( _h5t_find_td2 ( f, iter->cur_fid, iter->cur_eid, &td ) );
TRY ( _h5t_find_td2 ( f, iter->cur_cid, iter->cur_eid, &td ) );
/* skip to first element which is on current level */
i = -1;
h5_elem_ldta_t *el_dta;
do {
i++;
h5_id_t eid = _h5t_get_elem_id ( td->value.items[i] );
h5_id_t eid = _h5t_get_elem_idx ( td->value.items[i] );
el_dta = &t->elems_ldta[eid];
} while ( _h5t_elem_is_on_cur_level ( f, el_dta ) == H5_NOK );
} while ( iter->cur_eid != _h5t_get_elem_id(td->value.items[i]) );
} while ( iter->cur_eid != _h5t_get_elem_idx(td->value.items[i]) );
memcpy ( local_vids, td->key.vids, 3*sizeof(h5_id_t) );
return td->value.items[0];
@@ -209,8 +232,8 @@ h5t_end_traverse_triangles (
h5t_fdata_t *t = f->t;
h5t_entity_iterator_t *iter = &t->iters.triangle;
iter->cur_eid = 0;
iter->cur_fid = -1;
iter->cur_cid = -1;
iter->cur_eid = -1;
return H5_SUCCESS;
}
@@ -219,8 +242,9 @@ h5t_begin_traverse_elems (
h5_file_t * f
) {
h5t_fdata_t *t = f->t;
h5t_elem_iterator_t *iter = &t->iters.elem;
h5t_entity_iterator_t *iter = &t->iters.elem;
iter->cur_cid = -1;
iter->cur_eid = -1;
return H5_SUCCESS;
}
@@ -235,7 +259,7 @@ h5t_traverse_elems (
h5_id_t *local_vids
) {
h5t_fdata_t *t = f->t;
h5t_elem_iterator_t *iter = &t->iters.elem;
h5t_entity_iterator_t *iter = &t->iters.elem;
h5_elem_ldta_t *elem_data;
h5_id_t local_child_eid;
h5_id_t refined_on_level = -1;
@@ -263,7 +287,7 @@ h5t_traverse_elems (
elem_data->local_vids,
sizeof ( elem_data->local_vids[0] ) * t->mesh_type );
return iter->cur_eid;
return _h5t_build_elem_id ( iter->cur_eid );
}
h5_err_t
@@ -271,7 +295,8 @@ h5t_end_traverse_elems (
h5_file_t * f
) {
h5t_fdata_t *t = f->t;
h5t_elem_iterator_t *iter = &t->iters.elem;
h5t_entity_iterator_t *iter = &t->iters.elem;
iter->cur_cid = -1;
iter->cur_eid = -1;
return H5_SUCCESS;
}
+8 -130
View File
@@ -3,8 +3,6 @@
#include <hdf5.h>
#include "h5_core/h5_core.h"
#include "h5_core/h5_types_private.h"
#include "h5_core/h5t_types_private.h"
#include "h5_core/h5_core_private.h"
/*!
@@ -121,7 +119,7 @@ h5t_add_level (
t->dsinfo_num_elems_on_level.dims[0] = t->num_levels;
ssize_t num_bytes = t->num_levels*sizeof ( h5_size_t );
t->num_vertices = realloc ( t->num_vertices, num_bytes );
TRY ( t->num_vertices = _h5_alloc ( f, t->num_vertices, num_bytes ) );
t->num_vertices[t->cur_level] = -1;
TRY ( t->num_elems = _h5_alloc ( f, t->num_elems, num_bytes ) );
@@ -140,23 +138,6 @@ h5t_add_level (
return t->cur_level;
}
h5_err_t
_h5t_alloc_num_vertices (
h5_file_t * const f,
const h5_size_t num_vertices
) {
h5t_fdata_t *t = f->t;
ssize_t size = num_vertices * sizeof ( t->vertices[0] );
TRY ( t->vertices = _h5_alloc ( f, t->vertices, size ) );
size = num_vertices * sizeof ( t->vertices_data[0] );
TRY ( t->vertices_data = _h5_alloc ( f, t->vertices_data, size ) );
TRY( _h5_alloc_idmap ( f, &t->map_vertex_g2l, num_vertices ) );
TRY( _h5_alloc_idlist_items ( f, &t->sorted_lvertices, num_vertices ) );
return H5_SUCCESS;
}
/*!
Allocate memory for (more) vertices.
*/
@@ -221,110 +202,6 @@ h5t_end_store_vertices (
return H5_SUCCESS;
}
h5_err_t
_h5t_alloc_tris (
h5_file_t * const f,
const size_t cur,
const size_t new
) {
h5t_fdata_t *t = f->t;
const size_t nvertices = 3;
/* alloc mem for elements */
TRY ( t->elems.tris = _h5_alloc (
f,
t->elems.tris,
new * sizeof(t->elems.tris[0]) ) );
memset (
t->elems.tris + cur,
-1,
(new-cur) * sizeof(t->elems.tris[0]) );
/* alloc mem for local data of elements */
TRY ( t->elems_ldta = _h5_alloc (
f,
t->elems_ldta,
new * sizeof (t->elems_ldta[0]) ) );
memset (
t->elems_ldta + cur,
-1,
(new-cur) * sizeof (t->elems_ldta[0]) );
/* alloc mem for local vertex IDs of elements */
TRY ( t->elems_lvids = _h5_alloc (
f,
t->elems_lvids,
new * sizeof(t->elems_lvids[0]) * nvertices ) );
memset (
t->elems_lvids + cur * sizeof(t->elems_lvids[0]) * nvertices,
-1,
(new-cur) * sizeof(t->elems_lvids[0]) * nvertices );
/* re-init pointer to local vertex id in local data structure */
h5_id_t *p = t->elems_lvids;
h5_id_t id;
for ( id = 0; id < new; id++, p+=nvertices ) {
t->elems_ldta[id].local_vids = p;
}
/* alloc mem for global to local ID mapping */
TRY ( _h5_alloc_idmap ( f, &t->map_elem_g2l, new ) );
return H5_SUCCESS;
}
h5_err_t
_h5t_alloc_tets (
h5_file_t * const f,
const size_t cur,
const size_t new
) {
h5t_fdata_t *t = f->t;
const size_t nvertices = 4;
/* alloc mem for elements */
TRY ( t->elems.tets = _h5_alloc (
f,
t->elems.tets,
new * sizeof(t->elems.tets[0]) ) );
memset (
t->elems.tets + cur,
-1,
(new-cur) * sizeof(t->elems.tets[0]) );
/* alloc mem for local data of elements */
TRY ( t->elems_ldta = _h5_alloc (
f,
t->elems_ldta,
new * sizeof (t->elems_ldta[0]) ) );
memset (
t->elems_ldta + cur,
-1,
(new-cur) * sizeof (t->elems_ldta[0]) );
/* alloc mem for local vertex IDs of elements */
TRY ( t->elems_lvids = _h5_alloc (
f,
t->elems_lvids,
new * sizeof(t->elems_lvids[0]) * nvertices ) );
memset (
t->elems_lvids + cur * nvertices,
-1,
(new-cur) * sizeof(t->elems_lvids[0]) * nvertices );
/* re-init pointer to local vertex id in local data structure */
h5_id_t *p = t->elems_lvids;
h5_id_t id;
for ( id = 0; id < new; id++, p+=nvertices ) {
t->elems_ldta[id].local_vids = p;
}
/* alloc mem for global to local ID mapping */
TRY ( _h5_alloc_idmap ( f, &t->map_elem_g2l, new ) );
return H5_SUCCESS;
}
/*!
Initialize everything so that we can begin to store elements.
@@ -420,7 +297,7 @@ _h5t_store_tet (
sizeof (*local_vids) * t->mesh_type );
_h5t_sort_local_vids ( f, elem_ldta->local_vids, t->mesh_type );
h5_id_t face_id;
h5_te_entry_t *retval;
h5t_te_entry_t *retval;
for ( face_id = 0; face_id < 6; face_id++ ) {
TRY ( _h5t_search_te2 (
f,
@@ -450,7 +327,7 @@ _h5t_store_tri (
sizeof (*local_vids) * t->mesh_type );
_h5t_sort_local_vids ( f, elem_ldta->local_vids, t->mesh_type );
h5_id_t face_id;
h5_te_entry_t *retval;
h5t_te_entry_t *retval;
for ( face_id = 0; face_id < 3; face_id++ ) {
TRY ( _h5t_search_te2 (
f,
@@ -536,9 +413,9 @@ _h5t_bisect_edge (
h5_id_t el_id
) {
h5t_fdata_t *t = f->t;
h5_te_entry_t item;
h5t_te_entry_t item;
h5_id_t *vids = item.key.vids;
h5_te_entry_t *retval;
h5t_te_entry_t *retval;
/*
get all elements sharing the given edge
*/
@@ -549,14 +426,15 @@ _h5t_bisect_edge (
*/
size_t i;
for ( i = 0; i < retval->value.num_items; i++ ) {
h5_id_t local_id = _h5t_get_elem_id ( retval->value.items[i] );
h5_id_t local_id = _h5t_get_elem_idx ( retval->value.items[i] );
h5_elem_ldta_t *tet = &t->elems_ldta[local_id];
if ( tet->local_child_eid >= 0 ) {
/*
this element has been refined!
return bisecting point
*/
h5_id_t face_id = _h5t_get_face_id ( retval->value.items[i] );
h5_id_t face_id = _h5t_get_face_id (
retval->value.items[i] );
h5_id_t kids[2], edge0[2], edge1[2];
TRY ( _h5t_compute_direct_children_of_edge (
f,
-25
View File
@@ -1,26 +1,6 @@
#ifndef __H5T_STOREMESH_PRIVATE_H
#define __H5T_STOREMESH_PRIVATE_H
h5_err_t
_h5t_alloc_num_vertices (
h5_file_t * const f,
const h5_size_t num_vertices
);
h5_err_t
_h5t_alloc_tris (
h5_file_t * const f,
const size_t cur,
const size_t new
);
h5_err_t
_h5t_alloc_tets (
h5_file_t * const f,
const size_t cur,
const size_t new
);
h5_id_t
_h5t_store_tri (
h5_file_t * const f,
@@ -35,11 +15,6 @@ _h5t_store_tet (
const h5_id_t vids[]
);
h5_err_t
_h5t_close_level (
h5_file_t * const f
);
h5_err_t
_h5t_compute_direct_children_of_edge (
h5_file_t * const f,
+21 -66
View File
@@ -54,19 +54,6 @@ typedef union h5_elems {
} h5_elems_t;
/*
information about HDF5 dataset
*/
typedef struct h5_dataset_info {
char name[256];
int rank;
hsize_t dims[4];
hsize_t maxdims[4];
hsize_t chunk_size[4];
hid_t *type_id;
hid_t create_prop;
hid_t access_prop;
} h5_dataset_info_t;
typedef struct boundary {
@@ -82,71 +69,38 @@ typedef struct boundary {
h5_size_t *num_faces_on_level; /* real num of faces per level */
h5_id_t last_accessed_face;
h5_dataset_info_t dsinfo;
h5_dsinfo_t dsinfo;
} boundary_t;
/*** type ids' for compound types ***/
typedef struct h5_dtypes {
hid_t h5_id_t;
hid_t h5_int64_t;
hid_t h5_float64_t;
hid_t h5_id_t; /* ID's */
hid_t h5_int64_t; /* 64 bit signed integer */
hid_t h5_float64_t; /* 64 bit floating point */
hid_t h5_coord3d_t; /* 3-tuple of 64-bit float */
hid_t h5_3id_t; /* 3-tuple of id's */
hid_t h5_4id_t; /* 4-tuple of id's */
hid_t h5_3id_t; /* 3-tuple of ID's */
hid_t h5_4id_t; /* 4-tuple of ID's */
hid_t h5_vertex_t; /* vertex structure */
hid_t h5_triangle_t; /* triangle structure */
hid_t h5_tet_t; /* tetrahedron structure */
hid_t h5t_tag_idx_t;
} h5_dtypes_t;
typedef struct h5_te_entry_key {
h5_id_t vids[2];
} h5_te_entry_key_t;
typedef struct h5_te_entry {
h5_te_entry_key_t key;
h5_idlist_t value;
} h5_te_entry_t;
typedef struct h5_td_entry_key {
h5_3id_t vids;
} h5_td_entry_key_t;
typedef struct h5_td_entry {
h5_td_entry_key_t key;
h5_idlist_t value;
} h5_td_entry_t;
typedef struct hsearch_data {
struct _ENTRY *table;
unsigned int size;
unsigned int filled;
int (*compare)(void*, void*);
unsigned int (*compute_hash)(void*);
} h5_hashtable_t;
typedef struct h5t_adjacencies {
struct hsearch_data te_hash;
struct hsearch_data td_hash;
h5_hashtable_t te_hash;
h5_hashtable_t td_hash;
} h5t_adjacencies_t;
typedef struct h5t_elem_iterator {
h5_id_t cur_eid;
} h5t_elem_iterator_t;
typedef struct h5t_vertex_iterator {
h5_id_t cur_vid;
} h5t_vertex_iterator_t;
typedef struct h5t_entity_iterator {
h5_id_t cur_fid;
h5_id_t cur_cid;
h5_id_t cur_eid;
} h5t_entity_iterator_t;
typedef struct h5t_iterators {
h5t_vertex_iterator_t vertex;
h5t_entity_iterator_t vertex;
h5t_entity_iterator_t edge;
h5t_entity_iterator_t triangle;
h5t_elem_iterator_t elem;
h5t_entity_iterator_t elem;
} h5t_iterators_t;
typedef struct h5t_fdata {
@@ -157,7 +111,6 @@ typedef struct h5t_fdata {
h5_id_t cur_mesh; /* id of current mesh */
h5_id_t mesh_changed; /* true if new or has been changed */
h5_id_t num_meshes; /* number of meshes */
hid_t elem_tid; /* HDF5 type id: tet, triangle etc */
h5_id_t cur_level; /* id of current level */
h5_id_t new_level; /* idx of the first new level or -1 */
h5_size_t num_levels; /* number of levels */
@@ -166,7 +119,7 @@ typedef struct h5t_fdata {
hid_t topo_gid; /* grp id of mesh in current
level */
hid_t meshes_gid;
hid_t meshes_gid; /* HDF5 id */
hid_t mesh_gid;
/*** type ids' for base & compound data types ***/
@@ -184,8 +137,8 @@ typedef struct h5t_fdata {
h5_idmap_t map_vertex_g2l; /* map global id to local id */
h5_idlist_t sorted_lvertices;
h5_id_t last_stored_vid;
h5_dataset_info_t dsinfo_vertices;
h5_dataset_info_t dsinfo_num_vertices;
h5_dsinfo_t dsinfo_vertices;
h5_dsinfo_t dsinfo_num_vertices;
/*** Elements ***/
@@ -205,9 +158,9 @@ typedef struct h5t_fdata {
h5_idlist_t sorted_elems[H5_MAX_VERTICES_PER_ELEM];
h5_id_t last_stored_eid;
h5_dataset_info_t dsinfo_elems;
h5_dataset_info_t dsinfo_num_elems;
h5_dataset_info_t dsinfo_num_elems_on_level;
h5_dsinfo_t dsinfo_elems;
h5_dsinfo_t dsinfo_num_elems;
h5_dsinfo_t dsinfo_num_elems_on_level;
/*** Boundary Meshes ***/
h5_id_t num_boundaries; /* number of boundaries */
@@ -216,7 +169,9 @@ typedef struct h5t_fdata {
boundary_t boundary;
h5t_adjacencies_t adjacencies;
/*** Tags ***/
h5t_tagcontainer_t mtags;
h5t_tagcontainer_t stags;
} h5t_fdata_t;
#endif
+31 -29
View File
@@ -24,7 +24,7 @@ _get_diskshape_for_reading (
struct h5u_fdata *u = f->u;
hid_t space;
TRY( space = _h5_get_dataset_space ( f, dataset ) );
TRY( space = _hdf_get_dataset_space ( f, dataset ) );
if ( h5u_has_view ( f ) ) {
hsize_t stride;
@@ -42,14 +42,14 @@ _get_diskshape_for_reading (
/* now we select a subset */
if ( u->diskshape > 0 ) {
TRY ( _h5_select_hyperslab_of_space (
TRY ( _hdf_select_hyperslab_of_dataspace (
f,
u->diskshape,
H5S_SELECT_SET,
&start, &stride, &count,
NULL ) );
}
TRY ( _h5_select_hyperslab_of_space (
TRY ( _hdf_select_hyperslab_of_dataspace (
f,
space,
H5S_SELECT_SET,
@@ -76,7 +76,7 @@ _get_memshape_for_reading (
if ( h5u_has_view ( f ) ) {
hsize_t dmax=H5S_UNLIMITED;
hsize_t len = u->viewend - u->viewstart;
return _h5_create_space ( f, 1, &len, &dmax );
return _hdf_create_dataspace ( f, 1, &len, &dmax );
} else {
return H5S_ALL;
}
@@ -104,17 +104,19 @@ h5u_get_num_elems (
H5G_DATASET,
0,
dataset_name, sizeof (dataset_name) ) );
TRY( dataset_id = _h5_open_dataset ( f, f->step_gid, dataset_name ) );
TRY( dataset_id = _hdf_open_dataset ( f, f->step_gid, dataset_name ) );
TRY( space_id = _get_diskshape_for_reading ( f, dataset_id ) );
if ( h5u_has_view ( f ) ) {
TRY ( nparticles = _h5_get_selected_npoints_of_space ( f, space_id ) );
TRY ( nparticles = _hdf_get_selected_npoints_of_dataspace (
f, space_id ) );
}
else {
TRY ( nparticles = _h5_get_npoints_of_space ( f, space_id ) );
TRY ( nparticles = _hdf_get_npoints_of_dataspace (
f, space_id ) );
}
TRY( _h5_close_dataspace( f, space_id ) );
TRY( _h5_close_dataset( f, dataset_id ) );
TRY( _hdf_close_dataspace( f, space_id ) );
TRY( _hdf_close_dataset( f, dataset_id ) );
return (h5_int64_t) nparticles;
}
@@ -134,10 +136,10 @@ h5u_read_elems (
if ( f->step_gid < 0 ) {
TRY( h5_set_step ( f, f->step_idx ) );
}
TRY( (dataset_id = _h5_open_dataset ( f, f->step_gid, name ) ) );
TRY( (dataset_id = _hdf_open_dataset ( f, f->step_gid, name ) ) );
TRY( (space_id = _get_diskshape_for_reading ( f, dataset_id ) ) );
TRY( (memspace_id = _get_memshape_for_reading ( f, dataset_id ) ) );
TRY( _h5_read_dataset (
TRY( _hdf_read_dataset (
f,
dataset_id,
type,
@@ -145,9 +147,9 @@ h5u_read_elems (
space_id,
f->xfer_prop,
array ) );
TRY( _h5_close_dataspace( f, space_id ) );
TRY( _h5_close_dataspace( f, memspace_id ) );
TRY( _h5_close_dataset ( f, dataset_id ) );
TRY( _hdf_close_dataspace( f, space_id ) );
TRY( _hdf_close_dataspace( f, memspace_id ) );
TRY( _hdf_close_dataset ( f, dataset_id ) );
return H5_SUCCESS;
}
@@ -171,15 +173,15 @@ h5u_set_num_elements (
return H5_SUCCESS;
}
#endif
TRY( _h5_close_dataspace( f, u->diskshape ) );
TRY( _h5_close_dataspace( f, u->memshape ) );
TRY( _h5_close_dataspace( f, u->shape ) );
TRY( _hdf_close_dataspace( f, u->diskshape ) );
TRY( _hdf_close_dataspace( f, u->memshape ) );
TRY( _hdf_close_dataspace( f, u->shape ) );
u->diskshape = H5S_ALL;
u->memshape = H5S_ALL;
u->shape = H5S_ALL;
u->nparticles =(hsize_t) nparticles;
#ifndef PARALLEL_IO
TRY( u->shape = _h5_create_space (
TRY( u->shape = _hdf_create_dataspace (
f,
1,
&(u->nparticles),
@@ -237,17 +239,17 @@ h5u_set_num_elements (
}
/* declare overall datasize */
TRY ( f->u->shape = _h5_create_space ( f, 1, &total, &total ) );
TRY ( f->u->shape = _hdf_create_dataspace ( f, 1, &total, &total ) );
/* declare overall data size but then will select a subset */
TRY ( f->u->diskshape = _h5_create_space ( f, 1, &total, &total) );
TRY ( f->u->diskshape = _hdf_create_dataspace ( f, 1, &total, &total) );
/* declare local memory datasize */
TRY ( f->u->memshape = _h5_create_space (
TRY ( f->u->memshape = _hdf_create_dataspace (
f, 1, &(f->u->nparticles), &dmax ) );
count[0] = nparticles;
TRY ( _h5_select_hyperslab_of_space (
TRY ( _hdf_select_hyperslab_of_dataspace (
f,
f->u->diskshape,
H5S_SELECT_SET,
@@ -293,11 +295,11 @@ h5u_reset_view (
u->viewstart = -1;
u->viewend = -1;
TRY( _h5_close_dataspace( f, u->shape ) );
TRY( _hdf_close_dataspace( f, u->shape ) );
u->shape = H5S_ALL;
TRY( _h5_close_dataspace( f, u->diskshape ) );
TRY( _hdf_close_dataspace( f, u->diskshape ) );
u->diskshape = H5S_ALL;
TRY( _h5_close_dataspace( f, u->memshape ) );
TRY( _hdf_close_dataspace( f, u->memshape ) );
u->memshape = H5S_ALL;
return H5_SUCCESS;
@@ -356,16 +358,16 @@ h5u_set_view (
u->nparticles = end - start + 1;
/* declare overall datasize */
TRY ( u->shape = _h5_create_space ( f, 1, &total, &total ) );
TRY ( u->shape = _hdf_create_dataspace ( f, 1, &total, &total ) );
/* declare overall data size but then will select a subset */
TRY ( u->diskshape= _h5_create_space ( f, 1, &total, &total ) );
TRY ( u->diskshape= _hdf_create_dataspace ( f, 1, &total, &total ) );
/* declare local memory datasize */
TRY ( u->memshape = _h5_create_space (
TRY ( u->memshape = _hdf_create_dataspace (
f, 1, &(u->nparticles), &dmax ) );
TRY ( _h5_select_hyperslab_of_space (
TRY ( _hdf_select_hyperslab_of_dataspace (
f,
u->diskshape,
H5S_SELECT_SET,
+2
View File
@@ -3,6 +3,8 @@
#include "h5_core.h"
#include "h5_core_private.h"
/* OBSOLETE!!! */
struct _iter_op_data {
int stop_idx;
int count;