BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
DistributionItem Class Referenceabstract

Description

Definition at line 27 of file DistributionItems.h.

Inheritance diagram for DistributionItem:
[legend]

Public Member Functions

 DistributionItem ()
 
virtual ~DistributionItem ()=default
 
virtual std::unique_ptr< IDistribution1D > createDistribution (double scale=1.0) const =0
 
virtual DoubleDescriptors distributionValues (bool withMean=true) const =0
 
 DOUBLE_PROPERTY (sigmaFactor, SigmaFactor)
 
bool hasSigmaFactor () const
 
virtual void initDistribution (double)
 
template<typename T >
bool is () const
 
RealLimits limits () const
 
void serialize (Streamer &s)
 Serialization of contents. More...
 
virtual void setLimits (const RealLimits &limits)
 
virtual void setUnit (const variant< QString, Unit > &unit)=0
 Set the unit of the distributed value. More...
 
 UINT_PROPERTY (numberOfSamples, NumberOfSamples)
 

Protected Member Functions

void addToSerialization (DoubleProperty *d)
 
void initSigmaFactor ()
 

Protected Attributes

RealLimits m_limits
 

Private Attributes

QVector< DoubleProperty * > m_serializationProperties
 

Constructor & Destructor Documentation

◆ ~DistributionItem()

virtual DistributionItem::~DistributionItem ( )
virtualdefault

◆ DistributionItem()

DistributionItem::DistributionItem ( )

Definition at line 23 of file DistributionItems.cpp.

24 {
25  m_numberOfSamples.init("Number of samples", "", 5, "", RealLimits::lowerLimited(1.0),
26  "nSamples");
27 }

Member Function Documentation

◆ addToSerialization()

◆ createDistribution()

virtual std::unique_ptr<IDistribution1D> DistributionItem::createDistribution ( double  scale = 1.0) const
pure virtual

◆ distributionValues()

virtual DoubleDescriptors DistributionItem::distributionValues ( bool  withMean = true) const
pure virtual

◆ DOUBLE_PROPERTY()

DistributionItem::DOUBLE_PROPERTY ( sigmaFactor  ,
SigmaFactor   
)

◆ hasSigmaFactor()

bool DistributionItem::hasSigmaFactor ( ) const

Definition at line 45 of file DistributionItems.cpp.

46 {
47  return m_sigmaFactor.isInitialized();
48 }

Referenced by DistributionPlot::plot_multiple_values().

◆ initDistribution()

◆ initSigmaFactor()

void DistributionItem::initSigmaFactor ( )
protected

Definition at line 34 of file DistributionItems.cpp.

35 {
36  m_sigmaFactor.init("Sigma factor", "", 2.0, Unit::unitless, "sigmaFactor");
37  addToSerialization(&m_sigmaFactor);
38 }
@ unitless
void addToSerialization(DoubleProperty *d)

References addToSerialization(), and unitless.

Referenced by DistributionCosineItem::DistributionCosineItem(), DistributionGaussianItem::DistributionGaussianItem(), DistributionLogNormalItem::DistributionLogNormalItem(), and DistributionLorentzItem::DistributionLorentzItem().

Here is the call graph for this function:

◆ is()

template<typename T >
bool DistributionItem::is ( ) const
inline

Definition at line 33 of file DistributionItems.h.

34  {
35  return dynamic_cast<const T*>(this) != nullptr;
36  }

Referenced by DistributionPlot::plot_distributions(), DistributionPlot::plot_multiple_values(), and DistributionPlot::plot_single_value().

◆ limits()

RealLimits DistributionItem::limits ( ) const

Definition at line 62 of file DistributionItems.cpp.

63 {
64  return m_limits;
65 }

References m_limits.

Referenced by DistributionPlot::plot_multiple_values(), setLimits(), and SymmetricResolutionItem::setLimits().

◆ serialize()

void DistributionItem::serialize ( Streamer s)

Serialization of contents.

Important: limits and a changed unit (with setUnit) will not be serialized here. They have to be set again by the owner of DistributionItem after reading it

Definition at line 50 of file DistributionItems.cpp.

51 {
52  s.assertVersion(0);
53  Serialize::rwProperty(s, m_numberOfSamples);
54 
55  for (auto* p : m_serializationProperties)
56  Serialize::rwProperty(s, *p);
57 
58  // m_limits and a changed unit (with setUnit) will not be serialized here. They have to be set
59  // again by the owner of DistributionItem after reading it
60 }
void assertVersion(unsigned expectedVersion) const
As reader, throws DeserializationException unless the expected version is read. As writer,...
Definition: Streamer.cpp:26
void rwProperty(Streamer &s, DoubleProperty &d)

References Streamer::assertVersion(), m_serializationProperties, and Serialize::rwProperty().

Here is the call graph for this function:

◆ setLimits()

void DistributionItem::setLimits ( const RealLimits &  limits)
virtual

Reimplemented in SymmetricResolutionItem.

Definition at line 29 of file DistributionItems.cpp.

30 {
31  m_limits = limits;
32 }
RealLimits limits() const

References limits(), and m_limits.

Referenced by BeamAzimuthalAngleItem::initDistribution(), BeamInclinationAngleItem::initDistribution(), BeamAzimuthalAngleItem::serialize(), BeamInclinationAngleItem::serialize(), BeamWavelengthItem::serialize(), SpecularBeamInclinationItem::serialize(), and SymmetricResolutionItem::setLimits().

Here is the call graph for this function:

◆ setUnit()

◆ UINT_PROPERTY()

DistributionItem::UINT_PROPERTY ( numberOfSamples  ,
NumberOfSamples   
)

Member Data Documentation

◆ m_limits

◆ m_serializationProperties

QVector<DoubleProperty*> DistributionItem::m_serializationProperties
private

Definition at line 67 of file DistributionItems.h.

Referenced by addToSerialization(), and serialize().


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