GADGET-4
hdf5_util.h
Go to the documentation of this file.
1/*******************************************************************************
2 * \copyright This file is part of the GADGET4 N-body/SPH code developed
3 * \copyright by Volker Springel. Copyright (C) 2014-2020 by Volker Springel
4 * \copyright (vspringel@mpa-garching.mpg.de) and all contributing authors.
5 *******************************************************************************/
6
12#ifndef HDF5_UTIL_H
13#define HDF5_UTIL_H
14
15#include <hdf5.h>
16
17#define COMPRESSION_CHUNKSIZE 1000
18
19extern hid_t Halfprec_memtype;
20extern hid_t Int48_memtype;
21extern hid_t Int128_memtype;
22
25hid_t my_H5Fcreate(const char *fname, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
26hid_t my_H5Gcreate(hid_t loc_id, const char *groupname, size_t size_hint);
27hid_t my_H5Dcreate(hid_t loc_id, const char *datasetname, hid_t type_id, hid_t space_id, hid_t dcpl_id);
28hid_t my_H5Acreate(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id);
29hid_t my_H5Screate(H5S_class_t type);
30hid_t my_H5Screate_simple(int rank, const hsize_t *current_dims, const hsize_t *maximum_dims);
31herr_t my_H5Dwrite(hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t xfer_plist_id, const void *buf,
32 const char *datasetname);
33herr_t my_H5Awrite(hid_t attr_id, hid_t mem_type_id, const void *buf, const char *attr_name);
34hid_t my_H5Fopen(const char *fname, unsigned int flags, hid_t fapl_id);
35hid_t my_H5Dopen(hid_t file_id, const char *datasetname);
36hid_t my_H5Dopen_if_existing(hid_t file_id, const char *datasetname);
37herr_t my_H5Dset_extent(hid_t dset_id, const hsize_t size[]);
38herr_t my_H5Dread(hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t xfer_plist_id, void *buf,
39 const char *datasetname);
40hid_t my_H5Gopen(hid_t loc_id, const char *groupname);
41hid_t my_H5Aopen_name(hid_t loc_id, const char *attr_name);
42herr_t my_H5Aread(hid_t attr_id, hid_t mem_type_id, void *buf, const char *attr_name, hssize_t size);
43
44herr_t my_H5Aclose(hid_t attr_id, const char *attr_name);
45herr_t my_H5Dclose(hid_t dataset_id, const char *datasetname);
46herr_t my_H5Gclose(hid_t group_id, const char *groupname);
47herr_t my_H5Fclose(hid_t file_id, const char *fname);
48herr_t my_H5Sclose(hid_t dataspace_id, H5S_class_t type);
49herr_t my_H5Pclose(hid_t plist);
50
51hid_t my_H5Tcopy(hid_t type_id);
52herr_t my_H5Tclose(hid_t type_id);
53
54herr_t my_H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t *start, const hsize_t *stride, const hsize_t *count,
55 const hsize_t *block);
56size_t my_H5Tget_size(hid_t datatype_id);
57herr_t my_H5Tset_size(hid_t datatype_id, size_t size);
58
59void write_scalar_attribute(hid_t handle, const char *attr_name, const void *buf, hid_t mem_type_id);
60void write_vector_attribute(hid_t handle, const char *attr_name, const void *buf, hid_t mem_type_id, int length);
61void write_string_attribute(hid_t handle, const char *attr_name, const char *buf);
62
63void read_scalar_attribute(hid_t handle, const char *attr_name, void *buf, hid_t mem_type_id);
64int read_scalar_attribute(hid_t handle, const char *attr_name, const char *alternative_name, void *buf, hid_t mem_type_id);
65void read_vector_attribute(hid_t handle, const char *attr_name, void *buf, hid_t mem_type_id, int length);
66
67#endif
void write_vector_attribute(hid_t handle, const char *attr_name, const void *buf, hid_t mem_type_id, int length)
Definition: hdf5_util.cc:636
hid_t my_H5Gopen(hid_t loc_id, const char *groupname)
Definition: hdf5_util.cc:311
herr_t my_H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t *start, const hsize_t *stride, const hsize_t *count, const hsize_t *block)
Definition: hdf5_util.cc:549
hid_t my_H5Dopen(hid_t file_id, const char *datasetname)
Definition: hdf5_util.cc:325
herr_t my_H5Dread(hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t xfer_plist_id, void *buf, const char *datasetname)
Definition: hdf5_util.cc:385
hid_t my_H5Fopen(const char *fname, unsigned int flags, hid_t fapl_id)
Definition: hdf5_util.cc:297
void my_create_HDF5_special_integer_types(void)
Definition: hdf5_util.cc:135
herr_t my_H5Gclose(hid_t group_id, const char *groupname)
Definition: hdf5_util.cc:457
hid_t Halfprec_memtype
Definition: hdf5_util.cc:29
size_t my_H5Tget_size(hid_t datatype_id)
Definition: hdf5_util.cc:564
herr_t my_H5Tclose(hid_t type_id)
Definition: hdf5_util.cc:535
herr_t my_H5Tset_size(hid_t datatype_id, size_t size)
Definition: hdf5_util.cc:578
herr_t my_H5Dset_extent(hid_t dset_id, const hsize_t size[])
Definition: hdf5_util.cc:336
void read_vector_attribute(hid_t handle, const char *attr_name, void *buf, hid_t mem_type_id, int length)
Definition: hdf5_util.cc:614
hid_t Int48_memtype
Definition: hdf5_util.cc:30
hid_t my_H5Gcreate(hid_t loc_id, const char *groupname, size_t size_hint)
Definition: hdf5_util.cc:174
herr_t my_H5Pclose(hid_t plist)
Definition: hdf5_util.cc:468
hid_t my_H5Screate_simple(int rank, const hsize_t *current_dims, const hsize_t *maximum_dims)
Definition: hdf5_util.cc:283
herr_t my_H5Fclose(hid_t file_id, const char *fname)
Definition: hdf5_util.cc:482
herr_t my_H5Dclose(hid_t dataset_id, const char *datasetname)
Definition: hdf5_util.cc:443
hid_t my_H5Aopen_name(hid_t loc_id, const char *attr_name)
Definition: hdf5_util.cc:371
hid_t my_H5Dopen_if_existing(hid_t file_id, const char *datasetname)
Definition: hdf5_util.cc:352
herr_t my_H5Aread(hid_t attr_id, hid_t mem_type_id, void *buf, const char *attr_name, hssize_t size)
Definition: hdf5_util.cc:400
herr_t my_H5Aclose(hid_t attr_id, const char *attr_name)
Definition: hdf5_util.cc:429
hid_t my_H5Dcreate(hid_t loc_id, const char *datasetname, hid_t type_id, hid_t space_id, hid_t dcpl_id)
Definition: hdf5_util.cc:190
herr_t my_H5Sclose(hid_t dataspace_id, H5S_class_t type)
Definition: hdf5_util.cc:496
hid_t Int128_memtype
Definition: hdf5_util.cc:31
herr_t my_H5Awrite(hid_t attr_id, hid_t mem_type_id, const void *buf, const char *attr_name)
Definition: hdf5_util.cc:242
void write_scalar_attribute(hid_t handle, const char *attr_name, const void *buf, hid_t mem_type_id)
Definition: hdf5_util.cc:621
hid_t my_H5Fcreate(const char *fname, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
hid_t my_H5Screate(H5S_class_t type)
Definition: hdf5_util.cc:258
herr_t my_H5Dwrite(hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t xfer_plist_id, const void *buf, const char *datasetname)
Definition: hdf5_util.cc:206
hid_t my_H5Acreate(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id)
Definition: hdf5_util.cc:223
void read_scalar_attribute(hid_t handle, const char *attr_name, void *buf, hid_t mem_type_id)
Definition: hdf5_util.cc:589
hid_t my_H5Tcopy(hid_t type_id)
Definition: hdf5_util.cc:521
void my_create_HDF5_halfprec_handler(void)
Definition: hdf5_util.cc:121
void write_string_attribute(hid_t handle, const char *attr_name, const char *buf)
Definition: hdf5_util.cc:654