BornAgain  1.18.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 scattering at grazing incidence
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_CORE_PARTICLE_PARTICLEDISTRIBUTION_H
16 #define BORNAGAIN_CORE_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 {
29 public:
31 
32  ParticleDistribution* clone() const override final;
33 
34  void accept(INodeVisitor* visitor) const override final { visitor->visit(this); }
35 
36  void translate(kvector_t translation) override final;
37 
38  void rotate(const IRotation& rotation) override final;
39 
40  //! Returns list of new particles generated according to a distribution.
42 
43  //! Returns the prototype particle, used for generating multiple ones
44  const IParticle& prototype() const { return *mP_particle.get(); }
45 
46  //! Returns the distributed parameter data
48 
49  std::vector<const INode*> getChildren() const override final;
50 
51  std::string mainUnits() const;
52 
53 private:
54  std::unique_ptr<IParticle> mP_particle;
56 };
57 
58 #endif // BORNAGAIN_CORE_PARTICLE_PARTICLEDISTRIBUTION_H
Defines interface IAbstractParticle.
Defines class ParameterDistribution.
Defines and implements template class SafePointerVector.
Interface for a generic particle.
Visitor interface to visit ISample objects.
Definition: INodeVisitor.h:149
Pure virtual base class for Particle, ParticleComposition, ParticleCoreShell, MesoCrystal.
Definition: IParticle.h:33
Pure virtual interface for rotations.
Definition: Rotations.h:27
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.
std::vector< const INode * > getChildren() const override final
Returns a vector of children (const).
std::unique_ptr< IParticle > mP_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)
void rotate(const IRotation &rotation) override final
Applies the given rotation to the particle.
void accept(INodeVisitor *visitor) const override final
Calls the INodeVisitor's visit method.
ParticleDistribution * clone() const override final
Returns a clone of this ISample object.
void translate(kvector_t translation) override final
Translates the particle with the given vector.
A vector of pointers, owned by *this, with methods to handle them safely.