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

Class representing a Ray for simulating particle movement in a geometric domain. More...

#include <Ray.h>

Public Member Functions

 Ray ()
 Default constructor for the Ray class.
 
 Ray (Matrix< T > &origin, Matrix< T > &velocity, T m_dot, unsigned int children, int spawn_vertex_index)
 Parameterized constructor for the Ray class.
 
 Ray (const Ray< T > &other)
 Copy constructor for the Ray class.
 
 Ray (Ray< T > &&other)
 Move constructor for the Ray class.
 
 ~Ray ()
 Destructor for the Ray class.
 
Rayoperator= (const Ray &other)
 Copy assignment operator for the Ray class.
 
Rayoperator= (Ray &&other)
 Move assignment operator for the Ray class.
 
Matrix< T > & get_velocity ()
 Gets the velocity of the ray.
 
void set_velocity (Matrix< T > new_velocity)
 Sets the velocity of the ray.
 
Matrix< T > & get_origin ()
 Gets the origin of the ray.
 
void set_origin (Matrix< T > new_origin)
 Sets the origin of the ray.
 
get_mass_flux ()
 Gets the mass flux of the ray.
 
void set_mass_flux (T mass_flux)
 Sets the mass flux of the ray.
 
bool check_vertex_collision (Matrix< T > &p1, Matrix< T > &p2, Matrix< T > &p3, Matrix< T > &normal, Matrix< T > &col_position, T &distance)
 Checks if the ray collides with a triangle defined by three vertices.
 
bool check_bb_collision (Matrix< T > &bb)
 Checks if the ray collides with a bounding box.
 
std::vector< Ray< T > > propagate (Geometry< T > &geometry, const Gas< T > &gas, void(*kernel)(T *, T *, T *, T *, T *), unsigned int *collision_index)
 Propagates the ray through the geometry and handles collision and reflection.
 

Detailed Description

template<typename T>
class Ray< T >

Class representing a Ray for simulating particle movement in a geometric domain.

The Ray class models the behavior of particles moving in space, handling properties such as velocity, mass flux, and collision detection.

Template Parameters
TThe data type used for computations (e.g., float, double).

Constructor & Destructor Documentation

◆ Ray() [1/4]

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

Default constructor for the Ray class.

Initializes the ray with default values for origin, velocity, and other properties.

Initializes the ray with default values for origin, velocity, mass flux, and other properties.

◆ Ray() [2/4]

template<typename T >
Ray< T >::Ray ( Matrix< T > & origin,
Matrix< T > & velocity,
T m_dot,
unsigned int children,
int spawn_vertex_index )

Parameterized constructor for the Ray class.

Initializes the ray with specific origin, velocity, mass flux, number of children, and spawn vertex index.

Parameters
originOrigin point of the ray.
velocityVelocity vector of the ray.
m_dotMass flux carried by the ray.
childrenNumber of child rays this ray can spawn.
spawn_vertex_indexIndex of the vertex where this ray was spawned.

◆ Ray() [3/4]

template<typename T >
Ray< T >::Ray ( const Ray< T > & other)

Copy constructor for the Ray class.

Initializes a new ray by copying the properties of another ray.

Parameters
otherThe ray object to copy from.

◆ Ray() [4/4]

template<typename T >
Ray< T >::Ray ( Ray< T > && other)

Move constructor for the Ray class.

Initializes a new ray by moving the properties of another ray.

Parameters
otherThe ray object to move from.

◆ ~Ray()

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

Destructor for the Ray class.

Resets the properties of the ray to default values.

Member Function Documentation

◆ check_bb_collision()

template<typename T >
bool Ray< T >::check_bb_collision ( Matrix< T > & bb)

Checks if the ray collides with a bounding box.

Parameters
bbThe bounding box to check collision with.
Returns
true If the ray collides with the bounding box, false otherwise.

◆ check_vertex_collision()

template<typename T >
bool Ray< T >::check_vertex_collision ( Matrix< T > & p1,
Matrix< T > & p2,
Matrix< T > & p3,
Matrix< T > & normal,
Matrix< T > & col_position,
T & distance )

Checks if the ray collides with a triangle defined by three vertices.

