BornAgain  1.19.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 reflection and scattering
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 FormFactorComponents ff_components;
27 }
28 
30 {
31 }
32 
34 {
35  Layer vacuum_layer(refMat::Vacuum);
36 
37  Particle particle(refMat::Particle, *m_ff);
38  ParticleLayout particle_layout(particle);
39  vacuum_layer.addLayout(particle_layout);
40 
41  MultiLayer* result = new MultiLayer;
42  result->addLayer(vacuum_layer);
43  return result;
44 }
45 
47 {
48  auto name = ff_components.keys().at(index);
49  m_ff.reset(ff_components.getItem(name)->clone());
50  setName(name);
51  return buildSample();
52 }
53 
55 {
56  return ff_components.size();
57 }
Defines sample components for complex sample builders.
Defines class FormFactorFullSphere.
Defines class Layer.
Defines class MultiLayer.
Defines class ParticleInVacuumBuilder.
Defines class ParticleLayout.
Defines class Particle.
Defines materials in namespace refMat.
Defines some unit conversion factors and other constants in namespace Units.
Predefined form factors for functional tests.
void setName(const std::string &name)
A layer in a MultiLayer sample.
Definition: Layer.h:27
void addLayout(const ParticleLayout &decoration)
Definition: Layer.cpp:58
Our sample model: a stack of layers one below the other.
Definition: MultiLayer.h:41
void addLayer(const Layer &layer)
Adds layer with default (zero) roughness.
Definition: MultiLayer.cpp:53
MultiLayer * createSampleByIndex(size_t index)
std::unique_ptr< IFormFactor > m_ff
virtual MultiLayer * buildSample() const
Decorator class that adds particles to ISampleNode objects.
A particle with a form factor and refractive index.
Definition: Particle.h:24
QString const & name(EShape k)
Definition: particles.cpp:21
Constants and functions for physical unit conversions.
Definition: Units.h:30
static constexpr double nm
Definition: Units.h:39
static const Material Vacuum
static const Material Particle