BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
Particle3DContainer.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Realspace/Particle3DContainer.cpp
6 //! @brief Implements namespace GUI::View::TransformTo3D
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 
17 
18 // copy constructor
20  : m_cumulativeAbundance(other.m_cumulativeAbundance)
21  , m_containerType(other.m_containerType)
22 {
23  m_containerParticles.resize(other.m_containerParticles.size());
24  for (size_t i = 0; i < m_containerParticles.size(); ++i)
26  new GUI::RealSpace::Particles::Particle(*other.m_containerParticles[i]);
27 
28  m_containerParticlesBlend.resize(other.m_containerParticlesBlend.size());
29  for (size_t i = 0; i < m_containerParticlesBlend.size(); ++i)
30  m_containerParticlesBlend[i] = other.m_containerParticlesBlend[i];
31 }
32 
33 // copy assignment
35 {
36  if (this != &rhs) {
38  m_containerParticles.resize(rhs.containerSize());
39  for (size_t i = 0; i < m_containerParticles.size(); ++i)
42 
45 
47  for (size_t i = 0; i < m_containerParticlesBlend.size(); ++i)
49  }
50  return *this;
51 }
52 
53 // destructor
55 {
57 }
58 
59 // move constructor
61  : m_containerParticles(std::move(other.m_containerParticles))
62  , m_cumulativeAbundance(other.m_cumulativeAbundance)
63  , m_containerType(std::move(other.m_containerType))
64  , m_containerParticlesBlend(std::move(other.m_containerParticlesBlend))
65 {
66 }
67 
68 // move assignment
70 {
71  if (this != &rhs) {
73  m_containerParticles = std::move(rhs.m_containerParticles);
74  m_cumulativeAbundance = rhs.m_cumulativeAbundance;
75  m_containerType = std::move(rhs.m_containerType);
76  m_containerParticlesBlend = std::move(rhs.m_containerParticlesBlend);
77  }
78  return *this;
79 }
80 
82 {
83  for (auto it = m_containerParticles.begin(); it != m_containerParticles.end(); ++it)
84  delete (*it);
85 
86  m_containerParticles.clear();
88 }
89 
91 {
92  m_containerParticles.emplace_back(particle3D);
93  m_containerParticlesBlend.emplace_back(blend);
94 }
95 
96 void Particle3DContainer::setCumulativeAbundance(double cumulativeAbundance)
97 {
99 }
100 
101 void Particle3DContainer::setParticleType(QString particleType)
102 {
104 }
105 
106 std::unique_ptr<GUI::RealSpace::Particles::Particle>
107 Particle3DContainer::createParticle(const size_t& index) const
108 {
109  auto* particle = new GUI::RealSpace::Particles::Particle(*m_containerParticles.at(index));
110  return std::unique_ptr<GUI::RealSpace::Particles::Particle>(particle);
111 }
Implements namespace GUI::View::TransformTo3D.
@ other
The unit has no enum value defined in here (e.g. when defined as an explicit string)
QString particleType() const
std::unique_ptr< GUI::RealSpace::Particles::Particle > createParticle(const size_t &index) const
double cumulativeAbundance() const
void setCumulativeAbundance(double cumulativeAbundance)
void addParticle(GUI::RealSpace::Particles::Particle *particle3D, bool blend)
std::vector< GUI::RealSpace::Particles::Particle * > m_containerParticles
size_t containerSize() const
void setParticleType(QString particleType)
Particle3DContainer & operator=(const Particle3DContainer &rhs)
std::vector< bool > m_containerParticlesBlend
Defines Particle class.