BornAgain
1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
|
Limits for a real fit parameter.
Definition at line 24 of file RealLimits.h.
Public Member Functions | |
RealLimits () | |
Default constructor creates a "limitless" instance. More... | |
void | check (const std::string &name, double value) const |
Throws if value is outside limits. Parameter 'name' is for exception message. More... | |
bool | hasLowerAndUpperLimits () const |
if has lower and upper limit More... | |
bool | hasLowerLimit () const |
if has lower limit More... | |
bool | hasUpperLimit () const |
if has upper limit More... | |
bool | isInRange (double value) const |
Returns true if proposed value is in limits range. More... | |
bool | isLimited () const |
bool | isLimitless () const |
bool | isLowerLimited () const |
bool | isNonnegative () const |
bool | isPositive () const |
bool | isUpperLimited () const |
double | lowerLimit () const |
Returns lower limit. More... | |
bool | operator!= (const RealLimits &other) const |
bool | operator== (const RealLimits &other) const |
void | removeLimits () |
remove limits More... | |
void | removeLowerLimit () |
remove lower limit More... | |
void | removeUpperLimit () |
remove upper limit More... | |
RealLimits | scaledLimits (double factor) const |
Creates a copy with scaled boundaries, if applicable. More... | |
void | setLimits (double xmin, double xmax) |
Sets lower and upper limits. More... | |
void | setLowerLimit (double value) |
Sets lower limit. More... | |
void | setUpperLimit (double value) |
Sets upper limit. More... | |
std::string | toString () const |
double | upperLimit () const |
Returns upper limit. More... | |
Static Public Member Functions | |
static RealLimits | limited (double left_bound_value, double right_bound_value) |
Creates an object bounded from the left and right. More... | |
static RealLimits | limitless () |
Creates an object without bounds (default) More... | |
static RealLimits | lowerLimited (double bound_value) |
Creates an object bounded from the left. More... | |
static RealLimits | nonnegative () |
Creates an object which can have only positive values with 0. included. More... | |
static RealLimits | positive () |
Creates an object which can have only positive values (>0., zero is not included) More... | |
static RealLimits | upperLimited (double bound_value) |
Creates an object bounded from the right. More... | |
Protected Member Functions | |
RealLimits (bool has_lower_limit, bool has_upper_limit, double lower_limit, double upper_limit) | |
Protected Attributes | |
bool | m_has_lower_limit |
bool | m_has_upper_limit |
parameter has lower bound More... | |
double | m_lower_limit |
parameter has upper bound More... | |
double | m_upper_limit |
minimum allowed value More... | |
Friends | |
std::ostream & | operator<< (std::ostream &ostr, const RealLimits &m) |
Prints class. More... | |
RealLimits::RealLimits | ( | ) |
Default constructor creates a "limitless" instance.
Definition at line 21 of file RealLimits.cpp.
Referenced by limited(), limitless(), lowerLimited(), scaledLimits(), and upperLimited().
|
protected |
Definition at line 29 of file RealLimits.cpp.
void RealLimits::check | ( | const std::string & | name, |
double | value | ||
) | const |
Throws if value is outside limits. Parameter 'name' is for exception message.
Definition at line 170 of file RealLimits.cpp.
References isInRange().
Referenced by BasicLattice2D::BasicLattice2D(), Beam::Beam(), HexagonalLattice2D::HexagonalLattice2D(), IInterference::IInterference(), Interference1DLattice::Interference1DLattice(), Interference2DParaCrystal::Interference2DParaCrystal(), InterferenceHardDisk::InterferenceHardDisk(), InterferenceRadialParaCrystal::InterferenceRadialParaCrystal(), InterferenceTwin::InterferenceTwin(), LayerRoughness::LayerRoughness(), MultiLayer::MultiLayer(), ResolutionFunction2DGaussian::ResolutionFunction2DGaussian(), SquareLattice2D::SquareLattice2D(), INode::checkNodeArgs(), and Beam::setInclinationAngleGuarded().
bool RealLimits::hasLowerAndUpperLimits | ( | ) | const |
if has lower and upper limit
Definition at line 88 of file RealLimits.cpp.
References m_has_lower_limit, and m_has_upper_limit.
Referenced by IRangedDistribution::checkInitialization(), and AttLimits::isLimited().
bool RealLimits::hasLowerLimit | ( | ) | const |
if has lower limit
Definition at line 44 of file RealLimits.cpp.
References m_has_lower_limit.
Referenced by IDistribution1D::adjustMinMaxForLimits(), isInRange(), isLimited(), AttLimits::isLimitless(), isLimitless(), AttLimits::isLowerLimited(), isLowerLimited(), isNonnegative(), isPositive(), AttLimits::isUpperLimited(), and isUpperLimited().
bool RealLimits::hasUpperLimit | ( | ) | const |
if has upper limit
Definition at line 66 of file RealLimits.cpp.
References m_has_upper_limit.
Referenced by IDistribution1D::adjustMinMaxForLimits(), isInRange(), isLimited(), AttLimits::isLimitless(), isLimitless(), AttLimits::isLowerLimited(), isLowerLimited(), isNonnegative(), isPositive(), AttLimits::isUpperLimited(), and isUpperLimited().
bool RealLimits::isInRange | ( | double | value | ) | const |
Returns true if proposed value is in limits range.
Definition at line 105 of file RealLimits.cpp.
References hasLowerLimit(), hasUpperLimit(), m_lower_limit, and m_upper_limit.
Referenced by check().
bool RealLimits::isLimited | ( | ) | const |
Definition at line 218 of file RealLimits.cpp.
References hasLowerLimit(), and hasUpperLimit().
Referenced by Py::Fmt::printRealLimits(), and toString().
bool RealLimits::isLimitless | ( | ) | const |
Definition at line 192 of file RealLimits.cpp.
References hasLowerLimit(), and hasUpperLimit().
Referenced by Py::Fmt2::printRangedDistribution(), Py::Fmt::printRealLimits(), Py::Fmt::printRealLimitsArg(), and toString().
bool RealLimits::isLowerLimited | ( | ) | const |
Definition at line 208 of file RealLimits.cpp.
References hasLowerLimit(), and hasUpperLimit().
Referenced by Py::Fmt::printRealLimits(), and toString().
bool RealLimits::isNonnegative | ( | ) | const |
Definition at line 203 of file RealLimits.cpp.
References hasLowerLimit(), hasUpperLimit(), and lowerLimit().
Referenced by Py::Fmt::printRealLimits(), and toString().
bool RealLimits::isPositive | ( | ) | const |
Definition at line 197 of file RealLimits.cpp.
References hasLowerLimit(), hasUpperLimit(), and lowerLimit().
Referenced by Py::Fmt::printRealLimits(), and toString().
bool RealLimits::isUpperLimited | ( | ) | const |
Definition at line 213 of file RealLimits.cpp.
References hasLowerLimit(), and hasUpperLimit().
Referenced by Py::Fmt::printRealLimits(), and toString().
|
static |
Creates an object bounded from the left and right.
Definition at line 134 of file RealLimits.cpp.
References RealLimits().
Referenced by DepthProbeSimulation::DepthProbeSimulation(), INode::checkNodeArgs(), and AttLimits::limited().
|
static |
Creates an object without bounds (default)
Definition at line 139 of file RealLimits.cpp.
References RealLimits().
Referenced by INode::checkNodeArgs(), and AttLimits::fixed().
double RealLimits::lowerLimit | ( | ) | const |
Returns lower limit.
Definition at line 49 of file RealLimits.cpp.
References m_lower_limit.
Referenced by IDistribution1D::adjustMinMaxForLimits(), IRangedDistribution::checkInitialization(), isNonnegative(), isPositive(), AttLimits::lowerLimit(), Py::Fmt::printRealLimits(), and toString().
|
static |
Creates an object bounded from the left.
Definition at line 114 of file RealLimits.cpp.
References RealLimits().
Referenced by AttLimits::lowerLimited(), nonnegative(), and positive().
|
static |
Creates an object which can have only positive values with 0. included.
Definition at line 124 of file RealLimits.cpp.
References lowerLimited().
Referenced by Beam::Beam(), IInterference::IInterference(), Interference1DLattice::Interference1DLattice(), Interference2DParaCrystal::Interference2DParaCrystal(), InterferenceHardDisk::InterferenceHardDisk(), InterferenceRadialParaCrystal::InterferenceRadialParaCrystal(), InterferenceTwin::InterferenceTwin(), LayerRoughness::LayerRoughness(), MultiLayer::MultiLayer(), ResolutionFunction2DGaussian::ResolutionFunction2DGaussian(), INode::checkNodeArgs(), and AttLimits::nonnegative().
bool RealLimits::operator!= | ( | const RealLimits & | other | ) | const |
Definition at line 187 of file RealLimits.cpp.
bool RealLimits::operator== | ( | const RealLimits & | other | ) | const |
Definition at line 180 of file RealLimits.cpp.
References m_has_lower_limit, m_has_upper_limit, m_lower_limit, and m_upper_limit.
|
static |
Creates an object which can have only positive values (>0., zero is not included)
Definition at line 119 of file RealLimits.cpp.
References lowerLimited().
Referenced by BasicLattice2D::BasicLattice2D(), HexagonalLattice2D::HexagonalLattice2D(), SquareLattice2D::SquareLattice2D(), and AttLimits::positive().
void RealLimits::removeLimits | ( | ) |
remove limits
Definition at line 99 of file RealLimits.cpp.
References removeLowerLimit(), and removeUpperLimit().
Referenced by AttLimits::setFixed().
void RealLimits::removeLowerLimit | ( | ) |
remove lower limit
Definition at line 60 of file RealLimits.cpp.
References m_has_lower_limit, and m_lower_limit.
Referenced by removeLimits().
void RealLimits::removeUpperLimit | ( | ) |
remove upper limit
Definition at line 82 of file RealLimits.cpp.
References m_has_upper_limit, and m_upper_limit.
Referenced by removeLimits().
RealLimits RealLimits::scaledLimits | ( | double | factor | ) | const |
Creates a copy with scaled boundaries, if applicable.
Definition at line 38 of file RealLimits.cpp.
References RealLimits(), m_has_lower_limit, m_has_upper_limit, m_lower_limit, and m_upper_limit.
void RealLimits::setLimits | ( | double | xmin, |
double | xmax | ||
) |
Sets lower and upper limits.
Definition at line 93 of file RealLimits.cpp.
References setLowerLimit(), and setUpperLimit().
void RealLimits::setLowerLimit | ( | double | value | ) |
Sets lower limit.
Definition at line 54 of file RealLimits.cpp.
References m_has_lower_limit, and m_lower_limit.
Referenced by setLimits().
void RealLimits::setUpperLimit | ( | double | value | ) |
Sets upper limit.
Definition at line 76 of file RealLimits.cpp.
References m_has_upper_limit, and m_upper_limit.
Referenced by setLimits().
std::string RealLimits::toString | ( | ) | const |
Definition at line 144 of file RealLimits.cpp.
References isLimited(), isLimitless(), isLowerLimited(), isNonnegative(), isPositive(), isUpperLimited(), lowerLimit(), and upperLimit().
double RealLimits::upperLimit | ( | ) | const |
Returns upper limit.
Definition at line 71 of file RealLimits.cpp.
References m_upper_limit.
Referenced by IDistribution1D::adjustMinMaxForLimits(), IRangedDistribution::checkInitialization(), Py::Fmt::printRealLimits(), toString(), and AttLimits::upperLimit().
|
static |
Creates an object bounded from the right.
Definition at line 129 of file RealLimits.cpp.
References RealLimits().
Referenced by AttLimits::upperLimited().
|
friend |
|
protected |
Definition at line 111 of file RealLimits.h.
Referenced by hasLowerAndUpperLimits(), hasLowerLimit(), operator==(), removeLowerLimit(), scaledLimits(), and setLowerLimit().
|
protected |
parameter has lower bound
Definition at line 112 of file RealLimits.h.
Referenced by hasLowerAndUpperLimits(), hasUpperLimit(), operator==(), removeUpperLimit(), scaledLimits(), and setUpperLimit().
|
protected |
parameter has upper bound
Definition at line 113 of file RealLimits.h.
Referenced by isInRange(), lowerLimit(), operator==(), removeLowerLimit(), scaledLimits(), and setLowerLimit().
|
protected |
minimum allowed value
Definition at line 114 of file RealLimits.h.
Referenced by isInRange(), operator==(), removeUpperLimit(), scaledLimits(), setUpperLimit(), and upperLimit().