BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
Layer.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/Multilayer/Layer.h
6 //! @brief Defines class Layer.
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 
15 #ifndef BORNAGAIN_SAMPLE_MULTILAYER_LAYER_H
16 #define BORNAGAIN_SAMPLE_MULTILAYER_LAYER_H
17 
21 
22 class ParticleLayout;
23 
24 //! A layer in a MultiLayer sample.
25 //! @ingroup samples
26 
27 class Layer : public ISampleNode {
28 public:
29  Layer(Material material, double thickness = 0);
30 
31  ~Layer() override;
32 
33  Layer* clone() const final;
34 
35  void accept(INodeVisitor* visitor) const final { visitor->visit(this); }
36 
37  void setThickness(double thickness);
38  double thickness() const { return m_thickness; }
39 
40  const Material* material() const final { return &m_material; }
42 
43  void addLayout(const ParticleLayout& decoration);
44  size_t numberOfLayouts() const { return m_layouts.size(); }
45  std::vector<const ParticleLayout*> layouts() const;
46 
47  std::vector<const INode*> getChildren() const final;
48 
49  void registerThickness(bool make_registered = true);
50 
51  void setNumberOfSlices(unsigned int n_slices) { m_n_slices = n_slices; }
52  unsigned int numberOfSlices() const { return m_n_slices; }
53 
54 private:
55  Material m_material; //!< material
56  kvector_t m_B_field; //!< cached value of magnetic induction
57  double m_thickness; //!< layer thickness in nanometers
58  SafePointerVector<ParticleLayout> m_layouts; //!< independent layouts in this layer
59  unsigned int m_n_slices = 1; //!< number of slices to create for graded layer approach
60 };
61 
62 #endif // BORNAGAIN_SAMPLE_MULTILAYER_LAYER_H
Defines interface class ISampleNode.
Defines and implements class Material.
Defines and implements template class SafePointerVector.
Visitor interface to visit ISampleNode objects.
Definition: INodeVisitor.h:146
Abstract base class for sample components and properties related to scattering.
Definition: ISampleNode.h:28
A layer in a MultiLayer sample.
Definition: Layer.h:27
double thickness() const
Definition: Layer.h:38
void setNumberOfSlices(unsigned int n_slices)
Definition: Layer.h:51
std::vector< const ParticleLayout * > layouts() const
Definition: Layer.cpp:65
const Material * material() const final
Returns nullptr, unless overwritten to return a specific material.
Definition: Layer.h:40
kvector_t m_B_field
cached value of magnetic induction
Definition: Layer.h:56
void accept(INodeVisitor *visitor) const final
Calls the INodeVisitor's visit method.
Definition: Layer.h:35
double m_thickness
layer thickness in nanometers
Definition: Layer.h:57
~Layer() override
size_t numberOfLayouts() const
Definition: Layer.h:44
void setMaterial(Material material)
Definition: Layer.cpp:53
void setThickness(double thickness)
Sets layer thickness in nanometers.
Definition: Layer.cpp:46
unsigned int numberOfSlices() const
Definition: Layer.h:52
unsigned int m_n_slices
number of slices to create for graded layer approach
Definition: Layer.h:59
std::vector< const INode * > getChildren() const final
Returns a vector of children.
Definition: Layer.cpp:73
Material m_material
material
Definition: Layer.h:55
Layer(Material material, double thickness=0)
Constructor of a layer with thickness and material.
Definition: Layer.cpp:23
void registerThickness(bool make_registered=true)
Definition: Layer.cpp:81
void addLayout(const ParticleLayout &decoration)
Definition: Layer.cpp:58
SafePointerVector< ParticleLayout > m_layouts
independent layouts in this layer
Definition: Layer.h:58
Layer * clone() const final
Returns a clone of this ISampleNode object.
Definition: Layer.cpp:34
A wrapper for underlying material implementation.
Definition: Material.h:29
Decorator class that adds particles to ISampleNode objects.
size_t size() const