XGC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bounds.hpp
Go to the documentation of this file.
1 #ifndef BOUNDS_HPP
2 #define BOUNDS_HPP
3 
4 struct Bounds{
5  double min_;
6  double max_;
7 
8  KOKKOS_INLINE_FUNCTION Bounds(){}
9 
10  Bounds(double min_in, double max_in)
11  : min_(min_in),
12  max_(max_in)
13  {}
14 
15  KOKKOS_INLINE_FUNCTION bool is_outside(double v) const{
16  return ( v<min_ || v>max_);
17  }
18 
19  KOKKOS_INLINE_FUNCTION double width() const{
20  return (max_ - min_);
21  }
22 
23  KOKKOS_INLINE_FUNCTION double bound(double v) const{
24  return max(min(v,max_),min_);
25  }
26 };
27 
28 #endif
KOKKOS_INLINE_FUNCTION double width() const
Definition: bounds.hpp:19
Definition: bounds.hpp:4
KOKKOS_INLINE_FUNCTION double bound(double v) const
Definition: bounds.hpp:23
KOKKOS_INLINE_FUNCTION Bounds()
Definition: bounds.hpp:8
Bounds(double min_in, double max_in)
Definition: bounds.hpp:10
double min_
Definition: bounds.hpp:5
double max_
Definition: bounds.hpp:6
KOKKOS_INLINE_FUNCTION bool is_outside(double v) const
Definition: bounds.hpp:15