ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
Hdf5Logger.h
1/******************************************************************************
2* Copyright (c) ATTX LLC 2024. All Rights Reserved.
3*
4* This software and associated documentation (the "Software") are the
5* proprietary and confidential information of ATTX, LLC. The Software is
6* furnished under a license agreement between ATTX and the user organization
7* and may be used or copied only in accordance with the terms of the agreement.
8* Refer to 'license/attx_license.adoc' for standard license terms.
9*
10* EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
11* INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION
12* REGULATIONS (EAR99). No part of the Software may be used, reproduced, or
13* transmitted in any form or by any means, for any purpose, without the express
14* written permission of ATTX, LLC.
15******************************************************************************/
16/*
17HDF5 Logger header file
18
19Author: Alex Reynolds
20*/
21#ifndef HDF5_LOGGER_H
22#define HDF5_LOGGER_H
23
24#include <vector>
25
26#include "highfive/highfive.hpp"
27#include "logging/SimLogger.h"
28
29namespace modelspace {
30
31 /// @brief Class for logging to HDF5
32 ///
33 /// The CSV logger is a class that inherits from the base logger
34 /// class and manually configures it to write to CSV.
35 class Hdf5Logger : public clockwerk::SimLogger {
36 public:
37 /// Constructor for CSV logger -- wraps around logger constructor
38 Hdf5Logger(clockwerk::Executive &exec, const std::string &filename="output.h5", unsigned int buffer_size=1);
39 ~Hdf5Logger();
40
41 /// @brief Function to close down the file -- logs remaining buffered data
42 /// and closes
43 int close();
44 protected:
45 /// @brief Function to create an HDF5 file for logging
46 int _createSetupFile();
47
48 /// @brief Function to write buffered data to HDF5 file
49 int _writeToFile();
50
51 /// High Five variables for writing HDF5 to file
53 HighFive::DataSpace* _dataspace;
54 HighFive::DataSetCreateProps _props;
55 std::vector<HighFive::DataSet> _datasets;
56
57 /// Index to track where we're writing to our dataset
58 unsigned long long _l_start_idx;
59 unsigned long long _l_end_idx;
60 };
61
62}
63
64#endif
Central control mechanism to run simulations and software.
Definition Executive.h:43
Class for logging data to a file.
Definition SimLogger.h:67
Class for logging to HDF5.
Definition Hdf5Logger.h:35
HighFive::File * _file
High Five variables for writing HDF5 to file.
Definition Hdf5Logger.h:52
int _writeToFile()
Function to write buffered data to HDF5 file.
Definition Hdf5Logger.cpp:143
unsigned long long _l_start_idx
Index to track where we're writing to our dataset.
Definition Hdf5Logger.h:58
Hdf5Logger(clockwerk::Executive &exec, const std::string &filename="output.h5", unsigned int buffer_size=1)
Constructor for CSV logger – wraps around logger constructor.
Definition Hdf5Logger.cpp:24
int close()
Function to close down the file – logs remaining buffered data and closes.
Definition Hdf5Logger.cpp:223
int _createSetupFile()
Function to create an HDF5 file for logging.
Definition Hdf5Logger.cpp:64
Class to propagate CR3BP dynamics in characteristic units.
Definition ConfigurationWriter.cpp:18