BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
AttLimits Class Reference

Attributes and limits of a fit parameter, and coupling between these properties. More...

Collaboration diagram for AttLimits:
[legend]

Public Member Functions

 AttLimits ()
 
bool isFixed () const
 
bool isLimited () const
 
bool isLimitless () const
 
bool isLowerLimited () const
 
bool isUpperLimited () const
 
double lowerLimit () const
 
bool operator!= (const AttLimits &other) const
 
bool operator== (const AttLimits &other) const
 
void setFixed (bool isFixed)
 
std::string toString () const
 
double upperLimit () const
 

Static Public Member Functions

static AttLimits fixed ()
 
static AttLimits limited (double left_bound_value, double right_bound_value)
 
static AttLimits limitless ()
 
static AttLimits lowerLimited (double bound_value)
 
static AttLimits nonnegative ()
 
static AttLimits positive ()
 
static AttLimits upperLimited (double bound_value)
 

Private Member Functions

 AttLimits (const RealLimits &limits, const Attributes &fixedAttr)
 

Private Attributes

Attributes m_att_fixed
 
RealLimits m_limits
 

Friends

std::ostream & operator<< (std::ostream &ostr, const AttLimits &m)
 

Detailed Description

Attributes and limits of a fit parameter, and coupling between these properties.

Definition at line 25 of file AttLimits.h.

Constructor & Destructor Documentation

◆ AttLimits() [1/2]

AttLimits::AttLimits ( )

Definition at line 19 of file AttLimits.cpp.

RealLimits m_limits
Definition: AttLimits.h:62
Attributes m_att_fixed
Definition: AttLimits.h:63
static Attributes free()
Definition: Attributes.h:31
static RealLimits limitless()
Creates an object withoud bounds (default)
Definition: RealLimits.cpp:130

Referenced by fixed(), limited(), limitless(), lowerLimited(), nonnegative(), positive(), and upperLimited().

◆ AttLimits() [2/2]

AttLimits::AttLimits ( const RealLimits limits,
const Attributes fixedAttr 
)
private

Definition at line 21 of file AttLimits.cpp.

22  : m_limits(limits), m_att_fixed(fixedAttr)
23 {
24 }

Member Function Documentation

◆ fixed()

AttLimits AttLimits::fixed ( )
static

Definition at line 56 of file AttLimits.cpp.

57 {
59 }
static Attributes fixed()
Creates a fixed value object.
Definition: Attributes.h:30

References AttLimits(), Attributes::fixed(), and RealLimits::limitless().

Referenced by FitParameterItem::attLimits().

Here is the call graph for this function:

◆ isFixed()

bool AttLimits::isFixed ( ) const

Definition at line 61 of file AttLimits.cpp.

62 {
63  return m_att_fixed.isFixed();
64 }
bool isFixed() const
Definition: Attributes.h:34

References Attributes::isFixed(), and m_att_fixed.

Referenced by setFixed(), MinimizerAdapter::setParameter(), GeneticMinimizer::setParameter(), and toString().

Here is the call graph for this function:

◆ isLimited()

bool AttLimits::isLimited ( ) const

Definition at line 66 of file AttLimits.cpp.

67 {
69 }
bool isFree() const
Definition: Attributes.h:35
bool hasLowerAndUpperLimits() const
if has lower and upper limit
Definition: RealLimits.cpp:79

References RealLimits::hasLowerAndUpperLimits(), Attributes::isFree(), m_att_fixed, and m_limits.

Referenced by MinimizerAdapter::setParameter(), GeneticMinimizer::setParameter(), and toString().

Here is the call graph for this function:

◆ isLimitless()

bool AttLimits::isLimitless ( ) const

Definition at line 81 of file AttLimits.cpp.

82 {
84 }
bool hasUpperLimit() const
if has upper limit
Definition: RealLimits.cpp:57
bool hasLowerLimit() const
if has lower limit
Definition: RealLimits.cpp:35

References RealLimits::hasLowerLimit(), RealLimits::hasUpperLimit(), Attributes::isFree(), m_att_fixed, and m_limits.

Referenced by MinimizerAdapter::setParameter(), and toString().

Here is the call graph for this function:

◆ isLowerLimited()

bool AttLimits::isLowerLimited ( ) const

Definition at line 76 of file AttLimits.cpp.

77 {
79 }

References RealLimits::hasLowerLimit(), RealLimits::hasUpperLimit(), Attributes::isFree(), m_att_fixed, and m_limits.

Referenced by MinimizerAdapter::setParameter(), and toString().

Here is the call graph for this function:

◆ isUpperLimited()

bool AttLimits::isUpperLimited ( ) const

Definition at line 71 of file AttLimits.cpp.

72 {
74 }

References RealLimits::hasLowerLimit(), RealLimits::hasUpperLimit(), Attributes::isFree(), m_att_fixed, and m_limits.

Referenced by MinimizerAdapter::setParameter(), and toString().

Here is the call graph for this function:

◆ limited()

AttLimits AttLimits::limited ( double  left_bound_value,
double  right_bound_value 
)
static

Definition at line 51 of file AttLimits.cpp.

52 {
53  return AttLimits(RealLimits::limited(left_bound_value, right_bound_value), Attributes::free());
54 }
static RealLimits limited(double left_bound_value, double right_bound_value)
Creates an object bounded from the left and right.
Definition: RealLimits.cpp:125

References AttLimits(), Attributes::free(), and RealLimits::limited().

Referenced by FitParameterItem::attLimits().

Here is the call graph for this function:

◆ limitless()

AttLimits AttLimits::limitless ( )
static

Definition at line 26 of file AttLimits.cpp.