This function checks if the ray intersects with the triangle defined by points p1, p2, and p3, and updates the collision position and distance if a collision occurs.

Parameters
p1The first vertex of the triangle.
p2The second vertex of the triangle.
p3The third vertex of the triangle.
normalThe normal vector of the triangle.
col_positionThe position of the collision, if it occurs.
distanceThe distance from the ray origin to the collision point.
Returns
true If a collision occurs, false otherwise.

This function determines if the ray intersects with the triangle formed by vertices p1, p2, and p3. If a collision occurs, the position of the collision and the distance to the collision point are updated.

Parameters
p1The first vertex of the triangle.
p2The second vertex of the triangle.
p3The third vertex of the triangle.
normalThe normal vector of the triangle.
col_positionThe position of the collision (output parameter).
distanceThe distance from the ray origin to the collision point (output parameter).
Returns
true If a collision occurs, false otherwise.

◆ get_mass_flux()

template<typename T >
T Ray< T >::get_mass_flux ( )
inline

Gets the mass flux of the ray.

Returns
T The current mass flux of the ray.

◆ get_origin()

template<typename T >
Matrix< T > & Ray< T >::get_origin ( )
inline

Gets the origin of the ray.

Returns
Matrix<T>& The current origin point of the ray.

◆ get_velocity()

template<typename T >
Matrix< T > & Ray< T >::get_velocity ( )
inline

Gets the velocity of the ray.

Returns
Matrix<T>& The current velocity vector of the ray.

◆ operator=() [1/2]

template<typename T >
Ray< T > & Ray< T >::operator= ( const Ray< T > & other)

Copy assignment operator for the Ray class.

Copies the properties from another ray.

Parameters
otherThe ray object to copy from.
Returns
Ray& Reference to the current ray object.

◆ operator=() [2/2]

template<typename T >
Ray< T > & Ray< T >::operator= ( Ray< T > && other)

Move assignment operator for the Ray class.

Moves the properties from another ray, resetting the source ray.

Parameters
otherThe ray object to move from.
Returns
Ray& Reference to the current ray object.

Moves the properties from another ray, resetting the source ray's properties.

Parameters
otherThe ray object to move from.
Returns
Ray& Reference to the current ray object.

◆ propagate()

template<typename T >
std::vector< Ray< T > > Ray< T >::propagate ( Geometry< T > & geometry,
const Gas< T > & gas,
void(* kernel )(T *, T *, T *, T *, T *),
unsigned int * collision_index )

Propagates the ray through the geometry and handles collision and reflection.

This function propagates the ray, checking for collisions with the geometry, and applies a kernel function to compute the reflected ray properties.

Parameters
geometryThe geometry through which the ray propagates.
gasThe gas properties influencing the ray's behavior.
kernelThe function used to compute reflection or scattering after collision.
collision_indexPointer to store the index of the vertex where the collision occurred.
Returns
std::vector<Ray<T>> A vector of child rays spawned after collision.

This function propagates the ray through the given geometry, checking for collisions with the vertices of the geometry. If a collision occurs, the position, distance, and other properties of the collision are computed. The kernel function is used to calculate the reflected velocity of the ray based on the gas and surface properties at the collision point. After collision, child rays are generated and returned.

Parameters
geometryThe geometry through which the ray propagates.
gasThe gas properties that affect the ray's behavior during propagation.
kernelThe kernel function used to compute reflection or scattering after collision.
collision_indexPointer to store the index of the vertex where the collision occurred.
Returns
std::vector<Ray<T>> A vector containing child rays generated after the collision.

◆ set_mass_flux()

template<typename T >
void Ray< T >::set_mass_flux ( T mass_flux)
inline

Sets the mass flux of the ray.

Parameters
mass_fluxThe new mass flux to set.

◆ set_origin()

template<typename T >
void Ray< T >::set_origin ( Matrix< T > new_origin)
inline

Sets the origin of the ray.

Parameters
new_originThe new origin point to set.

◆ set_velocity()

template<typename T >
void Ray< T >::set_velocity ( Matrix< T > new_velocity)
inline

Sets the velocity of the ray.

Parameters
new_velocityThe new velocity vector to set.

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