BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IDistribution1D Class Referenceabstract
Inheritance diagram for IDistribution1D:
Collaboration diagram for IDistribution1D:

Public Member Functions

 IDistribution1D (const NodeMeta &meta, const std::vector< double > &PValues)
 
virtual IDistribution1Dclone () const =0
 
virtual double probabilityDensity (double x) const =0
 
virtual double getMean () const =0
 
std::vector< ParameterSampleequidistantSamples (size_t nbr_samples, double sigma_factor=0., const RealLimits &limits=RealLimits()) const
 
std::vector< ParameterSampleequidistantSamplesInRange (size_t nbr_samples, double xmin, double xmax) const
 
virtual std::vector< double > equidistantPoints (size_t nbr_samples, double sigma_factor, const RealLimits &limits=RealLimits()) const =0
 
virtual std::vector< double > equidistantPointsInRange (size_t nbr_samples, double xmin, double xmax) const
 
virtual bool isDelta () const =0
 
virtual void setUnits (const std::string &units)
 
virtual void transferToCPP ()
 
virtual void accept (INodeVisitor *visitor) const =0
 
virtual std::string treeToString () const
 
void registerChild (INode *node)
 
virtual std::vector< const INode * > getChildren () const
 
virtual void setParent (const INode *newParent)
 
const INodeparent () const
 
INodeparent ()
 
int copyNumber (const INode *node) const
 
std::string displayName () const
 
ParameterPoolcreateParameterTree () const
 
ParameterPoolparameterPool () const
 
std::string parametersToString () const
 
RealParameterregisterParameter (const std::string &name, double *parpointer)
 
void registerVector (const std::string &base_name, kvector_t *p_vec, const std::string &units="nm")
 
void setParameterValue (const std::string &name, double value)
 
void setVectorValue (const std::string &base_name, kvector_t value)
 
RealParameterparameter (const std::string &name) const
 
virtual void onChange ()
 
void removeParameter (const std::string &name)
 
void removeVector (const std::string &base_name)
 
void setName (const std::string &name)
 
const std::string & getName () const
 

Static Public Member Functions

static std::string XComponentName (const std::string &base_name)
 
static std::string YComponentName (const std::string &base_name)
 
static std::string ZComponentName (const std::string &base_name)
 

Protected Member Functions

void adjustMinMaxForLimits (double &xmin, double &xmax, const RealLimits &limits) const
 
std::vector< ParameterSamplegenerateSamplesFromValues (const std::vector< double > &sample_values) const
 

Protected Attributes

const size_t m_NP
 
std::vector< double > m_P
 

Private Attributes

const INodem_parent {nullptr}
 
std::string m_name
 
std::unique_ptr< ParameterPoolm_pool
 

Detailed Description

Interface for one-dimensional distributions.

Definition at line 32 of file Distributions.h.

Constructor & Destructor Documentation

◆ IDistribution1D()

IDistribution1D::IDistribution1D ( const NodeMeta meta,
const std::vector< double > &  PValues 
)

Definition at line 35 of file Distributions.cpp.

36  : INode(meta, PValues)
37 {
38 }
INode()
Definition: INode.h:51

Member Function Documentation

◆ clone()

◆ probabilityDensity()

virtual double IDistribution1D::probabilityDensity ( double  x) const
pure virtual

Returns the distribution-specific probability density for value x.

Implemented in DistributionTrapezoid, DistributionCosine, DistributionLogNormal, DistributionGaussian, DistributionLorentz, and DistributionGate.

Referenced by generateSamplesFromValues().

◆ getMean()

◆ equidistantSamples()

std::vector< ParameterSample > IDistribution1D::equidistantSamples ( size_t  nbr_samples,
double  sigma_factor = 0.,
const RealLimits limits = RealLimits() 
) const

Returns equidistant samples, using intrinsic parameters, weighted with probabilityDensity().

Definition at line 42 of file Distributions.cpp.

