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

A particle with a form factor and refractive index. More...

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

Public Member Functions

 Particle ()=delete
 
 Particle (Material material)
 
 Particle (Material material, const IFormFactor &form_factor)
 
 Particle (Material material, const IFormFactor &form_factor, const IRotation &rotation)
 
 ~Particle ()
 
double abundance () const
 
void accept (INodeVisitor *visitor) const final
 Calls the INodeVisitor's visit method. More...
 
virtual ParticleLimits bottomTopZ () const
 Top and bottom z-coordinate. More...
 
Particleclone () 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...
 
virtual IFormFactorcreateFormFactor () const
 Creates a form factor for this particle. More...
 
ParameterPoolcreateParameterTree () const
 Creates new parameter pool, with all local parameters and those of its children. More...
 
SlicedParticle createSlicedParticle (ZLimits limits) const final
 Creates a sliced form factor for this particle. More...
 
virtual SafePointerVector< IParticledecompose () const
 Decompose in constituent IParticle objects. More...
 
std::string displayName () const
 Returns display name, composed from the name of node and it's copy number. 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...
 
const Materialmaterial () const final
 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...
 
ParameterPoolparameterPool () const
 Returns pointer to the parameter pool. More...
 
std::string parametersToString () const
 Returns multiline string representing available parameters. More...
 
INodeparent ()
 
const INodeparent () const
 
kvector_t position () const
 Returns particle position. More...
 
std::vector< const INode * > progeny () const
 Returns a vector of all descendants. More...
 
void registerAbundance (bool make_registered=true)
 
void registerChild (INode *node)
 
RealParameterregisterParameter (const std::string &name, double *parpointer)
 
void registerPosition (bool make_registered=true)
 Registers the three components of its position. More...
 
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
 Rotates the particle. More...
 
const IRotationrotation () const
 Returns rotation object. More...
 
void setAbundance (double abundance)
 Sets particle abundance. More...
 
void setMaterial (Material material)
 
void setName (const std::string &name)
 
void setParameterValue (const std::string &name, double value)
 
virtual void setParent (const INode *newParent)
 
void setPosition (double x, double y, double z)
 Sets relative position of the particle's reference point in the coordinate system of parent. More...
 
void setPosition (kvector_t position)
 Sets relative position of the particle's reference point in the coordinate system of parent. More...
 
void setRotation (const IRotation &rotation)
 Sets transformation. More...
 
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. 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 Member Functions

kvector_t composedTranslation (const IRotation *p_rotation, kvector_t translation) const
 Gets a composed translation vector. More...
 
IRotationcreateComposedRotation (const IRotation *p_rotation) const
 Creates a composed IRotation object. More...
 
void registerParticleProperties ()
 Registers abundance and position. More...
 

Protected Attributes

double m_abundance {1.0}
 
std::unique_ptr< IFormFactorm_form_factor
 
Material m_material
 
const size_t m_NP
 
std::vector< double > m_P
 
kvector_t m_position
 
std::unique_ptr< IRotationm_rotation
 

Private Member Functions

void initialize ()
 
void setFormFactor (const IFormFactor &form_factor)
 

Private Attributes

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

Detailed Description

A particle with a form factor and refractive index.

Definition at line 24 of file Particle.h.

Constructor & Destructor Documentation

◆ Particle() [1/4]

Particle::Particle ( )
delete

Referenced by clone().

◆ ~Particle()

Particle::~Particle ( )
default

◆ Particle() [2/4]

Particle::Particle ( Material  material)

Definition at line 25 of file Particle.cpp.

25  : m_material(std::move(material))
26 {
27  initialize();
28 }
const Material * material() const final
Returns nullptr, unless overwritten to return a specific material.
Definition: Particle.h:39
void initialize()
Definition: Particle.cpp:97
Material m_material
Definition: Particle.h:44

References initialize().

Here is the call graph for this function:

◆ Particle() [3/4]

Particle::Particle ( Material  material,
const IFormFactor form_factor 
)

Definition at line 30 of file Particle.cpp.

