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 {
28 }
29 
31  : m_ff(new FormFactorFullSphere(5.0 * Units::nanometer))
32 {
33 }
34 
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 
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 
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.
IFormFactor * clone() const override=0
Returns a clone of this ISample object.
void setName(const std::string &name)
size_t size() const
Definition: IRegistry.h:48
const ValueType * getItem(const std::string &key) const
Definition: IRegistry.h:31
std::vector< std::string > keys() const
Definition: IRegistry.h:40
A layer, with thickness (in nanometer) and material.
Definition: Layer.h:28
void addLayout(const ILayout &decoration)
Definition: Layer.cpp:57
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
MultiLayer * createSampleByIndex(size_t index)
std::unique_ptr< IFormFactor > m_ff
virtual MultiLayer * buildSample() const
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
static constexpr double nanometer
Definition: Units.h:24
static const Material Vacuum
static const Material Particle