45 {
46  if (nbr_samples == 0)
48  "IDistribution1D::generateSamples: "
49  "number of generated samples must be bigger than zero");
50  if (isDelta())
51  return {ParameterSample(getMean())};
52  return generateSamplesFromValues(equidistantPoints(nbr_samples, sigma_factor, limits));
53 }
std::vector< ParameterSample > generateSamplesFromValues(const std::vector< double > &sample_values) const
Returns weighted samples from given interpolation points and probabilityDensity().
virtual double getMean() const =0
Returns the distribution-specific mean.
virtual bool isDelta() const =0
Returns true if the distribution is in the limit case of a Dirac delta distribution.
virtual std::vector< double > equidistantPoints(size_t nbr_samples, double sigma_factor, const RealLimits &limits=RealLimits()) const =0
Returns equidistant interpolation points, with range computed in distribution-specific way from mean ...
A parameter value with a weight, as obtained when sampling from a distribution.

References equidistantPoints(), generateSamplesFromValues(), getMean(), and isDelta().

Here is the call graph for this function:

◆ equidistantSamplesInRange()

std::vector< ParameterSample > IDistribution1D::equidistantSamplesInRange ( size_t  nbr_samples,
double  xmin,
double  xmax 
) const

Returns equidistant samples from xmin to xmax, weighted with probabilityDensity().

Definition at line 58 of file Distributions.cpp.

59 {
60  if (nbr_samples == 0)
62  "IDistribution1D::generateSamples: "
63  "number of generated samples must be bigger than zero");
64  if (isDelta())
65  return {ParameterSample(getMean())};
66  return generateSamplesFromValues(equidistantPointsInRange(nbr_samples, xmin, xmax));
67 }
virtual std::vector< double > equidistantPointsInRange(size_t nbr_samples, double xmin, double xmax) const
Returns equidistant interpolation points from xmin to xmax.

References equidistantPointsInRange(), generateSamplesFromValues(), getMean(), and isDelta().

Here is the call graph for this function:

◆ equidistantPoints()

virtual std::vector<double> IDistribution1D::equidistantPoints ( size_t  nbr_samples,
double  sigma_factor,
const RealLimits limits = RealLimits() 
) const
pure virtual

Returns equidistant interpolation points, with range computed in distribution-specific way from mean and width parameter, taking into account limits and sigma_factor.

Implemented in DistributionTrapezoid, DistributionCosine, DistributionLogNormal, DistributionGaussian, DistributionLorentz, and DistributionGate.

Referenced by equidistantSamples().

◆ equidistantPointsInRange()

std::vector< double > IDistribution1D::equidistantPointsInRange ( size_t  nbr_samples,
double  xmin,
double  xmax 
) const
virtual

Returns equidistant interpolation points from xmin to xmax.

Definition at line 71 of file Distributions.cpp.

73 {
74  if (nbr_samples < 2 || DoubleEqual(xmin, xmax))
75  return {getMean()};
76  std::vector<double> result(nbr_samples);
77  for (size_t i = 0; i < nbr_samples; ++i)
78  result[i] = xmin + i * (xmax - xmin) / (nbr_samples - 1.0);
79  return result;
80 }
bool DoubleEqual(double a, double b)

References anonymous_namespace{Distributions.cpp}::DoubleEqual(), and getMean().

Referenced by DistributionGate::equidistantPoints(), DistributionLorentz::equidistantPoints(), DistributionGaussian::equidistantPoints(), DistributionLogNormal::equidistantPoints(), DistributionCosine::equidistantPoints(), DistributionTrapezoid::equidistantPoints(), and equidistantSamplesInRange().

Here is the call graph for this function:

◆ isDelta()

virtual bool IDistribution1D::isDelta ( ) const
pure virtual

Returns true if the distribution is in the limit case of a Dirac delta distribution.

Implemented in DistributionTrapezoid, DistributionCosine, DistributionLogNormal, DistributionGaussian, DistributionLorentz, and DistributionGate.

Referenced by equidistantSamples(), and equidistantSamplesInRange().

◆ setUnits()

void IDistribution1D::setUnits ( const std::string &  units)
virtual

Sets distribution units.

Reimplemented in DistributionLogNormal.

Definition at line 82 of file Distributions.cpp.

83 {
84  for (auto* par : parameterPool()->parameters())
85  par->setUnit(units);
86 }
ParameterPool * parameterPool() const
Returns pointer to the parameter pool.

References IParameterized::parameterPool().

Here is the call graph for this function:

◆ adjustMinMaxForLimits()

void IDistribution1D::adjustMinMaxForLimits ( double &  xmin,
double &  xmax,
const RealLimits limits 
) const
protected

