BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ZLimits Class Reference

Description

An interval. Limits are of type double, and may be infinite. Used for the z-coordinate, especially when slicing form factors.

Definition at line 32 of file ZLimits.h.

Public Member Functions

 ZLimits ()
 
 ZLimits (double _min, double _max)
 
bool isFinite () const
 
double thickness () const
 
double thicknessOr0 () const
 
double zBottom () const
 
double zTop () const
 
double zTopOr0 () const
 

Static Public Member Functions

static ZLimits enclosingInterval (const ZLimits &left, const ZLimits &right)
 Returns the union of two ZLimits (the minimal interval that contains both input intervals). More...
 

Static Public Attributes

static constexpr double inf = std::numeric_limits<double>::infinity()
 

Private Attributes

double m_zmax
 
double m_zmin
 

Constructor & Destructor Documentation

◆ ZLimits() [1/2]

ZLimits::ZLimits ( )

Definition at line 27 of file ZLimits.cpp.

28  : ZLimits(-inf, inf)
29 {
30 }
ZLimits()
Definition: ZLimits.cpp:27
static constexpr double inf
Definition: ZLimits.h:45

◆ ZLimits() [2/2]

ZLimits::ZLimits ( double  _min,
double  _max 
)

Definition at line 20 of file ZLimits.cpp.

21  : m_zmin(_min)
22  , m_zmax(_max)
23 {
24  ASSERT(_min < _max);
25 }
#define ASSERT(condition)
Definition: Assert.h:45
double m_zmin
Definition: ZLimits.h:52
double m_zmax
Definition: ZLimits.h:53

References ASSERT.

Member Function Documentation

◆ enclosingInterval()

ZLimits ZLimits::enclosingInterval ( const ZLimits left,
const ZLimits right 
)
static

Returns the union of two ZLimits (the minimal interval that contains both input intervals).

Definition at line 37 of file ZLimits.cpp.

38 {
39  return {std::min(left.zBottom(), right.zBottom()), std::max(left.zTop(), right.zTop())};
40 }
double zBottom() const
Definition: ZLimits.h:39
double zTop() const
Definition: ZLimits.h:40

References zBottom(), and zTop().

Referenced by Compute::Slicing::zSpan().

Here is the call graph for this function:

◆ isFinite()

bool ZLimits::isFinite ( ) const

Definition at line 32 of file ZLimits.cpp.

33 {
34  return !std::isinf(m_zmin) && !std::isinf(m_zmax);
35 }

References m_zmax, and m_zmin.

Referenced by thicknessOr0().

◆ thickness()

double ZLimits::thickness ( ) const
inline

Definition at line 42 of file ZLimits.h.

42 { return m_zmax - m_zmin; }

References m_zmax, and m_zmin.

◆ thicknessOr0()

double ZLimits::thicknessOr0 ( ) const
inline

Definition at line 43 of file ZLimits.h.

43 { return isFinite() ? m_zmax - m_zmin : 0; }
bool isFinite() const
Definition: ZLimits.cpp:32

References isFinite(), m_zmax, and m_zmin.

Referenced by Slice::thicknessOr0().

Here is the call graph for this function:

◆ zBottom()

double ZLimits::zBottom ( ) const
inline

Definition at line 39 of file ZLimits.h.

39 { return m_zmin; }

References m_zmin.

Referenced by enclosingInterval(), operator<<(), operator==(), and Slice::zBottom().

◆ zTop()

double ZLimits::zTop ( ) const
inline

Definition at line 40 of file ZLimits.h.

40 { return m_zmax; }

References m_zmax.

Referenced by enclosingInterval(), operator<<(), operator==(), and Slice::zTop().

◆ zTopOr0()

double ZLimits::zTopOr0 ( ) const
inline

Definition at line 41 of file ZLimits.h.

41 { return std::isfinite(m_zmax) ? m_zmax : 0; }

References m_zmax.

Referenced by Slice::zTopOr0().

Member Data Documentation

◆ inf

constexpr double ZLimits::inf = std::numeric_limits<double>::infinity()
staticconstexpr

Definition at line 45 of file ZLimits.h.

Referenced by SliceStack::addSlice(), and SliceStack::addTopSlice().

◆ m_zmax

double ZLimits::m_zmax
private

Definition at line 53 of file ZLimits.h.

Referenced by isFinite(), thickness(), thicknessOr0(), zTop(), and zTopOr0().

◆ m_zmin

double ZLimits::m_zmin
private

Definition at line 52 of file ZLimits.h.

Referenced by isFinite(), thickness(), thicknessOr0(), and zBottom().


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