BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
AttLimits Class Reference
Collaboration diagram for AttLimits:

Public Member Functions

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

Static Public Member Functions

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

Private Member Functions

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

Private Attributes

RealLimits m_limits
 
Attributes m_att_fixed
 

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:63
Attributes m_att_fixed
Definition: AttLimits.h:64
static Attributes free()
Definition: Attributes.h:29
static RealLimits limitless()
Creates an object withoud bounds (default)
Definition: RealLimits.cpp:128

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

◆ limitless()

AttLimits AttLimits::limitless ( )
static

Definition at line 26 of file AttLimits.cpp.

27 {
28  return AttLimits();
29 }

References AttLimits().

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:103

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

Here is the call graph for this function:

◆ 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:108

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

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:113

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

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:118

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

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:123

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

Here is the call graph for this function:

◆ 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:28

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

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:32

References Attributes::isFixed(), and m_att_fixed.

Referenced by setFixed(), RootMinimizerAdapter::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:33
bool hasLowerAndUpperLimits() const
if has lower and upper limit
Definition: RealLimits.cpp:77

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

Referenced by RootMinimizerAdapter::setParameter(), GeneticMinimizer::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 }
bool hasUpperLimit() const
if has upper limit
Definition: RealLimits.cpp:55
bool hasLowerLimit() const
if has lower limit
Definition: RealLimits.cpp:33

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

Referenced by RootMinimizerAdapter::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 RootMinimizerAdapter::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 }

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

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

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:38

References RealLimits::lowerLimit(), and m_limits.

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

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:60

References m_limits, and RealLimits::upperLimit().

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

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:31
void removeLimits()
remove limits
Definition: RealLimits.cpp:88

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

Here is the call graph for this function:

◆ 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.

◆ operator!=()

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

Definition at line 107 of file AttLimits.cpp.

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

◆ 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:54

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

Referenced by GeneticMinimizer::setParameter().

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 54 of file AttLimits.h.

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

Member Data Documentation

◆ m_limits

RealLimits AttLimits::m_limits
private

◆ m_att_fixed

Attributes AttLimits::m_att_fixed
private

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