BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
BeamDistributionItem.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/Device/BeamDistributionItem.h
6 //! @brief Defines class BeamDistributionItem
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_GUI_MODEL_DEVICE_BEAMDISTRIBUTIONITEM_H
16 #define BORNAGAIN_GUI_MODEL_DEVICE_BEAMDISTRIBUTIONITEM_H
17 
20 #include "Param/Distrib/ParameterDistribution.h"
21 
22 //! The BeamDistributionItem handles wavelength, inclination and azimuthal parameter
23 //! distribution for BeamItem
24 
26 public:
27  virtual ~BeamDistributionItem() = default;
28 
29  virtual void serialize(Streamer& s) = 0;
30 
31  std::unique_ptr<ParameterDistribution>
32  getParameterDistributionForName(ParameterDistribution::WhichParameter which) const;
33 
34  virtual double meanValue() const;
35  void resetToValue(double value);
36 
37  virtual double scaleFactor() const;
38 
39  template <typename T>
44 
45 protected:
46  virtual std::unique_ptr<IDistribution1D> createDistribution1D() const;
47 
49 };
50 
51 template <typename T>
53 {
54  m_distribution.set<T>();
55  return dynamic_cast<T*>(m_distribution.get());
56 }
57 
58 #endif // BORNAGAIN_GUI_MODEL_DEVICE_BEAMDISTRIBUTIONITEM_H
Defines class DistributionItem and several subclasses.
Defines class SelectionProperty.
The BeamDistributionItem handles wavelength, inclination and azimuthal parameter distribution for Bea...
SelectionDescriptor< DistributionItem * > distributionSelection() const
virtual void serialize(Streamer &s)=0
DistributionItem * distribution() const
void setDistribution(DistributionItem *d)
virtual std::unique_ptr< IDistribution1D > createDistribution1D() const
void resetToValue(double value)
virtual double scaleFactor() const
std::unique_ptr< ParameterDistribution > getParameterDistributionForName(ParameterDistribution::WhichParameter which) const
virtual ~BeamDistributionItem()=default
SelectionProperty< DistributionItem * > m_distribution
virtual double meanValue() const
Describes a selection (various possibilities and the current one).
void set(T t, bool callInitializer=false)
Directly set the new item.
T get() const
Direct access to the stored pointer.
Supports serialization to or deserialization from QXmlStream.
Definition: Streamer.h:36