BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
MultipleLayoutBuilder.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/StandardSamples/MultipleLayoutBuilder.cpp
6 //! @brief Implements class MultipleLayoutBuilder.
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 
26 {
27  const double cylinder_height(5 * Units::nanometer);
28  const double cylinder_radius(5 * Units::nanometer);
29  const double prisheight(5 * Units::nanometer);
30  const double prislength(10 * Units::nanometer);
31  const double cylinder_weight(0.5);
32 
33  Layer vacuum_layer(refMat::Vacuum);
34  Layer substrate_layer(refMat::Substrate);
35 
36  ParticleLayout particle_layout_1;
37  ParticleLayout particle_layout_2;
38 
39  FormFactorCylinder ff_cylinder(cylinder_radius, cylinder_height);
40  Particle cylinder(refMat::Particle, ff_cylinder);
41 
42  FormFactorPrism3 ff_prism3(prislength, prisheight);
43  Particle prism3(refMat::Particle, ff_prism3);
44 
45  particle_layout_1.addParticle(cylinder, cylinder_weight);
46  particle_layout_2.addParticle(prism3, 1.0 - cylinder_weight);
47 
48  vacuum_layer.addLayout(particle_layout_1);
49  vacuum_layer.addLayout(particle_layout_2);
50 
51  MultiLayer* multi_layer = new MultiLayer();
52  multi_layer->addLayer(vacuum_layer);
53  multi_layer->addLayer(substrate_layer);
54  return multi_layer;
55 }
Defines class FormFactorCylinder.
Defines class FormFactorPrism3.
Defines class Layer.
Defines class MultiLayer.
Defines class MultipleLayoutBuilder.
Defines class ParticleLayout.
Defines class Particle.
Defines materials in namespace refMat.
Defines some unit conversion factors and other constants in namespace Units.
A circular cylinder.
A prism based on an equilateral triangle.
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 * buildSample() const
Decorator class that adds particles to ISample objects.
void addParticle(const IAbstractParticle &particle, double abundance=-1.0, const kvector_t position={}, const IRotation &rotation=IdentityRotation())
Adds particle to the layout with abundance, position and the rotation defined.
A particle with a form factor and refractive index.
Definition: Particle.h:26
static constexpr double nanometer
Definition: Units.h:24
static const Material Vacuum
static const Material Particle
static const Material Substrate