XGCa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
rz_bounds.hpp
Go to the documentation of this file.
1 #ifndef RZ_BOUNDS_HPP
2 #define RZ_BOUNDS_HPP
3 
4 struct RZBounds{
5  double min_r;
6  double max_r;
7  double min_z;
8  double max_z;
9 
10  KOKKOS_INLINE_FUNCTION RZBounds(){}
11 
12  RZBounds(double rmin, double rmax, double zmin, double zmax)
13  : min_r(rmin),
14  max_r(rmax),
15  min_z(zmin),
16  max_z(zmax)
17  {}
18 
19  KOKKOS_INLINE_FUNCTION bool is_outside(double r, double z) const{
20  return ( r<min_r || r>max_r ||
21  z<min_z || z>max_z );
22  }
23 
24  KOKKOS_INLINE_FUNCTION double get_r_width() const{
25  return (max_r - min_r);
26  }
27 
28  KOKKOS_INLINE_FUNCTION double get_z_width() const{
29  return (max_z - min_z);
30  }
31 
32  KOKKOS_INLINE_FUNCTION double bound_r(double r) const{
33  return max(min(r,max_r),min_r);
34  }
35 
36  KOKKOS_INLINE_FUNCTION double bound_z(double z) const{
37  return max(min(z,max_z),min_z);
38  }
39 
40  inline double area() const{
41  return get_r_width()*get_z_width();
42  }
43 
44  inline double dVolume_dphi() const{
45  return area()*(min_r + 0.5*get_r_width());
46  }
47 };
48 
49 #endif
Definition: rz_bounds.hpp:4
KOKKOS_INLINE_FUNCTION bool is_outside(double r, double z) const
Definition: rz_bounds.hpp:19
double max_z
Definition: rz_bounds.hpp:8
KOKKOS_INLINE_FUNCTION double bound_r(double r) const
Definition: rz_bounds.hpp:32
double dVolume_dphi() const
Definition: rz_bounds.hpp:44
double min_r
Definition: rz_bounds.hpp:5
RZBounds(double rmin, double rmax, double zmin, double zmax)
Definition: rz_bounds.hpp:12
KOKKOS_INLINE_FUNCTION double get_z_width() const
Definition: rz_bounds.hpp:28
KOKKOS_INLINE_FUNCTION double get_r_width() const
Definition: rz_bounds.hpp:24
KOKKOS_INLINE_FUNCTION RZBounds()
Definition: rz_bounds.hpp:10
double min_z
Definition: rz_bounds.hpp:7
KOKKOS_INLINE_FUNCTION double bound_z(double z) const
Definition: rz_bounds.hpp:36
double area() const
Definition: rz_bounds.hpp:40
double max_r
Definition: rz_bounds.hpp:6