BornAgain  1.19.0
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/coregui/Views/RealSpaceWidgets/Particle3DContainer.cpp
6 //! @brief Implements namespace 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), m_containerType(other.m_containerType)
21 {
22  m_containerParticles.resize(other.m_containerParticles.size());
23  for (size_t i = 0; i < m_containerParticles.size(); ++i)
26 
28  for (size_t i = 0; i < m_containerParticlesBlend.size(); ++i)
30 }
31 
32 // copy assignment
34 {
35  if (this != &rhs) {
37  m_containerParticles.resize(rhs.containerSize());
38  for (size_t i = 0; i < m_containerParticles.size(); ++i)
41 
44 
46  for (size_t i = 0; i < m_containerParticlesBlend.size(); ++i)
48  }
49  return *this;
50 }
51 
52 // destructor
54 {
56 }
57 
58 // move constructor
60  : m_containerParticles(std::move(other.m_containerParticles))
61  , m_cumulativeAbundance(std::move(other.m_cumulativeAbundance))
62  , m_containerType(std::move(other.m_containerType))
63  , m_containerParticlesBlend(std::move(other.m_containerParticlesBlend))
64 {
65 }
66 
67 // move assignment
69 {
70  if (this != &rhs) {
71  clearContainer();
72  m_containerParticles = std::move(rhs.m_containerParticles);
73  m_cumulativeAbundance = std::move(rhs.m_cumulativeAbundance);
74  m_containerType = std::move(rhs.m_containerType);
75  m_containerParticlesBlend = std::move(rhs.m_containerParticlesBlend);
76  }
77  return *this;
78 }
79 
81 {
82  for (auto it = m_containerParticles.begin(); it != m_containerParticles.end(); ++it)
83  delete (*it);
84 
85  m_containerParticles.clear();
87 }
88 
90 {
91  m_containerParticles.emplace_back(particle3D);
92  m_containerParticlesBlend.emplace_back(blend);
93 }
94 
95 void Particle3DContainer::setCumulativeAbundance(double cumulativeAbundance)
96 {
98 }
99 
100 void Particle3DContainer::setParticleType(QString particleType)
101 {
103 }
104 
105 std::unique_ptr<RealSpace::Particles::Particle>
106 Particle3DContainer::createParticle(const size_t& index) const
107 {
108  auto particle = new RealSpace::Particles::Particle(*m_containerParticles.at(index));
109  return std::unique_ptr<RealSpace::Particles::Particle>(particle);
110 }
Implements namespace TransformTo3D.
std::vector< RealSpace::Particles::Particle * > m_containerParticles
double cumulativeAbundance() const
void setCumulativeAbundance(double cumulativeAbundance)
std::unique_ptr< RealSpace::Particles::Particle > createParticle(const size_t &index) const
const QString particleType() const
void addParticle(RealSpace::Particles::Particle *particle3D, bool blend)
size_t containerSize() const
void setParticleType(QString particleType)
Particle3DContainer & operator=(const Particle3DContainer &rhs)
std::vector< bool > m_containerParticlesBlend
static const Material Particle
Defines Particle class.