GSI_Toolbox 1.0.0
A toolbox for Gas-Surface Interaction simulations
|
Class representing a geometric structure composed of vertices, normals, and properties. More...
#include <Geometry.h>
Public Member Functions | |
Geometry () | |
Default constructor for Geometry class. | |
Geometry (std::string filename) | |
Constructor that loads geometry data from a binary STL file. | |
~Geometry () | |
Destructor for Geometry class. | |
unsigned int | get_num_vertices () const |
Get the number of vertices (triangles) in the geometry. | |
void | shift (T *offset) |
Shift the geometry by an offset. | |
void | shift (Matrix< T > offset) |
Shift the geometry by a Matrix offset. | |
void | scale (T factor) |
Scale the geometry by a factor. | |
void | rotate (int axis, T angle) |
Rotate the geometry around a specific axis. | |
void | add_GSI_property (const char *property_name, T value) |
Add a scalar GSI property to the geometry. | |
void | add_GSI_property (const char *property_name, const Matrix< T > &values) |
Add a matrix GSI property to the geometry. | |
void | add_surface_property (const char *property_name, T value) |
Add a scalar surface property to the geometry. | |
void | add_surface_property (const char *property_name, const Matrix< T > &values) |
Add a matrix surface property to the geometry. | |
void | set_A_ref (T A_ref) |
Set the reference area for the geometry. | |
void | set_c_ref (T c_ref) |
Set the reference speed for the geometry. | |
void | compute_bounding_box () |
Compute the bounding box for the geometry. | |
T | get_A_ref () |
Get the reference area. | |
T | get_c_ref () |
Get the reference speed. | |
T | compute_area (unsigned int index) |
Compute the area of a specific triangle in the geometry. | |
void | print () |
Print the geometry details, including vertices, normals, and properties. | |
Matrix< T > & | get_p1_x () |
Matrix< T > & | get_p1_y () |
Matrix< T > & | get_p1_z () |
Matrix< T > & | get_p2_x () |
Matrix< T > & | get_p2_y () |
Matrix< T > & | get_p2_z () |
Matrix< T > & | get_p3_x () |
Matrix< T > & | get_p3_y () |
Matrix< T > & | get_p3_z () |
Matrix< T > & | get_norm_x () |
Matrix< T > & | get_norm_y () |
Matrix< T > & | get_norm_z () |
Matrix< T > & | get_GSI_property (int index) |
Get a GSI property by index. | |
char * | get_GSI_property_name (int index) |
Get the name of a GSI property by index. | |
Matrix< T > | get_bounding_box () |
Get the bounding box of the geometry. | |
Matrix< T > | get_center () |
Get the center of the bounding box of the geometry. | |
std::vector< Matrix< T > > & | get_GSI_properties () |
Get all GSI properties. | |
std::vector< const char * > & | get_GSI_property_names () |
Get all GSI property names. | |
std::vector< Matrix< T > > & | get_surface_properties () |
Get all surface properties. | |
std::vector< const char * > & | get_surface_property_names () |
Get all surface property names. | |
Class representing a geometric structure composed of vertices, normals, and properties.
This class is used to manage 3D geometries, typically loaded from STL files. It stores vertices, normals, gas-surface interaction (GSI) properties, and surface properties. The class provides methods for manipulating the geometry (shift, scale, rotate), adding properties, and calculating bounding boxes and areas.
T | Type of the numeric values used for geometry (e.g., float, double). |
Geometry< T >::Geometry | ( | ) |
Geometry< T >::Geometry | ( | std::string | filename | ) |
Constructor that loads geometry data from a binary STL file.
filename | The name of the STL file to load. |
This constructor reads an STL file, initializes the vertices, normals, and other properties, and computes the bounding box for the geometry.
filename | Name of the binary STL file to load. |
void Geometry< T >::add_GSI_property | ( | const char * | property_name, |
const Matrix< T > & | values ) |
Add a matrix GSI property to the geometry.
Adds a matrix GSI (Gas-Surface Interaction) property to the geometry.
property_name | The name of the GSI property. |
values | Matrix of values for the GSI property. |
This function adds a matrix of values as a GSI property to the list of GSI properties.
property_name | The name of the GSI property. |
values | Matrix of values for the GSI property. |
void Geometry< T >::add_GSI_property | ( | const char * | property_name, |
T | value ) |
Add a scalar GSI property to the geometry.
Adds a scalar GSI (Gas-Surface Interaction) property to the geometry.
property_name | The name of the GSI property. |
value | The scalar value to assign to the property. |
This function creates a GSI property with a scalar value and adds it to the list of GSI properties.
property_name | The name of the GSI property. |
value | Scalar value of the GSI property. |
void Geometry< T >::add_surface_property | ( | const char * | property_name, |
const Matrix< T > & | values ) |
Add a matrix surface property to the geometry.
Adds a matrix surface property to the geometry.
property_name | The name of the surface property. |
values | Matrix of values for the surface property. |
This function adds a matrix of values as a surface property to the list of surface properties.
property_name | The name of the surface property. |
values | Matrix of values for the surface property. |
void Geometry< T >::add_surface_property | ( | const char * | property_name, |
T | value ) |
Add a scalar surface property to the geometry.
Adds a scalar surface property to the geometry.
property_name | The name of the surface property. |
value | The scalar value to assign to the property. |
This function creates a surface property with a scalar value and adds it to the list of surface properties.
property_name | The name of the surface property. |
value | Scalar value of the surface property. |
T Geometry< T >::compute_area | ( | unsigned int | index | ) |
Compute the area of a specific triangle in the geometry.
Computes the area of a triangle at the specified index.
index | The index of the triangle. |
This function computes the area of the triangle at the specified index using the vertex coordinates.
index | Index of the triangle. |
void Geometry< T >::compute_bounding_box | ( | ) |
Compute the bounding box for the geometry.
Compute the bounding box of the geometry.
This method calculates the minimum and maximum coordinates of the vertices in all three dimensions and stores them in the bounding box matrix.
|
inline |
Get the reference area.
Get the bounding box of the geometry.
Returns the bounding box of the geometry.
This function provides the bounding box matrix, which contains the minimum and maximum coordinates in x, y, and z directions.
|
inline |
Get the reference speed.
Get the center of the bounding box of the geometry.
Get the center point of the geometry's bounding box.
Get all GSI properties.
Get a GSI property by index.
index | Index of the GSI property. |
|
inline |
Get the name of a GSI property by index.
index | Index of the GSI property. |
|
inline |
Get all GSI property names.
|
inline |
Get the number of vertices (triangles) in the geometry.
Get all surface properties.
|
inline |
Get all surface property names.
void Geometry< T >::print | ( | ) |
Print the geometry details, including vertices, normals, and properties.
Prints the details of the geometry, including vertices, normals, and properties.
This function outputs the details for each triangle in the geometry, such as the vertex coordinates (p1, p2, p3), normal vectors, GSI properties, and surface properties. Each triangle is printed with its corresponding properties.
void Geometry< T >::rotate | ( | int | axis, |
T | angle ) |
Rotate the geometry around a specific axis.
Rotates the geometry around the specified axis by the given angle.
axis | Axis of rotation (0 for x, 1 for y, 2 for z). |
angle | Angle of rotation in radians. |
This function rotates the vertices and normals of the geometry based on the given axis (0: x-axis, 1: y-axis, 2: z-axis) and angle (in radians). After the rotation, the bounding box is recomputed.
axis | The axis of rotation (0: x-axis, 1: y-axis, 2: z-axis). |
angle | The rotation angle (in radians). |
void Geometry< T >::scale | ( | T | factor | ) |
Scale the geometry by a factor.
factor | The scaling factor to apply. |
This method scales all vertices (p1, p2, p3) and the bounding box of the geometry by the given factor.
factor | The scaling factor to apply to the geometry. |
|
inline |
Set the reference area for the geometry.
A_ref | The reference area to set. |
|
inline |
Set the reference speed for the geometry.
c_ref | The reference speed to set. |
Shift the geometry by a Matrix offset.
Shift the geometry by an offset (Matrix version).
offset | Matrix representing x, y, z offset values. |
This method shifts the positions of all vertices (p1, p2, p3) using a Matrix that contains x, y, z offsets. It also updates the bounding box of the geometry.
offset | Matrix containing the offset values for x, y, and z. |
void Geometry< T >::shift | ( | T * | offset | ) |
Shift the geometry by an offset.
Shift the geometry by an offset (array version).
offset | Array containing x, y, z offset values. |
This method shifts the positions of all vertices (p1, p2, p3) by a specified x, y, z offset. It also updates the bounding box of the geometry.
offset | Array containing the offset values for x, y, and z. |