BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ParticleInVacuumBuilder.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/StandardSamples/ParticleInVacuumBuilder.cpp
6 //! @brief Implements class ParticleInVacuumBuilder.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************** //
14 
16 #include "Base/Const/Units.h"
24 
25 namespace
26 {
27 FormFactorComponents ff_components;
28 }
29 
30 ParticleInVacuumBuilder::ParticleInVacuumBuilder()
31  : m_ff(new FormFactorFullSphere(5.0 * Units::nanometer))
32 {
33 }
34 
35 MultiLayer* ParticleInVacuumBuilder::buildSample() const
36 {
37  Layer vacuum_layer(refMat::Vacuum);
38 
39  Particle particle(refMat::Particle, *m_ff);
40  ParticleLayout particle_layout(particle);
41  vacuum_layer.addLayout(particle_layout);
42 
43  MultiLayer* result = new MultiLayer;
44  result->addLayer(vacuum_layer);
45  return result;
46 }
47 
48 MultiLayer* ParticleInVacuumBuilder::createSampleByIndex(size_t index)
49 {
50  auto name = ff_components.keys().at(index);
51  m_ff.reset(ff_components.getItem(name)->clone());
52  setName(name);
53  return buildSample();
54 }
55 
56 size_t ParticleInVacuumBuilder::size()
57 {
58  return ff_components.size();
59 }
Defines class FormFactorFullSphere.
Defines class Layer.
Defines class MultiLayer.
Defines class ParticleInVacuumBuilder.
Defines class ParticleLayout.
Defines class Particle.
Defines materials in namespace refMat.
Defines sample components for complex sample builders.
Defines some unit conversion factors and other constants in namespace Units.
Predefined form factors for functional tests.
A layer, with thickness (in nanometer) and material.
Definition: Layer.h:28
Our sample model: a stack of layers one below the other.
Definition: MultiLayer.h:42
void addLayer(const Layer &layer)
Adds object to multilayer.
Definition: MultiLayer.cpp:54
Decorator class that adds particles to ISample objects.
A particle with a form factor and refractive index.
Definition: Particle.h:26
Constants and functions for physical unit conversions.
Definition: Units.h:21