31  : m_material(std::move(material)), m_form_factor(form_factor.clone())
32 {
33  initialize();
35 }
IFormFactor * clone() const override=0
Returns a clone of this ISampleNode object.
void registerChild(INode *node)
Definition: INode.cpp:57
std::unique_ptr< IFormFactor > m_form_factor
Definition: Particle.h:45

References initialize(), m_form_factor, and INode::registerChild().

Here is the call graph for this function:

◆ Particle() [4/4]

Particle::Particle ( Material  material,
const IFormFactor form_factor,
const IRotation rotation 
)

Definition at line 37 of file Particle.cpp.

38  : m_material(std::move(material)), m_form_factor(form_factor.clone())
39 {
40  initialize();
43 }
const IRotation * rotation() const
Returns rotation object.
Definition: IParticle.cpp:39
void setRotation(const IRotation &rotation)
Sets transformation.
Definition: IParticle.cpp:44

References initialize(), m_form_factor, INode::registerChild(), IParticle::rotation(), and IParticle::setRotation().

Here is the call graph for this function:

Member Function Documentation

◆ abundance()

◆ accept()

void Particle::accept ( INodeVisitor visitor) const
inlinefinalvirtual

Calls the INodeVisitor's visit method.

Reimplemented from IAbstractParticle.

Definition at line 34 of file Particle.h.

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

◆ bottomTopZ()

ParticleLimits IParticle::bottomTopZ ( ) const
virtualinherited

Top and bottom z-coordinate.

Reimplemented in ParticleComposition.

Definition at line 94 of file IParticle.cpp.

95 {
96  std::unique_ptr<IFormFactor> P_ff(createFormFactor());
97  std::unique_ptr<IRotation> P_rot(new IdentityRotation);
98  return {P_ff->bottomZ(*P_rot), P_ff->topZ(*P_rot)};
99 }
virtual IFormFactor * createFormFactor() const
Creates a form factor for this particle.
Definition: IParticle.cpp:23
The identity rotation, which leaves everything in place.
Definition: Rotations.h:57

References IParticle::createFormFactor().

Here is the call graph for this function:

◆ clone()

Particle * Particle::clone ( ) const
finalvirtual

Returns a clone of this ISampleNode object.

Implements IParticle.

Definition at line 45 of file Particle.cpp.

46 {
47  Particle* p_result = new Particle(m_material);
48  p_result->setAbundance(m_abundance);
49  if (m_form_factor)
50  p_result->setFormFactor(*m_form_factor);
51  if (m_rotation)
52  p_result->setRotation(*m_rotation);
53  p_result->setPosition(m_position);
54 
55  return p_result;
56 }
void setAbundance(double abundance)
Sets particle abundance.
void setPosition(kvector_t position)
Sets relative position of the particle's reference point in the coordinate system of parent.
Definition: IParticle.h:50
kvector_t m_position
Definition: IParticle.h:94
std::unique_ptr< IRotation > m_rotation
Definition: IParticle.h:95
A particle with a form factor and refractive index.
Definition: Particle.h:24
void setFormFactor(const IFormFactor &form_factor)
Definition: Particle.cpp:84
Particle()=delete

References Particle(), IAbstractParticle::m_abundance, m_form_factor, m_material, IParticle::m_position, IParticle::m_rotation, IAbstractParticle::setAbundance(), setFormFactor(), IParticle::setPosition(), and IParticle::setRotation().

Referenced by ParticleCoreShell::addAndRegisterCore(), ParticleCoreShell::addAndRegisterShell(), RealSpaceBuilderUtils::applyParticleCoreShellTransformations(), and RealSpaceBuilderUtils::singleParticle3DContainer().

Here is the call graph for this function:

◆ composedTranslation()

kvector_t IParticle::composedTranslation ( const IRotation p_rotation,
kvector_t  translation 
) const
protectedinherited

Gets a composed translation vector.

Definition at line 116 of file IParticle.cpp.

117 {
118  if (p_rotation) {
119  return translation + p_rotation->transformed(m_position);
120  } else {
121  return translation + m_position;
122  }
123 }
kvector_t transformed(const kvector_t &v) const
Definition: Rotations.cpp:53

References IParticle::m_position, and IRotation::transformed().

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:

◆ createComposedRotation()

IRotation * IParticle::createComposedRotation ( const IRotation p_rotation) const
protectedinherited

Creates a composed IRotation object.

Definition at line 101 of file IParticle.cpp.

102 {
103  if (p_rotation) {
104  if (m_rotation)
105  return createProduct(*p_rotation, *m_rotation);
106  else
107  return p_rotation->clone();
108  } else {
109  if (m_rotation)
110  return m_rotation->clone();
111  else
112  return nullptr;
113  }
114 }
IRotation * createProduct(const IRotation &left, const IRotation &right)
Returns concatenated rotation (first right, then left).
Definition: Rotations.cpp:70
virtual IRotation * clone() const =0

References IRotation::clone(), createProduct(), and IParticle::m_rotation.

Here is the call graph for this function:

◆ createFormFactor()

IFormFactor * IParticle::createFormFactor ( ) const
virtualinherited

Creates a form factor for this particle.

Reimplemented in ParticleComposition.

Definition at line 23 of file IParticle.cpp.

24 {
25  return createSlicedParticle(ZLimits{}).m_slicedff.release();
26 }
virtual SlicedParticle createSlicedParticle(ZLimits limits) const
Creates a sliced form factor for this particle.
Definition: IParticle.cpp:28
Class that contains upper and lower limits of the z-coordinate for the slicing of form factors.
Definition: ZLimits.h:45

References IParticle::createSlicedParticle().

Referenced by IParticle::bottomTopZ().

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:

◆ createSlicedParticle()

SlicedParticle Particle::createSlicedParticle ( ZLimits  limits) const
finalvirtual

Creates a sliced form factor for this particle.

Reimplemented from IParticle.

Definition at line 58 of file Particle.cpp.

59 {
60  if (!m_form_factor)
61  return {};
62  std::unique_ptr<IRotation> P_rotation(new IdentityRotation);
63  if (m_rotation)
64  P_rotation.reset(m_rotation->clone());
65  std::unique_ptr<IFormFactor> P_tem_ff(
66  m_form_factor->createSlicedFormFactor(limits, *P_rotation, m_position));
67  if (!P_tem_ff)
68  return {};
69  std::unique_ptr<FormFactorDecoratorMaterial> P_ff(new FormFactorDecoratorMaterial(*P_tem_ff));
70  double volume = P_tem_ff->volume();
71  Material transformed_material(m_material.rotatedMaterial(P_rotation->getTransform3D()));
72  P_ff->setMaterial(transformed_material);
73  SlicedParticle result;
74  result.m_regions.push_back({volume, transformed_material});
75  result.m_slicedff = std::move(P_ff);
76  return result;
77 }
Decorates a scalar formfactor with the correct factor for the material's refractive index and that of...
Material rotatedMaterial(const Transform3D &transform) const
Definition: Material.cpp:101
Struct that contains information on a sliced particle.
std::vector< HomogeneousRegion > m_regions
std::unique_ptr< IFormFactor > m_slicedff

References m_form_factor, m_material, IParticle::m_position, SlicedParticle::m_regions, IParticle::m_rotation, SlicedParticle::m_slicedff, and Material::rotatedMaterial().

Here is the call graph for this function:

◆ decompose()

SafePointerVector< IParticle > IParticle::decompose ( ) const
virtualinherited

Decompose in constituent IParticle objects.

Reimplemented in ParticleComposition.

Definition at line 87 of file IParticle.cpp.

88 {
90  result.push_back(this->clone());
91  return result;
92 }
IParticle * clone() const override=0
Returns a clone of this ISampleNode object.
A vector of pointers, owned by *this, with methods to handle them safely.
void push_back(T *pointer)

References IParticle::clone(), and SafePointerVector< T >::push_back().

