|
| LineOfSight () |
| Default constructor. More...
|
|
| LineOfSight (const Plane< DeviceType > &plane, const double &r0_in, const double &z0_in, const double &theta_in, const double &step_size_in) |
| Constructs a line-of-sight based on a given grid and parameters. More...
|
|
double | get_r0 () const |
| Returns the R-coordinate of the line-of-sight's origin. More...
|
|
double | get_z0 () const |
| Returns the Z-coordinate of the line-of-sight's origin. More...
|
|
double | get_phi0 () const |
| Returns the toroidal angle of the line-of-sight's origin. More...
|
|
double | get_theta () const |
| Returns the direction angle ( \(\theta\)) of the line-of-sight. More...
|
|
int | get_samples () const |
| Returns the number of sample points along the line-of-sight. More...
|
|
bool | is_valid () const |
| Indicates whether the line-of-sight is valid. More...
|
|
void | sample_points (const MagneticField< DeviceType > &magnetic_field, View< double *, CLayout, DeviceType > r_los, View< double *, CLayout, DeviceType > z_los, View< double *, CLayout, DeviceType > psi_los) const |
| Computes the sample points \((R,Z)\), and the poloidal flux \((\psi)\) along the line-of-sight. More...
|
|
KOKKOS_INLINE_FUNCTION double | interpolate_single (const Plane< DeviceType > &plane, const Kokkos::View< double *, CLayout, DeviceType > &field_in, const int i) const |
| Interpolates the field value at a single sample point along the line-of-sight. More...
|
|
KOKKOS_INLINE_FUNCTION double | interpolate_single (const Plane< DeviceType > &plane, const ScalarGridField &field_in, const int i) const |
| Interpolates the field value at a single sample point along the line-of-sight. More...
|
|
View< double *, CLayout,
DeviceType > | interpolate_to_los (const Plane< DeviceType > &plane, const ScalarGridField &field_in) const |
| Interpolates a ScalarGridField to the sample points on the line-of-sight. More...
|
|
Kokkos::View< double
*, CLayout, DeviceType > | interpolate_to_los (const Plane< DeviceType > &plane, const Kokkos::View< double *, CLayout, DeviceType > &field_in) const |
| Interpolates a 1D double view (field data at grid nodes) to the sample points on the line-of-sight. More...
|
|
Represents a two-dimensional line-of-sight in cylindrical coordinates.
This class defines a two-dimensional line-of-sight in cylindrical coordinates \((R,\varphi,Z)\) with a constant toroidal angle ( \(\varphi\)). The line-of-sight is specified by an origin \((R_0,Z_0)\), a direction angle ( \(\theta\)) measured in radians (with \(-\pi<\theta<\pi\), where \(\theta=0\) corresponds to \(Z=Z_0\)), and a spatial resolution (step_size) in meters. Upon construction, the class determines the number of valid sample points along the line-of-sight based on the provided grid.
If the origin is not on the mesh, the line-of-sight is marked as invalid.
- Note
- All Kokkos kernels execute on the DeviceType execution space and output results on DeviceType. Copying between Host and Device can be handled externally if needed.
LineOfSight::LineOfSight |
( |
const Plane< DeviceType > & |
plane, |
|
|
const double & |
r0_in, |
|
|
const double & |
z0_in, |
|
|
const double & |
theta_in, |
|
|
const double & |
step_size_in |
|
) |
| |
Constructs a line-of-sight based on a given grid and parameters.
This constructor verifies that the specified origin (r0_in, z0_in) lies on the provided grid. If the origin is not on the mesh, the line-of-sight remains invalid. Otherwise, it computes the number of valid sample points along the line-of-sight by stepping from the origin in the direction given by theta_in with increments of step_size_in until a sample point falls outside the grid.
- Parameters
-
[in] | plane | Plane (mesh) object used for determining mesh boundaries and number of samples. |
[in] | r0_in | R-coordinate of the line-of-sight's origin. |
[in] | z0_in | Z-coordinate of the line-of-sight's origin. |
[in] | theta_in | Direction angle (in radians) of the line-of-sight. |
[in] | step_size_in | Spacing (in meters) between consecutive sample points. |
KOKKOS_INLINE_FUNCTION double LineOfSight::interpolate_single |
( |
const Plane< DeviceType > & |
plane, |
|
|
const Kokkos::View< double *, CLayout, DeviceType > & |
field_in, |
|
|
const int |
i |
|
) |
| const |
Interpolates the field value at a single sample point along the line-of-sight.
This function computes the interpolated field value at the i-th sample point along the line-of-sight. It first calculates the current position (R, Z) using the line-of-sight parameters (origin, step_size, theta), then performs a grid search using plane.search_tr2_no_precheck
to determine the containing triangle and its barycentric weights. Finally, the function gathers the field values from field_in
at the nodes of the triangle, weighting them appropriately, and returns the resulting interpolated field value.
- Parameters
-
[in] | plane | The plane (mesh) object used for the grid search and retrieving node indices. |
[in] | field_in | A 1D Kokkos::View of doubles containing field data defined on grid nodes. |
[in] | i | The index of the sample point along the line-of-sight. |
- Returns
- The interpolated field value at the i-th sample point.
KOKKOS_INLINE_FUNCTION double LineOfSight::interpolate_single |
( |
const Plane< DeviceType > & |
plane, |
|
|
const ScalarGridField & |
field_in, |
|
|
const int |
i |
|
) |
| const |
Interpolates the field value at a single sample point along the line-of-sight.
This function computes the interpolated field value at the i-th sample point along the line-of-sight. It first calculates the current position (R, Z) using the line-of-sight parameters (origin, step_size, theta), then performs a grid search using plane.search_tr2_no_precheck
to determine the containing triangle and its barycentric weights. Finally, the function gathers the field values from field_in
at the nodes of the triangle, weighting them appropriately, and returns the resulting interpolated field value.
- Parameters
-
[in] | plane | The plane (mesh) object used for the grid search and retrieving node indices. |
[in] | field_in | A ScalarGridField containing field data defined on grid nodes. |
[in] | i | The index of the sample point along the line-of-sight. |
- Returns
- The interpolated field value at the i-th sample point.
Computes the sample points \((R,Z)\), and the poloidal flux \((\psi)\) along the line-of-sight.
This function allocates and populates three 1D Kokkos::Views (r_los, z_los, psi_los) on the DeviceType. For each sample point, the function computes the (R, Z) coordinates based on the origin, direction, and step size, and then interpolates the poloidal flux using the provided MagneticField.
- Parameters
-
[in] | magnetic_field | MagneticField object used for psi interpolation. |
[out] | r_los | Output view for R coordinates. |
[out] | z_los | Output view for Z coordinates. |
[out] | psi_los | Output view for psi values. |