GSI_Toolbox 1.0.0 A toolbox for Gas-Surface Interaction simulations

Loading...
Searching...
No Matches
Public Member Functions | List of all members
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.
Ray & | operator= (const Ray &other)
| Copy assignment operator for the Ray class.
Ray & | operator= (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.
T | 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

  T | The 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

  origin | Origin point of the ray.
  velocity | Velocity vector of the ray.
  m_dot | Mass flux carried by the ray.
  children | Number of child rays this ray can spawn.
  spawn_vertex_index | Index 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

  other | The 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

  other | The 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

  bb | The 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

  p1 | The first vertex of the triangle.
  p2 | The second vertex of the triangle.
  p3 | The third vertex of the triangle.
  normal | The normal vector of the triangle.
  col_position | The position of the collision, if it occurs.
  distance | The 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

  p1 | The first vertex of the triangle.
  p2 | The second vertex of the triangle.
  p3 | The third vertex of the triangle.
  normal | The normal vector of the triangle.
  col_position | The position of the collision (output parameter).
  distance | The 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

  other | The 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

  other | The 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

  other | The 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

  geometry | The geometry through which the ray propagates.
  gas | The gas properties influencing the ray's behavior.
  kernel | The function used to compute reflection or scattering after collision.
  collision_index | Pointer 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

  geometry | The geometry through which the ray propagates.
  gas | The gas properties that affect the ray's behavior during propagation.
  kernel | The kernel function used to compute reflection or scattering after collision.
  collision_index | Pointer 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_flux | The 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_origin | The 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_velocity | The new velocity vector to set.

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

- src/Ray.h