group_particles
Loading...
Searching...
No Matches
callback_utils_meta.hpp
Go to the documentation of this file.
1
7#ifndef CALLBACK_UTILS_META_HPP
8#define CALLBACK_UTILS_META_HPP
9
10#include "callback.hpp"
11#include "hdf5_utils.hpp"
12
13namespace CallbackUtils {
14
17namespace meta
18{
19
24 template<typename AFields, uint8_t PartType>
25 struct Illustris :
26 virtual public Callback<AFields>
27 {// {{{
28 void read_grp_meta (size_t chunk_idx, std::shared_ptr<H5::H5File> fptr,
29 size_t &Ngroups) const override final
30 {
31 auto header = fptr->openGroup("/Header");
32 Ngroups = hdf5Utils::read_scalar_attr<int32_t,size_t>(header, "Ngroups_ThisFile");
33 header.close();
34 }
35
36 void read_prt_meta (size_t chunk_idx, std::shared_ptr<H5::H5File> fptr,
37 coord_t &Bsize, size_t &Npart) const override final
38 {
39 auto header = fptr->openGroup("/Header");
40 Bsize = hdf5Utils::read_scalar_attr<double,coord_t>(header, "BoxSize");
41 Npart = hdf5Utils::read_vector_attr<int32_t,size_t>(header, "NumPart_ThisFile", PartType);
42 header.close();
43 }
44 };// }}}
45
53 template<typename AFields, uint8_t PartType>
54 struct SIMBA :
55 virtual public Callback<AFields>
56 {// {{{
57 void read_grp_meta (size_t chunk_idx, std::shared_ptr<H5::H5File> fptr,
58 size_t &Ngroups) const override final
59 {
60 auto header = fptr->openGroup("/Header");
61 Ngroups = hdf5Utils::read_scalar_attr<int32_t,size_t>(header, "Ngroups_ThisFile");
62 header.close();
63 }
64
65 void read_prt_meta (size_t chunk_idx, std::shared_ptr<H5::H5File> fptr,
66 coord_t &Bsize, size_t &Npart) const override final
67 {
68 auto header = fptr->openGroup("/Header");
69 Bsize = hdf5Utils::read_scalar_attr<double,coord_t>(header, "BoxSize");
70 Npart = hdf5Utils::read_vector_attr<uint32_t,size_t>(header, "NumPart_ThisFile", PartType);
71 header.close();
72 }
73 };// }}}
74
79 template<typename AFields>
80 struct Gadget :
81 virtual public Callback<AFields>,
82 public Illustris<AFields, 1>
83 { };
84
85} // namespace meta
86
87} // namespace CallbackUtils
88
89#endif // CALLBACK_UTILS_META_HPP
Contains the abstract base class that the user should subclass from in order to define the desired fu...
float coord_t
Internal coordinate type.
Definition fields.hpp:28
some utility functions to read attributes from hdf5 files
contains classes that implement parts of the Callback base.
Definition callback_utils.hpp:35
The abstract base class the user should inherit from.
Definition callback.hpp:32
retrieves meta-data from a Gadget-type simulation.
Definition callback_utils_meta.hpp:83
retrieves meta-data from an Illustris-type simulation.
Definition callback_utils_meta.hpp:27
retrieves meta-data from a SIMBA-type simulation.
Definition callback_utils_meta.hpp:56