BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
TransformationsBuilder.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/StandardSamples/TransformationsBuilder.cpp
6 //! @brief Implements classes to build samples with different transformations.
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 layer_thickness(100);
30  const double length(50);
31  const double width(20);
32  const double height(10);
33 
34  Particle box(refMat::Ag, Box(length, width, height));
35  box.setRotation(RotationZ(90. * deg));
36  box.rotate(RotationY(90. * deg));
37  box.setParticlePosition(R3(0, 0, -layer_thickness / 2.));
38 
39  ParticleLayout layout;
40  layout.addParticle(box);
41 
42  Layer vacuum_layer(refMat::Vacuum);
43  Layer middle_layer(refMat::Teflon, layer_thickness);
44  middle_layer.addLayout(layout);
45  Layer substrate(refMat::Substrate2);
46 
47  auto* sample = new MultiLayer();
48  sample->addLayer(vacuum_layer);
49  sample->addLayer(middle_layer);
50  sample->addLayer(substrate);
51  return sample;
52 }
Defines class Box.
Defines class Layer.
Defines class MultiLayer.
Defines class ParticleLayout.
Defines class Particle.
Defines materials in namespace refMat.
Defines IRotation classes.
Defines classes to build samples with different transformations.
Defines some unit conversion factors and other constants in namespace Units.
A rectangular prism (parallelepiped).
Definition: Box.h:23
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 y axis.
Definition: Rotations.h:98
A rotation about the z axis.
Definition: Rotations.h:122
MultiLayer * createTransformBox()
static constexpr double deg
Definition: Units.h:46
static const Material Substrate2
static const Material Vacuum
static const Material Ag
static const Material Teflon