BornAgain  1.18.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 scattering at grazing incidence
4 //
5 //! @file Fit/Tools/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_TOOLS_ATTLIMITS_H
16 #define BORNAGAIN_FIT_TOOLS_ATTLIMITS_H
17 
18 #include "Fit/Tools/Attributes.h"
19 #include "Fit/Tools/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 {
27 public:
28  AttLimits();
29 
30  static AttLimits limitless();
31  static AttLimits lowerLimited(double bound_value);
32  static AttLimits positive();
33  static AttLimits nonnegative();
34  static AttLimits upperLimited(double bound_value);
35  static AttLimits limited(double left_bound_value, double right_bound_value);
36  static AttLimits fixed();
37 
38  bool isFixed() const;
39  bool isLimited() const;
40  bool isUpperLimited() const;
41  bool isLowerLimited() const;
42  bool isLimitless() const;
43 
44  double lowerLimit() const;
45  double upperLimit() const;
46 
47  void setFixed(bool isFixed);
48 
49  bool operator==(const AttLimits& other) const;
50  bool operator!=(const AttLimits& other) const;
51 
52  std::string toString() const;
53 
54  friend std::ostream& operator<<(std::ostream& ostr, const AttLimits& m)
55  {
56  ostr << m.toString();
57  return ostr;
58  }
59 
60 private:
61  AttLimits(const RealLimits& limits, const Attributes& fixedAttr);
62 
65 };
66 
67 #endif // BORNAGAIN_FIT_TOOLS_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:26
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:63
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:54
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:64
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:24
Limits for a real fit parameter.
Definition: RealLimits.h:25