BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ISampleNode.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/Scattering/ISampleNode.h
6 //! @brief Defines interface class ISampleNode.
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 USER_API
16 #ifndef BORNAGAIN_SAMPLE_SCATTERING_ISAMPLENODE_H
17 #define BORNAGAIN_SAMPLE_SCATTERING_ISAMPLENODE_H
18 
19 #include "Base/Types/ICloneable.h"
20 #include "Param/Node/INode.h"
21 #include <vector>
22 
23 class Material;
24 
25 //! Abstract base class for sample components and properties related to scattering.
26 //! @ingroup samples_internal
27 
28 class ISampleNode : public ICloneable, public INode {
29 public:
30  ISampleNode() = default;
31  ISampleNode(const NodeMeta& meta, const std::vector<double>& PValues);
32 
33  //! Returns a clone of this ISampleNode object.
34  ISampleNode* clone() const override = 0;
35 
36  //! Returns nullptr, unless overwritten to return a specific material.
37  virtual const Material* material() const { return nullptr; }
38 
39  //! Returns set of unique materials contained in this ISampleNode.
40  std::vector<const Material*> containedMaterials() const;
41 
42  //! Returns true if there is any magnetic material in this ISampleNode.
43  bool isMagnetic() const;
44 };
45 
46 #endif // BORNAGAIN_SAMPLE_SCATTERING_ISAMPLENODE_H
47 #endif // USER_API
Defines and implements the standard mix-in ICloneable.
Defines interface INode.
Interface for polymorphic classes that should not be copied, except by explicit cloning.
Definition: ICloneable.h:25
Base class for tree-like structures containing parameterized objects.
Definition: INode.h:49
Abstract base class for sample components and properties related to scattering.
Definition: ISampleNode.h:28
std::vector< const Material * > containedMaterials() const
Returns set of unique materials contained in this ISampleNode.
Definition: ISampleNode.cpp:26
bool isMagnetic() const
Returns true if there is any magnetic material in this ISampleNode.
Definition: ISampleNode.cpp:40
virtual const Material * material() const
Returns nullptr, unless overwritten to return a specific material.
Definition: ISampleNode.h:37
ISampleNode()=default
ISampleNode * clone() const override=0
Returns a clone of this ISampleNode object.
A wrapper for underlying material implementation.
Definition: Material.h:29
Metadata of one model node.
Definition: INode.h:38