G2_read.cppΒΆ
An implementation cpp file containing functions for reading Gadget2 binary and HDF5 filetypes into a flexible and dynamically allocated object array.
Functions
- herr_t hdf5_error_handler(void * unused)
Function to act as custom simple error handler.
- Return
- HDF5 error status object
- void query_file_datasets(hid_t file, int * N_dsets_type)
Function to probe a HDF5 file and count the properties associated with each particle type.
- Parameters
- file -
target file
- N_dsets_type -
address of array in which to record the number of datasets for each particle type
- file -
- herr_t interrogate_object(hid_t loc_id, const char * name, void * N_dsets)
Function which prints the label of any discovered data structure and counts any properties which may be smoothed.
- Return
- HDF5 error status object
- Parameters
- loc_id -
datasest location within HDF5 file
- name -
character array in which discovered dataset label is stored
- N_dsets -
address of integer counter which is incremented when a new property is discovered
- loc_id -
- void read_file_datasets(hid_t file, int * dset_it)
Function to control looping over desired data to be read from HDF5 file.
- Parameters
- file -
target file
- dset_it -
address of array in which to record the number of datasets read for each particle type
- file -
- herr_t read_object(hid_t loc_id, const char * name, void * dset_it)
Function to perform actual read of data from HDF5 file.
- Return
- HDF5 error status object
- Parameters
- loc_id -
datasest location within HDF5 file
- name -
character array in which discovered dataset label is stored
- dset_it -
address of integer counter which is incremented when a property is read - extra 7th entry holds current particle type
- loc_id -
- void G2_read(const char * fName, int * npart, int mode)
Variables
- hid_t file
HDF5 file object.
- DynamicArray< ParticleData > P
main array of particle data
- DynamicArray< ParticleProperty > props
array of discovered particles properties available for smoothing
- int max_N_dsets
highest number of datasets (properties) on any given particle type
- int tot_N_dsets
total number of datasets (properties)
- int N_dsets_type[6]
number of datasets (properties) by particle type