BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ParticleDistribution Class Reference

A particle type that is a parametric distribution of IParticle's. More...

Inheritance diagram for ParticleDistribution:
[legend]
Collaboration diagram for ParticleDistribution:
[legend]

Public Member Functions

 ParticleDistribution (const IParticle &prototype, const ParameterDistribution &par_distr)
 
double abundance () const
 
void accept (INodeVisitor *visitor) const final
 Calls the INodeVisitor's visit method. More...
 
ParticleDistributionclone () const final
 Returns a clone of this ISampleNode object. More...
 
std::vector< const Material * > containedMaterials () const
 Returns set of unique materials contained in this ISampleNode. More...
 
int copyNumber (const INode *node) const
 Returns copyNumber of child, which takes into account existence of children with same name. More...
 
ParameterPoolcreateParameterTree () const
 Creates new parameter pool, with all local parameters and those of its children. More...
 
std::string displayName () const
 Returns display name, composed from the name of node and it's copy number. More...
 
SafePointerVector< IParticlegenerateParticles () const
 Returns list of new particles generated according to a distribution. More...
 
std::vector< const INode * > getChildren () const final
 Returns a vector of children. More...
 
const std::string & getName () const
 
bool isMagnetic () const
 Returns true if there is any magnetic material in this ISampleNode. More...
 
std::string mainUnits () const
 
virtual const Materialmaterial () const
 Returns nullptr, unless overwritten to return a specific material. More...
 
virtual void onChange ()
 Action to be taken in inherited class when a parameter has changed. More...
 
RealParameterparameter (const std::string &name) const
 Returns parameter with given 'name'. More...
 
ParameterDistribution parameterDistribution () const
 Returns the distributed parameter data. More...
 
ParameterPoolparameterPool () const
 Returns pointer to the parameter pool. More...
 
std::string parametersToString () const
 Returns multiline string representing available parameters. More...
 
INodeparent ()
 
const INodeparent () const
 
std::vector< const INode * > progeny () const
 Returns a vector of all descendants. More...
 
const IParticleprototype () const
 Returns the prototype particle, used for generating multiple ones. More...
 
void registerChild (INode *node)
 
RealParameterregisterParameter (const std::string &name, double *parpointer)
 
void registerVector (const std::string &base_name, kvector_t *p_vec, const std::string &units="nm")
 
void removeParameter (const std::string &name)
 
void removeVector (const std::string &base_name)
 
void rotate (const IRotation &rotation) final
 Applies the given rotation to the particle. More...
 
void setAbundance (double abundance)
 Sets particle abundance. More...
 
void setName (const std::string &name)
 
void setParameterValue (const std::string &name, double value)
 
virtual void setParent (const INode *newParent)
 
void setVectorValue (const std::string &base_name, kvector_t value)
 
virtual void transferToCPP ()
 Used for Python overriding of clone (see swig/tweaks.py) More...
 
void translate (kvector_t translation) final
 Translates the particle with the given vector. More...
 
virtual std::string treeToString () const
 Returns multiline string representing tree structure below the node. More...
 

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 Attributes

double m_abundance {1.0}
 
const size_t m_NP
 
std::vector< double > m_P
 

Private Attributes

std::string m_name
 
ParameterDistribution m_par_distribution
 
const INodem_parent {nullptr}
 
std::unique_ptr< IParticlem_particle
 
std::unique_ptr< ParameterPoolm_pool
 parameter pool (kind of pointer-to-implementation) More...
 

Detailed Description

A particle type that is a parametric distribution of IParticle's.

Definition at line 27 of file ParticleDistribution.h.

Constructor & Destructor Documentation

◆ ParticleDistribution()

ParticleDistribution::ParticleDistribution ( const IParticle prototype,
const ParameterDistribution par_distr 
)

Definition at line 24 of file ParticleDistribution.cpp.

26  : m_par_distribution(par_distr)
27 {
28  setName("ParticleDistribution");
29  m_particle.reset(prototype.clone());
31  m_particle->registerAbundance(false);
32  if (auto* dist = m_par_distribution.getDistribution())
33  registerChild(dist);
34  registerParameter("Abundance", &m_abundance);
35 }
void registerChild(INode *node)
Definition: INode.cpp:57
void setName(const std::string &name)
RealParameter & registerParameter(const std::string &name, double *parpointer)
IParticle * clone() const override=0
Returns a clone of this ISampleNode object.
const IDistribution1D * getDistribution() const
ParameterDistribution m_par_distribution
const IParticle & prototype() const
Returns the prototype particle, used for generating multiple ones.
std::unique_ptr< IParticle > m_particle

