GSI_Toolbox 1.0.0
A toolbox for Gas-Surface Interaction simulations
Loading...
Searching...
No Matches
Geometry< T > Class Template Reference

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.
 
get_A_ref ()
 Get the reference area.
 
get_c_ref ()
 Get the reference speed.
 
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.
 

Detailed Description

template<typename T>
class Geometry< T >

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.

Template Parameters
TType of the numeric values used for geometry (e.g., float, double).

Constructor & Destructor Documentation

◆ Geometry() [1/2]

template<typename T >
Geometry< T >::Geometry ( )

Default constructor for Geometry class.

Default constructor for the Geometry class.

Initializes the geometry with zero vertices, and default values for reference area and speed.

Initializes the number of vertices to zero and sets default values for the reference area and speed.

◆ Geometry() [2/2]

template<typename T >
Geometry< T >::Geometry ( std::string filename)

Constructor that loads geometry data from a binary STL file.

Parameters
filenameThe 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.

Parameters
filenameName of the binary STL file to load.

◆ ~Geometry()

template<typename T >
Geometry< T >::~Geometry ( )

Destructor for Geometry class.

Destructor for the Geometry class.

Resets the number of vertices to zero.

Resets the number of vertices to zero, effectively clearing the geometry data.

Member Function Documentation

◆ add_GSI_property() [1/2]

template<typename T >
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.

Parameters
property_nameThe name of the GSI property.
valuesMatrix of values for the GSI property.

This function adds a matrix of values as a GSI property to the list of GSI properties.

Parameters
property_nameThe name of the GSI property.
valuesMatrix of values for the GSI property.

◆ add_GSI_property() [2/2]

template<typename T >
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.

Parameters
property_nameThe name of the GSI property.
valueThe 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.

Parameters
property_nameThe name of the GSI property.
valueScalar value of the GSI property.

◆ add_surface_property() [1/2]

template<typename T >
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.

Parameters
property_nameThe name of the surface property.
valuesMatrix of values for the surface property.

This function adds a matrix of values as a surface property to the list of surface properties.

Parameters
property_nameThe name of the surface property.
valuesMatrix of values for the surface property.

◆ add_surface_property() [2/2]

template<typename T >
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.

Parameters
property_nameThe name of the surface property.
valueThe 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.

Parameters
property_nameThe name of the surface property.
valueScalar value of the surface property.

◆ compute_area()

template<typename T >
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.

Parameters
indexThe index of the triangle.
Returns
The computed area of the triangle.

This function computes the area of the triangle at the specified index using the vertex coordinates.

Parameters
indexIndex of the triangle.
Returns
The computed area of the triangle.

◆ compute_bounding_box()

template<typename T >
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.

◆ get_A_ref()

template<typename T >
T Geometry< T >::get_A_ref ( )
inline

Get the reference area.

Returns
The reference area.

◆ get_bounding_box()

template<typename T >
Matrix< T > Geometry< T >::get_bounding_box ( )

Get the bounding box of the geometry.

Returns the bounding box of the geometry.

Returns
The bounding box matrix.

This function provides the bounding box matrix, which contains the minimum and maximum coordinates in x, y, and z directions.

Returns
Matrix<T> The bounding box of the geometry.

◆ get_c_ref()

template<typename T >
T Geometry< T >::get_c_ref ( )
inline

Get the reference speed.

Returns
The reference speed.

◆ get_center()

template<typename T >
Matrix< T > Geometry< T >::get_center ( )

Get the center of the bounding box of the geometry.

Get the center point of the geometry's bounding box.

Returns
A matrix representing the center of the bounding box.
Matrix representing the center coordinates of the bounding box.

◆ get_GSI_properties()

template<typename T >
std::vector< Matrix< T > > & Geometry< T >::get_GSI_properties ( )
inline

Get all GSI properties.

Returns
A vector of GSI property matrices.

◆ get_GSI_property()

template<typename T >
Matrix< T > & Geometry< T >::get_GSI_property ( int index)
inline

Get a GSI property by index.

Parameters
indexIndex of the GSI property.
Returns
The GSI property matrix.

◆ get_GSI_property_name()

template<typename T >
char * Geometry< T >::get_GSI_property_name ( int index)
inline

Get the name of a GSI property by index.

Parameters
indexIndex of the GSI property.
Returns
The name of the GSI property.

◆ get_GSI_property_names()

template<typename T >
std::vector< const char * > & Geometry< T >::get_GSI_property_names ( )
inline

Get all GSI property names.

Returns
A vector of GSI property names.

◆ get_num_vertices()

template<typename T >
unsigned int Geometry< T >::get_num_vertices ( ) const
inline

Get the number of vertices (triangles) in the geometry.

Returns
The number of vertices.

◆ get_surface_properties()

template<typename T >
std::vector< Matrix< T > > & Geometry< T >::get_surface_properties ( )
inline

Get all surface properties.

Returns
A vector of surface property matrices.

◆ get_surface_property_names()

template<typename T >
std::vector< const char * > & Geometry< T >::get_surface_property_names ( )
inline

Get all surface property names.

Returns
A vector of surface property names.

◆ print()

template<typename T >
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.

◆ rotate()

template<typename T >
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.

Parameters
axisAxis of rotation (0 for x, 1 for y, 2 for z).
angleAngle 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.

Parameters
axisThe axis of rotation (0: x-axis, 1: y-axis, 2: z-axis).
angleThe rotation angle (in radians).

◆ scale()

template<typename T >
void Geometry< T >::scale ( T factor)

Scale the geometry by a factor.

Parameters
factorThe scaling factor to apply.

This method scales all vertices (p1, p2, p3) and the bounding box of the geometry by the given factor.

Parameters
factorThe scaling factor to apply to the geometry.

◆ set_A_ref()

template<typename T >
void Geometry< T >::set_A_ref ( T A_ref)
inline

Set the reference area for the geometry.

Parameters
A_refThe reference area to set.

◆ set_c_ref()

template<typename T >
void Geometry< T >::set_c_ref ( T c_ref)
inline

Set the reference speed for the geometry.

Parameters
c_refThe reference speed to set.

◆ shift() [1/2]

template<typename T >
void Geometry< T >::shift ( Matrix< T > offset)

Shift the geometry by a Matrix offset.

Shift the geometry by an offset (Matrix version).

Parameters
offsetMatrix 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.

Parameters
offsetMatrix containing the offset values for x, y, and z.

◆ shift() [2/2]

template<typename T >
void Geometry< T >::shift ( T * offset)

Shift the geometry by an offset.

Shift the geometry by an offset (array version).

Parameters
offsetArray 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.

Parameters
offsetArray containing the offset values for x, y, and z.

The documentation for this class was generated from the following file: