BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
LayerInterface.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/Interface/LayerInterface.h
6 //! @brief Defines class LayerInterface.
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 #ifdef SWIG
16 #error no need to expose this header to Swig
17 #endif
18 
19 #ifndef USER_API
20 #ifndef BORNAGAIN_SAMPLE_INTERFACE_LAYERINTERFACE_H
21 #define BORNAGAIN_SAMPLE_INTERFACE_LAYERINTERFACE_H
22 
24 #include <memory>
25 
26 class LayerRoughness;
27 class Layer;
28 
29 //! Interface between two layers, possibly with roughness.
30 
31 class LayerInterface : public ISampleNode {
32 public:
33  ~LayerInterface() override;
34 
35  LayerInterface* clone() const override;
36  std::string className() const final { return "LayerInterface"; }
37 
38  //! Creates smooth interface between two layers
39  static LayerInterface* createSmoothInterface(const Layer* top_layer, const Layer* bottom_layer);
40 
41  //! Creates rough interface between two layers
42  static LayerInterface* createRoughInterface(const Layer* top_layer, const Layer* bottom_layer,
43  const LayerRoughness& roughness);
44 
45  //! Sets roughness of the interface.
47 
48  //! Returns roughness of the interface.
49  const LayerRoughness* roughness() const;
50 
51  const Layer* topLayer() const;
52 
53  const Layer* bottomLayer() const;
54 
55  std::vector<const INode*> nodeChildren() const override;
56 
57 private:
58  void setLayersTopBottom(const Layer* top_layer, const Layer* bottom_layer);
60 
61  const Layer* m_topLayer; //!< pointer to the layer above interface
62  const Layer* m_bottomLayer; //!< pointer to the layer below interface
63  std::unique_ptr<LayerRoughness> m_roughness; //!< roughness of the interface
64 };
65 
67 {
68  return m_roughness.get();
69 }
70 
71 inline const Layer* LayerInterface::topLayer() const
72 {
73  return m_topLayer;
74 }
75 
76 inline const Layer* LayerInterface::bottomLayer() const
77 {
78  return m_bottomLayer;
79 }
80 
81 #endif // BORNAGAIN_SAMPLE_INTERFACE_LAYERINTERFACE_H
82 #endif // USER_API
Defines interface class ISampleNode.
Abstract base class for sample components and properties related to scattering.
Definition: ISampleNode.h:27
Interface between two layers, possibly with roughness.
static LayerInterface * createRoughInterface(const Layer *top_layer, const Layer *bottom_layer, const LayerRoughness &roughness)
Creates rough interface between two layers.
const Layer * topLayer() const
~LayerInterface() override
const LayerRoughness * roughness() const
Returns roughness of the interface.
LayerInterface * clone() const override
Returns a clone of this ISampleNode object.
static LayerInterface * createSmoothInterface(const Layer *top_layer, const Layer *bottom_layer)
Creates smooth interface between two layers.
std::string className() const final
Returns the class name, to be hard-coded in each leaf class that inherits from INode.
void setLayersTopBottom(const Layer *top_layer, const Layer *bottom_layer)
Sets links to the layers above and below the interface.
std::unique_ptr< LayerRoughness > m_roughness
roughness of the interface
const Layer * m_bottomLayer
pointer to the layer below interface
void setRoughness(const LayerRoughness &roughness)
Sets roughness of the interface.
std::vector< const INode * > nodeChildren() const override
Returns all children.
const Layer * m_topLayer
pointer to the layer above interface
const Layer * bottomLayer() const
A roughness of interface between two layers.
A layer in a MultiLayer sample.
Definition: Layer.h:26