References IParticle::clone(), ParameterDistribution::getDistribution(), IAbstractParticle::m_abundance, m_par_distribution, m_particle, prototype(), INode::registerChild(), IParametricComponent::registerParameter(), and IParametricComponent::setName().

Referenced by clone().

Here is the call graph for this function:

Member Function Documentation

◆ abundance()

◆ accept()

void ParticleDistribution::accept ( INodeVisitor visitor) const
inlinefinalvirtual

Calls the INodeVisitor's visit method.

Reimplemented from IAbstractParticle.

Definition at line 33 of file ParticleDistribution.h.

33 { visitor->visit(this); }
virtual void visit(const BasicLattice2D *)
Definition: INodeVisitor.h:151

◆ clone()

ParticleDistribution * ParticleDistribution::clone ( ) const
finalvirtual

Returns a clone of this ISampleNode object.

Implements IAbstractParticle.

Definition at line 37 of file ParticleDistribution.cpp.

38 {
40  result->setAbundance(m_abundance);
41  return result;
42 }
void setAbundance(double abundance)
Sets particle abundance.
A particle type that is a parametric distribution of IParticle's.
ParticleDistribution(const IParticle &prototype, const ParameterDistribution &par_distr)

References ParticleDistribution(), IAbstractParticle::m_abundance, m_par_distribution, m_particle, and IAbstractParticle::setAbundance().

Here is the call graph for this function:

◆ containedMaterials()

std::vector< const Material * > ISampleNode::containedMaterials ( ) const
inherited

Returns set of unique materials contained in this ISampleNode.

Definition at line 26 of file ISampleNode.cpp.

27 {
28  std::vector<const Material*> result;
29  if (const Material* p_material = material())
30  result.push_back(p_material);
31  for (const auto* child : getChildren()) {
32  if (const ISampleNode* sample = dynamic_cast<const ISampleNode*>(child)) {
33  for (const Material* p_material : sample->containedMaterials())
34  result.push_back(p_material);
35  }
36  }
37  return result;
38 }
virtual std::vector< const INode * > getChildren() const
Returns a vector of children.
Definition: INode.cpp:63
Abstract base class for sample components and properties related to scattering.
Definition: ISampleNode.h:28
virtual const Material * material() const
Returns nullptr, unless overwritten to return a specific material.
Definition: ISampleNode.h:37
A wrapper for underlying material implementation.
Definition: Material.h:29

References INode::getChildren(), and ISampleNode::material().

Referenced by MultiLayerUtils::ContainsCompatibleMaterials(), SampleToPython::initLabels(), and ISampleNode::isMagnetic().

Here is the call graph for this function:

◆ 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 94 of file INode.cpp.

95 {
96  if (node->parent() != this)
97  return -1;
98 
99  int result(-1), count(0);
100  for (auto child : getChildren()) {
101 
102  if (child == nullptr)
103  throw std::runtime_error("INode::copyNumber() -> Error. Nullptr as child.");
104 
105  if (child == node)
106  result = count;
107 
108  if (child->getName() == node->getName())
109  ++count;
110  }
111 
112  return count > 1 ? result : -1;
113 }
const INode * parent() const
Definition: INode.cpp:84
const std::string & getName() const

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

Referenced by INode::displayName().

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 IParametricComponent.

Definition at line 126 of file INode.cpp.

127 {
128  std::unique_ptr<ParameterPool> result(new ParameterPool);
129 
130  for (const INode* child : progeny()) {
131  const std::string path = NodeUtils::nodePath(child, parent()) + "/";
132  child->parameterPool()->copyToExternalPool(path, result.get());
133  }
134 
135  return result.release();
136 }
Base class for tree-like structures containing parameterized objects.
Definition: INode.h:49
std::vector< const INode * > progeny() const
Returns a vector of all descendants.
Definition: INode.cpp:68
Container with parameters for IParametricComponent object.
Definition: ParameterPool.h:29
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:89

References NodeUtils::nodePath(), INode::parent(), and INode::progeny().

Referenced by ISimulation::runSimulation(), DepthProbeSimulation::validateParametrization(), OffSpecularSimulation::validateParametrization(), and SpecularSimulation::validateParametrization().

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 115 of file INode.cpp.

