BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ParticleDistribution.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/Particle/ParticleDistribution.h
6 //! @brief Defines class ParticleDistribution.
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_SAMPLE_PARTICLE_PARTICLEDISTRIBUTION_H
16 #define BORNAGAIN_SAMPLE_PARTICLE_PARTICLEDISTRIBUTION_H
17 
21 
22 class IParticle;
23 
24 //! A particle type that is a parametric distribution of IParticle's.
25 //! @ingroup samples
26 
28 public:
30 
31  ParticleDistribution* clone() const final;
32 
33  void accept(INodeVisitor* visitor) const final { visitor->visit(this); }
34 
35  void translate(kvector_t translation) final;
36 
37  void rotate(const IRotation& rotation) final;
38 
39  //! Returns list of new particles generated according to a distribution.
41 
42  //! Returns the prototype particle, used for generating multiple ones
43  const IParticle& prototype() const { return *m_particle.get(); }
44 
45  //! Returns the distributed parameter data
47 
48  std::vector<const INode*> getChildren() const final;
49 
50  std::string mainUnits() const;
51 
52 private:
53  std::unique_ptr<IParticle> m_particle;
55 };
56 
57 #endif // BORNAGAIN_SAMPLE_PARTICLE_PARTICLEDISTRIBUTION_H
Defines interface IAbstractParticle.
Defines class ParameterDistribution.
Defines and implements template class SafePointerVector.
Interface for a generic particle.
Visitor interface to visit ISampleNode objects.
Definition: INodeVisitor.h:146
Abstract base class for Particle, ParticleComposition, ParticleCoreShell, MesoCrystal.
Definition: IParticle.h:33
Abstract base class for rotations.
Definition: Rotations.h:28
A parametric distribution function, for use with any model parameter.
A particle type that is a parametric distribution of IParticle's.
ParameterDistribution m_par_distribution
const IParticle & prototype() const
Returns the prototype particle, used for generating multiple ones.
ParticleDistribution * clone() const final
Returns a clone of this ISampleNode object.
void accept(INodeVisitor *visitor) const final
Calls the INodeVisitor's visit method.
std::vector< const INode * > getChildren() const final
Returns a vector of children.
void translate(kvector_t translation) final
Translates the particle with the given vector.
void rotate(const IRotation &rotation) final
Applies the given rotation to the particle.
SafePointerVector< IParticle > generateParticles() const
Returns list of new particles generated according to a distribution.
ParameterDistribution parameterDistribution() const
Returns the distributed parameter data.
std::string mainUnits() const
ParticleDistribution(const IParticle &prototype, const ParameterDistribution &par_distr)
std::unique_ptr< IParticle > m_particle
A vector of pointers, owned by *this, with methods to handle them safely.
Definition: filesystem.h:81