BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
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 
27 class ISampleNode : public ICloneable, public INode {
28 public:
29  ISampleNode() = default;
30  ISampleNode(const std::vector<double>& PValues);
31 
32  //! Returns a clone of this ISampleNode object.
33  ISampleNode* clone() const override = 0;
34 
35  //! Returns nullptr, unless overwritten to return a specific material.
36  virtual const Material* material() const { return nullptr; }
37 
38  //! Returns set of unique materials contained in this ISampleNode.
39  std::vector<const Material*> containedMaterials() const;
40 
41  //! Returns true if there is any magnetic material in this ISampleNode.
42  bool isMagnetic() const;
43 };
44 
45 #endif // BORNAGAIN_SAMPLE_SCATTERING_ISAMPLENODE_H
46 #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:23
Base class for tree-like structures containing parameterized objects.
Definition: INode.h:40
Abstract base class for sample components and properties related to scattering.
Definition: ISampleNode.h:27
std::vector< const Material * > containedMaterials() const
Returns set of unique materials contained in this ISampleNode.
Definition: ISampleNode.cpp:25
bool isMagnetic() const
Returns true if there is any magnetic material in this ISampleNode.
Definition: ISampleNode.cpp:39
virtual const Material * material() const
Returns nullptr, unless overwritten to return a specific material.
Definition: ISampleNode.h:36
ISampleNode()=default
ISampleNode * clone() const override=0
Returns a clone of this ISampleNode object.
A wrapper for underlying material implementation.
Definition: Material.h:35