116 {
117  std::string result = getName();
118  if (m_parent) {
119  int index = m_parent->copyNumber(this);
120  if (index >= 0)
121  result = result + std::to_string(index);
122  }
123  return result;
124 }
const INode * m_parent
Definition: INode.h:83
int copyNumber(const INode *node) const
Returns copyNumber of child, which takes into account existence of children with same name.
Definition: INode.cpp:94

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

Referenced by NodeUtils::nodePath().

Here is the call graph for this function:

◆ generateParticles()

SafePointerVector< IParticle > ParticleDistribution::generateParticles ( ) const

Returns list of new particles generated according to a distribution.

Returns particle clones with parameter values drawn from distribution.

Definition at line 56 of file ParticleDistribution.cpp.

57 {
58  // createParameterTree
59  ParameterPool pool;
60  for (const INode* child : m_particle->progeny()) {
61  const std::string path = NodeUtils::nodePath(child, m_particle->parent()) + "/";
62  child->parameterPool()->copyToExternalPool(path, &pool);
63  }
64  std::string main_par_name = m_par_distribution.getMainParameterName();
65  double main_par_value = pool.getUniqueMatch(main_par_name)->value();
66 
67  // Preset link ratios:
68  std::map<std::string, double> linked_ratios;
69  for (const std::string& name : m_par_distribution.getLinkedParameterNames())
70  linked_ratios[name] =
71  main_par_value == 0 ? 1.0 : pool.getUniqueMatch(name)->value() / main_par_value;
72 
73  // Draw distribution samples; for each sample, create one particle clone:
74  std::vector<ParameterSample> main_par_samples = m_par_distribution.generateSamples();
76  for (const ParameterSample& main_sample : main_par_samples) {
77  IParticle* particle_clone = m_particle->clone();
78  ParameterPool pool2;
79  for (const INode* child : particle_clone->progeny()) {
80  const std::string path = NodeUtils::nodePath(child, particle_clone->parent()) + "/";
81  child->parameterPool()->copyToExternalPool(path, &pool2);
82  }
83  pool2.setUniqueMatchValue(main_par_name, main_sample.value);
84  for (const auto& it : linked_ratios)
85  pool2.setUniqueMatchValue(it.first, main_sample.value * it.second);
86  particle_clone->setAbundance(abundance() * main_sample.weight);
87  result.push_back(particle_clone);
88  }
89  return result;
90 }
double abundance() const
Abstract base class for Particle, ParticleComposition, ParticleCoreShell, MesoCrystal.
Definition: IParticle.h:33
std::vector< ParameterSample > generateSamples() const
generate list of sampled values with their weight
std::vector< std::string > getLinkedParameterNames() const
get list of linked parameter names
std::string getMainParameterName() const
get the main parameter's name
void setUniqueMatchValue(const std::string &pattern, double value)
Sets value of the one parameter that matches pattern ('*' allowed), or throws.
RealParameter * getUniqueMatch(const std::string &pattern) const
Returns the one parameter that matches the pattern (wildcards '*' allowed), or throws.
A parameter value with a weight, as obtained when sampling from a distribution.
double value() const
Returns value of wrapped parameter.
A vector of pointers, owned by *this, with methods to handle them safely.
void push_back(T *pointer)
QString const & name(EShape k)
Definition: particles.cpp:21

References IAbstractParticle::abundance(), ParameterDistribution::generateSamples(), ParameterDistribution::getLinkedParameterNames(), ParameterDistribution::getMainParameterName(), ParameterPool::getUniqueMatch(), m_par_distribution, m_particle, RealSpace::Particles::name(), NodeUtils::nodePath(), INode::parent(), INode::progeny(), SafePointerVector< T >::push_back(), IAbstractParticle::setAbundance(), ParameterPool::setUniqueMatchValue(), and RealParameter::value().

Referenced by RealSpaceBuilderUtils::particleDistribution3DContainer().

Here is the call graph for this function:

◆ getChildren()

std::vector< const INode * > ParticleDistribution::getChildren ( ) const
finalvirtual

Returns a vector of children.

Reimplemented from INode.

Definition at line 92 of file ParticleDistribution.cpp.

93 {
94  std::vector<const INode*> result = std::vector<const INode*>() << m_particle;
95  if (const auto* dist = m_par_distribution.getDistribution())
96  result.emplace_back(dist);
97  return result;
98 }

References ParameterDistribution::getDistribution(), m_par_distribution, and m_particle.

Here is the call graph for this function:

◆ getName()

◆ isMagnetic()