modifies xmin and xmax if they are outside of limits

Definition at line 88 of file Distributions.cpp.

90 {
91  if (limits.hasLowerLimit() && xmin < limits.lowerLimit())
92  xmin = limits.lowerLimit();
93  if (limits.hasUpperLimit() && xmax > limits.upperLimit())
94  xmax = limits.upperLimit();
95  if (xmin > xmax) {
96  std::ostringstream ostr;
97  ostr << "IDistribution1D::adjustMinMaxForLimits() -> Error. Can't' adjust ";
98  ostr << "xmin:" << xmin << " xmax:" << xmax << " for given limits " << limits << std::endl;
99  throw Exceptions::DomainErrorException(ostr.str());
100  }
101 }
bool hasUpperLimit() const
if has upper limit
Definition: RealLimits.cpp:55
double upperLimit() const
Returns upper limit.
Definition: RealLimits.cpp:60
double lowerLimit() const
Returns lower limit.
Definition: RealLimits.cpp:38
bool hasLowerLimit() const
if has lower limit
Definition: RealLimits.cpp:33

References RealLimits::hasLowerLimit(), RealLimits::hasUpperLimit(), RealLimits::lowerLimit(), and RealLimits::upperLimit().

Referenced by DistributionGate::equidistantPoints(), DistributionLorentz::equidistantPoints(), DistributionGaussian::equidistantPoints(), DistributionLogNormal::equidistantPoints(), DistributionCosine::equidistantPoints(), and DistributionTrapezoid::equidistantPoints().

Here is the call graph for this function:

◆ generateSamplesFromValues()

std::vector< ParameterSample > IDistribution1D::generateSamplesFromValues ( const std::vector< double > &  sample_values) const
protected

Returns weighted samples from given interpolation points and probabilityDensity().

Definition at line 106 of file Distributions.cpp.

107 {
108  std::vector<ParameterSample> result;
109  double norm_factor = 0.0;
110  for (double value : sample_values) {
111  double pdf = probabilityDensity(value);
112  result.push_back(ParameterSample(value, pdf));
113  norm_factor += pdf;
114  }
115  if (norm_factor <= 0.0)
116  throw Exceptions::RuntimeErrorException("IDistribution1D::generateSamples: "
117  "total probability must be bigger than zero");
118  for (ParameterSample& sample : result)
119  sample.weight /= norm_factor;
120  return result;
121 }
virtual double probabilityDensity(double x) const =0
Returns the distribution-specific probability density for value x.

References probabilityDensity().

Referenced by equidistantSamples(), and equidistantSamplesInRange().

Here is the call graph for this function:

◆ transferToCPP()

virtual void ICloneable::transferToCPP ( )
inlinevirtualinherited

Used for Python overriding of clone (see swig/tweaks.py)

Definition at line 34 of file ICloneable.h.

◆ accept()

virtual void INode::accept ( INodeVisitor visitor) const
pure virtualinherited

Calls the INodeVisitor's visit method.

