BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ParameterTuningDelegate::TuningData Class Reference

Description

Definition at line 32 of file ParameterTuningDelegate.h.

Public Member Functions

 TuningData ()
 
void setItemLimits (const RealLimits &item_limits)
 
void setRangeFactor (double range_factor)
 
double slider_to_value (int slider) const
 
double step () const
 
int value_to_slider (double value)
 

Public Attributes

RealLimits m_item_limits
 
double m_range_factor
 
double m_rmax
 
double m_rmin
 
int m_smax
 
int m_smin
 

Constructor & Destructor Documentation

◆ TuningData()

ParameterTuningDelegate::TuningData::TuningData ( )

Member Function Documentation

◆ setItemLimits()

void ParameterTuningDelegate::TuningData::setItemLimits ( const RealLimits &  item_limits)

Definition at line 54 of file ParameterTuningDelegate.cpp.

55 {
56  m_item_limits = item_limits;
57 }

Referenced by ParameterTuningDelegate::createEditor().

◆ setRangeFactor()

void ParameterTuningDelegate::TuningData::setRangeFactor ( double  range_factor)

Definition at line 49 of file ParameterTuningDelegate.cpp.

50 {
51  m_range_factor = range_factor;
52 }

Referenced by ParameterTuningDelegate::setSliderRangeFactor().

◆ slider_to_value()

double ParameterTuningDelegate::TuningData::slider_to_value ( int  slider) const

Definition at line 79 of file ParameterTuningDelegate.cpp.

80 {
81  return m_rmin + (slider - m_smin) * (m_rmax - m_rmin) / (m_smax - m_smin);
82 }

Referenced by ParameterTuningDelegate::sliderValueChanged().

◆ step()

double ParameterTuningDelegate::TuningData::step ( ) const

Definition at line 84 of file ParameterTuningDelegate.cpp.

85 {
86  return (m_rmax - m_rmin) / (m_smax - m_smin);
87 }

Referenced by ParameterTuningDelegate::createEditor().

◆ value_to_slider()

int ParameterTuningDelegate::TuningData::value_to_slider ( double  value)

Definition at line 59 of file ParameterTuningDelegate.cpp.

60 {
61  double dr(0);
62  if (value == 0.0)
63  dr = 1.0 * m_range_factor / 100.;
64  else
65  dr = std::abs(value) * m_range_factor / 100.;
66  m_rmin = value - dr;
67  m_rmax = value + dr;
68 
69  if (m_item_limits.hasLowerLimit() && m_rmin < m_item_limits.lowerLimit())
70  m_rmin = m_item_limits.lowerLimit();
71 
72  if (m_item_limits.hasUpperLimit() && m_rmax > m_item_limits.upperLimit())
73  m_rmax = m_item_limits.upperLimit();
74 
75  double result = m_smin + (value - m_rmin) * (m_smax - m_smin) / (m_rmax - m_rmin);
76  return static_cast<int>(result);
77 }

Referenced by ParameterTuningDelegate::createEditor(), and ParameterTuningDelegate::updateSlider().

Member Data Documentation

◆ m_item_limits

RealLimits ParameterTuningDelegate::TuningData::m_item_limits

Definition at line 45 of file ParameterTuningDelegate.h.

◆ m_range_factor

double ParameterTuningDelegate::TuningData::m_range_factor

Definition at line 44 of file ParameterTuningDelegate.h.

◆ m_rmax

double ParameterTuningDelegate::TuningData::m_rmax

Definition at line 43 of file ParameterTuningDelegate.h.

◆ m_rmin

double ParameterTuningDelegate::TuningData::m_rmin

Definition at line 42 of file ParameterTuningDelegate.h.

◆ m_smax

int ParameterTuningDelegate::TuningData::m_smax

Definition at line 41 of file ParameterTuningDelegate.h.

Referenced by ParameterTuningDelegate::createEditor().

◆ m_smin

int ParameterTuningDelegate::TuningData::m_smin

Definition at line 40 of file ParameterTuningDelegate.h.

Referenced by ParameterTuningDelegate::createEditor().


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