bool ISampleNode::isMagnetic ( ) const
inherited

Returns true if there is any magnetic material in this ISampleNode.

Definition at line 40 of file ISampleNode.cpp.

41 {
42  const auto materials = containedMaterials();
43  return std::any_of(materials.cbegin(), materials.cend(),
44  [](const Material* mat) { return mat->isMagneticMaterial(); });
45 }
std::vector< const Material * > containedMaterials() const
Returns set of unique materials contained in this ISampleNode.
Definition: ISampleNode.cpp:26

References ISampleNode::containedMaterials().

Referenced by ProcessedSample::initLayouts().

Here is the call graph for this function:

◆ mainUnits()

std::string ParticleDistribution::mainUnits ( ) const

Definition at line 100 of file ParticleDistribution.cpp.

101 {
103  parameterDistribution().getMainParameterName());
104 }
ParameterDistribution parameterDistribution() const
Returns the distributed parameter data.
std::string poolParameterUnits(const IParametricComponent &node, const std::string &parName)
Returns units of main parameter.

References parameterDistribution(), ParameterUtils::poolParameterUnits(), and prototype().

Referenced by TransformFromDomain::setParticleDistributionItem().

Here is the call graph for this function:

◆ material()

virtual const Material* ISampleNode::material ( ) const
inlinevirtualinherited

◆ onChange()

◆ parameter()

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

Returns parameter with given 'name'.

Definition at line 86 of file IParametricComponent.cpp.

87 {
88  return m_pool->parameter(name);
89 }
std::unique_ptr< ParameterPool > m_pool
parameter pool (kind of pointer-to-implementation)

References IParametricComponent::m_pool, and RealSpace::Particles::name().

Referenced by DepthProbeSimulation::initialize(), SpecularSimulation::initialize(), Lattice3D::initialize(), IParticle::registerAbundance(), ParticleLayout::registerParticleDensity(), IParticle::registerPosition(), Layer::registerThickness(), Lattice2D::setRotationEnabled(), and DistributionLogNormal::setUnits().

Here is the call graph for this function:

◆ parameterDistribution()

ParameterDistribution ParticleDistribution::parameterDistribution ( ) const
inline

Returns the distributed parameter data.

Definition at line 46 of file ParticleDistribution.h.

46 { return m_par_distribution; }

References m_par_distribution.

Referenced by mainUnits(), and TransformFromDomain::setParticleDistributionItem().

◆ parameterPool()

ParameterPool* IParametricComponent::parameterPool ( ) const
inlineinherited

Returns pointer to the parameter pool.

Definition at line 39 of file IParametricComponent.h.

39 { return m_pool.get(); } // has non-const usages!

References IParametricComponent::m_pool.

Referenced by INode::INode(), IParametricComponent::IParametricComponent(), pyfmt2::argumentList(), SampleBuilderNode::borrow_builder_parameters(), SampleBuilderNode::reset(), and IDistribution1D::setUnits().

◆ parametersToString()

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

Returns multiline string representing available parameters.

Definition at line 43 of file IParametricComponent.cpp.

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

References IParametricComponent::createParameterTree().

Here is the call graph for this function:

◆ parent() [1/2]

INode * INode::parent ( )
inherited

Definition at line 89 of file INode.cpp.

90 {
91  return const_cast<INode*>(m_parent);
92 }

References INode::m_parent.

◆ parent() [2/2]

◆ progeny()

std::vector< const INode * > INode::progeny ( ) const
inherited

Returns a vector of all descendants.

Definition at line 68 of file INode.cpp.

69 {
70  std::vector<const INode*> result;
71  result.push_back(this);
72  for (const auto* child : getChildren()) {
73  for (const auto* p : child->progeny())
74  result.push_back(p);
75  }
76  return result;
77 }

References INode::getChildren().

Referenced by INode::createParameterTree(), and generateParticles().

Here is the call graph for this function:

◆ prototype()

const IParticle& ParticleDistribution::prototype ( ) const
inline

Returns the prototype particle, used for generating multiple ones.

Definition at line 43 of file ParticleDistribution.h.

43 { return *m_particle.get(); }

References m_particle.

Referenced by ParticleDistribution(), and mainUnits().

◆ registerChild()

void INode::registerChild ( INode node)
inherited

Definition at line 57 of file INode.cpp.

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

References ASSERT, and INode::setParent().

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

Here is the call graph for this function:

◆ registerParameter()

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

Definition at line 51 of file IParametricComponent.cpp.

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