Implemented in FormFactorSphereLogNormalRadius, FormFactorSphereGaussianRadius, FormFactorGaussSphere, FormFactorDecoratorRotation, FormFactorDecoratorPositionFactor, FormFactorDecoratorMaterial, ParticleDistribution, ParticleCoreShell, ParticleComposition, Particle, MesoCrystal, FormFactorWeighted, FormFactorCrystal, FormFactorCoreShell, Crystal, Layer, FormFactorTruncatedSpheroid, FormFactorTruncatedSphere, FormFactorTruncatedCube, FormFactorTetrahedron, FormFactorSawtoothRippleLorentz, FormFactorSawtoothRippleGauss, FormFactorSawtoothRippleBox, FormFactorPyramid, FormFactorPrism6, FormFactorPrism3, FormFactorLongBoxLorentz, FormFactorLongBoxGauss, FormFactorIcosahedron, FormFactorHollowSphere, FormFactorHemiEllipsoid, FormFactorFullSpheroid, FormFactorFullSphere, FormFactorEllipsoidalCylinder, FormFactorDot, FormFactorDodecahedron, FormFactorCylinder, FormFactorCuboctahedron, FormFactorCosineRippleLorentz, FormFactorCosineRippleGauss, FormFactorCosineRippleBox, FormFactorCone6, FormFactorCone, FormFactorCantellatedCube, FormFactorBox, FormFactorAnisoPyramid, FTDistribution1DVoigt, FTDistribution1DCosine, FTDistribution1DTriangle, FTDistribution1DGate, FTDistribution1DGauss, FTDistribution1DCauchy, InterferenceFunctionTwin, InterferenceFunctionRadialParaCrystal, InterferenceFunctionNone, InterferenceFunctionHardDisk, InterferenceFunctionFinite3DLattice, InterferenceFunctionFinite2DLattice, InterferenceFunction3DLattice, InterferenceFunction2DSuperLattice, InterferenceFunction2DParaCrystal, InterferenceFunction2DLattice, InterferenceFunction1DLattice, SpecularSimulation, DepthProbeSimulation, FormFactorDWBAPol, FormFactorDWBA, FormFactorBAPol, Lattice, MisesGaussPeakShape, MisesFisherGaussPeakShape, LorentzFisherPeakShape, GaussFisherPeakShape, IsotropicLorentzPeakShape, IsotropicGaussPeakShape, SphericalDetector, SpecularDetector1D, FootprintSquare, FootprintGauss, Beam, GISASSimulation, PoissonNoiseBackground, ConstantBackground, MultiLayer, ParticleLayout, SampleProvider, SampleBuilderNode, HexagonalLattice, SquareLattice, BasicLattice, FormFactorBarLorentz, FormFactorBarGauss, FTDistribution2DVoigt, FTDistribution2DCone, FTDistribution2DGate, FTDistribution2DGauss, FTDistribution2DCauchy, FTDecayFunction2DVoigt, FTDecayFunction2DGauss, FTDecayFunction2DCauchy, FTDecayFunction1DVoigt, FTDecayFunction1DTriangle, FTDecayFunction1DGauss, FTDecayFunction1DCauchy, DistributionTrapezoid, DistributionCosine, DistributionLogNormal, DistributionGaussian, DistributionLorentz, DistributionGate, ResolutionFunction2DGaussian, ConvolutionDetectorResolution, Instrument, RectangularDetector, IsGISAXSDetector, DetectionProperties, OffSpecSimulation, ILayout, LayerRoughness, LayerInterface, RotationEuler, RotationZ, RotationY, RotationX, IdentityRotation, and IAbstractParticle.

Referenced by VisitNodesPostorder(), and VisitNodesPreorder().

◆ treeToString()

std::string INode::treeToString ( ) const
virtualinherited

Returns multiline string representing tree structure below the node.

Definition at line 53 of file INode.cpp.

54 {
55  return NodeUtils::nodeToString(*this);
56 }
std::string nodeToString(const INode &node)
Returns multiline string representing tree structure starting from given node.
Definition: NodeUtils.cpp:67

References NodeUtils::nodeToString().

Here is the call graph for this function:

◆ registerChild()

void INode::registerChild ( INode node)
inherited

Definition at line 58 of file INode.cpp.

59 {
60  ASSERT(node);
61  node->setParent(this);
62 }
#define ASSERT(condition)
Definition: Assert.h:26
virtual void setParent(const INode *newParent)
Definition: INode.cpp:69

References ASSERT, and INode::setParent().

Referenced by ParticleLayout::addAndRegisterAbstractParticle(), ParticleCoreShell::addAndRegisterCore(), MultiLayer::addAndRegisterInterface(), MultiLayer::addAndRegisterLayer(), ParticleCoreShell::addAndRegisterShell(), Layer::addLayout(), ParticleComposition::addParticlePointer(), Beam::Beam(), Crystal::Crystal(), IDetector::IDetector(), Simulation::initialize(), MesoCrystal::initialize(), Instrument::Instrument(), Beam::operator=(), Instrument::operator=(), Particle::Particle(), ParticleDistribution::ParticleDistribution(), IParticle::rotate(), ParticleLayout::setAndRegisterInterferenceFunction(), Simulation::setBackground(), InterferenceFunction1DLattice::setDecayFunction(), InterferenceFunction2DLattice::setDecayFunction(), Instrument::setDetector(), IDetector::setDetectorResolution(), Beam::setFootprintFactor(), Particle::setFormFactor(), InterferenceFunctionFinite3DLattice::setLattice(), InterferenceFunction2DLattice::setLattice(), InterferenceFunction2DParaCrystal::setLattice(), InterferenceFunction2DSuperLattice::setLattice(), InterferenceFunctionFinite2DLattice::setLattice(), InterferenceFunctionRadialParaCrystal::setProbabilityDistribution(), InterferenceFunction2DParaCrystal::setProbabilityDistributions(), ConvolutionDetectorResolution::setResolutionFunction(), IParticle::setRotation(), LayerInterface::setRoughness(), and InterferenceFunction2DSuperLattice::setSubstructureIFF().

