BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
LayersWithAbsorptionBuilder.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/StandardSamples/LayersWithAbsorptionBuilder.cpp
6 //! @brief Implements class LayersWithAbsorptionBuilder.
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 using Units::deg;
26 
28 {
29  const double middle_layer_thickness(60.0);
30 
31  Particle particle(refMat::Ag, *ff);
32  particle.setRotation(RotationZ(10.0 * deg));
33  particle.rotate(RotationY(10.0 * deg));
34  particle.rotate(RotationX(10.0 * deg));
35  particle.setParticlePosition(R3(0.0, 0.0, -middle_layer_thickness / 2.0));
36 
37  ParticleLayout layout;
38  layout.addParticle(particle);
39 
40  Layer vacuum_layer(refMat::Vacuum);
42  Layer substrate(refMat::Substrate2);
43 
44  middle_layer.addLayout(layout);
45 
46  auto* sample = new MultiLayer(ff->shapeName());
47  sample->addLayer(vacuum_layer);
48  sample->addLayer(middle_layer);
49  sample->addLayer(substrate);
50  return sample;
51 }
Defines class Layer.
Defines class LayersWithAbsorptionBuilder.
const double middle_layer_thickness(60.0)
Defines class MultiLayer.
Defines class ParticleLayout.
Defines class Particle.
Defines materials in namespace refMat.
Defines IRotation classes.
Defines class Sphere.
Defines some unit conversion factors and other constants in namespace Units.
Abstract base class for Born form factors.
Definition: IFormFactor.h:36
void setParticlePosition(R3 position)
Sets relative position of the particle's reference point in the coordinate system of parent.
Definition: IParticle.h:51
IParticle * rotate(const IRotation &rotation)
Rotates the particle, and returns this.
Definition: IParticle.cpp:41
void setRotation(const IRotation &rotation)
Sets transformation.
Definition: IParticle.cpp:36
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 rotation about the x axis.
Definition: Rotations.h:74
A rotation about the y axis.
Definition: Rotations.h:98
A rotation about the z axis.
Definition: Rotations.h:122
MultiLayer * createLayersWithAbsorptionWithFF(const IFormFactor *)
static constexpr double deg
Definition: Units.h:46
static const Material Substrate2
static const Material Vacuum
static const Material Ag
static const Material Teflon