1- #ifndef H5FILEINFO_H
2- #define H5FILEINFO_H
31/* ********************************************************************
4- * @file h5fileinfo .h
2+ * @file h5_reader .h
53 *
6- * @brief header file of HydroData main class and helper class \
7- * H5FileInfo.
4+ * @brief HDF5 reader for hydrodynamic data (HydroData and H5FileInfo).
5+ *
6+ * This header provides the public API for reading BEMIO-formatted HDF5
7+ * hydrodynamic data files. HydroData holds the parsed coefficients and
8+ * H5FileInfo handles file loading.
89 *********************************************************************/
9- // TODO: clean up include statements
10- #pragma once
10+ # ifndef HYDROC_IO_H5_READER_H
11+ #define HYDROC_IO_H5_READER_H
1112
1213#include < limits>
1314#include < optional>
@@ -29,9 +30,7 @@ class H5File;
2930
3031class H5FileInfo ;
3132
32- // TODO separate these 2 classes into 2 files? (and corresponding .cpp)
33-
34- // contains "chunked" data from the h5 file, generated from H5FileInfor class
33+ // contains "chunked" data from the h5 file, generated from H5FileInfo class
3534class HydroData {
3635 public:
3736 struct BodyInfo {
@@ -45,7 +44,6 @@ class HydroData {
4544 Eigen::MatrixXd lin_matrix;
4645 Eigen::MatrixXd inf_added_mass;
4746 Eigen::Tensor<double , 3 > rirf_matrix;
48- // Eigen::Tensor<double, 3> radiation_damping_matrix;
4947 };
5048 struct SimulationParameters {
5149 std::string h5_file_name;
@@ -59,15 +57,11 @@ class HydroData {
5957 Eigen::Tensor<double , 3 > excitation_phase_matrix;
6058 };
6159 struct IrregularWaveInfo {
62- // Eigen::Tensor<double,3> excitation_re_matrix;
63- // Eigen::Vector3i re_dims;
64- // Eigen::Tensor<double, 3> excitation_im_matrix;
65- // Eigen::Vector3i im_dims;
6660 Eigen::VectorXd excitation_irf_time;
67- Eigen::MatrixXd excitation_irf_matrix; // TODO needs to be tensor?
61+ Eigen::MatrixXd excitation_irf_matrix;
6862
6963 // see std::optional documentation for how to use
70- std::optional<Eigen::MatrixXd> excitation_irf_resampled; // TODO needs to be tensor?
64+ std::optional<Eigen::MatrixXd> excitation_irf_resampled;
7165 std::optional<Eigen::MatrixXd> excitation_irf_time_resampled;
7266 };
7367
@@ -160,8 +154,8 @@ class HydroData {
160154 */
161155 Eigen::VectorXd GetCBVector (int b) const { return body_data_[b].cb ; }
162156
163- double GetExcitationIRFVal (int b, int dof, int s) const ; // TODO if this isn't used get rid of it
164- Eigen::MatrixXd GetExcitationIRF (int b) const ; // TODO if this isn't used get rid of it
157+ double GetExcitationIRFVal (int b, int dof, int s) const ;
158+ Eigen::MatrixXd GetExcitationIRF (int b) const ;
165159
166160 // things that are the same no matter the body, don't need body argument
167161 /* *
@@ -225,11 +219,14 @@ class HydroData {
225219 std::vector<IrregularWaveInfo>& GetIrregularWaveInfos () { return irreg_wave_data_; }
226220};
227221
228- // TODO change name to LoadH5File or ReadH5File or H5Init or something similar to give better description of
229- // functionality used only to initialize everything in HydroData from the h5 file
222+ /* *
223+ * @brief HDF5 file reader for hydrodynamic data.
224+ *
225+ * Reads BEMIO-formatted HDF5 files and produces a HydroData object.
226+ */
230227class H5FileInfo {
231228 public:
232- bool printed = false ; // TODO remove this, dont use here
229+ bool printed = false ;
233230
234231 /* *
235232 * @brief prepares for h5 file reading, checks file exists.
@@ -257,7 +254,7 @@ class H5FileInfo {
257254 *
258255 * @return newly initialized HydroData object
259256 */
260- HydroData ReadH5Data (); // TODO: eventually pass user input struct here? instead of making it in function?
257+ HydroData ReadH5Data ();
261258
262259 private:
263260 std::string h5_file_name_;
@@ -299,7 +296,7 @@ class H5FileInfo {
299296 * @param[in] data_name data name within file to extract value from
300297 * @param[out] var variable to be set from h5 info
301298 */
302- void Init3D (H5::H5File& file, std::string data_name, Eigen::Tensor<double , 3 >& var /* , std::vector<int>& dims */ );
299+ void Init3D (H5::H5File& file, std::string data_name, Eigen::Tensor<double , 3 >& var);
303300
304301 /* *
305302 * @brief helper function for readH5Data() to remove the middle index of 3D data if that index is 1.
@@ -314,4 +311,4 @@ class H5FileInfo {
314311 Eigen::MatrixXd SqueezeMid (Eigen::Tensor<double , 3 >& to_be_squeezed);
315312};
316313
317- #endif
314+ #endif // HYDROC_IO_H5_READER_H
0 commit comments