Here is the call graph for this function:

◆ getChildren()

◆ setParent()

void INode::setParent ( const INode newParent)
virtualinherited

Reimplemented in SampleProvider.

Definition at line 69 of file INode.cpp.

70 {
71  m_parent = newParent;
72 }
const INode * m_parent
Definition: INode.h:81

References INode::m_parent.

Referenced by INode::registerChild(), SampleProvider::setBuilder(), and SampleProvider::setParent().

◆ parent() [1/2]

const INode * INode::parent ( ) const
inherited

◆ parent() [2/2]

INode * INode::parent ( )
inherited

Definition at line 79 of file INode.cpp.

80 {
81  return const_cast<INode*>(m_parent);
82 }
Base class for tree-like structures containing parameterized objects.
Definition: INode.h:49

References INode::m_parent.

◆ copyNumber()

int INode::copyNumber ( const INode node) const
inherited

Returns copyNumber of child, which takes into account existence of children with same name.

Definition at line 84 of file INode.cpp.

85 {
86  if (node->parent() != this)
87  return -1;
88 
89  int result(-1), count(0);
90  for (auto child : getChildren()) {
91 
92  if (child == nullptr)
93  throw std::runtime_error("INode::copyNumber() -> Error. Nullptr as child.");
94 
95  if (child == node)
96  result = count;
97 
98  if (child->getName() == node->getName())
99  ++count;
100  }
101 
102  return count > 1 ? result : -1;
103 }
const INode * parent() const
Definition: INode.cpp:74
virtual std::vector< const INode * > getChildren() const
Returns a vector of children (const).
Definition: INode.cpp:64
const std::string & getName() const

References INode::getChildren(), IParameterized::getName(), and INode::parent().

Referenced by INode::displayName().

Here is the call graph for this function:

◆ displayName()

std::string INode::displayName ( ) const
inherited

Returns display name, composed from the name of node and it's copy number.

Definition at line 105 of file INode.cpp.

106 {
107  std::string result = getName();
108  if (m_parent) {
109  int index = m_parent->copyNumber(this);
110  if (index >= 0)
111  result = result + std::to_string(index);
112  }
113  return result;
114 }
int copyNumber(const INode *node) const
Returns copyNumber of child, which takes into account existence of children with same name.
Definition: INode.cpp:84

References INode::copyNumber(), IParameterized::getName(), and INode::m_parent.

Referenced by NodeUtils::nodePath(), and anonymous_namespace{NodeUtils.cpp}::nodeString().

Here is the call graph for this function:

◆ createParameterTree()

ParameterPool * INode::createParameterTree ( ) const
virtualinherited

Creates new parameter pool, with all local parameters and those of its children.

Reimplemented from IParameterized.

Definition at line 116 of file INode.cpp.

117 {
118  std::unique_ptr<ParameterPool> result(new ParameterPool);
119 
121  it.first();
122  while (!it.isDone()) {
123  const INode* child = it.getCurrent();
124  const std::string path = NodeUtils::nodePath(*child, this->parent()) + "/";
125  child->parameterPool()->copyToExternalPool(path, result.get());
126  it.next();
127  }
128 
129  return result.release();
130 }
Iterator through INode tree of objects.
Definition: NodeIterator.h:90
Container with parameters for IParameterized object.
Definition: ParameterPool.h:30
void copyToExternalPool(const std::string &prefix, ParameterPool *other_pool) const
Copies parameters of given pool to other pool, prepeding prefix to the parameter names.
std::string nodePath(const INode &node, const INode *root=nullptr)
Returns path composed of node's displayName, with respect to root node.
Definition: NodeUtils.cpp:82