Referenced by SlicedFormFactorList::createSlicedFormFactors().

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:

◆ getChildren()

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

Returns a vector of children.

Reimplemented from IParticle.

Definition at line 92 of file Particle.cpp.

93 {
94  return std::vector<const INode*>() << IParticle::getChildren() << m_form_factor;
95 }
std::vector< const INode * > getChildren() const override
Returns a vector of children.
Definition: IParticle.cpp:61

References IParticle::getChildren(), and m_form_factor.

Here is the call graph for this function:

◆ getName()

◆ initialize()

void Particle::initialize ( )
private

Definition at line 97 of file Particle.cpp.

98 {
99  setName("Particle");
101 }
void setName(const std::string &name)
void registerParticleProperties()
Registers abundance and position.
Definition: IParticle.cpp:125

References IParticle::registerParticleProperties(), and IParametricComponent::setName().

Referenced by Particle().

Here is the call graph for this function:

◆ 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:

◆ material()

const Material* Particle::material ( ) const
inlinefinalvirtual

Returns nullptr, unless overwritten to return a specific material.

Reimplemented from ISampleNode.

Definition at line 39 of file Particle.h.

39 { return &m_material; }

References m_material.

Referenced by RealSpaceBuilderUtils::applyParticleColor(), setMaterial(), and GUIDomainSampleVisitor::visit().

◆ 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)
QString const & name(EShape k)
Definition: particles.cpp:21

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:

◆ 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]

◆ position()

◆ 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 ParticleDistribution::generateParticles().

Here is the call graph for this function:

◆ registerAbundance()

void IParticle::registerAbundance ( bool  make_registered = true)
inherited

Definition at line 66 of file IParticle.cpp.

67 {
68  if (make_registered) {
69  if (!parameter("Abundance"))
70  registerParameter("Abundance", &m_abundance);
71  } else {
72  removeParameter("Abundance");
73  }
74 }
void removeParameter(const std::string &name)
RealParameter * parameter(const std::string &name) const
Returns parameter with given 'name'.
RealParameter & registerParameter(const std::string &name, double *parpointer)

References IAbstractParticle::m_abundance, IParametricComponent::parameter(), IParametricComponent::registerParameter(), and IParametricComponent::removeParameter().

Referenced by ParticleComposition::addParticlePointer(), and IParticle::registerParticleProperties().

Here is the call graph for this function:

◆ 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(), ParticleDistribution::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(), 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::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:

◆ registerParticleProperties()

void IParticle::registerParticleProperties ( )
protectedinherited

Registers abundance and position.

Definition at line 125 of file IParticle.cpp.

126 {
129 }
void registerAbundance(bool make_registered=true)
Definition: IParticle.cpp:66
void registerPosition(bool make_registered=true)
Registers the three components of its position.
Definition: IParticle.cpp:76

References IParticle::registerAbundance(), and IParticle::registerPosition().

Referenced by ParticleCoreShell::ParticleCoreShell(), MesoCrystal::initialize(), initialize(), and ParticleComposition::initialize().

Here is the call graph for this function:

◆ registerPosition()

void IParticle::registerPosition ( bool  make_registered = true)
inherited

Registers the three components of its position.

Definition at line 76 of file IParticle.cpp.

77 {
78  if (make_registered) {
79  if (!parameter(XComponentName("Position"))) {
80  registerVector("Position", &m_position, "nm");
81  }
82  } else {
83  removeVector("Position");
84  }
85 }
void registerVector(const std::string &base_name, kvector_t *p_vec, const std::string &units="nm")
static std::string XComponentName(const std::string &base_name)
void removeVector(const std::string &base_name)

References IParticle::m_position, IParametricComponent::parameter(), IParametricComponent::registerVector(), IParametricComponent::removeVector(), and IParametricComponent::XComponentName().

Referenced by IParticle::registerParticleProperties().

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 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 IParticle::rotate ( const IRotation rotation)
finalvirtualinherited

Rotates the particle.

Implements IAbstractParticle.

Definition at line 50 of file IParticle.cpp.

