windio Namespace Reference
Kynema API
A flexible multibody structural dynamics code for wind turbines
|
Loading...
Searching...
No Matches
Classes | |
class | Field |
class | Schema |
class | Struct |
Functions | |
str | modify_name (str snake_str) |
str | modify_variable_name (str snake_str) |
None | build_structs (Struct s, Schema struct_schema, dict definition_map, dict[str, Struct] struct_map) |
tuple[str, Schema] | get_ref (str ref, Definitions definitions, dict[str, Struct] struct_map, str path) |
None | set_type (Field field, Schema schema, dict definition_map, dict[str, Struct] struct_map) |
None | build_type (Field field, Schema schema, dict definition_map, dict[str, Struct] struct_map) |
str | set_parse_function (Field field) |
str | build_parse_function (Struct s) |
main () | |
Variables | |
Definitions = dict[str, yaml.Node] | |
dict | definitions = {} |
str | FILE_HEADER |
str | FILE_FOOTER |
Function Documentation
◆ build_parse_function()
str windio.build_parse_function | ( | Struct | s | ) |
Builds the parse function for the struct Args: s (Struct): The struct to build the parse function for Returns: str: The parse function as a string
◆ build_structs()
None windio.build_structs | ( | Struct | s, |
Schema | struct_schema, | ||
dict | definition_map, | ||
dict[str, Struct] | struct_map | ||
) |
Builds the struct based on the schema Args: s (Struct): The struct to build struct_schema (Schema): The schema of the struct definition_map (dict): The definitions in the schema struct_map (dict[str, Struct]): The structs that have been built Returns: None
◆ build_type()
None windio.build_type | ( | Field | field, |
Schema | schema, | ||
dict | definition_map, | ||
dict[str, Struct] | struct_map | ||
) |
Determines the type of a field based on the schema and builds the Struct/Class if necessary. - If the field is an object, a new Struct is created for it - If the field is a string, the type is set to std::string - If the field is a number, the type is set to double - If the field is an integer, the type is set to int - If the field is a boolean, the type is set to bool - If the field is an array, the type is set to the item type followed by [] Args: field (Field): The field to build schema (Schema): The schema of the field definition_map (dict): The definitions present in the schema struct_map (dict[str, Struct]): The structs that have already been built based on the schema Returns: None
◆ get_ref()
tuple[str, Schema] windio.get_ref | ( | str | ref, |
Definitions | definitions, | ||
dict[str, Struct] | struct_map, | ||
str | path | ||
) |
◆ main()
windio.main | ( | ) |
Main function to build the structs from the schema
◆ modify_name()
str windio.modify_name | ( | str | snake_str | ) |
Converts a snake_case string to PascalCase string. Removes spaces and replaces forward slashes with 'DividedBy' Args: snake_str (str): The snake_case string to convert Returns: str: The camelCase string
◆ modify_variable_name()
str windio.modify_variable_name | ( | str | snake_str | ) |
◆ set_parse_function()
str windio.set_parse_function | ( | Field | field | ) |
Sets the parse function for the field based on the type of the field Args: field (Field): The field to set the parse function for Returns: str: The parse function as a string
◆ set_type()
None windio.set_type | ( | Field | field, |
Schema | schema, | ||
dict | definition_map, | ||
dict[str, Struct] | struct_map | ||
) |
Sets the type of a field based on the schema type Args: field (Field): The field to set the type of schema (Schema): The schema of the field definition_map (dict): The definitions present in the schema struct_map (dict[str, Struct]): The structs that have already been built based on the schema Returns: None
Variable Documentation
◆ Definitions
windio.Definitions = dict[str, yaml.Node] |
◆ definitions
dict windio.definitions = {} |
◆ FILE_FOOTER
str windio.FILE_FOOTER |
Initial value:
1= """
2struct WindIO {
3 Turbine turbine;
4 WindIO(std::string file_path) {
5 const YAML::Node config = YAML::Load(file_path);
6 turbine.parse(config);
7 }
8};
9
10} // namespace kynema::wind_io
11"""
◆ FILE_HEADER
str windio.FILE_HEADER |
Initial value:
1= """
2#pragma once
3
4#include <string>
5#include <variant>
6#include <vector>
7
8#include <yaml-cpp/yaml.h>
9
10namespace kynema::wind_io {
11
12"""
Generated by