References ParameterPool::copyToExternalPool(), NodeIterator< Strategy >::first(), NodeIterator< Strategy >::getCurrent(), NodeIterator< Strategy >::isDone(), NodeIterator< Strategy >::next(), NodeUtils::nodePath(), IParameterized::parameterPool(), and INode::parent().

Referenced by ParticleDistribution::generateParticles(), Simulation::runSimulation(), DepthProbeSimulation::validateParametrization(), OffSpecSimulation::validateParametrization(), and SpecularSimulation::validateParametrization().

Here is the call graph for this function:

◆ parameterPool()

ParameterPool* IParameterized::parameterPool ( ) const
inlineinherited

Returns pointer to the parameter pool.

Definition at line 38 of file IParameterized.h.

38 { return m_pool.get(); } // has non-const usages!
std::unique_ptr< ParameterPool > m_pool
parameter pool (kind of pointer-to-implementation)

References IParameterized::m_pool.

Referenced by pyfmt2::argumentList(), SampleBuilderNode::borrow_builder_parameters(), INode::createParameterTree(), INode::INode(), IParameterized::IParameterized(), anonymous_namespace{NodeUtils.cpp}::poolToString(), SampleBuilderNode::reset(), and setUnits().

◆ parametersToString()

std::string IParameterized::parametersToString ( ) const
inherited

Returns multiline string representing available parameters.

Definition at line 40 of file IParameterized.cpp.

41 {
42  std::ostringstream result;
43  std::unique_ptr<ParameterPool> P_pool(createParameterTree());
44  result << *P_pool << "\n";
45  return result.str();
46 }
virtual ParameterPool * createParameterTree() const
Creates new parameter pool, with all local parameters and those of its children.

References IParameterized::createParameterTree().

Here is the call graph for this function:

◆ registerParameter()

RealParameter & IParameterized::registerParameter ( const std::string &  name,
double *  parpointer 
)
inherited

Definition at line 48 of file IParameterized.cpp.

49 {
50  return m_pool->addParameter(
51  new RealParameter(name, data, getName(), [&]() -> void { onChange(); }));
52 }
virtual void onChange()
Action to be taken in inherited class when a parameter has changed.
Wraps a parameter of type double.
Definition: RealParameter.h:32

References IParameterized::getName(), IParameterized::m_pool, and IParameterized::onChange().

Referenced by BasicLattice::BasicLattice(), Beam::Beam(), CylindersInBABuilder::CylindersInBABuilder(), DetectionProperties::DetectionProperties(), HexagonalLattice::HexagonalLattice(), IInterferenceFunction::IInterferenceFunction(), INode::INode(), InterferenceFunction1DLattice::InterferenceFunction1DLattice(), InterferenceFunction2DParaCrystal::InterferenceFunction2DParaCrystal(), InterferenceFunctionHardDisk::InterferenceFunctionHardDisk(), InterferenceFunctionRadialParaCrystal::InterferenceFunctionRadialParaCrystal(), InterferenceFunctionTwin::InterferenceFunctionTwin(), Lattice2D::Lattice2D(), LayerRoughness::LayerRoughness(), MultiLayer::MultiLayer(), ParticleDistribution::ParticleDistribution(), PlainMultiLayerBySLDBuilder::PlainMultiLayerBySLDBuilder(), IParticle::registerAbundance(), ParticleLayout::registerParticleDensity(), Layer::registerThickness(), IParameterized::registerVector(), ParticleLayout::registerWeight(), ResolutionFunction2DGaussian::ResolutionFunction2DGaussian(), ResonatorBuilder::ResonatorBuilder(), Lattice2D::setRotationEnabled(), SquareLattice::SquareLattice(), and TriangularRippleBuilder::TriangularRippleBuilder().

Here is the call graph for this function:

◆ registerVector()

void IParameterized::registerVector ( const std::string &  base_name,
kvector_t p_vec,
const std::string &  units = "nm" 
)
inherited

Definition at line 54 of file IParameterized.cpp.

