From 43812f7667b771a2441378be36239a3a4432c519 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 30 Sep 2022 10:00:33 +0200 Subject: [PATCH 01/16] correct logic; rm comments --- GUI/View/Realspace/RealspaceBuilder.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/GUI/View/Realspace/RealspaceBuilder.cpp b/GUI/View/Realspace/RealspaceBuilder.cpp index ca68d7b2f5b..8d4f77187cf 100644 --- a/GUI/View/Realspace/RealspaceBuilder.cpp +++ b/GUI/View/Realspace/RealspaceBuilder.cpp @@ -176,20 +176,17 @@ void RealspaceBuilder::populateParticleFromParticleItem(Img3D::Model* model, particle3DContainer = m_builderUtils->singleParticle3DContainer(*particle); } else if (const auto* particleCoreShellItem = dynamic_cast<const CoreAndShellItem*>(&particleItem)) { - // If there is no CORE or SHELL to populate inside CoreAndShellItem if (!particleCoreShellItem->core() || !particleCoreShellItem->shell()) return; auto particleCoreShell = particleCoreShellItem->createCoreAndShell(); particle3DContainer = m_builderUtils->particleCoreShell3DContainer(*particleCoreShell); } else if (const auto* particleCompositionItem = dynamic_cast<const CompoundItem*>(&particleItem)) { - // If there is no particle to populate inside CompoundItem - if (!particleCompositionItem->particles().empty()) + if (particleCompositionItem->particles().empty()) return; auto particleComposition = particleCompositionItem->createCompound(); particle3DContainer = m_builderUtils->particleComposition3DContainer(*particleComposition); } else if (const auto* mesocrystalItem = dynamic_cast<const MesocrystalItem*>(&particleItem)) { - // If there is no particle to populate inside MesocrystalItem if (!mesocrystalItem->basisParticle()) return; particle3DContainer = m_builderUtils->mesocrystal3DContainer(*mesocrystalItem); -- GitLab From 60e97e7e42801fdc9ec6bd838aa9cdbfa8f35faf Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 30 Sep 2022 10:03:29 +0200 Subject: [PATCH 02/16] uniform local var name --- GUI/View/Realspace/RealspaceBuilder.cpp | 28 +++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/GUI/View/Realspace/RealspaceBuilder.cpp b/GUI/View/Realspace/RealspaceBuilder.cpp index 8d4f77187cf..9038b202658 100644 --- a/GUI/View/Realspace/RealspaceBuilder.cpp +++ b/GUI/View/Realspace/RealspaceBuilder.cpp @@ -171,25 +171,27 @@ void RealspaceBuilder::populateParticleFromParticleItem(Img3D::Model* model, const ItemWithParticles& particleItem) const { Particle3DContainer particle3DContainer; - if (const auto* pItem = dynamic_cast<const ParticleItem*>(&particleItem)) { - auto particle = pItem->createParticle(); + + if (const auto* item = dynamic_cast<const ParticleItem*>(&particleItem)) { + auto particle = item->createParticle(); particle3DContainer = m_builderUtils->singleParticle3DContainer(*particle); - } else if (const auto* particleCoreShellItem = - dynamic_cast<const CoreAndShellItem*>(&particleItem)) { - if (!particleCoreShellItem->core() || !particleCoreShellItem->shell()) + + } else if (const auto* item = dynamic_cast<const CoreAndShellItem*>(&particleItem)) { + if (!item->core() || !item->shell()) return; - auto particleCoreShell = particleCoreShellItem->createCoreAndShell(); + auto particleCoreShell = item->createCoreAndShell(); particle3DContainer = m_builderUtils->particleCoreShell3DContainer(*particleCoreShell); - } else if (const auto* particleCompositionItem = - dynamic_cast<const CompoundItem*>(&particleItem)) { - if (particleCompositionItem->particles().empty()) + + } else if (const auto* item = dynamic_cast<const CompoundItem*>(&particleItem)) { + if (item->particles().empty()) return; - auto particleComposition = particleCompositionItem->createCompound(); + auto particleComposition = item->createCompound(); particle3DContainer = m_builderUtils->particleComposition3DContainer(*particleComposition); - } else if (const auto* mesocrystalItem = dynamic_cast<const MesocrystalItem*>(&particleItem)) { - if (!mesocrystalItem->basisParticle()) + + } else if (const auto* item = dynamic_cast<const MesocrystalItem*>(&particleItem)) { + if (!item->basisParticle()) return; - particle3DContainer = m_builderUtils->mesocrystal3DContainer(*mesocrystalItem); + particle3DContainer = m_builderUtils->mesocrystal3DContainer(*item); } populateParticleFromParticle3DContainer(model, particle3DContainer); -- GitLab From d7e82f5a23b771c5082da68bbdd3daface78cc08 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 30 Sep 2022 10:06:14 +0200 Subject: [PATCH 03/16] no need for if(size) around for loop --- GUI/View/Realspace/RealspaceBuilder.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/GUI/View/Realspace/RealspaceBuilder.cpp b/GUI/View/Realspace/RealspaceBuilder.cpp index 9038b202658..5e9c94c64f2 100644 --- a/GUI/View/Realspace/RealspaceBuilder.cpp +++ b/GUI/View/Realspace/RealspaceBuilder.cpp @@ -201,16 +201,14 @@ void RealspaceBuilder::populateParticleFromParticle3DContainer( Img3D::Model* model, const Particle3DContainer& particle3DContainer, const F3& lattice_position) const { - if (particle3DContainer.containerSize()) { - for (size_t i = 0; i < particle3DContainer.containerSize(); ++i) { - auto particle3D = particle3DContainer.createParticle(i); - particle3D->addTranslation(lattice_position); - if (particle3D) { - if (!particle3DContainer.particle3DBlend(i)) - model->add(particle3D.release()); - else - model->addBlend(particle3D.release()); // use addBlend() for transparent object - } + for (size_t i = 0; i < particle3DContainer.containerSize(); ++i) { + auto particle3D = particle3DContainer.createParticle(i); + particle3D->addTranslation(lattice_position); + if (particle3D) { + if (!particle3DContainer.particle3DBlend(i)) + model->add(particle3D.release()); + else + model->addBlend(particle3D.release()); // use addBlend() for transparent object } } } -- GitLab From 94b082628b08b9e4d56bd39b2263137283e77770 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 30 Sep 2022 10:08:33 +0200 Subject: [PATCH 04/16] replace trivial if by assertion --- GUI/View/Realspace/RealspaceBuilder.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/GUI/View/Realspace/RealspaceBuilder.cpp b/GUI/View/Realspace/RealspaceBuilder.cpp index 5e9c94c64f2..61bb9b7d06d 100644 --- a/GUI/View/Realspace/RealspaceBuilder.cpp +++ b/GUI/View/Realspace/RealspaceBuilder.cpp @@ -13,6 +13,7 @@ // ************************************************************************************************ #include "GUI/View/Realspace/RealspaceBuilder.h" +#include "Base/Util/Assert.h" #include "GUI/Model/Descriptor/DoubleDescriptor.h" #include "GUI/Model/Sample/CompoundItem.h" #include "GUI/Model/Sample/CoreAndShellItem.h" @@ -203,12 +204,11 @@ void RealspaceBuilder::populateParticleFromParticle3DContainer( { for (size_t i = 0; i < particle3DContainer.containerSize(); ++i) { auto particle3D = particle3DContainer.createParticle(i); + ASSERT(particle3D); particle3D->addTranslation(lattice_position); - if (particle3D) { - if (!particle3DContainer.particle3DBlend(i)) - model->add(particle3D.release()); - else - model->addBlend(particle3D.release()); // use addBlend() for transparent object - } + if (!particle3DContainer.particle3DBlend(i)) + model->add(particle3D.release()); + else + model->addBlend(particle3D.release()); // use addBlend() for transparent object } } -- GitLab From 28e1d8e18fd4b3b5d103880d77fddbf411065414 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 30 Sep 2022 10:15:57 +0200 Subject: [PATCH 05/16] rm promise from err msg --- GUI/View/Realspace/RealspaceBuilderUtils.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/GUI/View/Realspace/RealspaceBuilderUtils.cpp b/GUI/View/Realspace/RealspaceBuilderUtils.cpp index 90766825c76..bdc8e8023fe 100644 --- a/GUI/View/Realspace/RealspaceBuilderUtils.cpp +++ b/GUI/View/Realspace/RealspaceBuilderUtils.cpp @@ -242,10 +242,7 @@ Img3D::BuilderUtils::particleComposition3DContainer(const Compound& particleComp } else if (dynamic_cast<const Mesocrystal*>(pc_particle)) { // TODO: Implement method to populate Mesocrystal from CORE and NOT from MesocrystalItem // as it is done currently in BuilderUtils::mesocrystal3DContainer - std::ostringstream ostr; - ostr << "Sorry, Mesocrystal inside Compound not yet implemented"; - ostr << "\n\nStay tuned!"; - throw std::runtime_error(ostr.str()); + throw std::runtime_error("Mesocrystal inside compound particle is not supported"); } else if (const auto* p = dynamic_cast<const Particle*>(pc_particle)) particle3DContainer = singleParticle3DContainer(*p, 1.0, origin); else -- GitLab From fc05e51507db34f1f5c0dbd31bed07cf79e2f636 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 30 Sep 2022 11:00:25 +0200 Subject: [PATCH 06/16] fct back to class, don't transfer class pointer --- GUI/View/Realspace/RealspaceBuilder.cpp | 90 ++++++++++++-------- GUI/View/Realspace/RealspaceBuilder.h | 15 ++-- GUI/View/Realspace/RealspaceBuilderUtils.cpp | 9 +- 3 files changed, 69 insertions(+), 45 deletions(-) diff --git a/GUI/View/Realspace/RealspaceBuilder.cpp b/GUI/View/Realspace/RealspaceBuilder.cpp index 61bb9b7d06d..c1b18af9afa 100644 --- a/GUI/View/Realspace/RealspaceBuilder.cpp +++ b/GUI/View/Realspace/RealspaceBuilder.cpp @@ -33,6 +33,7 @@ #include "Sample/Aggregate/Interferences.h" #include "Sample/Particle/CoreAndShell.h" #include "Sample/Particle/Particle.h" +#include <iostream> // DEBUG using Img3D::F3; @@ -64,41 +65,6 @@ std::vector<std::vector<double>> generatePositions(const ParticleLayoutItem& lay return RandomPositionBuilder().generatePositions(layerSize, density); } -void populateParticlesAtLatticePositions( - const std::vector<std::vector<double>>& lattice_positions, - const std::vector<Particle3DContainer>& particle3DContainer_vector, Img3D::Model* model, - const SceneGeometry& sceneGeometry, const RealspaceBuilder* builder3D) -{ - const double layerBorderWidth = 10.0; - - double layer_size = sceneGeometry.layerSize; - double layer_thickness = sceneGeometry.topOrBottomLayerThickness; - - for (std::vector<double> position : lattice_positions) { - // for random selection of particles based on their abundances - double rand_num = (rand() / static_cast<double>(RAND_MAX)); // (between 0 and 1) - int k = 0; - - for (const auto& particle3DContainer : particle3DContainer_vector) { - if (rand_num <= particle3DContainer.cumulativeAbundance()) { - // lattice position + location (TO BE ADDED) - double pos_x = position[0]; - double pos_y = position[1]; - double pos_z = 0; - - if (std::abs(pos_x) <= layer_size - layerBorderWidth - && std::abs(pos_y) <= layer_size - layerBorderWidth - && std::abs(pos_z) <= layer_thickness) { - builder3D->populateParticleFromParticle3DContainer( - model, particle3DContainer, Img3D::F3fromR3({position[0], position[1], 0})); - } - break; - } - ++k; - } - } -} - } // namespace @@ -113,14 +79,22 @@ void RealspaceBuilder::populate(Img3D::Model* model, ItemForRealspace item, { model->defCamPos = cameraPosition; + // depending on item type, visualize the full sample model, or only parts of it if (const auto* p = std::get_if<MultiLayerItem*>(&item)) populateMultiLayer(model, **p, sceneGeometry); + else if (const auto* p = std::get_if<LayerItem*>(&item)) populateLayer(model, **p, sceneGeometry); + else if (const auto* p = std::get_if<ParticleLayoutItem*>(&item)) populateLayout(model, **p, sceneGeometry); + else if (const auto* p = std::get_if<ItemWithParticles*>(&item)) + // visualize one generalized particle (simple particle or core/shell or compound or meso..) populateParticleFromParticleItem(model, **p); + + else + ASSERT(0); } void RealspaceBuilder::populateMultiLayer(Img3D::Model* model, const MultiLayerItem& mlayerItem, @@ -165,7 +139,7 @@ void RealspaceBuilder::populateLayout(Img3D::Model* model, const ParticleLayoutI const auto latticePositions = generatePositions(layoutItem, layer_size, total_density); populateParticlesAtLatticePositions(latticePositions, particle3DContainer_vector, model, - sceneGeometry, this); + sceneGeometry); } void RealspaceBuilder::populateParticleFromParticleItem(Img3D::Model* model, @@ -174,26 +148,33 @@ void RealspaceBuilder::populateParticleFromParticleItem(Img3D::Model* model, Particle3DContainer particle3DContainer; if (const auto* item = dynamic_cast<const ParticleItem*>(&particleItem)) { + std::cout << "DEBUG PP: Particle" << std::endl; auto particle = item->createParticle(); particle3DContainer = m_builderUtils->singleParticle3DContainer(*particle); } else if (const auto* item = dynamic_cast<const CoreAndShellItem*>(&particleItem)) { + std::cout << "DEBUG PP: CoreAndShell" << std::endl; if (!item->core() || !item->shell()) return; auto particleCoreShell = item->createCoreAndShell(); particle3DContainer = m_builderUtils->particleCoreShell3DContainer(*particleCoreShell); } else if (const auto* item = dynamic_cast<const CompoundItem*>(&particleItem)) { + std::cout << "DEBUG PP: Compound" << std::endl; if (item->particles().empty()) return; + std::cout << "DEBUG PP: Compound not empty" << std::endl; auto particleComposition = item->createCompound(); particle3DContainer = m_builderUtils->particleComposition3DContainer(*particleComposition); } else if (const auto* item = dynamic_cast<const MesocrystalItem*>(&particleItem)) { + std::cout << "DEBUG PP: Mesocrystal" << std::endl; if (!item->basisParticle()) return; particle3DContainer = m_builderUtils->mesocrystal3DContainer(*item); - } + + } else + ASSERT(0); populateParticleFromParticle3DContainer(model, particle3DContainer); } @@ -212,3 +193,38 @@ void RealspaceBuilder::populateParticleFromParticle3DContainer( model->addBlend(particle3D.release()); // use addBlend() for transparent object } } + +void RealspaceBuilder::populateParticlesAtLatticePositions( + const std::vector<std::vector<double>>& lattice_positions, + const std::vector<Particle3DContainer>& particle3DContainer_vector, Img3D::Model* model, + const SceneGeometry& sceneGeometry) const +{ + const double layerBorderWidth = 10.0; + + double layer_size = sceneGeometry.layerSize; + double layer_thickness = sceneGeometry.topOrBottomLayerThickness; + + for (std::vector<double> position : lattice_positions) { + // for random selection of particles based on their abundances + double rand_num = (rand() / static_cast<double>(RAND_MAX)); // (between 0 and 1) + int k = 0; + + for (const auto& particle3DContainer : particle3DContainer_vector) { + if (rand_num <= particle3DContainer.cumulativeAbundance()) { + // lattice position + location (TO BE ADDED) + double pos_x = position[0]; + double pos_y = position[1]; + double pos_z = 0; + + if (std::abs(pos_x) <= layer_size - layerBorderWidth + && std::abs(pos_y) <= layer_size - layerBorderWidth + && std::abs(pos_z) <= layer_thickness) { + populateParticleFromParticle3DContainer( + model, particle3DContainer, Img3D::F3fromR3({position[0], position[1], 0})); + } + break; + } + ++k; + } + } +} diff --git a/GUI/View/Realspace/RealspaceBuilder.h b/GUI/View/Realspace/RealspaceBuilder.h index 38d8e9ddf8d..b546b26ec90 100644 --- a/GUI/View/Realspace/RealspaceBuilder.h +++ b/GUI/View/Realspace/RealspaceBuilder.h @@ -44,11 +44,9 @@ public: const Img3D::Position& cameraPosition = Img3D::Position({0, -200, 120}, {0, 0, 0}, {0, 0, 1})) const; - void populateParticleFromParticle3DContainer(Img3D::Model* model, - const Particle3DContainer& particle3DContainer, - const Img3D::F3& lattice_position = {}) const; - private: + std::unique_ptr<Img3D::BuilderUtils> m_builderUtils; + void populateMultiLayer(Img3D::Model* model, const MultiLayerItem& mlayerItem, const SceneGeometry& sceneGeometry, const Img3D::F3& origin = {}) const; @@ -62,9 +60,14 @@ private: void populateParticleFromParticleItem(Img3D::Model* model, const ItemWithParticles& particleItem) const; + void populateParticleFromParticle3DContainer(Img3D::Model* model, + const Particle3DContainer& particle3DContainer, + const Img3D::F3& lattice_position = {}) const; -private: - std::unique_ptr<Img3D::BuilderUtils> m_builderUtils; + void populateParticlesAtLatticePositions( + const std::vector<std::vector<double>>& lattice_positions, + const std::vector<Particle3DContainer>& particle3DContainer_vector, Img3D::Model* model, + const SceneGeometry& sceneGeometry) const; }; #endif // BORNAGAIN_GUI_VIEW_REALSPACE_REALSPACEBUILDER_H diff --git a/GUI/View/Realspace/RealspaceBuilderUtils.cpp b/GUI/View/Realspace/RealspaceBuilderUtils.cpp index bdc8e8023fe..28d030d8caf 100644 --- a/GUI/View/Realspace/RealspaceBuilderUtils.cpp +++ b/GUI/View/Realspace/RealspaceBuilderUtils.cpp @@ -29,6 +29,7 @@ #include "Sample/Particle/IFormFactor.h" #include "Sample/Particle/Mesocrystal.h" #include "Sample/Particle/Particle.h" +#include <iostream> // DEBUG using Img3D::F3; @@ -231,12 +232,14 @@ Img3D::BuilderUtils::particleComposition3DContainer(const Compound& particleComp // clone of the particleComposition std::unique_ptr<Compound> PC_clone(particleComposition.clone()); + std::cout << "DEBUG BEFORE " << particleComposition.decompose().size() << std::endl; + std::cout << "DEBUG AFTER " << PC_clone->decompose().size() << std::endl; + Particle3DContainer result; for (const auto* pc_particle : PC_clone->decompose()) { ASSERT(pc_particle); Particle3DContainer particle3DContainer; - // no abundances are associated with the individual components of Compound if (const auto* p = dynamic_cast<const CoreAndShell*>(pc_particle)) { particle3DContainer = particleCoreShell3DContainer(*p, 1.0, origin); } else if (dynamic_cast<const Mesocrystal*>(pc_particle)) { @@ -248,13 +251,15 @@ Img3D::BuilderUtils::particleComposition3DContainer(const Compound& particleComp else ASSERT(0); - // add particles from 3Dcontainer of core-shell/particle into result + // keep result flat for (size_t i = 0; i < particle3DContainer.containerSize(); ++i) { result.addParticle(particle3DContainer.createParticle(i).release(), particle3DContainer.particle3DBlend(i)); } } + // set the correct abundance for the entire Compound + // (no abundances are associated with the individual components of Compound) result.setCumulativeAbundance(PC_clone->abundance() / total_abundance); result.setParticleType("Compound"); -- GitLab From b88b300c42c440b2dfebcea7b2050043304f037e Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 30 Sep 2022 11:22:32 +0200 Subject: [PATCH 07/16] again, rm promise from err msg --- GUI/View/Realspace/RealspaceBuilderUtils.cpp | 15 ++++++++------- GUI/View/Realspace/RealspaceBuilderUtils.h | 9 +++++---- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/GUI/View/Realspace/RealspaceBuilderUtils.cpp b/GUI/View/Realspace/RealspaceBuilderUtils.cpp index 28d030d8caf..0fb3a77e085 100644 --- a/GUI/View/Realspace/RealspaceBuilderUtils.cpp +++ b/GUI/View/Realspace/RealspaceBuilderUtils.cpp @@ -291,20 +291,21 @@ Img3D::BuilderUtils::mesocrystal3DContainer(const MesocrystalItem& mesocrystalIt const auto* particleComposition = dynamic_cast<const Compound*>(particleBasis.get()); mesocrystalBasis3DContainer = particleComposition3DContainer(*particleComposition, 1.0, origin); + } else if (dynamic_cast<const CoreAndShell*>(particleBasis.get())) { const auto* particleCoreShell = dynamic_cast<const CoreAndShell*>(particleBasis.get()); mesocrystalBasis3DContainer = particleCoreShell3DContainer(*particleCoreShell, 1.0, origin); + } else if (dynamic_cast<const Mesocrystal*>(particleBasis.get())) { // TODO: Implement method to populate Mesocrystal from CORE and NOT from MesocrystalItem // as it is done currently in Img3D::BuilderUtils::mesocrystal3DContainer - std::ostringstream ostr; - ostr << "Sorry, Mesocrystal inside Mesocrystal not yet implemented"; - ostr << "\n\nStay tuned!"; - throw std::runtime_error(ostr.str()); - } else { - const auto* particle = dynamic_cast<const Particle*>(particleBasis.get()); + throw std::runtime_error("Mesocrystal inside mesocrystal is not supported"); + + } else if (const auto* particle = dynamic_cast<const Particle*>(particleBasis.get())) { mesocrystalBasis3DContainer = singleParticle3DContainer(*particle, 1.0, origin); - } + + } else + ASSERT(0); Particle3DContainer result; diff --git a/GUI/View/Realspace/RealspaceBuilderUtils.h b/GUI/View/Realspace/RealspaceBuilderUtils.h index b2cd97034ee..ac06d636557 100644 --- a/GUI/View/Realspace/RealspaceBuilderUtils.h +++ b/GUI/View/Realspace/RealspaceBuilderUtils.h @@ -44,10 +44,6 @@ class BuilderUtils { public: BuilderUtils(std::function<QColor(const QString&)> fnColorFromMaterialName); - // Apply color to a 3D particle - void applyParticleColor(const Particle& particle, Img3D::Particles::Particle& particle3D, - double alpha = 1); - std::vector<Particle3DContainer> particle3DContainerVector(const ParticleLayoutItem& layoutItem, const Img3D::F3& origin = {}); @@ -69,6 +65,11 @@ public: private: std::function<QColor(const QString&)> m_fnColorFromMaterialName; + + //! Apply color to a 3D particle + void applyParticleColor(const Particle& particle, Img3D::Particles::Particle& particle3D, + double alpha = 1); + }; } // namespace Img3D -- GitLab From 7dccc4e2c27dacc3bf37453c7e7f24c909b7bc71 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 30 Sep 2022 11:27:46 +0200 Subject: [PATCH 08/16] shorter name for intermediate var --- GUI/View/Realspace/RealspaceBuilderUtils.cpp | 51 +++++++++----------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/GUI/View/Realspace/RealspaceBuilderUtils.cpp b/GUI/View/Realspace/RealspaceBuilderUtils.cpp index 0fb3a77e085..ea27cc2f770 100644 --- a/GUI/View/Realspace/RealspaceBuilderUtils.cpp +++ b/GUI/View/Realspace/RealspaceBuilderUtils.cpp @@ -135,37 +135,34 @@ Img3D::BuilderUtils::particle3DContainerVector(const ParticleLayoutItem& layoutI double cumulative_abundance = 0; for (auto* particleItem : layoutItem.particles()) { - Particle3DContainer particle3DContainer; + Particle3DContainer out; if (const auto* pItem = dynamic_cast<ParticleItem*>(particleItem)) { auto particle = pItem->createParticle(); - particle3DContainer = singleParticle3DContainer(*particle, total_abundance, origin); + out = singleParticle3DContainer(*particle, total_abundance, origin); } else if (const auto* coreShellItem = dynamic_cast<CoreAndShellItem*>(particleItem)) { // If there is no CORE or SHELL to populate inside CoreAndShellItem if (!coreShellItem->core() || !coreShellItem->shell()) continue; auto particleCoreShell = coreShellItem->createCoreAndShell(); - particle3DContainer = - particleCoreShell3DContainer(*particleCoreShell, total_abundance, origin); + out = particleCoreShell3DContainer(*particleCoreShell, total_abundance, origin); } else if (const auto* compositionItem = dynamic_cast<CompoundItem*>(particleItem)) { // If there is no particle to populate inside CompoundItem if (!compositionItem->particles().empty()) continue; auto particleComposition = compositionItem->createCompound(); - particle3DContainer = - particleComposition3DContainer(*particleComposition, total_abundance, origin); + out = particleComposition3DContainer(*particleComposition, total_abundance, origin); } else if (const auto* mesocrystalItem = dynamic_cast<MesocrystalItem*>(particleItem)) { // If there is no particle to populate inside MesocrystalItem if (!mesocrystalItem->basisParticle()) continue; - particle3DContainer = - BuilderUtils::mesocrystal3DContainer(*mesocrystalItem, total_abundance, origin); + out = BuilderUtils::mesocrystal3DContainer(*mesocrystalItem, total_abundance, origin); } - cumulative_abundance += particle3DContainer.cumulativeAbundance(); - particle3DContainer.setCumulativeAbundance(cumulative_abundance); + cumulative_abundance += out.cumulativeAbundance(); + out.setCumulativeAbundance(cumulative_abundance); - result.emplace_back(particle3DContainer); + result.emplace_back(out); } return result; @@ -202,23 +199,23 @@ Img3D::BuilderUtils::particleCoreShell3DContainer(const CoreAndShell& particleCo const auto* shellff = getUnderlyingFormFactor(PCS_clone->shellParticle()->formfactor_at_bottom()); - auto coreParticle3D = GUI::View::TransformTo3D::createParticlefromFormfactor(coreff); - auto shellParticle3D = GUI::View::TransformTo3D::createParticlefromFormfactor(shellff); + auto outCore = GUI::View::TransformTo3D::createParticlefromFormfactor(coreff); + auto outShell = GUI::View::TransformTo3D::createParticlefromFormfactor(shellff); // core - applyCoreAndShellTransformations(*PCS_clone->coreParticle(), *coreParticle3D, *PCS_clone, + applyCoreAndShellTransformations(*PCS_clone->coreParticle(), *outCore, *PCS_clone, to_kvector(origin)); - applyParticleColor(*PCS_clone->coreParticle(), *coreParticle3D); + applyParticleColor(*PCS_clone->coreParticle(), *outCore); // shell (set an alpha value of 0.5 for transparency) - applyCoreAndShellTransformations(*PCS_clone->shellParticle(), *shellParticle3D, *PCS_clone, + applyCoreAndShellTransformations(*PCS_clone->shellParticle(), *outShell, *PCS_clone, to_kvector(origin)); - applyParticleColor(*PCS_clone->shellParticle(), *shellParticle3D, 0.5); + applyParticleColor(*PCS_clone->shellParticle(), *outShell, 0.5); Particle3DContainer result; - result.addParticle(coreParticle3D.release(), false); // index 0 - result.addParticle(shellParticle3D.release(), true); // index 1 + result.addParticle(outCore.release(), false); // index 0 + result.addParticle(outShell.release(), true); // index 1 result.setCumulativeAbundance(PCS_clone->abundance() / total_abundance); result.setParticleType("CoreAndShell"); @@ -285,16 +282,15 @@ Img3D::BuilderUtils::mesocrystal3DContainer(const MesocrystalItem& mesocrystalIt const auto* mesocrystal_rotation = M_clone->rotation(); auto mesocrystal_translation = M_clone->particlePosition(); - Particle3DContainer mesocrystalBasis3DContainer; + Particle3DContainer outBasis; if (dynamic_cast<const Compound*>(particleBasis.get())) { const auto* particleComposition = dynamic_cast<const Compound*>(particleBasis.get()); - mesocrystalBasis3DContainer = - particleComposition3DContainer(*particleComposition, 1.0, origin); + outBasis = particleComposition3DContainer(*particleComposition, 1.0, origin); } else if (dynamic_cast<const CoreAndShell*>(particleBasis.get())) { const auto* particleCoreShell = dynamic_cast<const CoreAndShell*>(particleBasis.get()); - mesocrystalBasis3DContainer = particleCoreShell3DContainer(*particleCoreShell, 1.0, origin); + outBasis = particleCoreShell3DContainer(*particleCoreShell, 1.0, origin); } else if (dynamic_cast<const Mesocrystal*>(particleBasis.get())) { // TODO: Implement method to populate Mesocrystal from CORE and NOT from MesocrystalItem @@ -302,7 +298,7 @@ Img3D::BuilderUtils::mesocrystal3DContainer(const MesocrystalItem& mesocrystalIt throw std::runtime_error("Mesocrystal inside mesocrystal is not supported"); } else if (const auto* particle = dynamic_cast<const Particle*>(particleBasis.get())) { - mesocrystalBasis3DContainer = singleParticle3DContainer(*particle, 1.0, origin); + outBasis = singleParticle3DContainer(*particle, 1.0, origin); } else ASSERT(0); @@ -316,8 +312,8 @@ Img3D::BuilderUtils::mesocrystal3DContainer(const MesocrystalItem& mesocrystalIt + k * lattice.basisVectorC(); if (Img3D::Tool::insideForm(outerShapeff.get(), positionInside)) { - for (size_t it = 0; it < mesocrystalBasis3DContainer.containerSize(); ++it) { - auto particle3D = mesocrystalBasis3DContainer.createParticle(it); + for (size_t it = 0; it < outBasis.containerSize(); ++it) { + auto particle3D = outBasis.createParticle(it); particle3D->addTranslation(Img3D::F3fromR3(positionInside)); particle3D->addExtrinsicRotation( @@ -325,8 +321,7 @@ Img3D::BuilderUtils::mesocrystal3DContainer(const MesocrystalItem& mesocrystalIt particle3D->addTranslation(Img3D::F3fromR3(mesocrystal_translation)); - result.addParticle(particle3D.release(), - mesocrystalBasis3DContainer.particle3DBlend(it)); + result.addParticle(particle3D.release(), outBasis.particle3DBlend(it)); } } } -- GitLab From 58f58b8dd119e09e8e1723c40b98e9fa5126ab1d Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 30 Sep 2022 11:36:43 +0200 Subject: [PATCH 09/16] sectioning --- GUI/View/Realspace/RealspaceBuilderUtils.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/GUI/View/Realspace/RealspaceBuilderUtils.cpp b/GUI/View/Realspace/RealspaceBuilderUtils.cpp index ea27cc2f770..7104684ca77 100644 --- a/GUI/View/Realspace/RealspaceBuilderUtils.cpp +++ b/GUI/View/Realspace/RealspaceBuilderUtils.cpp @@ -131,7 +131,6 @@ Img3D::BuilderUtils::particle3DContainerVector(const ParticleLayoutItem& layoutI std::vector<Particle3DContainer> result; double total_abundance = Img3D::Tool::cumulativeAbundances(layoutItem).last(); - double cumulative_abundance = 0; for (auto* particleItem : layoutItem.particles()) { @@ -140,24 +139,29 @@ Img3D::BuilderUtils::particle3DContainerVector(const ParticleLayoutItem& layoutI if (const auto* pItem = dynamic_cast<ParticleItem*>(particleItem)) { auto particle = pItem->createParticle(); out = singleParticle3DContainer(*particle, total_abundance, origin); + } else if (const auto* coreShellItem = dynamic_cast<CoreAndShellItem*>(particleItem)) { // If there is no CORE or SHELL to populate inside CoreAndShellItem if (!coreShellItem->core() || !coreShellItem->shell()) continue; auto particleCoreShell = coreShellItem->createCoreAndShell(); out = particleCoreShell3DContainer(*particleCoreShell, total_abundance, origin); + } else if (const auto* compositionItem = dynamic_cast<CompoundItem*>(particleItem)) { // If there is no particle to populate inside CompoundItem if (!compositionItem->particles().empty()) continue; auto particleComposition = compositionItem->createCompound(); out = particleComposition3DContainer(*particleComposition, total_abundance, origin); + } else if (const auto* mesocrystalItem = dynamic_cast<MesocrystalItem*>(particleItem)) { // If there is no particle to populate inside MesocrystalItem if (!mesocrystalItem->basisParticle()) continue; out = BuilderUtils::mesocrystal3DContainer(*mesocrystalItem, total_abundance, origin); - } + + } else + ASSERT(0); cumulative_abundance += out.cumulativeAbundance(); out.setCumulativeAbundance(cumulative_abundance); -- GitLab From febc55658824c53fc7c634a2bd2ed353905cfeae Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 30 Sep 2022 11:40:58 +0200 Subject: [PATCH 10/16] shorter fct name --- GUI/View/Realspace/RealspaceBuilder.cpp | 4 ++-- GUI/View/Realspace/RealspaceBuilder.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/GUI/View/Realspace/RealspaceBuilder.cpp b/GUI/View/Realspace/RealspaceBuilder.cpp index c1b18af9afa..63e41d5e6cc 100644 --- a/GUI/View/Realspace/RealspaceBuilder.cpp +++ b/GUI/View/Realspace/RealspaceBuilder.cpp @@ -138,7 +138,7 @@ void RealspaceBuilder::populateLayout(Img3D::Model* model, const ParticleLayoutI auto particle3DContainer_vector = m_builderUtils->particle3DContainerVector(layoutItem, origin); const auto latticePositions = generatePositions(layoutItem, layer_size, total_density); - populateParticlesAtLatticePositions(latticePositions, particle3DContainer_vector, model, + populateParticlesInLattice(latticePositions, particle3DContainer_vector, model, sceneGeometry); } @@ -194,7 +194,7 @@ void RealspaceBuilder::populateParticleFromParticle3DContainer( } } -void RealspaceBuilder::populateParticlesAtLatticePositions( +void RealspaceBuilder::populateParticlesInLattice( const std::vector<std::vector<double>>& lattice_positions, const std::vector<Particle3DContainer>& particle3DContainer_vector, Img3D::Model* model, const SceneGeometry& sceneGeometry) const diff --git a/GUI/View/Realspace/RealspaceBuilder.h b/GUI/View/Realspace/RealspaceBuilder.h index b546b26ec90..493325ea29a 100644 --- a/GUI/View/Realspace/RealspaceBuilder.h +++ b/GUI/View/Realspace/RealspaceBuilder.h @@ -64,7 +64,7 @@ private: const Particle3DContainer& particle3DContainer, const Img3D::F3& lattice_position = {}) const; - void populateParticlesAtLatticePositions( + void populateParticlesInLattice( const std::vector<std::vector<double>>& lattice_positions, const std::vector<Particle3DContainer>& particle3DContainer_vector, Img3D::Model* model, const SceneGeometry& sceneGeometry) const; -- GitLab From 819e7972b9cd234445bf8f5273a25a92d16c63a4 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 30 Sep 2022 11:42:08 +0200 Subject: [PATCH 11/16] shorter fct name --- GUI/View/Realspace/RealspaceBuilder.cpp | 4 ++-- GUI/View/Realspace/RealspaceBuilder.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/GUI/View/Realspace/RealspaceBuilder.cpp b/GUI/View/Realspace/RealspaceBuilder.cpp index 63e41d5e6cc..b589dae4026 100644 --- a/GUI/View/Realspace/RealspaceBuilder.cpp +++ b/GUI/View/Realspace/RealspaceBuilder.cpp @@ -91,7 +91,7 @@ void RealspaceBuilder::populate(Img3D::Model* model, ItemForRealspace item, else if (const auto* p = std::get_if<ItemWithParticles*>(&item)) // visualize one generalized particle (simple particle or core/shell or compound or meso..) - populateParticleFromParticleItem(model, **p); + populateParticleFromItem(model, **p); else ASSERT(0); @@ -142,7 +142,7 @@ void RealspaceBuilder::populateLayout(Img3D::Model* model, const ParticleLayoutI sceneGeometry); } -void RealspaceBuilder::populateParticleFromParticleItem(Img3D::Model* model, +void RealspaceBuilder::populateParticleFromItem(Img3D::Model* model, const ItemWithParticles& particleItem) const { Particle3DContainer particle3DContainer; diff --git a/GUI/View/Realspace/RealspaceBuilder.h b/GUI/View/Realspace/RealspaceBuilder.h index 493325ea29a..c49042dec3a 100644 --- a/GUI/View/Realspace/RealspaceBuilder.h +++ b/GUI/View/Realspace/RealspaceBuilder.h @@ -57,7 +57,7 @@ private: void populateLayout(Img3D::Model* model, const ParticleLayoutItem& layoutItem, const SceneGeometry& sceneGeometry, const Img3D::F3& origin = {}) const; - void populateParticleFromParticleItem(Img3D::Model* model, + void populateParticleFromItem(Img3D::Model* model, const ItemWithParticles& particleItem) const; void populateParticleFromParticle3DContainer(Img3D::Model* model, -- GitLab From 5fb4dd9620c36e476e52f027c51fe87db5fd97d1 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 30 Sep 2022 11:44:55 +0200 Subject: [PATCH 12/16] shorter fct name --- GUI/View/Realspace/RealspaceBuilder.cpp | 6 +++--- GUI/View/Realspace/RealspaceBuilder.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/GUI/View/Realspace/RealspaceBuilder.cpp b/GUI/View/Realspace/RealspaceBuilder.cpp index b589dae4026..ede6189e9f5 100644 --- a/GUI/View/Realspace/RealspaceBuilder.cpp +++ b/GUI/View/Realspace/RealspaceBuilder.cpp @@ -176,10 +176,10 @@ void RealspaceBuilder::populateParticleFromItem(Img3D::Model* model, } else ASSERT(0); - populateParticleFromParticle3DContainer(model, particle3DContainer); + translateContainer(model, particle3DContainer); } -void RealspaceBuilder::populateParticleFromParticle3DContainer( +void RealspaceBuilder::translateContainer( Img3D::Model* model, const Particle3DContainer& particle3DContainer, const F3& lattice_position) const { @@ -219,7 +219,7 @@ void RealspaceBuilder::populateParticlesInLattice( if (std::abs(pos_x) <= layer_size - layerBorderWidth && std::abs(pos_y) <= layer_size - layerBorderWidth && std::abs(pos_z) <= layer_thickness) { - populateParticleFromParticle3DContainer( + translateContainer( model, particle3DContainer, Img3D::F3fromR3({position[0], position[1], 0})); } break; diff --git a/GUI/View/Realspace/RealspaceBuilder.h b/GUI/View/Realspace/RealspaceBuilder.h index c49042dec3a..56c05739f77 100644 --- a/GUI/View/Realspace/RealspaceBuilder.h +++ b/GUI/View/Realspace/RealspaceBuilder.h @@ -60,7 +60,7 @@ private: void populateParticleFromItem(Img3D::Model* model, const ItemWithParticles& particleItem) const; - void populateParticleFromParticle3DContainer(Img3D::Model* model, + void translateContainer(Img3D::Model* model, const Particle3DContainer& particle3DContainer, const Img3D::F3& lattice_position = {}) const; -- GitLab From 138f9e00de404e4244eb9dd94f3c760a1c78d8e0 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 30 Sep 2022 12:34:46 +0200 Subject: [PATCH 13/16] generic local var name --- GUI/View/Realspace/RealspaceBuilderUtils.cpp | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/GUI/View/Realspace/RealspaceBuilderUtils.cpp b/GUI/View/Realspace/RealspaceBuilderUtils.cpp index 7104684ca77..839d6366d86 100644 --- a/GUI/View/Realspace/RealspaceBuilderUtils.cpp +++ b/GUI/View/Realspace/RealspaceBuilderUtils.cpp @@ -136,29 +136,29 @@ Img3D::BuilderUtils::particle3DContainerVector(const ParticleLayoutItem& layoutI for (auto* particleItem : layoutItem.particles()) { Particle3DContainer out; - if (const auto* pItem = dynamic_cast<ParticleItem*>(particleItem)) { - auto particle = pItem->createParticle(); + if (const auto* item = dynamic_cast<ParticleItem*>(particleItem)) { + auto particle = item->createParticle(); out = singleParticle3DContainer(*particle, total_abundance, origin); - } else if (const auto* coreShellItem = dynamic_cast<CoreAndShellItem*>(particleItem)) { + } else if (const auto* item = dynamic_cast<CoreAndShellItem*>(particleItem)) { // If there is no CORE or SHELL to populate inside CoreAndShellItem - if (!coreShellItem->core() || !coreShellItem->shell()) + if (!item->core() || !item->shell()) continue; - auto particleCoreShell = coreShellItem->createCoreAndShell(); + auto particleCoreShell = item->createCoreAndShell(); out = particleCoreShell3DContainer(*particleCoreShell, total_abundance, origin); - } else if (const auto* compositionItem = dynamic_cast<CompoundItem*>(particleItem)) { + } else if (const auto* item = dynamic_cast<CompoundItem*>(particleItem)) { // If there is no particle to populate inside CompoundItem - if (!compositionItem->particles().empty()) + if (!item->particles().empty()) continue; - auto particleComposition = compositionItem->createCompound(); + auto particleComposition = item->createCompound(); out = particleComposition3DContainer(*particleComposition, total_abundance, origin); - } else if (const auto* mesocrystalItem = dynamic_cast<MesocrystalItem*>(particleItem)) { + } else if (const auto* item = dynamic_cast<MesocrystalItem*>(particleItem)) { // If there is no particle to populate inside MesocrystalItem - if (!mesocrystalItem->basisParticle()) + if (!item->basisParticle()) continue; - out = BuilderUtils::mesocrystal3DContainer(*mesocrystalItem, total_abundance, origin); + out = BuilderUtils::mesocrystal3DContainer(*item, total_abundance, origin); } else ASSERT(0); -- GitLab From 08a4b8b1260b7dc3cfae8fa7b6effbd3a68c1af7 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 30 Sep 2022 12:37:38 +0200 Subject: [PATCH 14/16] corr logic --- GUI/View/Realspace/RealspaceBuilderUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GUI/View/Realspace/RealspaceBuilderUtils.cpp b/GUI/View/Realspace/RealspaceBuilderUtils.cpp index 839d6366d86..19dfa783d79 100644 --- a/GUI/View/Realspace/RealspaceBuilderUtils.cpp +++ b/GUI/View/Realspace/RealspaceBuilderUtils.cpp @@ -149,7 +149,7 @@ Img3D::BuilderUtils::particle3DContainerVector(const ParticleLayoutItem& layoutI } else if (const auto* item = dynamic_cast<CompoundItem*>(particleItem)) { // If there is no particle to populate inside CompoundItem - if (!item->particles().empty()) + if (item->particles().empty()) continue; auto particleComposition = item->createCompound(); out = particleComposition3DContainer(*particleComposition, total_abundance, origin); -- GitLab From 65539cf9426b34b5ef004cc661f0c29feb4524a6 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 30 Sep 2022 12:37:56 +0200 Subject: [PATCH 15/16] rm comms --- GUI/View/Realspace/RealspaceBuilderUtils.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/GUI/View/Realspace/RealspaceBuilderUtils.cpp b/GUI/View/Realspace/RealspaceBuilderUtils.cpp index 19dfa783d79..6b28eab0444 100644 --- a/GUI/View/Realspace/RealspaceBuilderUtils.cpp +++ b/GUI/View/Realspace/RealspaceBuilderUtils.cpp @@ -141,21 +141,18 @@ Img3D::BuilderUtils::particle3DContainerVector(const ParticleLayoutItem& layoutI out = singleParticle3DContainer(*particle, total_abundance, origin); } else if (const auto* item = dynamic_cast<CoreAndShellItem*>(particleItem)) { - // If there is no CORE or SHELL to populate inside CoreAndShellItem if (!item->core() || !item->shell()) continue; auto particleCoreShell = item->createCoreAndShell(); out = particleCoreShell3DContainer(*particleCoreShell, total_abundance, origin); } else if (const auto* item = dynamic_cast<CompoundItem*>(particleItem)) { - // If there is no particle to populate inside CompoundItem if (item->particles().empty()) continue; auto particleComposition = item->createCompound(); out = particleComposition3DContainer(*particleComposition, total_abundance, origin); } else if (const auto* item = dynamic_cast<MesocrystalItem*>(particleItem)) { - // If there is no particle to populate inside MesocrystalItem if (!item->basisParticle()) continue; out = BuilderUtils::mesocrystal3DContainer(*item, total_abundance, origin); -- GitLab From 007a478d46464f9d0c5778f1145209810d71909a Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 30 Sep 2022 12:42:18 +0200 Subject: [PATCH 16/16] rm deb msgs --- GUI/View/Realspace/RealspaceBuilder.cpp | 6 ------ GUI/View/Realspace/RealspaceBuilderUtils.cpp | 4 ---- 2 files changed, 10 deletions(-) diff --git a/GUI/View/Realspace/RealspaceBuilder.cpp b/GUI/View/Realspace/RealspaceBuilder.cpp index ede6189e9f5..84d0155ddae 100644 --- a/GUI/View/Realspace/RealspaceBuilder.cpp +++ b/GUI/View/Realspace/RealspaceBuilder.cpp @@ -33,7 +33,6 @@ #include "Sample/Aggregate/Interferences.h" #include "Sample/Particle/CoreAndShell.h" #include "Sample/Particle/Particle.h" -#include <iostream> // DEBUG using Img3D::F3; @@ -148,27 +147,22 @@ void RealspaceBuilder::populateParticleFromItem(Img3D::Model* model, Particle3DContainer particle3DContainer; if (const auto* item = dynamic_cast<const ParticleItem*>(&particleItem)) { - std::cout << "DEBUG PP: Particle" << std::endl; auto particle = item->createParticle(); particle3DContainer = m_builderUtils->singleParticle3DContainer(*particle); } else if (const auto* item = dynamic_cast<const CoreAndShellItem*>(&particleItem)) { - std::cout << "DEBUG PP: CoreAndShell" << std::endl; if (!item->core() || !item->shell()) return; auto particleCoreShell = item->createCoreAndShell(); particle3DContainer = m_builderUtils->particleCoreShell3DContainer(*particleCoreShell); } else if (const auto* item = dynamic_cast<const CompoundItem*>(&particleItem)) { - std::cout << "DEBUG PP: Compound" << std::endl; if (item->particles().empty()) return; - std::cout << "DEBUG PP: Compound not empty" << std::endl; auto particleComposition = item->createCompound(); particle3DContainer = m_builderUtils->particleComposition3DContainer(*particleComposition); } else if (const auto* item = dynamic_cast<const MesocrystalItem*>(&particleItem)) { - std::cout << "DEBUG PP: Mesocrystal" << std::endl; if (!item->basisParticle()) return; particle3DContainer = m_builderUtils->mesocrystal3DContainer(*item); diff --git a/GUI/View/Realspace/RealspaceBuilderUtils.cpp b/GUI/View/Realspace/RealspaceBuilderUtils.cpp index 6b28eab0444..7a7d5837c26 100644 --- a/GUI/View/Realspace/RealspaceBuilderUtils.cpp +++ b/GUI/View/Realspace/RealspaceBuilderUtils.cpp @@ -29,7 +29,6 @@ #include "Sample/Particle/IFormFactor.h" #include "Sample/Particle/Mesocrystal.h" #include "Sample/Particle/Particle.h" -#include <iostream> // DEBUG using Img3D::F3; @@ -230,9 +229,6 @@ Img3D::BuilderUtils::particleComposition3DContainer(const Compound& particleComp // clone of the particleComposition std::unique_ptr<Compound> PC_clone(particleComposition.clone()); - std::cout << "DEBUG BEFORE " << particleComposition.decompose().size() << std::endl; - std::cout << "DEBUG AFTER " << PC_clone->decompose().size() << std::endl; - Particle3DContainer result; for (const auto* pc_particle : PC_clone->decompose()) { -- GitLab