BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ParticleComposition.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/Particle/ParticleComposition.h
6 //! @brief Defines class ParticleComposition.
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_PARTICLECOMPOSITION_H
16 #define BORNAGAIN_SAMPLE_PARTICLE_PARTICLECOMPOSITION_H
17 
20 
21 //! A composition of particles at fixed positions
22 //! @ingroup samples
23 
25 public:
27 
29 
30  ParticleComposition* clone() const override;
31  std::string className() const final { return "ParticleComposition"; }
32  std::vector<const INode*> nodeChildren() const override;
33 
34 #ifndef SWIG
35  std::vector<std::unique_ptr<IParticle>> decompose() const override;
36 #endif
37 
38  void addParticle(const IParticle& particle);
39  void addParticle(const IParticle& particle, R3 position);
40  void addParticles(const IParticle& particle, std::vector<R3> positions);
41 
42  //! Returns number of different particles
43  size_t nbrParticles() const { return m_particles.size(); }
44 
45  std::vector<const IParticle*> particles() const;
46 
47 private:
49 };
50 
51 #endif // BORNAGAIN_SAMPLE_PARTICLE_PARTICLECOMPOSITION_H
Defines interface IParticle.
Defines and implements templated class OwningVector.
Abstract base class for Particle, ParticleComposition, ParticleCoreShell, MesoCrystal....
Definition: IParticle.h:31
size_t size() const
Definition: OwningVector.h:70
A composition of particles at fixed positions.
void addParticle(const IParticle &particle)
size_t nbrParticles() const
Returns number of different particles.
void addParticles(const IParticle &particle, std::vector< R3 > positions)
std::vector< std::unique_ptr< IParticle > > decompose() const override
Decompose in constituent IParticle objects.
std::vector< const INode * > nodeChildren() const override
Returns all children.
std::string className() const final
Returns the class name, to be hard-coded in each leaf class that inherits from INode.
std::vector< const IParticle * > particles() const
OwningVector< IParticle > m_particles
~ParticleComposition() override
ParticleComposition * clone() const override
Returns a clone of this ISampleNode object.