56 {
57  registerParameter(XComponentName(base_name), &((*p_vec)[0])).setUnit(units);
58  registerParameter(YComponentName(base_name), &((*p_vec)[1])).setUnit(units);
59  registerParameter(ZComponentName(base_name), &((*p_vec)[2])).setUnit(units);
60 }
RealParameter & registerParameter(const std::string &name, double *parpointer)
static std::string XComponentName(const std::string &base_name)
static std::string YComponentName(const std::string &base_name)
static std::string ZComponentName(const std::string &base_name)
RealParameter & setUnit(const std::string &name)

References IParameterized::registerParameter(), RealParameter::setUnit(), IParameterized::XComponentName(), IParameterized::YComponentName(), and IParameterized::ZComponentName().

Referenced by Beam::Beam(), DetectionProperties::DetectionProperties(), InterferenceFunctionTwin::InterferenceFunctionTwin(), MultiLayer::MultiLayer(), Lattice::registerBasisVectors(), and IParticle::registerPosition().

Here is the call graph for this function:

◆ setParameterValue()

void IParameterized::setParameterValue ( const std::string &  name,
double  value 
)
inherited

Definition at line 62 of file IParameterized.cpp.

63 {
64  if (name.find('*') == std::string::npos && name.find('/') == std::string::npos) {
65  m_pool->setParameterValue(name, value);
66  } else {
67  std::unique_ptr<ParameterPool> P_pool{createParameterTree()};
68  if (name.find('*') != std::string::npos)
69  P_pool->setMatchedParametersValue(name, value);
70  else
71  P_pool->setParameterValue(name, value);
72  }
73 }
int setMatchedParametersValue(const std::string &wildcards, double value)
Sets value of the nonzero parameters that match pattern ('*' allowed), or throws.

References IParameterized::createParameterTree(), IParameterized::m_pool, and ParameterPool::setMatchedParametersValue().

Referenced by AsymRippleBuilder::buildSample(), and IParameterized::setVectorValue().

Here is the call graph for this function:

◆ setVectorValue()

void IParameterized::setVectorValue ( const std::string &  base_name,
kvector_t  value 
)
inherited

Definition at line 75 of file IParameterized.cpp.

76 {
77  setParameterValue(XComponentName(base_name), value.x());
78  setParameterValue(YComponentName(base_name), value.y());
79  setParameterValue(ZComponentName(base_name), value.z());
80 }
T z() const
Returns z-component in cartesian coordinate system.
Definition: BasicVector3D.h:68
T y() const
Returns y-component in cartesian coordinate system.
Definition: BasicVector3D.h:66
T x() const
Returns x-component in cartesian coordinate system.
Definition: BasicVector3D.h:64
void setParameterValue(const std::string &name, double value)

References IParameterized::setParameterValue(), BasicVector3D< T >::x(), IParameterized::XComponentName(), BasicVector3D< T >::y(), IParameterized::YComponentName(), BasicVector3D< T >::z(), and IParameterized::ZComponentName().

Here is the call graph for this function:

◆ parameter()

RealParameter * IParameterized::parameter ( const std::string &  name) const
inherited

◆ onChange()

◆ removeParameter()

void IParameterized::removeParameter ( const std::string &  name)
inherited

◆ removeVector()

void IParameterized::removeVector ( const std::string &  base_name)
inherited

Definition at line 93 of file IParameterized.cpp.

94 {
95  removeParameter(XComponentName(base_name));
96  removeParameter(YComponentName(base_name));
97  removeParameter(ZComponentName(base_name));
98 }
void removeParameter(const std::string &name)

References IParameterized::removeParameter(), IParameterized::XComponentName(), IParameterized::YComponentName(), and IParameterized::ZComponentName().

Referenced by IParticle::registerPosition().

Here is the call graph for this function:

◆ XComponentName()

std::string IParameterized::XComponentName ( const std::string &  base_name)
staticinherited

◆ YComponentName()

std::string IParameterized::YComponentName ( const std::string &  base_name)
staticinherited

Definition at line 105 of file IParameterized.cpp.

106 {
107  return base_name + "Y";
108 }

Referenced by IParameterized::registerVector(), IParameterized::removeVector(), and IParameterized::setVectorValue().

◆ ZComponentName()

std::string IParameterized::ZComponentName ( const std::string &  base_name)
staticinherited

Definition at line 110 of file IParameterized.cpp.

111 {
112  return base_name + "Z";
113 }

Referenced by IParameterized::registerVector(), IParameterized::removeVector(), and IParameterized::setVectorValue().

