BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
LayerInterface.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/Slice/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_SLICE_LAYERINTERFACE_H
21 #define BORNAGAIN_SAMPLE_SLICE_LAYERINTERFACE_H
22 
24 #include <memory>
25 
26 class LayerRoughness;
27 
28 //! Interface between two layers, possibly with roughness.
29 //! @ingroup samples_internal
30 
31 class LayerInterface : public ISampleNode {
32 public:
33  virtual ~LayerInterface();
34 
35  LayerInterface* clone() const;
36 
37  virtual void accept(INodeVisitor* visitor) const { visitor->visit(this); }
38 
39  //! Creates smooth interface between two layers
40  static LayerInterface* createSmoothInterface(const Layer* top_layer, const Layer* bottom_layer);
41 
42  //! Creates rough interface between two layers
43  static LayerInterface* createRoughInterface(const Layer* top_layer, const Layer* bottom_layer,
44  const LayerRoughness& roughness);
45 
46  //! Sets roughness of the interface.
47  void setRoughness(const LayerRoughness& roughness);
48 
49  //! Returns roughness of the interface.
50  const LayerRoughness* getRoughness() const;
51 
52  const Layer* topLayer() const;
53 
54  const Layer* bottomLayer() const;
55 
56  std::vector<const INode*> getChildren() const;
57 
58 private:
59  void setLayersTopBottom(const Layer* top_layer, const Layer* bottom_layer);
61 
62  const Layer* m_topLayer; //!< pointer to the layer above interface
63  const Layer* m_bottomLayer; //!< pointer to the layer below interface
64  std::unique_ptr<LayerRoughness> m_roughness; //!< roughness of the interface
65 };
66 
68 {
69  return m_roughness.get();
70 }
71 
72 inline const Layer* LayerInterface::topLayer() const
73 {
74  return m_topLayer;
75 }
76 
77 inline const Layer* LayerInterface::bottomLayer() const
78 {
79  return m_bottomLayer;
80 }
81 
82 #endif // BORNAGAIN_SAMPLE_SLICE_LAYERINTERFACE_H
83 #endif // USER_API
Defines interface class ISampleNode.
Visitor interface to visit ISampleNode objects.
Definition: INodeVisitor.h:146
virtual void visit(const BasicLattice2D *)
Definition: INodeVisitor.h:151
Abstract base class for sample components and properties related to scattering.
Definition: ISampleNode.h:28
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.
LayerInterface * clone() const
Returns a clone of this ISampleNode object.
const Layer * topLayer() const
virtual void accept(INodeVisitor *visitor) const
Calls the INodeVisitor's visit method.
static LayerInterface * createSmoothInterface(const Layer *top_layer, const Layer *bottom_layer)
Creates smooth interface between two layers.
virtual ~LayerInterface()
const LayerRoughness * getRoughness() const
Returns roughness of the interface.
void setLayersTopBottom(const Layer *top_layer, const Layer *bottom_layer)
Sets links to the layers above and below the interface.
std::vector< const INode * > getChildren() const
Returns a vector of children.
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.
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:27