BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IAbstractParticle.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/Particle/IAbstractParticle.h
6 //! @brief Defines interface IAbstractParticle.
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_PARTICLE_IABSTRACTPARTICLE_H
16 #define BORNAGAIN_CORE_PARTICLE_IABSTRACTPARTICLE_H
17 
19 
20 class IRotation;
21 
22 //! Interface for a generic particle.
23 //!
24 //! Inherited by IParticle and ParticleDistribution.
25 
26 //! @ingroup samples
27 
28 class IAbstractParticle : public ISample
29 {
30 public:
31  IAbstractParticle() = default;
32  IAbstractParticle(const NodeMeta& meta, const std::vector<double>& PValues);
33  virtual ~IAbstractParticle() = default;
34 
35  virtual IAbstractParticle* clone() const = 0;
36 
37  virtual void accept(INodeVisitor* visitor) const;
38 
39  double abundance() const { return m_abundance; }
40 
41  //! Sets particle abundance.
42  //! @param abundance: proportion of this type of particles normalized to the
43  //! total number of particles in the layout.
45 
46  //! Translates the particle with the given vector
47  virtual void translate(kvector_t translation) = 0;
48 
49  //! Applies the given rotation to the particle
50  virtual void rotate(const IRotation& rotation) = 0;
51 
52 protected:
53  double m_abundance{1.0}; // not a Parameter
54 };
55 
56 #endif // BORNAGAIN_CORE_PARTICLE_IABSTRACTPARTICLE_H
Defines interface class ISample.
Interface for a generic particle.
virtual void accept(INodeVisitor *visitor) const
Calls the INodeVisitor's visit method.
void setAbundance(double abundance)
Sets particle abundance.
virtual ~IAbstractParticle()=default
virtual IAbstractParticle * clone() const =0
Returns a clone of this ISample object.
virtual void translate(kvector_t translation)=0
Translates the particle with the given vector.
double abundance() const
IAbstractParticle()=default
virtual void rotate(const IRotation &rotation)=0
Applies the given rotation to the particle.
Visitor interface to visit ISample objects.
Definition: INodeVisitor.h:149
Pure virtual interface for rotations.
Definition: Rotations.h:27
Pure virtual base class for sample components and properties related to scattering.
Definition: ISample.h:28
Metadata of one model node.
Definition: INode.h:37