generate_vtk_output.VTKOutput Class Reference
|
Kynema API
A flexible multibody structural dynamics code for wind turbines
|
Loading...
Searching...
No Matches
generate_vtk_output.VTKOutput Class Reference
Public Member Functions | |
| __init__ (self, str netcdf_path, str connectivity_path) | |
| generate_visualization (self, int timestep, str output_dir, int stride) | |
| visualize_all_timesteps (self, str output_dir, int stride) | |
Public Attributes | |
| netcdf_path | |
| data | |
| mesh_connectivity | |
| num_nodes | |
| num_timesteps | |
Protected Member Functions | |
| _load_mesh_connectivity (self, str connectivity_path) | |
| List[Dict[str, List[float]]] | _extract_node_data_at_timestep (self, int timestep, Optional[List[int]] node_indices=None) |
| _add_node_data_to_vtk_object (self, vtk.vtkObject vtk_object, List[Dict[str, List[float]]] nodes) | |
| _add_beams_to_grid (self, grid, cell_types, element_ids, element_type_names) | |
| _add_masses_to_grid (self, grid, cell_types, element_ids, element_type_names) | |
| _add_springs_to_grid (self, grid, cell_types, element_ids, element_type_names) | |
| _add_constraints_to_grid (self, grid, cell_types, element_ids, element_type_names) | |
Detailed Description
Class to generate VTK files from Kynema (NetCDF-based) outputs and mesh connectivity (YAML-based).
Constructor & Destructor Documentation
◆ __init__()
| generate_vtk_output.VTKOutput.__init__ | ( | self, | |
| str | netcdf_path, | ||
| str | connectivity_path | ||
| ) |
Initializes the visualizer with the path to the NetCDF file and mesh connectivity file.
Args:
netcdf_path (str): Path to the NetCDF output file
connectivity_path (str): Path to the mesh connectivity YAML file
Member Function Documentation
◆ _add_beams_to_grid()
|
protected |
Adds beam elements to the unstructured grid. Represented as polyline cells.
Args:
grid (vtk.vtkUnstructuredGrid): Grid to add beams to
cell_types (Dict[int, int]): Dictionary to track cell types
element_ids (Dict[int, int]): Dictionary to track original element IDs
element_type_names (Dict[int, str]): Dictionary to track element type names
◆ _add_constraints_to_grid()
|
protected |
Adds constraint elements to the unstructured grid. Represented as line cells.
Args:
grid (vtk.vtkUnstructuredGrid): Grid to add constraints to
cell_types (Dict[int, int]): Dictionary to track cell types
element_ids (Dict[int, int]): Dictionary to track original element IDs
element_type_names (Dict[int, str]): Dictionary to track element type names
◆ _add_masses_to_grid()
|
protected |
Adds mass elements to the unstructured grid. Represented as vertices.
Args:
grid (vtk.vtkUnstructuredGrid): Grid to add masses to
cell_types (Dict[int, int]): Dictionary to track cell types
element_ids (Dict[int, int]): Dictionary to track original element IDs
element_type_names (Dict[int, str]): Dictionary to track element type names
◆ _add_node_data_to_vtk_object()
|
protected |
Adds common node data to a VTK object (polydata or unstructured grid).
Following data are added to the VTK object:
- Orientation (as 3x3 rotation matrix)
- Velocity (as 6x1 vector)
- Acceleration (as 6x1 vector)
Args:
vtk_object: VTK object to add data to
nodes: List of node data dictionaries
◆ _add_springs_to_grid()
|
protected |
Adds spring elements to the unstructured grid. Represented as line cells.
Args:
grid (vtk.vtkUnstructuredGrid): Grid to add springs to
cell_types (Dict[int, int]): Dictionary to track cell types
element_ids (Dict[int, int]): Dictionary to track original element IDs
element_type_names (Dict[int, str]): Dictionary to track element type names
◆ _extract_node_data_at_timestep()
|
protected |
Extracts node data for a specific timestep and returns a list of Kynema's NodeData-like structures.
Node data contains the following components:
- Position: x_x, x_y, x_z, x_w, x_i, x_j, x_k
- Velocity: v_x, v_y, v_z, v_i, v_j, v_k
- Acceleration: a_x, a_y, a_z, a_i, a_j, a_k
- Force (if available): f_x, f_y, f_z
- Moment (if available): f_i, f_j, f_k
- Deformation (if available): deformation_x, deformation_y, deformation_z
Args:
timestep (int): The timestep to extract node data from
node_indices (Optional[List[int]]):
If provided, only extract data for these specific node indices.
If None, extract data for all nodes.
Returns:
list[dict]: A list of NodeData-like structures (dicts)
◆ _load_mesh_connectivity()
|
protected |
Loads mesh connectivity information from a YAML file.
Args:
connectivity_path (str): Path to the connectivity YAML file
◆ generate_visualization()
| generate_vtk_output.VTKOutput.generate_visualization | ( | self, | |
| int | timestep, | ||
| str | output_dir, | ||
| int | stride | ||
| ) |
Generates visualization for the specified timestep based on mesh connectivity.
This method automatically determines what elements to create based on the
available connectivity data.
Args:
timestep (int): Timestep to visualize
output_dir (str): Directory to save the output files
◆ visualize_all_timesteps()
| generate_vtk_output.VTKOutput.visualize_all_timesteps | ( | self, | |
| str | output_dir, | ||
| int | stride | ||
| ) |
Generates visualization for all timesteps.
Args:
output_dir (str): Directory to save the output files
Member Data Documentation
◆ data
| generate_vtk_output.VTKOutput.data |
◆ mesh_connectivity
| generate_vtk_output.VTKOutput.mesh_connectivity |
◆ netcdf_path
| generate_vtk_output.VTKOutput.netcdf_path |
◆ num_nodes
| generate_vtk_output.VTKOutput.num_nodes |
◆ num_timesteps
| generate_vtk_output.VTKOutput.num_timesteps |
The documentation for this class was generated from the following file:
- /home/runner/work/kynema/kynema/kynema/src/viz/generate_vtk_output.py
Generated by