BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
MultipleLayoutBuilder.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
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 
23 
25 {
26  const double cylinder_height(5);
27  const double cylinder_radius(5);
28  const double prisheight(5);
29  const double prislength(10);
30  const double cylinder_weight(0.5);
31 
32  Layer vacuum_layer(refMat::Vacuum);
33  Layer substrate_layer(refMat::Substrate);
34 
35  ParticleLayout particle_layout_1;
36  ParticleLayout particle_layout_2;
37 
38  Cylinder ff_cylinder(cylinder_radius, cylinder_height);
39  Particle cylinder(refMat::Particle, ff_cylinder);
40 
41  Prism3 ff_prism3(prislength, prisheight);
42  Particle prism3(refMat::Particle, ff_prism3);
43 
44  particle_layout_1.addParticle(cylinder, cylinder_weight);
45  particle_layout_2.addParticle(prism3, 1.0 - cylinder_weight);
46 
47  vacuum_layer.addLayout(particle_layout_1);
48  vacuum_layer.addLayout(particle_layout_2);
49 
50  auto* sample = new MultiLayer();
51  sample->addLayer(vacuum_layer);
52  sample->addLayer(substrate_layer);
53  return sample;
54 }
Defines class Cylinder.
Defines class Layer.
Defines class MultiLayer.
Defines class MultipleLayoutBuilder.
Defines class ParticleLayout.
Defines class Particle.
Defines class Prism3.
Defines materials in namespace refMat.
A circular cylinder.
Definition: Cylinder.h:23
A layer in a MultiLayer sample.
Definition: Layer.h:26
void addLayout(const ParticleLayout &layout)
Definition: Layer.cpp:49
Our sample model: a stack of layers one below the other.
Definition: MultiLayer.h:43
Decorator class that adds particles to ISampleNode objects.
void addParticle(const IParticle &particle, double abundance=-1.0)
Adds particle to the layout with abundance, position and the rotation defined.
A particle with a form factor and refractive index.
Definition: Particle.h:25
A prism based on an equilateral triangle.
Definition: Prism3.h:23
MultiLayer * createMultipleLayout()
static const Material Vacuum
static const Material Particle
static const Material Substrate