51 {
52  if (m_rotation) {
54  } else {
55  m_rotation.reset(rotation.clone());
56  }
59 }

References IRotation::clone(), createProduct(), IParticle::m_position, IParticle::m_rotation, INode::registerChild(), IParticle::rotation(), and IRotation::transformed().

Referenced by BoxCompositionRotateZandYBuilder::buildSample(), CoreShellBoxRotateZandYBuilder::buildSample(), LayersWithAbsorptionBuilder::buildSample(), LayersWithAbsorptionBySLDBuilder::buildSample(), and TransformBoxBuilder::buildSample().

Here is the call graph for this function:

◆ rotation()

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

double abundance() const

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

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

Here is the call graph for this function:

◆ setFormFactor()

void Particle::setFormFactor ( const IFormFactor form_factor)
private

Definition at line 84 of file Particle.cpp.

85 {
86  if (&form_factor != m_form_factor.get()) {
87  m_form_factor.reset(form_factor.clone());
89  }
90 }

References IFormFactor::clone(), m_form_factor, and INode::registerChild().

Referenced by clone().

Here is the call graph for this function:

◆ setMaterial()

void Particle::setMaterial ( Material  material)

Definition at line 79 of file Particle.cpp.

80 {
81  m_material = std::move(material);
82 }

References m_material, and material().

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::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(), 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().

◆ setPosition() [1/2]

void IParticle::setPosition ( double  x,
double  y,
double  z 
)
inlineinherited

Sets relative position of the particle's reference point in the coordinate system of parent.

Parameters
xx-coordinate in nanometers
yy-coordinate in nanometers
zz-coordinate in nanometers

Definition at line 57 of file IParticle.h.

57 { m_position = kvector_t(x, y, z); }
BasicVector3D< double > kvector_t
Definition: Vectors3D.h:21

References IParticle::m_position.

◆ setPosition() [2/2]

void IParticle::setPosition ( kvector_t  position)
inlineinherited

Sets relative position of the particle's reference point in the coordinate system of parent.

Parameters
positionrelative position vector (components are in nanometers)

Definition at line 50 of file IParticle.h.

50 { m_position = position; }
kvector_t position() const
Returns particle position.
Definition: IParticle.h:45

References IParticle::m_position, and IParticle::position().

Referenced by BoxCompositionRotateXBuilder::buildSample(), BoxCompositionRotateYBuilder::buildSample(), BoxCompositionRotateZBuilder::buildSample(), BoxCompositionRotateZandYBuilder::buildSample(), BoxStackCompositionBuilder::buildSample(), CoreShellBoxRotateZandYBuilder::buildSample(), CustomMorphologyBuilder::buildSample(), LayersWithAbsorptionBuilder::buildSample(), LayersWithAbsorptionBySLDBuilder::buildSample(), SlicedCompositionBuilder::buildSample(), TransformBoxBuilder::buildSample(), RotatedSquareLattice2DBuilder::buildSample(), MesoCrystal::clone(), clone(), ParticleComposition::clone(), ParticleCoreShell::clone(), and TransformToDomain::setPositionInfo().

Here is the call graph for this function:

◆ setRotation()

◆ 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 IParticle::translate ( kvector_t  translation)
finalvirtualinherited

Translates the particle.

Implements IAbstractParticle.

Definition at line 34 of file IParticle.cpp.

35 {
36  m_position += translation;
37 }

References IParticle::m_position.

Referenced by ParticleComposition::addParticle(), and SlicedFormFactorList::addParticle().

◆ 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_form_factor

std::unique_ptr<IFormFactor> Particle::m_form_factor
protected

Definition at line 45 of file Particle.h.

Referenced by Particle(), clone(), createSlicedParticle(), getChildren(), and setFormFactor().

◆ m_material

Material Particle::m_material
protected

Definition at line 44 of file Particle.h.

Referenced by clone(), createSlicedParticle(), material(), and setMaterial().

◆ 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_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_pool

◆ m_position

◆ m_rotation


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