XGCa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
line_of_sight.hpp
Go to the documentation of this file.
1 #ifndef LINE_OF_SIGHT_HPP
2 #define LINE_OF_SIGHT_HPP
3 
4 #include "space_settings.hpp"
5 #include "plane.hpp"
6 #include "magnetic_field.hpp"
7 #include "grid_field.hpp"
8 #include <cmath>
9 
24 class LineOfSight {
25  bool valid;
26  double r0;
27  double z0;
28  double phi0;
29  double theta;
30  double step_size;
31  int samples;
32 
33  public:
34  //
40  LineOfSight() : valid(false), r0(0.0), z0(0.0), phi0(0.0), theta(0.0), step_size(0.0), samples(0) {}
41 
42  // Constructor
43  LineOfSight(const Plane<DeviceType>& plane, const double& r0_in, const double& z0_in,
44  const double& theta_in, const double& step_size_in);
45 
46  //
47  // Accessor functions
48  //
53  double get_r0() const { return r0; }
58  double get_z0() const { return z0; }
63  double get_phi0() const { return phi0; }
68  double get_theta() const { return theta; }
73  int get_samples() const { return samples; }
78  bool is_valid() const { return valid; }
79 
80 
81  // Get (R,Z) coordinates of the sample points
83  View<double*,CLayout,DeviceType> r_los, View<double*,CLayout,DeviceType> z_los,
84  View<double*,CLayout,DeviceType> psi_los) const;
85 
86  // Interpolates input field to single sample point on line-of-sight
87  KOKKOS_INLINE_FUNCTION double interpolate_single(const Plane<DeviceType>& plane, const Kokkos::View<double*,CLayout,DeviceType>& field_in,
88  const int i) const;
89 
90  // Interpolates input field to single sample point on line-of-sight
91  KOKKOS_INLINE_FUNCTION double interpolate_single(const Plane<DeviceType>& plane, const ScalarGridField& field_in,
92  const int i) const;
93 
94  // Interpolate ScalarGridField along line-of-sight
95  View<double*,CLayout,DeviceType> interpolate_to_los(const Plane<DeviceType>& plane,
96  const ScalarGridField& field_in) const;
97 
98  // Interpolate a 1D View along line-of sight
99  Kokkos::View<double*, CLayout, DeviceType> interpolate_to_los(const Plane<DeviceType>& plane,
100  const Kokkos::View<double*, CLayout, DeviceType>& field_in) const;
101 
102 };
103 #endif
double theta
Direction of the line of sight. This angle must satisfy .
Definition: line_of_sight.hpp:29
double get_z0() const
Returns the Z-coordinate of the line-of-sight&#39;s origin.
Definition: line_of_sight.hpp:58
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 , and the poloidal flux along the line-of-sight.
Definition: line_of_sight.cpp:95
Definition: magnetic_field.hpp:12
double step_size
Step size or resolution along the line-of-sight in meters.
Definition: line_of_sight.hpp:30
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.
Definition: line_of_sight.cpp:171
int samples
Number of sample points.
Definition: line_of_sight.hpp:31
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.
Definition: line_of_sight.cpp:204
Definition: grid_field.hpp:22
double r0
Major radius coordinate of the line-of-sight&#39;s origin.
Definition: line_of_sight.hpp:26
double get_phi0() const
Returns the toroidal angle of the line-of-sight&#39;s origin.
Definition: line_of_sight.hpp:63
double z0
Vertical coordinate (height) of the line-of-sight&#39;s origin.
Definition: line_of_sight.hpp:27
int get_samples() const
Returns the number of sample points along the line-of-sight.
Definition: line_of_sight.hpp:73
double phi0
Toroidal angle of the plane on which the line-of-sight is defined.
Definition: line_of_sight.hpp:28
bool valid
Indicates whether the line-of-sight has been instantiated correctly.
Definition: line_of_sight.hpp:25
double get_theta() const
Returns the direction angle ( ) of the line-of-sight.
Definition: line_of_sight.hpp:68
Definition: magnetic_field.F90:1
double get_r0() const
Returns the R-coordinate of the line-of-sight&#39;s origin.
Definition: line_of_sight.hpp:53
bool is_valid() const
Indicates whether the line-of-sight is valid.
Definition: line_of_sight.hpp:78
LineOfSight()
Default constructor.
Definition: line_of_sight.hpp:40
Represents a two-dimensional line-of-sight in cylindrical coordinates.
Definition: line_of_sight.hpp:24