◆ setName()

void IParameterized::setName ( const std::string &  name)
inlineinherited

Definition at line 68 of file IParameterized.h.

68 { m_name = name; }
std::string m_name

References IParameterized::m_name.

Referenced by BasicLattice::BasicLattice(), Beam::Beam(), Layer::clone(), ConvolutionDetectorResolution::ConvolutionDetectorResolution(), LayersWithAbsorptionBuilder::createSampleByIndex(), Basic2DParaCrystalBuilder::createSampleByIndex(), ParticleInVacuumBuilder::createSampleByIndex(), SimpleMagneticRotationBuilder::createSampleByIndex(), Crystal::Crystal(), DetectionProperties::DetectionProperties(), DistributionHandler::DistributionHandler(), FormFactorBAPol::FormFactorBAPol(), FormFactorCoreShell::FormFactorCoreShell(), FormFactorCrystal::FormFactorCrystal(), FormFactorDecoratorMaterial::FormFactorDecoratorMaterial(), FormFactorDecoratorPositionFactor::FormFactorDecoratorPositionFactor(), FormFactorDecoratorRotation::FormFactorDecoratorRotation(), FormFactorDWBA::FormFactorDWBA(), FormFactorDWBAPol::FormFactorDWBAPol(), FormFactorWeighted::FormFactorWeighted(), HexagonalLattice::HexagonalLattice(), IDetector::IDetector(), DepthProbeSimulation::initialize(), GISASSimulation::initialize(), OffSpecSimulation::initialize(), SpecularSimulation::initialize(), SpecularDetector1D::initialize(), MesoCrystal::initialize(), Particle::initialize(), ParticleComposition::initialize(), INode::INode(), Instrument::Instrument(), InterferenceFunction1DLattice::InterferenceFunction1DLattice(), InterferenceFunction2DLattice::InterferenceFunction2DLattice(), InterferenceFunction2DParaCrystal::InterferenceFunction2DParaCrystal(), InterferenceFunction2DSuperLattice::InterferenceFunction2DSuperLattice(), InterferenceFunction3DLattice::InterferenceFunction3DLattice(), InterferenceFunctionFinite2DLattice::InterferenceFunctionFinite2DLattice(), InterferenceFunctionFinite3DLattice::InterferenceFunctionFinite3DLattice(), InterferenceFunctionHardDisk::InterferenceFunctionHardDisk(), InterferenceFunctionNone::InterferenceFunctionNone(), InterferenceFunctionRadialParaCrystal::InterferenceFunctionRadialParaCrystal(), InterferenceFunctionTwin::InterferenceFunctionTwin(), ISampleBuilder::ISampleBuilder(), IsGISAXSDetector::IsGISAXSDetector(), Lattice::Lattice(), Layer::Layer(), LayerInterface::LayerInterface(), LayerRoughness::LayerRoughness(), MultiLayer::MultiLayer(), Beam::operator=(), SampleBuilderNode::operator=(), ParticleCoreShell::ParticleCoreShell(), ParticleDistribution::ParticleDistribution(), ParticleLayout::ParticleLayout(), RectangularDetector::RectangularDetector(), SampleBuilderNode::reset(), ResolutionFunction2DGaussian::ResolutionFunction2DGaussian(), SampleBuilderNode::SampleBuilderNode(), SampleBuilderNode::setSBN(), SphericalDetector::SphericalDetector(), and SquareLattice::SquareLattice().

◆ getName()

Member Data Documentation

◆ m_parent

const INode* INode::m_parent {nullptr}
privateinherited

Definition at line 81 of file INode.h.

Referenced by INode::displayName(), INode::parent(), and INode::setParent().

◆ m_NP

const size_t INode::m_NP
protectedinherited

Definition at line 86 of file INode.h.

Referenced by INode::INode().

◆ m_P

std::vector<double> INode::m_P
protectedinherited

Definition at line 87 of file INode.h.

Referenced by INode::INode(), and IFootprintFactor::setWidthRatio().

◆ m_name

std::string IParameterized::m_name
privateinherited

Definition at line 72 of file IParameterized.h.

Referenced by IParameterized::getName(), and IParameterized::setName().

◆ m_pool

std::unique_ptr<ParameterPool> IParameterized::m_pool
privateinherited

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