BornAgain  1.18.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 scattering at grazing incidence
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_CORE_MULTILAYER_LAYER_H
16 #define BORNAGAIN_CORE_MULTILAYER_LAYER_H
17 
21 
22 class ILayout;
23 
24 //! A layer, with thickness (in nanometer) and material.
25 //! @ingroup samples
26 
27 class Layer : public ISample
28 {
29 public:
30  Layer(Material material, double thickness = 0);
31 
32  ~Layer() override;
33 
34  Layer* clone() const override final;
35 
36  void accept(INodeVisitor* visitor) const override final { visitor->visit(this); }
37 
38  void setThickness(double thickness);
39  double thickness() const { return m_thickness; }
40 
41  const Material* material() const override final { return &m_material; }
43 
44  void addLayout(const ILayout& decoration);
45  size_t numberOfLayouts() const { return m_layouts.size(); }
46  std::vector<const ILayout*> layouts() const;
47 
48  std::vector<const INode*> getChildren() const override final;
49 
50  void registerThickness(bool make_registered = true);
51 
52  void setNumberOfSlices(unsigned int n_slices) { m_n_slices = n_slices; }
53  unsigned int numberOfSlices() const { return m_n_slices; }
54 
55 private:
56  Material m_material; //!< material
57  kvector_t m_B_field; //!< cached value of magnetic induction
58  double m_thickness; //!< layer thickness in nanometers
59  SafePointerVector<ILayout> m_layouts; //!< independent layouts in this layer
60  unsigned int m_n_slices = 1; //!< number of slices to create for graded layer approach
61 };
62 
63 #endif // BORNAGAIN_CORE_MULTILAYER_LAYER_H
Defines interface class ISample.
Defines and implements class Material.
Defines and implements template class SafePointerVector.
Pure virtual interface class to equip a sample layer with scattering properties.
Definition: ILayout.h:32
Visitor interface to visit ISample objects.
Definition: INodeVisitor.h:149
Pure virtual base class for sample components and properties related to scattering.
Definition: ISample.h:28
A layer, with thickness (in nanometer) and material.
Definition: Layer.h:28
double thickness() const
Definition: Layer.h:39
const Material * material() const override final
Returns nullptr, unless overwritten to return a specific material.
Definition: Layer.h:41
void accept(INodeVisitor *visitor) const override final
Calls the INodeVisitor's visit method.
Definition: Layer.h:36
void setNumberOfSlices(unsigned int n_slices)
Definition: Layer.h:52
std::vector< const INode * > getChildren() const override final
Returns a vector of children (const).
Definition: Layer.cpp:72
kvector_t m_B_field
cached value of magnetic induction
Definition: Layer.h:57
double m_thickness
layer thickness in nanometers
Definition: Layer.h:58
~Layer() override
Layer * clone() const override final
Returns a clone of this ISample object.
Definition: Layer.cpp:33
size_t numberOfLayouts() const
Definition: Layer.h:45
void addLayout(const ILayout &decoration)
Definition: Layer.cpp:57
void setMaterial(Material material)
Definition: Layer.cpp:52
void setThickness(double thickness)
Sets layer thickness in nanometers.
Definition: Layer.cpp:45
unsigned int numberOfSlices() const
Definition: Layer.h:53
unsigned int m_n_slices
number of slices to create for graded layer approach
Definition: Layer.h:60
Material m_material
material
Definition: Layer.h:56
Layer(Material material, double thickness=0)
Constructor of a layer with thickness and material.
Definition: Layer.cpp:24
void registerThickness(bool make_registered=true)
Definition: Layer.cpp:80
std::vector< const ILayout * > layouts() const
Definition: Layer.cpp:64
SafePointerVector< ILayout > m_layouts
independent layouts in this layer
Definition: Layer.h:59
A wrapper for underlying material implementation.
Definition: Material.h:29
size_t size() const