BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ZLimits.cpp File Reference
Include dependency graph for ZLimits.cpp:

Go to the source code of this file.

Functions

OneSidedLimit MinLimit (const OneSidedLimit &left, const OneSidedLimit &right)
 
OneSidedLimit MaxLimit (const OneSidedLimit &left, const OneSidedLimit &right)
 
bool operator== (const OneSidedLimit &left, const OneSidedLimit &right)
 
bool operator!= (const OneSidedLimit &left, const OneSidedLimit &right)
 
std::ostream & operator<< (std::ostream &ostr, const OneSidedLimit &limit)
 
ZLimits ConvexHull (const ZLimits &left, const ZLimits &right)
 
bool operator== (const ZLimits &left, const ZLimits &right)
 
bool operator!= (const ZLimits &left, const ZLimits &right)
 
std::ostream & operator<< (std::ostream &ostr, const ZLimits &limits)
 

Detailed Description

Defines class ZLimits.

Homepage:\n http://www.bornagainproject.org
License:\n GNU General Public License v3 or higher (see COPYING)
Authors
Scientific Computing Group at MLZ (see CITATION, AUTHORS)

Definition in file ZLimits.cpp.

Function Documentation

◆ MinLimit()

OneSidedLimit MinLimit ( const OneSidedLimit left,
const OneSidedLimit right 
)

Definition at line 49 of file ZLimits.cpp.

50 {
51  if (left.m_limitless || right.m_limitless)
52  return {true, 0};
53  return {false, std::min(left.m_value, right.m_value)};
54 }
double m_value
Definition: ZLimits.h:32
bool m_limitless
Definition: ZLimits.h:31

References OneSidedLimit::m_limitless, and OneSidedLimit::m_value.

Referenced by ConvexHull().

◆ MaxLimit()

OneSidedLimit MaxLimit ( const OneSidedLimit left,
const OneSidedLimit right 
)

Definition at line 56 of file ZLimits.cpp.

57 {
58  if (left.m_limitless || right.m_limitless)
59  return {true, 0};
60  return {false, std::max(left.m_value, right.m_value)};
61 }

References OneSidedLimit::m_limitless, and OneSidedLimit::m_value.

Referenced by ConvexHull().

◆ operator==() [1/2]

bool operator== ( const OneSidedLimit left,
const OneSidedLimit right 
)

Definition at line 63 of file ZLimits.cpp.

64 {
65  if (left.m_limitless != right.m_limitless)
66  return false;
67  if (!left.m_limitless && left.m_value != right.m_value)
68  return false;
69  return true;
70 }

References OneSidedLimit::m_limitless, and OneSidedLimit::m_value.

◆ operator!=() [1/2]

bool operator!= ( const OneSidedLimit left,
const OneSidedLimit right 
)

Definition at line 72 of file ZLimits.cpp.

73 {
74  return !(left == right);
75 }

◆ operator<<() [1/2]

std::ostream& operator<< ( std::ostream &  ostr,
const OneSidedLimit limit 
)

Definition at line 77 of file ZLimits.cpp.

78 {
79  return ostr << "{" << (limit.m_limitless ? "true, " : "false, ") << limit.m_value << "}";
80 }

References OneSidedLimit::m_limitless, and OneSidedLimit::m_value.

◆ ConvexHull()

ZLimits ConvexHull ( const ZLimits left,
const ZLimits right 
)

Definition at line 82 of file ZLimits.cpp.

83 {
84  return {MinLimit(left.lowerLimit(), right.lowerLimit()),
85  MaxLimit(left.upperLimit(), right.upperLimit())};
86 }
OneSidedLimit MinLimit(const OneSidedLimit &left, const OneSidedLimit &right)
Definition: ZLimits.cpp:49
OneSidedLimit MaxLimit(const OneSidedLimit &left, const OneSidedLimit &right)
Definition: ZLimits.cpp:56
OneSidedLimit lowerLimit() const
Definition: ZLimits.cpp:39
OneSidedLimit upperLimit() const
Definition: ZLimits.cpp:44

References ZLimits::lowerLimit(), MaxLimit(), MinLimit(), and ZLimits::upperLimit().

Referenced by anonymous_namespace{LayerFillLimits.cpp}::CalculateNewLayerLimits().

Here is the call graph for this function:

◆ operator==() [2/2]

bool operator== ( const ZLimits left,
const ZLimits right 
)

Definition at line 88 of file ZLimits.cpp.

89 {
90  return (left.lowerLimit() == right.lowerLimit() && left.upperLimit() == right.upperLimit());
91 }

References ZLimits::lowerLimit(), and ZLimits::upperLimit().

Here is the call graph for this function:

◆ operator!=() [2/2]

bool operator!= ( const ZLimits left,
const ZLimits right 
)

Definition at line 93 of file ZLimits.cpp.

94 {
95  return !(left == right);
96 }

◆ operator<<() [2/2]

std::ostream& operator<< ( std::ostream &  ostr,
const ZLimits limits 
)

Definition at line 98 of file ZLimits.cpp.

99 {
100  return ostr << "Lower: " << limits.lowerLimit() << ", Upper: " << limits.upperLimit();
101 }

References ZLimits::lowerLimit(), and ZLimits::upperLimit().

Here is the call graph for this function: