NodeStateWriter Class Reference
|
Kynema API
A flexible multibody structural dynamics code for wind turbines
|
Loading...
Searching...
No Matches
kynema::util::NodeStateWriter Class Reference
Class for writing Kynema nodal state data to NetCDF-based output files. More...
#include <node_state_writer.hpp>
Public Member Functions | |
| NodeStateWriter (const std::string &file_path, bool create, size_t num_nodes, const std::vector< std::string > &enabled_state_prefixes={"x", "u", "v", "a", "f"}, size_t buffer_size=kDefaultBufferSize) | |
| Constructor to create a NodeStateWriter object. | |
| ~NodeStateWriter () | |
| Destructor to flush any remaining buffered data. | |
| NodeStateWriter (const NodeStateWriter &)=delete | |
| NodeStateWriter & | operator= (const NodeStateWriter &)=delete |
| NodeStateWriter (NodeStateWriter &&)=delete | |
| NodeStateWriter & | operator= (NodeStateWriter &&)=delete |
| void | WriteStateDataAtTimestep (size_t timestep, const std::string &component_prefix, const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &z, const std::vector< double > &i, const std::vector< double > &j, const std::vector< double > &k, const std::vector< double > &w=std::vector< double >()) |
| Writes state data for a specific timestep. | |
| const NetCdfFile & | GetFile () const |
| Get the NetCDF file object. | |
| size_t | GetNumNodes () const |
| Get the number of nodes with state data in output file. | |
| void | Close () |
| Manually flush and close the underlying NetCDF file. | |
| void | Open () |
| Manually (re)open the underlying NetCDF file. | |
Static Public Attributes | |
| static constexpr size_t | kDefaultBufferSize {0} |
| Default buffer size (number of timesteps to accumulate before auto-flush, 0 = no buffering) | |
Detailed Description
Class for writing Kynema nodal state data to NetCDF-based output files.
This class handles the writing of nodal state data for Kynema simulations to NetCDF format. It manages the output of:
- Position (x, y, z, w, i, j, k)
- Displacement (x, y, z, w, i, j, k)
- Velocity (x, y, z, i, j, k)
- Acceleration (x, y, z, i, j, k)
- Force (x, y, z, i, j, k)
- Note
- Each item is stored as a separate variable in the NetCDF file, organized by timestep and node index. The file structure uses an unlimited time dimension to allow for continuous writing of timesteps during simulation.
- The class includes buffering to improve write performance by batching multiple timesteps together before writing to disk.
Constructor & Destructor Documentation
◆ NodeStateWriter() [1/3]
| kynema::util::NodeStateWriter::NodeStateWriter | ( | const std::string & | file_path, |
| bool | create, | ||
| size_t | num_nodes, | ||
| const std::vector< std::string > & | enabled_state_prefixes = {"x", "u", "v", "a", "f"}, |
||
| size_t | buffer_size = kDefaultBufferSize |
||
| ) |
Constructor to create a NodeStateWriter object.
- Parameters
-
file_path Path to the output NetCDF file create Whether to create a new file or open an existing one num_nodes Number of nodes in the simulation enabled_state_prefixes Vector of state component prefixes to enable for writing (default: all state components i.e. {"x", "u", "v", "a", "f"}) buffer_size Number of timesteps to accumulate before auto-flush (0 = no buffering)
◆ ~NodeStateWriter()
| kynema::util::NodeStateWriter::~NodeStateWriter | ( | ) |
Destructor to flush any remaining buffered data.
◆ NodeStateWriter() [2/3]
|
delete |
◆ NodeStateWriter() [3/3]
|
delete |
Member Function Documentation
◆ Close()
| void kynema::util::NodeStateWriter::Close | ( | ) |
Manually flush and close the underlying NetCDF file.
◆ GetFile()
| const NetCdfFile & kynema::util::NodeStateWriter::GetFile | ( | ) | const |
Get the NetCDF file object.
◆ GetNumNodes()
| size_t kynema::util::NodeStateWriter::GetNumNodes | ( | ) | const |
Get the number of nodes with state data in output file.
◆ Open()
| void kynema::util::NodeStateWriter::Open | ( | ) |
Manually (re)open the underlying NetCDF file.
◆ operator=() [1/2]
|
delete |
◆ operator=() [2/2]
|
delete |
◆ WriteStateDataAtTimestep()
| void kynema::util::NodeStateWriter::WriteStateDataAtTimestep | ( | size_t | timestep, |
| const std::string & | component_prefix, | ||
| const std::vector< double > & | x, | ||
| const std::vector< double > & | y, | ||
| const std::vector< double > & | z, | ||
| const std::vector< double > & | i, | ||
| const std::vector< double > & | j, | ||
| const std::vector< double > & | k, | ||
| const std::vector< double > & | w = std::vector<double>() |
||
| ) |
Writes state data for a specific timestep.
- Parameters
-
timestep Current timestep index component_prefix Prefix for the component x Data for component 1 y Data for component 2 z Data for component 3 i Data for component 4 j Data for component 5 k Data for component 6 w Data for component 7 (optional, only used for position and displacement)
Member Data Documentation
◆ kDefaultBufferSize
|
staticconstexpr |
Default buffer size (number of timesteps to accumulate before auto-flush, 0 = no buffering)
The documentation for this class was generated from the following files:
- /home/runner/work/kynema/kynema/kynema/src/utilities/netcdf/node_state_writer.hpp
- /home/runner/work/kynema/kynema/kynema/src/utilities/netcdf/node_state_writer.cpp
Generated by