27 {
28  return AttLimits();
29 }

References AttLimits().

Referenced by FitParameterItem::attLimits().

Here is the call graph for this function:

◆ lowerLimit()

double AttLimits::lowerLimit ( ) const

Definition at line 86 of file AttLimits.cpp.

87 {
88  return m_limits.lowerLimit();
89 }
double lowerLimit() const
Returns lower limit.
Definition: RealLimits.cpp:40

References RealLimits::lowerLimit(), and m_limits.

Referenced by MinimizerAdapter::setParameter(), and toString().

Here is the call graph for this function:

◆ lowerLimited()

AttLimits AttLimits::lowerLimited ( double  bound_value)
static

Definition at line 31 of file AttLimits.cpp.

32 {
33  return AttLimits(RealLimits::lowerLimited(bound_value), Attributes::free());
34 }
static RealLimits lowerLimited(double bound_value)
Creates an object bounded from the left.
Definition: RealLimits.cpp:105

References AttLimits(), Attributes::free(), and RealLimits::lowerLimited().

Referenced by FitParameterItem::attLimits().

Here is the call graph for this function:

◆ nonnegative()

AttLimits AttLimits::nonnegative ( )
static

Definition at line 41 of file AttLimits.cpp.

42 {
44 }
static RealLimits nonnegative()
Creates an object which can have only positive values with 0. included.
Definition: RealLimits.cpp:115

References AttLimits(), Attributes::free(), and RealLimits::nonnegative().

Here is the call graph for this function:

◆ operator!=()

bool AttLimits::operator!= ( const AttLimits other) const

Definition at line 107 of file AttLimits.cpp.

108 {
109  return !(*this == other);
110 }

◆ operator==()

bool AttLimits::operator== ( const AttLimits other) const

Definition at line 102 of file AttLimits.cpp.

103 {
104  return m_limits == other.m_limits && m_att_fixed == other.m_att_fixed;
105 }

References m_att_fixed, and m_limits.

◆ positive()

AttLimits AttLimits::positive ( )
static

Definition at line 36 of file AttLimits.cpp.

37 {
39 }
static RealLimits positive()
Creates an object which can have only positive values (>0., zero is not included)
Definition: RealLimits.cpp:110

References AttLimits(), Attributes::free(), and RealLimits::positive().

Here is the call graph for this function:

◆ setFixed()

void AttLimits::setFixed ( bool  isFixed)

Definition at line 96 of file AttLimits.cpp.

97 {
100 }
bool isFixed() const
Definition: AttLimits.cpp:61
void setFixed(bool is_fixed)
Definition: Attributes.h:33
void removeLimits()
remove limits
Definition: RealLimits.cpp:90

References isFixed(), m_att_fixed, m_limits, RealLimits::removeLimits(), and Attributes::setFixed().

Here is the call graph for this function:

◆ toString()

std::string AttLimits::toString ( ) const

Definition at line 112 of file AttLimits.cpp.

113 {
114  std::ostringstream result;
115 
116  if (isFixed())
117  result << "fixed";
118  else if (isLimitless())
119  result << "free";
120  else if (isLowerLimited())
121  result << "lowerLimited(" << std::scientific << std::setprecision(2) << lowerLimit() << ")";
122  else if (isUpperLimited())
123  result << "upperLimited(" << std::scientific << std::setprecision(2) << upperLimit() << ")";
124  else if (isLimited())
125  result << "limited(" << std::scientific << std::setprecision(2) << lowerLimit() << ","
126  << std::scientific << std::setprecision(2) << upperLimit() << ")";
127 
128  return result.str();
129 }
double lowerLimit() const
Definition: AttLimits.cpp:86
double upperLimit() const
Definition: AttLimits.cpp:91
bool isUpperLimited() const
Definition: AttLimits.cpp:71
bool isLimitless() const
Definition: AttLimits.cpp:81
bool isLimited() const
Definition: AttLimits.cpp:66
bool isLowerLimited() const
Definition: AttLimits.cpp:76
std::string scientific(const T value, int n=10)
Returns scientific string representing given value of any numeric type.
Definition: StringUtils.h:61

References isFixed(), isLimited(), isLimitless(), isLowerLimited(), isUpperLimited(), lowerLimit(), StringUtils::scientific(), and upperLimit().

Referenced by GeneticMinimizer::setParameter().

Here is the call graph for this function:

◆ upperLimit()

double AttLimits::upperLimit ( ) const

Definition at line 91 of file AttLimits.cpp.

92 {
93  return m_limits.upperLimit();
94 }
double upperLimit() const
Returns upper limit.
Definition: RealLimits.cpp:62

References m_limits, and RealLimits::upperLimit().

Referenced by MinimizerAdapter::setParameter(), and toString().

Here is the call graph for this function:

◆ upperLimited()

AttLimits AttLimits::upperLimited ( double  bound_value)
static

Definition at line 46 of file AttLimits.cpp.

47 {
48  return AttLimits(RealLimits::upperLimited(bound_value), Attributes::free());
49 }
static RealLimits upperLimited(double bound_value)
Creates an object bounded from the right.
Definition: RealLimits.cpp:120

References AttLimits(), Attributes::free(), and RealLimits::upperLimited().

Referenced by FitParameterItem::attLimits().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  ostr,
const AttLimits m 
)
friend

Definition at line 53 of file AttLimits.h.

54  {
55  ostr << m.toString();
56  return ostr;
57  }
std::string toString() const
Definition: AttLimits.cpp:112

Member Data Documentation

◆ m_att_fixed

Attributes AttLimits::m_att_fixed
private

◆ m_limits

RealLimits AttLimits::m_limits
private

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