BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
AttLimits.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Fit/Param/AttLimits.h
6 //! @brief Defines and implements class AttLimits.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_FIT_PARAM_ATTLIMITS_H
16 #define BORNAGAIN_FIT_PARAM_ATTLIMITS_H
17 
18 #include "Fit/Param/Attributes.h"
19 #include "Fit/Param/RealLimits.h"
20 #include <string>
21 
22 //! Attributes and limits of a fit parameter, and coupling between these properties.
23 //! @ingroup fitting
24 
25 class AttLimits {
26 public:
27  AttLimits();
28 
29  static AttLimits limitless();
30  static AttLimits lowerLimited(double bound_value);
31  static AttLimits positive();
32  static AttLimits nonnegative();
33  static AttLimits upperLimited(double bound_value);
34  static AttLimits limited(double left_bound_value, double right_bound_value);
35  static AttLimits fixed();
36 
37  bool isFixed() const;
38  bool isLimited() const;
39  bool isUpperLimited() const;
40  bool isLowerLimited() const;
41  bool isLimitless() const;
42 
43  double lowerLimit() const;
44  double upperLimit() const;
45 
46  void setFixed(bool isFixed);
47 
48  bool operator==(const AttLimits& other) const;
49  bool operator!=(const AttLimits& other) const;
50 
51  std::string toString() const;
52 
53  friend std::ostream& operator<<(std::ostream& ostr, const AttLimits& m)
54  {
55  ostr << m.toString();
56  return ostr;
57  }
58 
59 private:
60  AttLimits(const RealLimits& limits, const Attributes& fixedAttr);
61 
64 };
65 
66 #endif // BORNAGAIN_FIT_PARAM_ATTLIMITS_H
Defines and implements class Attributes.
Defines class RealLimits.
Attributes and limits of a fit parameter, and coupling between these properties.
Definition: AttLimits.h:25
double lowerLimit() const
Definition: AttLimits.cpp:86
std::string toString() const
Definition: AttLimits.cpp:112
static AttLimits lowerLimited(double bound_value)
Definition: AttLimits.cpp:31
void setFixed(bool isFixed)
Definition: AttLimits.cpp:96
RealLimits m_limits
Definition: AttLimits.h:62
static AttLimits limitless()
Definition: AttLimits.cpp:26
double upperLimit() const
Definition: AttLimits.cpp:91
static AttLimits fixed()
Definition: AttLimits.cpp:56
bool isUpperLimited() const
Definition: AttLimits.cpp:71
bool operator==(const AttLimits &other) const
Definition: AttLimits.cpp:102
friend std::ostream & operator<<(std::ostream &ostr, const AttLimits &m)
Definition: AttLimits.h:53
bool operator!=(const AttLimits &other) const
Definition: AttLimits.cpp:107
bool isFixed() const
Definition: AttLimits.cpp:61
bool isLimitless() const
Definition: AttLimits.cpp:81
bool isLimited() const
Definition: AttLimits.cpp:66
Attributes m_att_fixed
Definition: AttLimits.h:63
static AttLimits upperLimited(double bound_value)
Definition: AttLimits.cpp:46
static AttLimits nonnegative()
Definition: AttLimits.cpp:41
static AttLimits positive()
Definition: AttLimits.cpp:36
static AttLimits limited(double left_bound_value, double right_bound_value)
Definition: AttLimits.cpp:51
bool isLowerLimited() const
Definition: AttLimits.cpp:76
Attributes for a fit parameter.
Definition: Attributes.h:26
Limits for a real fit parameter.
Definition: RealLimits.h:24