References IParametricComponent::getName(), IParametricComponent::m_pool, RealSpace::Particles::name(), and IParametricComponent::onChange().

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

Here is the call graph for this function:

◆ registerVector()

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

Definition at line 57 of file IParametricComponent.cpp.

59 {
60  registerParameter(XComponentName(base_name), &((*p_vec)[0])).setUnit(units);
61  registerParameter(YComponentName(base_name), &((*p_vec)[1])).setUnit(units);
62  registerParameter(ZComponentName(base_name), &((*p_vec)[2])).setUnit(units);
63 }
static std::string XComponentName(const std::string &base_name)
static std::string ZComponentName(const std::string &base_name)
static std::string YComponentName(const std::string &base_name)
RealParameter & setUnit(const std::string &name)
MVVM_MODEL_EXPORT std::string base_name(const std::string &path)
Provide the filename of a file path.
Definition: fileutils.cpp:78

References ModelView::Utils::base_name(), IParametricComponent::registerParameter(), RealParameter::setUnit(), IParametricComponent::XComponentName(), IParametricComponent::YComponentName(), and IParametricComponent::ZComponentName().

Referenced by Beam::Beam(), DetectionProperties::DetectionProperties(), InterferenceFunctionTwin::InterferenceFunctionTwin(), MultiLayer::MultiLayer(), Lattice3D::initialize(), and IParticle::registerPosition().

Here is the call graph for this function:

◆ removeParameter()

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

Definition at line 91 of file IParametricComponent.cpp.

92 {
93  m_pool->removeParameter(name);
94 }

References IParametricComponent::m_pool, and RealSpace::Particles::name().

Referenced by IParticle::registerAbundance(), ParticleLayout::registerParticleDensity(), Layer::registerThickness(), IParametricComponent::removeVector(), and Lattice2D::setRotationEnabled().

Here is the call graph for this function:

◆ removeVector()

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

Definition at line 96 of file IParametricComponent.cpp.

References ModelView::Utils::base_name(), IParametricComponent::removeParameter(), IParametricComponent::XComponentName(), IParametricComponent::YComponentName(), and IParametricComponent::ZComponentName().

Referenced by IParticle::registerPosition().

Here is the call graph for this function:

◆ rotate()

void ParticleDistribution::rotate ( const IRotation rotation)
finalvirtual

Applies the given rotation to the particle.

Implements IAbstractParticle.

Definition at line 49 of file ParticleDistribution.cpp.

50 {
51  m_particle->rotate(rotation);
52 }

References m_particle.

◆ setAbundance()

void IAbstractParticle::setAbundance ( double  abundance)
inlineinherited

Sets particle abundance.

Parameters
abundanceproportion of this type of particles normalized to the total number of particles in the layout.

Definition at line 44 of file IAbstractParticle.h.

References IAbstractParticle::abundance(), and IAbstractParticle::m_abundance.

Referenced by ParticleLayout::addParticle(), MesoCrystal::clone(), Particle::clone(), ParticleComposition::clone(), ParticleCoreShell::clone(), clone(), and generateParticles().

Here is the call graph for this function:

◆ setName()

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

Definition at line 69 of file IParametricComponent.h.

69 { m_name = name; }

References IParametricComponent::m_name, and RealSpace::Particles::name().

Referenced by BasicLattice2D::BasicLattice2D(), Beam::Beam(), ConvolutionDetectorResolution::ConvolutionDetectorResolution(), Crystal::Crystal(), DetectionProperties::DetectionProperties(), DistributionHandler::DistributionHandler(), FormFactorCoreShell::FormFactorCoreShell(), FormFactorCrystal::FormFactorCrystal(), FormFactorDecoratorMaterial::FormFactorDecoratorMaterial(), FormFactorDecoratorPositionFactor::FormFactorDecoratorPositionFactor(), FormFactorDecoratorRotation::FormFactorDecoratorRotation(), FormFactorWeighted::FormFactorWeighted(), HexagonalLattice2D::HexagonalLattice2D(), IDetector::IDetector(), 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(), Lattice3D::Lattice3D(), Layer::Layer(), LayerInterface::LayerInterface(), LayerRoughness::LayerRoughness(), MultiLayer::MultiLayer(), ParticleCoreShell::ParticleCoreShell(), ParticleDistribution(), ParticleLayout::ParticleLayout(), RectangularDetector::RectangularDetector(), ResolutionFunction2DGaussian::ResolutionFunction2DGaussian(), SampleBuilderNode::SampleBuilderNode(), SphericalDetector::SphericalDetector(), SquareLattice2D::SquareLattice2D(), Layer::clone(), LayersWithAbsorptionBuilder::createSampleByIndex(), Basic2DParaCrystalBuilder::createSampleByIndex(), ParticleInVacuumBuilder::createSampleByIndex(), SimpleMagneticRotationBuilder::createSampleByIndex(), DepthProbeSimulation::initialize(), GISASSimulation::initialize(), OffSpecularSimulation::initialize(), SpecularSimulation::initialize(), SpecularDetector1D::initialize(), MesoCrystal::initialize(), Particle::initialize(), ParticleComposition::initialize(), Beam::operator=(), SampleBuilderNode::operator=(), SampleBuilderNode::reset(), and SampleBuilderNode::setSBN().

