StellarCollapseEos.hpp
Go to the documentation of this file.
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 /// \file
5 /// Defines class h5::StellarCollapseEos
6 
7 #pragma once
8 
9 #include <hdf5.h>
10 #include <string>
11 #include <vector>
12 
13 #include "DataStructures/BoostMultiArray.hpp" // IWYU pragma: keep
14 #include "IO/H5/Object.hpp"
15 #include "IO/H5/OpenGroup.hpp"
16 
17 // IWYU pragma: no_include <boost/multi_array.hpp>
18 
19 namespace h5 {
20 /*!
21  * \ingroup HDF5Group
22  * \brief Reads in tabulated equation of state file from
23  * [stellarcollapse.org](https://stellarcollapse.org)
24  *
25  * Reads in H5 file containing data for tabulated equation of state.
26  * Contains functions to obtain thermodynamic quantities from the file,
27  * stored as either rank-1 or rank-3 datasets.
28  *
29  * It is assumed that the file is in the format of the
30  * [SRO (Schneider, Roberts, Ott 2017) Equation of State files](https://
31  * stellarcollapse.org/SROEOS)
32  *
33  * The description of each dataset in the file can be found
34  * [here](https://bitbucket.org/andschn/sroeos/src/master/
35  * User_Guide/User_Guide.pdf?fileviewer=file-view-default)
36  *
37  */
39  public:
40  /// \cond
41  // The root-level HDF5 group in the SRO Equation of State files does not
42  // have an extension in its group name
43  static std::string extension() noexcept { return ""; }
44 
45  StellarCollapseEos(bool exists, detail::OpenGroup&& group, hid_t location,
46  const std::string& /*name*/) noexcept;
47 
48  StellarCollapseEos(const StellarCollapseEos& /*rhs*/) = delete;
49  StellarCollapseEos& operator=(const StellarCollapseEos& /*rhs*/) = delete;
50  StellarCollapseEos(StellarCollapseEos&& /*rhs*/) noexcept = delete;
51  StellarCollapseEos& operator=(StellarCollapseEos&& /*rhs*/) noexcept = delete;
52 
53  ~StellarCollapseEos() override = default;
54  /// \endcond
55 
56  /*!
57  * \ingroup HDF5Group
58  * \brief reads a rank-0 dataset (contains only one element)
59  */
60  template <typename T>
61  T get_scalar_dataset(const std::string& dataset_name) const noexcept;
62 
63  /*!
64  * \ingroup HDF5Group
65  * \brief reads a dataset with elements along 1 dimension
66  */
67  std::vector<double> get_rank1_dataset(const std::string& dataset_name) const
68  noexcept;
69 
70  /*!
71  * \ingroup HDF5Group
72  * \brief reads a dataset with elements along 3 dimensions
73  */
74  boost::multi_array<double, 3> get_rank3_dataset(
75  const std::string& dataset_name) const noexcept;
76 
77  private:
78  detail::OpenGroup root_group_;
79  detail::OpenGroup group_;
80 };
81 } // namespace h5
Defines class OpenGroup for opening groups in HDF5.
Contains functions and classes for manipulating HDF5 files.
Definition: AccessType.cpp:10
Defines class h5::Object abstract base class.
std::vector< double > get_rank1_dataset(const std::string &dataset_name) const noexcept
reads a dataset with elements along 1 dimension
Abstract base class representing an object in an HDF5 file.
Definition: Object.hpp:14
T get_scalar_dataset(const std::string &dataset_name) const noexcept
reads a rank-0 dataset (contains only one element)
boost::multi_array< double, 3 > get_rank3_dataset(const std::string &dataset_name) const noexcept
reads a dataset with elements along 3 dimensions
Reads in tabulated equation of state file from stellarcollapse.org
Definition: StellarCollapseEos.hpp:38