BornAgain  1.18.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 scattering at grazing incidence
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 #ifndef BORNAGAIN_CORE_MULTILAYER_LAYERINTERFACE_H
16 #define BORNAGAIN_CORE_MULTILAYER_LAYERINTERFACE_H
17 
19 #include <memory>
20 
21 class LayerRoughness;
22 
23 //! Interface between two layers, possibly with roughness.
24 //! @ingroup samples_internal
25 
26 class LayerInterface : public ISample
27 {
28 public:
29  virtual ~LayerInterface();
30 
31  LayerInterface* clone() const;
32 
33  virtual void accept(INodeVisitor* visitor) const { visitor->visit(this); }
34 
35  //! Creates smooth interface between two layers
36  static LayerInterface* createSmoothInterface(const Layer* top_layer, const Layer* bottom_layer);
37 
38  //! Creates rough interface between two layers
39  static LayerInterface* createRoughInterface(const Layer* top_layer, const Layer* bottom_layer,
40  const LayerRoughness& roughness);
41 
42  //! Sets roughness of the interface.
43  void setRoughness(const LayerRoughness& roughness);
44 
45  //! Returns roughness of the interface.
46  const LayerRoughness* getRoughness() const;
47 
48  const Layer* topLayer() const;
49 
50  const Layer* bottomLayer() const;
51 
52  std::vector<const INode*> getChildren() const;
53 
54 private:
55  void setLayersTopBottom(const Layer* top_layer, const Layer* bottom_layer);
57 
58  const Layer* m_topLayer; //!< pointer to the layer above interface
59  const Layer* m_bottomLayer; //!< pointer to the layer below interface
60  std::unique_ptr<LayerRoughness> m_roughness; //!< roughness of the interface
61 };
62 
64 {
65  return m_roughness.get();
66 }
67 
68 inline const Layer* LayerInterface::topLayer() const
69 {
70  return m_topLayer;
71 }
72 
73 inline const Layer* LayerInterface::bottomLayer() const
74 {
75  return m_bottomLayer;
76 }
77 
78 #endif // BORNAGAIN_CORE_MULTILAYER_LAYERINTERFACE_H
Defines interface class ISample.
Visitor interface to visit ISample objects.
Definition: INodeVisitor.h:149
virtual void visit(const BasicLattice *)
Definition: INodeVisitor.h:154
Pure virtual base class for sample components and properties related to scattering.
Definition: ISample.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 ISample 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 (const).
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, with thickness (in nanometer) and material.
Definition: Layer.h:28