Here is the call graph for this function:

◆ setParameterValue()

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

Definition at line 65 of file IParametricComponent.cpp.

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

References IParametricComponent::createParameterTree(), IParametricComponent::m_pool, RealSpace::Particles::name(), and ParameterPool::setMatchedParametersValue().

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

Here is the call graph for this function:

◆ setParent()

void INode::setParent ( const INode newParent)
virtualinherited

Reimplemented in SampleProvider.

Definition at line 79 of file INode.cpp.

80 {
81  m_parent = newParent;
82 }

References INode::m_parent.

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

◆ setVectorValue()

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

Definition at line 78 of file IParametricComponent.cpp.

79 {
83 }
T z() const
Returns z-component in cartesian coordinate system.
Definition: BasicVector3D.h:67
T y() const
Returns y-component in cartesian coordinate system.
Definition: BasicVector3D.h:65
T x() const
Returns x-component in cartesian coordinate system.
Definition: BasicVector3D.h:63
void setParameterValue(const std::string &name, double value)

References ModelView::Utils::base_name(), IParametricComponent::setParameterValue(), BasicVector3D< T >::x(), IParametricComponent::XComponentName(), BasicVector3D< T >::y(), IParametricComponent::YComponentName(), BasicVector3D< T >::z(), and IParametricComponent::ZComponentName().

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.

◆ translate()

void ParticleDistribution::translate ( kvector_t  translation)
finalvirtual

Translates the particle with the given vector.

Implements IAbstractParticle.

Definition at line 44 of file ParticleDistribution.cpp.

45 {
46  m_particle->translate(translation);
47 }

References m_particle.

◆ treeToString()

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

Returns multiline string representing tree structure below the node.

Definition at line 52 of file INode.cpp.

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

References NodeUtils::nodeToString().

Here is the call graph for this function:

◆ XComponentName()

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

Definition at line 103 of file IParametricComponent.cpp.

104 {
105  return base_name + "X";
106 }

References ModelView::Utils::base_name().

Referenced by Lattice3D::initialize(), IParticle::registerPosition(), IParametricComponent::registerVector(), IParametricComponent::removeVector(), IParametricComponent::setVectorValue(), and VectorParameterTranslator::translate().

Here is the call graph for this function:

◆ YComponentName()

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

Definition at line 108 of file IParametricComponent.cpp.

109 {
110  return base_name + "Y";
111 }

References ModelView::Utils::base_name().

Referenced by IParametricComponent::registerVector(), IParametricComponent::removeVector(), IParametricComponent::setVectorValue(), and VectorParameterTranslator::translate().

Here is the call graph for this function:

◆ ZComponentName()

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

Definition at line 113 of file IParametricComponent.cpp.

114 {
115  return base_name + "Z";
116 }

References ModelView::Utils::base_name().

Referenced by IParametricComponent::registerVector(), IParametricComponent::removeVector(), IParametricComponent::setVectorValue(), and VectorParameterTranslator::translate().

Here is the call graph for this function:

Member Data Documentation

◆ m_abundance

◆ m_name

std::string IParametricComponent::m_name
privateinherited

◆ m_NP

const size_t INode::m_NP
protectedinherited

Definition at line 88 of file INode.h.

Referenced by INode::INode().

◆ m_P

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

Definition at line 89 of file INode.h.

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

◆ m_par_distribution

ParameterDistribution ParticleDistribution::m_par_distribution
private

◆ m_parent

const INode* INode::m_parent {nullptr}
privateinherited

Definition at line 83 of file INode.h.

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

◆ m_particle

std::unique_ptr<IParticle> ParticleDistribution::m_particle
private

◆ m_pool


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