diff --git a/Core/Contrib/ParticleLayoutContribution.cpp b/Core/Contrib/ParticleLayoutContribution.cpp index bffeef3b5b72105b37b7e9721b002e3523730343..ce52edf7fff462db6eee15ba22f8cbbeb315892e 100644 --- a/Core/Contrib/ParticleLayoutContribution.cpp +++ b/Core/Contrib/ParticleLayoutContribution.cpp @@ -28,7 +28,7 @@ std::unique_ptr<IInterparticleStrategy> processedInterference(const ProcessedLay const IInterference* iff = re_layout.interferenceFunction(); const std::vector<std::unique_ptr<const CoherentFFSum>>& weighted_formfactors = - re_layout.formFactorList(); + re_layout.formfactorList(); const auto* radial_para = dynamic_cast<const InterferenceRadialParaCrystal*>(iff); if (radial_para) diff --git a/Core/Export/SampleToPython.cpp b/Core/Export/SampleToPython.cpp index 0b7a88d08433c9c71c63de6d6a42b395674639ef..ef06f78babf3d94b117e4da7340cbf02872cf3e8 100644 --- a/Core/Export/SampleToPython.cpp +++ b/Core/Export/SampleToPython.cpp @@ -228,13 +228,13 @@ std::string SampleToPython::defineRoughnesses() const std::string SampleToPython::defineFormFactors() const { - std::vector<const IBornFF*> formFactors = m_objs->objectsOfType<IBornFF>(); - if (formFactors.empty()) + std::vector<const IBornFF*> formfactors = m_objs->objectsOfType<IBornFF>(); + if (formfactors.empty()) return ""; std::ostringstream result; result << "\n" << indent() << "# Define form factors\n"; result << std::setprecision(12); - for (const auto* s : formFactors) { + for (const auto* s : formfactors) { const std::string& key = m_objs->obj2key(s); result << indent() << key << " = ba." << s->pythonConstructor() << "\n"; } diff --git a/GUI/Model/From/FromDomain.cpp b/GUI/Model/From/FromDomain.cpp index df621e0393cd3153cde5a7e0057e6263068c9d40..9ebefee9d343598d6f524b6f153c446fea049e8f 100644 --- a/GUI/Model/From/FromDomain.cpp +++ b/GUI/Model/From/FromDomain.cpp @@ -824,145 +824,145 @@ void GUI::Transform::FromDomain::setInterference(ParticleLayoutItem* layoutItem, void GUI::Transform::FromDomain::setFormFactor(std::variant<ParticleItem*, MesoCrystalItem*> parent, const IBornFF* iFormFactor) { - if (const auto* formFactor = dynamic_cast<const FormFactorAnisoPyramid*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<AnisoPyramidItem>(parent); - formFactorItem->setLength(formFactor->length()); - formFactorItem->setWidth(formFactor->width()); - formFactorItem->setHeight(formFactor->height()); - formFactorItem->setAlpha(Units::rad2deg(formFactor->alpha())); - } else if (const auto* formFactor = dynamic_cast<const FormFactorBarGauss*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<BarGaussItem>(parent); - formFactorItem->setLength(formFactor->length()); - formFactorItem->setWidth(formFactor->width()); - formFactorItem->setHeight(formFactor->height()); - } else if (const auto* formFactor = dynamic_cast<const FormFactorBarLorentz*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<BarLorentzItem>(parent); - formFactorItem->setLength(formFactor->length()); - formFactorItem->setWidth(formFactor->width()); - formFactorItem->setHeight(formFactor->height()); - } else if (const auto* formFactor = dynamic_cast<const FormFactorBox*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<BoxItem>(parent); - formFactorItem->setLength(formFactor->length()); - formFactorItem->setWidth(formFactor->width()); - formFactorItem->setHeight(formFactor->height()); - } else if (const auto* formFactor = dynamic_cast<const FormFactorCone*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<ConeItem>(parent); - formFactorItem->setRadius(formFactor->adius()); - formFactorItem->setHeight(formFactor->height()); - formFactorItem->setAlpha(Units::rad2deg(formFactor->alpha())); - } else if (const auto* formFactor = dynamic_cast<const FormFactorCone6*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<Cone6Item>(parent); - formFactorItem->setBaseEdge(formFactor->baseEdge()); - formFactorItem->setHeight(formFactor->height()); - formFactorItem->setAlpha(Units::rad2deg(formFactor->alpha())); - } else if (const auto* formFactor = dynamic_cast<const FormFactorCuboctahedron*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<CuboctahedronItem>(parent); - formFactorItem->setLength(formFactor->length()); - formFactorItem->setHeight(formFactor->height()); - formFactorItem->setHeightRatio(formFactor->heightRatio()); - formFactorItem->setAlpha(Units::rad2deg(formFactor->alpha())); - } else if (const auto* formFactor = dynamic_cast<const FormFactorCylinder*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<CylinderItem>(parent); - formFactorItem->setRadius(formFactor->adius()); - formFactorItem->setHeight(formFactor->height()); - } else if (const auto* formFactor = dynamic_cast<const FormFactorDodecahedron*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<DodecahedronItem>(parent); - formFactorItem->setEdge(formFactor->edge()); - } else if (const auto* formFactor = + if (const auto* formfactor = dynamic_cast<const FormFactorAnisoPyramid*>(iFormFactor)) { + auto* formfactorItem = addFormFactorItem<AnisoPyramidItem>(parent); + formfactorItem->setLength(formfactor->length()); + formfactorItem->setWidth(formfactor->width()); + formfactorItem->setHeight(formfactor->height()); + formfactorItem->setAlpha(Units::rad2deg(formfactor->alpha())); + } else if (const auto* formfactor = dynamic_cast<const FormFactorBarGauss*>(iFormFactor)) { + auto* formfactorItem = addFormFactorItem<BarGaussItem>(parent); + formfactorItem->setLength(formfactor->length()); + formfactorItem->setWidth(formfactor->width()); + formfactorItem->setHeight(formfactor->height()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorBarLorentz*>(iFormFactor)) { + auto* formfactorItem = addFormFactorItem<BarLorentzItem>(parent); + formfactorItem->setLength(formfactor->length()); + formfactorItem->setWidth(formfactor->width()); + formfactorItem->setHeight(formfactor->height()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorBox*>(iFormFactor)) { + auto* formfactorItem = addFormFactorItem<BoxItem>(parent); + formfactorItem->setLength(formfactor->length()); + formfactorItem->setWidth(formfactor->width()); + formfactorItem->setHeight(formfactor->height()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorCone*>(iFormFactor)) { + auto* formfactorItem = addFormFactorItem<ConeItem>(parent); + formfactorItem->setRadius(formfactor->adius()); + formfactorItem->setHeight(formfactor->height()); + formfactorItem->setAlpha(Units::rad2deg(formfactor->alpha())); + } else if (const auto* formfactor = dynamic_cast<const FormFactorCone6*>(iFormFactor)) { + auto* formfactorItem = addFormFactorItem<Cone6Item>(parent); + formfactorItem->setBaseEdge(formfactor->baseEdge()); + formfactorItem->setHeight(formfactor->height()); + formfactorItem->setAlpha(Units::rad2deg(formfactor->alpha())); + } else if (const auto* formfactor = dynamic_cast<const FormFactorCuboctahedron*>(iFormFactor)) { + auto* formfactorItem = addFormFactorItem<CuboctahedronItem>(parent); + formfactorItem->setLength(formfactor->length()); + formfactorItem->setHeight(formfactor->height()); + formfactorItem->setHeightRatio(formfactor->heightRatio()); + formfactorItem->setAlpha(Units::rad2deg(formfactor->alpha())); + } else if (const auto* formfactor = dynamic_cast<const FormFactorCylinder*>(iFormFactor)) { + auto* formfactorItem = addFormFactorItem<CylinderItem>(parent); + formfactorItem->setRadius(formfactor->adius()); + formfactorItem->setHeight(formfactor->height()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorDodecahedron*>(iFormFactor)) { + auto* formfactorItem = addFormFactorItem<DodecahedronItem>(parent); + formfactorItem->setEdge(formfactor->edge()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorEllipsoidalCylinder*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<EllipsoidalCylinderItem>(parent); - formFactorItem->setRadiusX(formFactor->adiusX()); - formFactorItem->setRadiusY(formFactor->adiusY()); - formFactorItem->setHeight(formFactor->height()); - } else if (const auto* formFactor = dynamic_cast<const FormFactorFullSphere*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<FullSphereItem>(parent); - formFactorItem->setRadius(formFactor->adius()); - } else if (const auto* formFactor = dynamic_cast<const FormFactorFullSpheroid*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<FullSpheroidItem>(parent); - formFactorItem->setRadius(formFactor->adius()); - formFactorItem->setHeight(formFactor->height()); - } else if (const auto* formFactor = dynamic_cast<const FormFactorIcosahedron*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<IcosahedronItem>(parent); - formFactorItem->setEdge(formFactor->edge()); - } else if (const auto* formFactor = dynamic_cast<const FormFactorHemiEllipsoid*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<HemiEllipsoidItem>(parent); - formFactorItem->setRadiusX(formFactor->adiusX()); - formFactorItem->setRadiusY(formFactor->adiusY()); - formFactorItem->setHeight(formFactor->height()); - } else if (const auto* formFactor = dynamic_cast<const FormFactorPrism3*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<Prism3Item>(parent); - formFactorItem->setBaseEdge(formFactor->baseEdge()); - formFactorItem->setHeight(formFactor->height()); - } else if (const auto* formFactor = dynamic_cast<const FormFactorPrism6*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<Prism6Item>(parent); - formFactorItem->setBaseEdge(formFactor->baseEdge()); - formFactorItem->setHeight(formFactor->height()); - } else if (const auto* formFactor = dynamic_cast<const FormFactorPyramid*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<PyramidItem>(parent); - formFactorItem->setBaseEdge(formFactor->baseEdge()); - formFactorItem->setHeight(formFactor->height()); - formFactorItem->setAlpha(Units::rad2deg(formFactor->alpha())); - } else if (const auto* formFactor = + auto* formfactorItem = addFormFactorItem<EllipsoidalCylinderItem>(parent); + formfactorItem->setRadiusX(formfactor->adiusX()); + formfactorItem->setRadiusY(formfactor->adiusY()); + formfactorItem->setHeight(formfactor->height()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorFullSphere*>(iFormFactor)) { + auto* formfactorItem = addFormFactorItem<FullSphereItem>(parent); + formfactorItem->setRadius(formfactor->adius()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorFullSpheroid*>(iFormFactor)) { + auto* formfactorItem = addFormFactorItem<FullSpheroidItem>(parent); + formfactorItem->setRadius(formfactor->adius()); + formfactorItem->setHeight(formfactor->height()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorIcosahedron*>(iFormFactor)) { + auto* formfactorItem = addFormFactorItem<IcosahedronItem>(parent); + formfactorItem->setEdge(formfactor->edge()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorHemiEllipsoid*>(iFormFactor)) { + auto* formfactorItem = addFormFactorItem<HemiEllipsoidItem>(parent); + formfactorItem->setRadiusX(formfactor->adiusX()); + formfactorItem->setRadiusY(formfactor->adiusY()); + formfactorItem->setHeight(formfactor->height()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorPrism3*>(iFormFactor)) { + auto* formfactorItem = addFormFactorItem<Prism3Item>(parent); + formfactorItem->setBaseEdge(formfactor->baseEdge()); + formfactorItem->setHeight(formfactor->height()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorPrism6*>(iFormFactor)) { + auto* formfactorItem = addFormFactorItem<Prism6Item>(parent); + formfactorItem->setBaseEdge(formfactor->baseEdge()); + formfactorItem->setHeight(formfactor->height()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorPyramid*>(iFormFactor)) { + auto* formfactorItem = addFormFactorItem<PyramidItem>(parent); + formfactorItem->setBaseEdge(formfactor->baseEdge()); + formfactorItem->setHeight(formfactor->height()); + formfactorItem->setAlpha(Units::rad2deg(formfactor->alpha())); + } else if (const auto* formfactor = dynamic_cast<const FormFactorCosineRippleBox*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<CosineRippleBoxItem>(parent); - formFactorItem->setLength(formFactor->length()); - formFactorItem->setWidth(formFactor->width()); - formFactorItem->setHeight(formFactor->height()); - } else if (const auto* formFactor = + auto* formfactorItem = addFormFactorItem<CosineRippleBoxItem>(parent); + formfactorItem->setLength(formfactor->length()); + formfactorItem->setWidth(formfactor->width()); + formfactorItem->setHeight(formfactor->height()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorCosineRippleGauss*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<CosineRippleGaussItem>(parent); - formFactorItem->setLength(formFactor->length()); - formFactorItem->setWidth(formFactor->width()); - formFactorItem->setHeight(formFactor->height()); - } else if (const auto* formFactor = + auto* formfactorItem = addFormFactorItem<CosineRippleGaussItem>(parent); + formfactorItem->setLength(formfactor->length()); + formfactorItem->setWidth(formfactor->width()); + formfactorItem->setHeight(formfactor->height()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorCosineRippleLorentz*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<CosineRippleLorentzItem>(parent); - formFactorItem->setLength(formFactor->length()); - formFactorItem->setWidth(formFactor->width()); - formFactorItem->setHeight(formFactor->height()); - } else if (const auto* formFactor = + auto* formfactorItem = addFormFactorItem<CosineRippleLorentzItem>(parent); + formfactorItem->setLength(formfactor->length()); + formfactorItem->setWidth(formfactor->width()); + formfactorItem->setHeight(formfactor->height()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorSawtoothRippleBox*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<SawtoothRippleBoxItem>(parent); - formFactorItem->setLength(formFactor->length()); - formFactorItem->setWidth(formFactor->width()); - formFactorItem->setHeight(formFactor->height()); - formFactorItem->setAsymmetry(formFactor->asymmetry()); - } else if (const auto* formFactor = + auto* formfactorItem = addFormFactorItem<SawtoothRippleBoxItem>(parent); + formfactorItem->setLength(formfactor->length()); + formfactorItem->setWidth(formfactor->width()); + formfactorItem->setHeight(formfactor->height()); + formfactorItem->setAsymmetry(formfactor->asymmetry()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorSawtoothRippleGauss*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<SawtoothRippleGaussItem>(parent); - formFactorItem->setLength(formFactor->length()); - formFactorItem->setWidth(formFactor->width()); - formFactorItem->setHeight(formFactor->height()); - formFactorItem->setAsymmetry(formFactor->asymmetry()); - } else if (const auto* formFactor = + auto* formfactorItem = addFormFactorItem<SawtoothRippleGaussItem>(parent); + formfactorItem->setLength(formfactor->length()); + formfactorItem->setWidth(formfactor->width()); + formfactorItem->setHeight(formfactor->height()); + formfactorItem->setAsymmetry(formfactor->asymmetry()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorSawtoothRippleLorentz*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<SawtoothRippleLorentzItem>(parent); - formFactorItem->setLength(formFactor->length()); - formFactorItem->setWidth(formFactor->width()); - formFactorItem->setHeight(formFactor->height()); - formFactorItem->setAsymmetry(formFactor->asymmetry()); - } else if (const auto* formFactor = dynamic_cast<const FormFactorTetrahedron*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<TetrahedronItem>(parent); - formFactorItem->setBaseEdge(formFactor->baseEdge()); - formFactorItem->setHeight(formFactor->height()); - formFactorItem->setAlpha(Units::rad2deg(formFactor->alpha())); - } else if (const auto* formFactor = dynamic_cast<const FormFactorTruncatedCube*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<TruncatedCubeItem>(parent); - formFactorItem->setLength(formFactor->length()); - formFactorItem->setRemovedLength(formFactor->removedLength()); - } else if (const auto* formFactor = + auto* formfactorItem = addFormFactorItem<SawtoothRippleLorentzItem>(parent); + formfactorItem->setLength(formfactor->length()); + formfactorItem->setWidth(formfactor->width()); + formfactorItem->setHeight(formfactor->height()); + formfactorItem->setAsymmetry(formfactor->asymmetry()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorTetrahedron*>(iFormFactor)) { + auto* formfactorItem = addFormFactorItem<TetrahedronItem>(parent); + formfactorItem->setBaseEdge(formfactor->baseEdge()); + formfactorItem->setHeight(formfactor->height()); + formfactorItem->setAlpha(Units::rad2deg(formfactor->alpha())); + } else if (const auto* formfactor = dynamic_cast<const FormFactorTruncatedCube*>(iFormFactor)) { + auto* formfactorItem = addFormFactorItem<TruncatedCubeItem>(parent); + formfactorItem->setLength(formfactor->length()); + formfactorItem->setRemovedLength(formfactor->removedLength()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorTruncatedSphere*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<TruncatedSphereItem>(parent); - formFactorItem->setRadius(formFactor->adius()); - formFactorItem->setHeight(formFactor->height()); - formFactorItem->setRemovedTop(formFactor->removedTop()); - } else if (const auto* formFactor = + auto* formfactorItem = addFormFactorItem<TruncatedSphereItem>(parent); + formfactorItem->setRadius(formfactor->adius()); + formfactorItem->setHeight(formfactor->height()); + formfactorItem->setRemovedTop(formfactor->removedTop()); + } else if (const auto* formfactor = dynamic_cast<const FormFactorTruncatedSpheroid*>(iFormFactor)) { - auto* formFactorItem = addFormFactorItem<TruncatedSpheroidItem>(parent); - formFactorItem->setRadius(formFactor->adius()); - formFactorItem->setHeight(formFactor->height()); - formFactorItem->setHeightFlattening(formFactor->heightFlattening()); - formFactorItem->setRemovedTop(formFactor->removedTop()); + auto* formfactorItem = addFormFactorItem<TruncatedSpheroidItem>(parent); + formfactorItem->setRadius(formfactor->adius()); + formfactorItem->setHeight(formfactor->height()); + formfactorItem->setHeightFlattening(formfactor->heightFlattening()); + formfactorItem->setRemovedTop(formfactor->removedTop()); } else ASSERT(false); } diff --git a/GUI/Model/From/GUISampleBuilder.cpp b/GUI/Model/From/GUISampleBuilder.cpp index a5337ce78329b1bd01ed3fc3bc5d51020b1ac326..a15652c4cdac841861c87fa5c849acfa73cab6b7 100644 --- a/GUI/Model/From/GUISampleBuilder.cpp +++ b/GUI/Model/From/GUISampleBuilder.cpp @@ -116,7 +116,7 @@ void GUISampleBuilder::copyParticle(ParticleItem* particleItem, const Particle* particleItem->setPosition(particle->particlePosition()); particleItem->setMaterial(createMaterialFromDomain(particle->material())); FromDomain::setRotation(particleItem, particle->rotation()); - FromDomain::setFormFactor(particleItem, particle->formFactor()); + FromDomain::setFormFactor(particleItem, particle->formfactor()); } void GUISampleBuilder::copyParticle(const IParticle* iparticle, diff --git a/GUI/Model/Group/ItemCatalog.cpp b/GUI/Model/Group/ItemCatalog.cpp index 3aa73386c54deffd57cd3c90e1b24fbdaca415a0..7a5f9506e7e15b48a8e596423a35d775e0b77e6c 100644 --- a/GUI/Model/Group/ItemCatalog.cpp +++ b/GUI/Model/Group/ItemCatalog.cpp @@ -355,7 +355,7 @@ QStringList ItemCatalog::validTopItemTypes() InterferenceRadialParaCrystalItem::M_TYPE}; } -QStringList ItemCatalog::formFactorHardParticleTypes() +QStringList ItemCatalog::formfactorHardParticleTypes() { return {AnisoPyramidItem::M_TYPE, BoxItem::M_TYPE, @@ -378,7 +378,7 @@ QStringList ItemCatalog::formFactorHardParticleTypes() TruncatedSpheroidItem::M_TYPE}; } -QStringList ItemCatalog::formFactorRippleTypes() +QStringList ItemCatalog::formfactorRippleTypes() { return {BoxItem::M_TYPE, BarGaussItem::M_TYPE, @@ -391,7 +391,7 @@ QStringList ItemCatalog::formFactorRippleTypes() SawtoothRippleLorentzItem::M_TYPE}; } -QStringList ItemCatalog::formFactorTypes() +QStringList ItemCatalog::formfactorTypes() { // Fill own list instead of just concatenating the above ones, because the sort order differs return {AnisoPyramidItem::M_TYPE, @@ -438,8 +438,8 @@ QStringList ItemCatalog::particleAssemblyTypes() bool ItemCatalog::isFormFactorModelType(const QString& modeltype) { - return formFactorHardParticleTypes().indexOf(modeltype) != -1 - || formFactorRippleTypes().indexOf(modeltype) != -1; + return formfactorHardParticleTypes().indexOf(modeltype) != -1 + || formfactorRippleTypes().indexOf(modeltype) != -1; } ItemCatalog::UiInfo ItemCatalog::uiInfo(const QString& modelType) const diff --git a/GUI/Model/Group/ItemCatalog.h b/GUI/Model/Group/ItemCatalog.h index 75ad0ceb8d057372de3acc8dfb6068a04ffc16b6..f8d11a4c0d132512ef3afd43f56ddae2fd786aea 100644 --- a/GUI/Model/Group/ItemCatalog.h +++ b/GUI/Model/Group/ItemCatalog.h @@ -39,9 +39,9 @@ public: std::unique_ptr<SessionItem> createItemPtr(const QString& modelType) const; static QStringList validTopItemTypes(); - static QStringList formFactorHardParticleTypes(); - static QStringList formFactorRippleTypes(); - static QStringList formFactorTypes(); + static QStringList formfactorHardParticleTypes(); + static QStringList formfactorRippleTypes(); + static QStringList formfactorTypes(); static QStringList interferenceFunctionTypes(); static QStringList particleAssemblyTypes(); diff --git a/GUI/Model/Sample/FormFactorItems.cpp b/GUI/Model/Sample/FormFactorItems.cpp index 332bde03bff49d9c56ab9bc7670646bffa442f3c..a1df5b34d416d482a1fa8c267773d46e1021fb2d 100644 --- a/GUI/Model/Sample/FormFactorItems.cpp +++ b/GUI/Model/Sample/FormFactorItems.cpp @@ -1339,7 +1339,7 @@ void TruncatedSpheroidItem::setRemovedTop(const double removed_top) /* ------------------------------------------------ */ -GroupInfo formFactorGroupInfo() +GroupInfo formfactorGroupInfo() { - return GroupInfo(ItemCatalog::formFactorTypes(), CylinderItem::M_TYPE); + return GroupInfo(ItemCatalog::formfactorTypes(), CylinderItem::M_TYPE); } diff --git a/GUI/Model/Sample/FormFactorItems.h b/GUI/Model/Sample/FormFactorItems.h index 37c870048fb58ff4e7ff4172a5fca34c55e7a6e0..18920df50e0094fb07c33ce257d605db202c13fe 100644 --- a/GUI/Model/Sample/FormFactorItems.h +++ b/GUI/Model/Sample/FormFactorItems.h @@ -658,6 +658,6 @@ public: }; /// get a group info containing all form factors -GroupInfo formFactorGroupInfo(); +GroupInfo formfactorGroupInfo(); #endif // BORNAGAIN_GUI_MODEL_SAMPLE_FORMFACTORITEMS_H diff --git a/GUI/Model/Sample/MesoCrystalItem.cpp b/GUI/Model/Sample/MesoCrystalItem.cpp index 4198015778b632ae4bd5e59398b89cdae78021f0..822bd2ee868b0640ce14b11a33b95ad0bc9afb2d 100644 --- a/GUI/Model/Sample/MesoCrystalItem.cpp +++ b/GUI/Model/Sample/MesoCrystalItem.cpp @@ -49,7 +49,7 @@ const QString density_tooltip = MesoCrystalItem::MesoCrystalItem() : SessionItem(M_TYPE), ItemWithParticles(M_TYPE, abundance_tooltip, position_tooltip) { - addGroupProperty(P_OUTER_SHAPE, formFactorGroupInfo()); + addGroupProperty(P_OUTER_SHAPE, formfactorGroupInfo()); addProperty<VectorItem>(P_VECTOR_A)->setToolTip(lattice_vector1_tooltip); addProperty<VectorItem>(P_VECTOR_B)->setToolTip(lattice_vector2_tooltip); diff --git a/GUI/Model/Sample/ParticleItem.cpp b/GUI/Model/Sample/ParticleItem.cpp index cd770d9a5b5c5331a3bb5c45e42abc744d084a87..8592d033aee861d0eb4da7067722497b7e0bb755 100644 --- a/GUI/Model/Sample/ParticleItem.cpp +++ b/GUI/Model/Sample/ParticleItem.cpp @@ -39,7 +39,7 @@ ParticleItem::ParticleItem() , ItemWithMaterial(M_TYPE) , ItemWithParticles(M_TYPE, abundance_tooltip, position_tooltip) { - addGroupProperty(P_FORM_FACTOR, formFactorGroupInfo()); + addGroupProperty(P_FORM_FACTOR, formfactorGroupInfo()); setDefaultTagTransformation(); } @@ -62,12 +62,12 @@ void ParticleItem::setFormFactor(const QString& model_type) setGroupProperty(P_FORM_FACTOR, model_type); } -FormFactorItem* ParticleItem::formFactor() const +FormFactorItem* ParticleItem::formfactor() const { return dynamic_cast<FormFactorItem*>(getGroupItem(P_FORM_FACTOR)); } -GroupItem* ParticleItem::formFactorItem() const +GroupItem* ParticleItem::formfactorItem() const { return item<GroupItem>(P_FORM_FACTOR); } diff --git a/GUI/Model/Sample/ParticleItem.h b/GUI/Model/Sample/ParticleItem.h index b8d21d3f68078a8635061ad3dbefb39132d1fab2..0d1b4882dfb5c142a854d0da087c07064cdbd382 100644 --- a/GUI/Model/Sample/ParticleItem.h +++ b/GUI/Model/Sample/ParticleItem.h @@ -36,8 +36,8 @@ public: template <typename T> T* setFormFactorType(); void setFormFactor(const QString& model_type); - FormFactorItem* formFactor() const; - GroupItem* formFactorItem() const; + FormFactorItem* formfactor() const; + GroupItem* formfactorItem() const; QVector<ItemWithParticles*> containedItemsWithParticles() const override; }; diff --git a/GUI/View/Realspace/RealSpaceBuilderUtils.cpp b/GUI/View/Realspace/RealSpaceBuilderUtils.cpp index 663d2d6d2d4f340f63b17513ccba99ad01bc6f94..ec5cef443e4293b92513fb929722dfc448b5eb71 100644 --- a/GUI/View/Realspace/RealSpaceBuilderUtils.cpp +++ b/GUI/View/Realspace/RealSpaceBuilderUtils.cpp @@ -261,7 +261,7 @@ Particle3DContainer GUI::RealSpace::BuilderUtils::singleParticle3DContainer( { std::unique_ptr<Particle> P_clone(particle.clone()); // clone of the particle - const IBornFF* ff = getUnderlyingFormFactor(P_clone->formFactor()); + const IBornFF* ff = getUnderlyingFormFactor(P_clone->formfactor()); auto particle3D = GUI::View::TransformTo3D::createParticlefromFormfactor(ff); applyParticleTransformations(*P_clone, *particle3D, to_kvector(origin)); @@ -282,9 +282,9 @@ Particle3DContainer GUI::RealSpace::BuilderUtils::particleCoreShell3DContainer( std::unique_ptr<ParticleCoreShell> PCS_clone(particleCoreShell.clone()); std::unique_ptr<const IBornFF> coreParticleff( - PCS_clone->coreParticle()->formFactor()); + PCS_clone->coreParticle()->formfactor()); std::unique_ptr<const IBornFF> shellParticleff( - PCS_clone->shellParticle()->formFactor()); + PCS_clone->shellParticle()->formfactor()); const auto* coreff = getUnderlyingFormFactor(coreParticleff.get()); const auto* shellff = getUnderlyingFormFactor(shellParticleff.get()); diff --git a/GUI/View/SampleDesigner/LayerEditorUtils.cpp b/GUI/View/SampleDesigner/LayerEditorUtils.cpp index d69403b7d25ec398d882a85b25c7be375a51faf5..e1109bda3471e63ecb34479deb62d4750a11166a 100644 --- a/GUI/View/SampleDesigner/LayerEditorUtils.cpp +++ b/GUI/View/SampleDesigner/LayerEditorUtils.cpp @@ -235,11 +235,11 @@ QPushButton* LayerEditorUtils::createAddParticleButton(QWidget* parentWidget, }; group("Hard particles"); - for (const auto& modelType : ItemCatalog::formFactorHardParticleTypes()) + for (const auto& modelType : ItemCatalog::formfactorHardParticleTypes()) entry(modelType); group("Ripples"); - for (const auto& modelType : ItemCatalog::formFactorRippleTypes()) + for (const auto& modelType : ItemCatalog::formfactorRippleTypes()) entry(modelType); group("Particle assemblies"); diff --git a/GUI/View/SampleDesigner/MesoCrystalForm.cpp b/GUI/View/SampleDesigner/MesoCrystalForm.cpp index 8ba8249ad8da53090bbb7df80c722d6116d79f8d..17a0bf19fb4d47578e5d39600e6890ac8d83c75e 100644 --- a/GUI/View/SampleDesigner/MesoCrystalForm.cpp +++ b/GUI/View/SampleDesigner/MesoCrystalForm.cpp @@ -66,8 +66,8 @@ QComboBox* MesoCrystalForm::createBasisCombo(QWidget* parent, ItemWithParticles* WheelEventEater::install(combo); combo->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); - const auto modelTypes = ItemCatalog::formFactorHardParticleTypes() - + ItemCatalog::formFactorRippleTypes() + const auto modelTypes = ItemCatalog::formfactorHardParticleTypes() + + ItemCatalog::formfactorRippleTypes() + ItemCatalog::particleAssemblyTypes(); combo->addItem("None", ""); @@ -81,7 +81,7 @@ QComboBox* MesoCrystalForm::createBasisCombo(QWidget* parent, ItemWithParticles* if (current == nullptr) combo->setCurrentIndex(0); else if (auto* p = dynamic_cast<ParticleItem*>(current)) - combo->setCurrentIndex(combo->findData(p->formFactor()->modelType())); + combo->setCurrentIndex(combo->findData(p->formfactor()->modelType())); else combo->setCurrentIndex(combo->findData(current->modelType())); diff --git a/GUI/View/SampleDesigner/ParticleCoreShellForm.cpp b/GUI/View/SampleDesigner/ParticleCoreShellForm.cpp index 0b17c1a9325101725fa53199993539a264c87aa3..dbf1012010f73ef428b0f81a3d354c4be8cb0ac2 100644 --- a/GUI/View/SampleDesigner/ParticleCoreShellForm.cpp +++ b/GUI/View/SampleDesigner/ParticleCoreShellForm.cpp @@ -36,7 +36,7 @@ QComboBox* createFormFactorCombo(QWidget* parent, FormFactorItem* current) combo->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); combo->addItem(QIcon(), "None", ""); - for (const auto& modelType : ItemCatalog::formFactorTypes()) { + for (const auto& modelType : ItemCatalog::formfactorTypes()) { const auto ui = ItemCatalog::instance().uiInfo(modelType); combo->addItem(QIcon(ui.iconPath), ui.menuEntry, modelType); } @@ -71,11 +71,11 @@ ParticleCoreShellForm::ParticleCoreShellForm(QWidget* parent, ParticleCoreShellI core.layouter = std::make_unique<FormLayouter>(coreParticleGroup, ec); - core.formFactorCombo = createFormFactorCombo( - coreParticleGroup, item->core() != nullptr ? item->core()->formFactor() : nullptr); - connect(core.formFactorCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, + core.formfactorCombo = createFormFactorCombo( + coreParticleGroup, item->core() != nullptr ? item->core()->formfactor() : nullptr); + connect(core.formfactorCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ParticleCoreShellForm::onCoreComboChanged); - core.layouter->addRow("Form factor:", core.formFactorCombo); + core.layouter->addRow("Form factor:", core.formfactorCombo); core.collapser = GroupBoxCollapser::installIntoGroupBox(coreParticleGroup); auto* showInRealSpaceAction = @@ -94,11 +94,11 @@ ParticleCoreShellForm::ParticleCoreShellForm(QWidget* parent, ParticleCoreShellI auto* shellParticleGroup = new QGroupBox(this); shellParticleGroup->setObjectName("Particle"); shell.layouter = std::make_unique<FormLayouter>(shellParticleGroup, ec); - shell.formFactorCombo = createFormFactorCombo( - shellParticleGroup, item->shell() != nullptr ? item->shell()->formFactor() : nullptr); - connect(shell.formFactorCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, + shell.formfactorCombo = createFormFactorCombo( + shellParticleGroup, item->shell() != nullptr ? item->shell()->formfactor() : nullptr); + connect(shell.formfactorCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ParticleCoreShellForm::onShellComboChanged); - shell.layouter->addRow("Form factor:", shell.formFactorCombo); + shell.layouter->addRow("Form factor:", shell.formfactorCombo); shell.collapser = GroupBoxCollapser::installIntoGroupBox(shellParticleGroup); auto* showInRealSpaceAction = @@ -131,7 +131,7 @@ void ParticleCoreShellForm::onCoreComboChanged() while (core.layouter->layout()->rowCount() > 1) core.layouter->layout()->removeRow(1); - const QString newClassName = core.formFactorCombo->currentData().toString(); + const QString newClassName = core.formfactorCombo->currentData().toString(); m_ec->setCoreFormFactor(this, newClassName); } @@ -140,7 +140,7 @@ void ParticleCoreShellForm::onShellComboChanged() while (shell.layouter->layout()->rowCount() > 1) shell.layouter->layout()->removeRow(1); - const QString newClassName = shell.formFactorCombo->currentData().toString(); + const QString newClassName = shell.formfactorCombo->currentData().toString(); m_ec->setShellFormFactor(this, newClassName); } @@ -161,12 +161,12 @@ void ParticleCoreShellForm::createCoreWidgets() QString groupTitle = "Core"; if (ParticleItem* particle = m_item->core()) { - const QString formFactor = - particle->formFactorItem()->value().value<ComboProperty>().getValue(); + const QString formfactor = + particle->formfactorItem()->value().value<ComboProperty>().getValue(); - groupTitle += " (" + formFactor + ")"; + groupTitle += " (" + formfactor + ")"; - core.layouter->addGroupOfValues("Geometry", particle->formFactor()->geometryValues()); + core.layouter->addGroupOfValues("Geometry", particle->formfactor()->geometryValues()); core.layouter->addVector(particle->positionVector(), false); core.layouter->addSelection(particle->rotationMethod()); // no abundance since this is handled in CoreShell itself! @@ -180,12 +180,12 @@ void ParticleCoreShellForm::createShellWidgets() QString groupTitle = "Shell"; if (ParticleItem* particle = m_item->shell()) { - const QString formFactor = - particle->formFactorItem()->value().value<ComboProperty>().getValue(); + const QString formfactor = + particle->formfactorItem()->value().value<ComboProperty>().getValue(); - groupTitle += " (" + formFactor + ")"; + groupTitle += " (" + formfactor + ")"; - shell.layouter->addGroupOfValues("Geometry", particle->formFactor()->geometryValues()); + shell.layouter->addGroupOfValues("Geometry", particle->formfactor()->geometryValues()); shell.layouter->addSelection(particle->rotationMethod()); // no position vector - not allowed in CoreShell // no abundance since this is handled in CoreShell itself! diff --git a/GUI/View/SampleDesigner/ParticleCoreShellForm.h b/GUI/View/SampleDesigner/ParticleCoreShellForm.h index 5df4fc9600de230d113623c72b407bc08f5405af..bbb5619da9f40470fb4e5f4049c2e1193790926b 100644 --- a/GUI/View/SampleDesigner/ParticleCoreShellForm.h +++ b/GUI/View/SampleDesigner/ParticleCoreShellForm.h @@ -50,7 +50,7 @@ private: SampleEditorController* m_ec; struct Location { std::unique_ptr<FormLayouter> layouter; - QComboBox* formFactorCombo = nullptr; + QComboBox* formfactorCombo = nullptr; GroupBoxCollapser* collapser = nullptr; }; Location core; diff --git a/GUI/View/SampleDesigner/ParticleForm.cpp b/GUI/View/SampleDesigner/ParticleForm.cpp index 4b836e3d92b8e140258ddc73d7c75c0d77653826..367c724d3c39ddc37a1e855fe36ecfdc9f2f604d 100644 --- a/GUI/View/SampleDesigner/ParticleForm.cpp +++ b/GUI/View/SampleDesigner/ParticleForm.cpp @@ -27,13 +27,13 @@ ParticleForm::ParticleForm(QWidget* parent, ParticleItem* particleItem, bool all SampleEditorController* ec, bool allowRemove) : QGroupBox(parent) { - const QString formFactor = - particleItem->formFactorItem()->value().value<ComboProperty>().getValue(); - setTitle("Particle (" + formFactor + ")"); + const QString formfactor = + particleItem->formfactorItem()->value().value<ComboProperty>().getValue(); + setTitle("Particle (" + formfactor + ")"); FormLayouter layouter(this, ec); layouter.addRow("Material", new MaterialInplaceForm(this, particleItem, ec)); - layouter.addGroupOfValues("Geometry", particleItem->formFactor()->geometryValues()); + layouter.addGroupOfValues("Geometry", particleItem->formfactor()->geometryValues()); layouter.addVector(particleItem->positionVector(), false); layouter.addSelection(particleItem->rotationMethod()); if (allowAbundance) diff --git a/GUI/View/SampleDesigner/SampleEditorController.cpp b/GUI/View/SampleDesigner/SampleEditorController.cpp index 496a60a76c27968516fcaca900e55af31671cb54..cd5b6ee3f10a39e71286efccbe6e68fba5a131d9 100644 --- a/GUI/View/SampleDesigner/SampleEditorController.cpp +++ b/GUI/View/SampleDesigner/SampleEditorController.cpp @@ -198,11 +198,11 @@ void SampleEditorController::addParticle(ParticleCompositionItem* compositionIte } void SampleEditorController::setCoreFormFactor(ParticleCoreShellForm* widget, - const QString& formFactorModelType) + const QString& formfactorModelType) { auto* particleCoreShell = widget->coreShellItem(); - if (formFactorModelType.isEmpty()) { + if (formfactorModelType.isEmpty()) { particleCoreShell->clearCore(); return; } @@ -210,18 +210,18 @@ void SampleEditorController::setCoreFormFactor(ParticleCoreShellForm* widget, if (particleCoreShell->core() == nullptr) particleCoreShell->createCore(materialModel()); - particleCoreShell->core()->setFormFactor(formFactorModelType); + particleCoreShell->core()->setFormFactor(formfactorModelType); widget->createCoreWidgets(); m_multiLayerForm->updateUnits(); emit modified(); } void SampleEditorController::setShellFormFactor(ParticleCoreShellForm* widget, - const QString& formFactorModelType) + const QString& formfactorModelType) { auto* particleCoreShell = widget->coreShellItem(); - if (formFactorModelType.isEmpty()) { + if (formfactorModelType.isEmpty()) { particleCoreShell->clearShell(); return; } @@ -229,7 +229,7 @@ void SampleEditorController::setShellFormFactor(ParticleCoreShellForm* widget, if (particleCoreShell->shell() == nullptr) particleCoreShell->createShell(materialModel()); - particleCoreShell->shell()->setFormFactor(formFactorModelType); + particleCoreShell->shell()->setFormFactor(formfactorModelType); widget->createShellWidgets(); m_multiLayerForm->updateUnits(); emit modified(); diff --git a/GUI/View/SampleDesigner/SampleEditorController.h b/GUI/View/SampleDesigner/SampleEditorController.h index c97dc651eb5da22da859eac49059b7fe1c405b3a..9e686ba1ae51d7d934e5d209794b061dc5149383 100644 --- a/GUI/View/SampleDesigner/SampleEditorController.h +++ b/GUI/View/SampleDesigner/SampleEditorController.h @@ -78,8 +78,8 @@ public: void addParticle(ParticleLayoutItem* layout, const QString& classname); void addParticle(ParticleCompositionItem* composition, const QString& classname); - void setCoreFormFactor(ParticleCoreShellForm* widget, const QString& formFactorModelType); - void setShellFormFactor(ParticleCoreShellForm* widget, const QString& formFactorModelType); + void setCoreFormFactor(ParticleCoreShellForm* widget, const QString& formfactorModelType); + void setShellFormFactor(ParticleCoreShellForm* widget, const QString& formfactorModelType); void removeParticle(ItemWithParticles* item); void setMesoCrystalBasis(MesoCrystalForm* widget, const QString& classname); void selectInterference(InterferenceForm* widget, int newIndex); diff --git a/Resample/Particle/ParticleInSlice.h b/Resample/Particle/ParticleInSlice.h index f0a1d1df7e4609ae3b349a85fd06f21f89da405d..ef21a3baaac44673bee1ab1dc0909bc099e7dc43 100644 --- a/Resample/Particle/ParticleInSlice.h +++ b/Resample/Particle/ParticleInSlice.h @@ -20,8 +20,8 @@ #ifndef BORNAGAIN_RESAMPLE_PARTICLE_PARTICLEINSLICE_H #define BORNAGAIN_RESAMPLE_PARTICLE_PARTICLEINSLICE_H -#include "Sample/Material/Admixtures.h" #include "Resample/Particle/IReParticle.h" +#include "Sample/Material/Admixtures.h" #include <memory> //! Struct that contains information on a sliced particle. diff --git a/Resample/Particle/ReCoreShell.cpp b/Resample/Particle/ReCoreShell.cpp index 95c93ec115048cd521eb69501c5174800ea3cbe1..a48bbfbf50e9b813694291232b525e132b6643db 100644 --- a/Resample/Particle/ReCoreShell.cpp +++ b/Resample/Particle/ReCoreShell.cpp @@ -15,10 +15,7 @@ #include "Resample/Particle/ReCoreShell.h" #include "Base/Vector/WavevectorInfo.h" // debug -ReCoreShell::ReCoreShell(IReParticle* core, IReParticle* shell) - : m_core(core), m_shell(shell) -{ -} +ReCoreShell::ReCoreShell(IReParticle* core, IReParticle* shell) : m_core(core), m_shell(shell) {} ReCoreShell::~ReCoreShell() = default; diff --git a/Resample/Particle/ReMesocrystal.cpp b/Resample/Particle/ReMesocrystal.cpp index 27867539a7c1cacaa246e7c475e72dcf96ecc7b1..2d05bc1399b7c2bceaee25a7fb5a84ebce10d74b 100644 --- a/Resample/Particle/ReMesocrystal.cpp +++ b/Resample/Particle/ReMesocrystal.cpp @@ -17,7 +17,7 @@ #include "Base/Vector/WavevectorInfo.h" ReMesocrystal::ReMesocrystal(const Lattice3D& lattice, const IReParticle& basis_formfactor, - const IReParticle& meso_formfactor, double position_variance) + const IReParticle& meso_formfactor, double position_variance) : m_lattice(lattice) , m_basis_formfactor(basis_formfactor.clone()) , m_meso_formfactor(meso_formfactor.clone()) diff --git a/Resample/Particle/ReMesocrystal.h b/Resample/Particle/ReMesocrystal.h index 357a46ee582db7e17465b60dff7f3eb9023e367f..d7defbc35040f3cefabae1ca3d8ec15768aa75dc 100644 --- a/Resample/Particle/ReMesocrystal.h +++ b/Resample/Particle/ReMesocrystal.h @@ -15,8 +15,8 @@ #ifndef BORNAGAIN_RESAMPLE_PARTICLE_REMESOCRYSTAL_H #define BORNAGAIN_RESAMPLE_PARTICLE_REMESOCRYSTAL_H -#include "Sample/Lattice/Lattice3D.h" #include "Resample/Particle/IReParticle.h" +#include "Sample/Lattice/Lattice3D.h" //! The form factor of a MesoCrystal. //! @ingroup formfactors @@ -24,13 +24,13 @@ class ReMesocrystal : public IReParticle { public: ReMesocrystal(const Lattice3D& lattice, const IReParticle& basis_formfactor, - const IReParticle& meso_formfactor, double position_variance = 0.0); + const IReParticle& meso_formfactor, double position_variance = 0.0); ~ReMesocrystal() override; ReMesocrystal* clone() const override { return new ReMesocrystal(m_lattice, *m_basis_formfactor, *m_meso_formfactor, - m_position_variance); + m_position_variance); } void setAmbientMaterial(const Material& material) override diff --git a/Resample/Particle/ReParticle.cpp b/Resample/Particle/ReParticle.cpp index 409d10ecb3b43481fc66b20b5901facddfd926f9..2e58363b24d96f58b44ab0c2fe075363476987ab 100644 --- a/Resample/Particle/ReParticle.cpp +++ b/Resample/Particle/ReParticle.cpp @@ -21,7 +21,7 @@ #include "Sample/Scattering/Rotations.h" ReParticle::ReParticle(IBornFF* ff, const Material* material, const Material* ambient_material, - const R3* position, const RotMatrix* rotMatrix) + const R3* position, const RotMatrix* rotMatrix) : m_ff(std::move(ff)) , m_material(std::move(material)) , m_ambient_material(std::move(ambient_material)) @@ -40,14 +40,14 @@ ReParticle::~ReParticle() = default; ReParticle* ReParticle::clone() const { return new ReParticle(m_ff->clone(), m_material ? new Material(*m_material) : nullptr, - m_ambient_material ? new Material(*m_ambient_material) : nullptr, - m_position ? new R3(*m_position) : nullptr, - m_rotMatrix ? new RotMatrix(*m_rotMatrix) : nullptr); + m_ambient_material ? new Material(*m_ambient_material) : nullptr, + m_position ? new R3(*m_position) : nullptr, + m_rotMatrix ? new RotMatrix(*m_rotMatrix) : nullptr); } -ReParticle* ReParticle::createTransformedFormFactor(const IBornFF& formfactor, - const IRotation* rot, R3 translation) +ReParticle* ReParticle::createTransformedFormFactor(const IBornFF& formfactor, const IRotation* rot, + R3 translation) { auto* result = new ReParticle(formfactor); if (rot && !rot->isIdentity()) diff --git a/Resample/Particle/ReParticle.h b/Resample/Particle/ReParticle.h index 1227b1e4b2ce87eb4e68cb580888562127eee4ca..12843f63840903fb1ab2c6f2fa359de255fad6af 100644 --- a/Resample/Particle/ReParticle.h +++ b/Resample/Particle/ReParticle.h @@ -63,14 +63,14 @@ public: virtual complex_t formfactor(C3 q) const; static ReParticle* createTransformedFormFactor(const IBornFF& formfactor, const IRotation* rot, - R3 translation); + R3 translation); protected: std::unique_ptr<const IBornFF> m_ff; // private: ReParticle(IBornFF* ff, const Material* material, const Material* ambient_material, - const R3* position, const RotMatrix* rotMatrix); + const R3* position, const RotMatrix* rotMatrix); std::unique_ptr<const Material> m_material; std::unique_ptr<const Material> m_ambient_material; diff --git a/Resample/Processed/ParticleRegions.cpp b/Resample/Processed/ParticleRegions.cpp index d8fbae7902943a971a606efa7083100f4f034e93..e66c0caeb80f6278bd675d1087ac0e2fc4610d13 100644 --- a/Resample/Processed/ParticleRegions.cpp +++ b/Resample/Processed/ParticleRegions.cpp @@ -13,6 +13,7 @@ // ************************************************************************************************ #include "Resample/Processed/ParticleRegions.h" +#include "Resample/Processed/Slicer.h" #include "Sample/Aggregate/ParticleLayout.h" #include "Sample/Multilayer/Layer.h" #include "Sample/Multilayer/MultiLayer.h" @@ -163,7 +164,7 @@ std::vector<ZLimits> Compute::Slicing::particleRegions(const MultiLayer& multila const double offset = (i == 0) ? 0 : bottom_coords[i - 1]; for (const auto* layout : layer->layouts()) for (const auto& particle : layout->particles()) - layer_fill_limits.update(preprocessor::zSpan(particle), offset); + layer_fill_limits.update(preprocessor::zSpan(particle.get()), offset); } } return layer_fill_limits.layerZLimits(); diff --git a/Resample/Processed/ProcessedLayout.h b/Resample/Processed/ProcessedLayout.h index 61fdf1b2fe911b83f84331cb72fcc386e64f7f0e..0cbda19e023c68f6a23a9365dcbd45888c3ff25a 100644 --- a/Resample/Processed/ProcessedLayout.h +++ b/Resample/Processed/ProcessedLayout.h @@ -43,7 +43,7 @@ public: ~ProcessedLayout(); double surfaceDensity() const { return m_surface_density; } - const std::vector<std::unique_ptr<const CoherentFFSum>>& formFactorList() const + const std::vector<std::unique_ptr<const CoherentFFSum>>& formfactorList() const { return m_formfactors; } diff --git a/Resample/Processed/ProcessedSample.cpp b/Resample/Processed/ProcessedSample.cpp index 8eb337b2f083c7cdab8601cee080b43c21808cb7..984159135d3fc2f7e2078fb9c50db7daf55f8a33 100644 --- a/Resample/Processed/ProcessedSample.cpp +++ b/Resample/Processed/ProcessedSample.cpp @@ -18,8 +18,10 @@ #include "Resample/Coherence/SumDWBA.h" #include "Resample/Flux/IFlux.h" #include "Resample/Options/SimulationOptions.h" +#include "Resample/Particle/ParticleInSlice.h" #include "Resample/Processed/ParticleRegions.h" #include "Resample/Processed/ProcessedLayout.h" +#include "Resample/Processed/Slicer.h" #include "Resample/Specular/ComputeFluxMagnetic.h" #include "Resample/Specular/ComputeFluxScalar.h" #include "Sample/Aggregate/IInterference.h" @@ -32,7 +34,6 @@ #include "Sample/Multilayer/MultiLayer.h" #include "Sample/Multilayer/MultilayerUtils.h" #include "Sample/Particle/IParticle.h" -#include "Resample/Particle/ParticleInSlice.h" namespace { @@ -203,7 +204,7 @@ size_t zToSliceIndex(double z, const SliceStack& slices) std::pair<size_t, size_t> SliceIndexSpan(const IParticle& particle, const SliceStack& slices, double z_ref) { - const ZLimits zSpan = particle.zSpan(); + const ZLimits zSpan = preprocessor::zSpan(&particle); const double zbottom = zSpan.zBottom(); const double ztop = zSpan.zTop(); const double eps = @@ -248,7 +249,8 @@ ProcessedLayout makeProcessedLayout(const ParticleLayout& layout, const SliceSta double z1 = slice.zTopOr0(); limits = {slice.zBottom() - z1, slice.zTop() - z1}; } - ParticleInSlice pis = subparticle->createParticleInSlice(limits); + ParticleInSlice pis = preprocessor::createParticleInSlice(subparticle.get(), + limits); pis.sliced_ff->setAmbientMaterial(slices.at(iSlice).material()); std::unique_ptr<SumDWBA> computer; diff --git a/Resample/Processed/Slicer.cpp b/Resample/Processed/Slicer.cpp index 54e5e9b6e1b3935a1e146d3cdae04746df0b39b8..c3fe8265479a4c3852d528c5576ba71ee63aca00 100644 --- a/Resample/Processed/Slicer.cpp +++ b/Resample/Processed/Slicer.cpp @@ -13,14 +13,21 @@ // ************************************************************************************************ #include "Resample/Processed/Slicer.h" -#include "Resample/Particle/ReParticle.h" -#include "Sample/HardParticle/HardParticles.h" -#include "Resample/Particle/ReCoreShell.h" +#include "Base/Math/Functions.h" +#include "Base/Util/Assert.h" +#include "Base/Vector/RotMatrix.h" #include "Resample/Particle/ParticleInSlice.h" -#include "Resample/Particle/ReMesocrystal.h" #include "Resample/Particle/ReCompound.h" +#include "Resample/Particle/ReCoreShell.h" +#include "Resample/Particle/ReMesocrystal.h" #include "Resample/Particle/ReParticle.h" +#include "Sample/HardParticle/HardParticles.h" #include "Sample/Material/MaterialFactoryFuncs.h" +#include "Sample/Particle/Particle.h" +#include "Sample/Particle/ParticleComposition.h" +#include "Sample/Particle/ParticleCoreShell.h" +#include "Sample/Particle/MesoCrystal.h" +#include "Sample/Scattering/Rotations.h" #include "Sample/Scattering/ZLimits.h" namespace { @@ -69,52 +76,78 @@ bool shapeOutsideLimits(const IBornFF& formfactor, ZLimits limits, const IRotati return ztop <= limits.zBottom() || zbottom >= limits.zTop(); } +ReParticle* createSlicedFormFactor(const IBornFF* ff, ZLimits limits, const IRotation* rot, + R3 translation) +{ + if (shapeIsContainedInLimits(*ff, limits, rot, translation)) + return ReParticle::createTransformedFormFactor(*ff, rot, translation); + if (shapeOutsideLimits(*ff, limits, rot, translation)) + return nullptr; + if (ff->canSliceAnalytically(rot)) + return preprocessor::sliceFormFactor(ff, limits, rot, translation); + throw std::runtime_error("Slicing of " + ff->className() + + " not supported for the given rotation!"); +} + } // namespace ZLimits preprocessor::zSpan(const IParticle* particle) { - if (const auto* p = dynamic_cast<ParticleComposition>(particle)) { + if (const auto* p = dynamic_cast<const ParticleComposition*>(particle)) { const auto subparticles = p->decompose(); ASSERT(subparticles.size() > 0); - ZLimits result = zSpan(subparticles[0]); + ZLimits result = zSpan(subparticles[0].get()); for (const auto& subparticle : subparticles) - result = ZLimits::enclosingInterval(result, zSpan(subparticle)); + result = ZLimits::enclosingInterval(result, zSpan(subparticle.get())); return result; } - IReParticle* re = particle->createParticleInSlice(ZLimits{}).sliced_ff.release(); - double bot = re->bottomZ(nullptr); - double top = re->topZ(nullptr); + const ParticleInSlice pis = createParticleInSlice(particle, ZLimits{}); + const double bot = pis.sliced_ff->bottomZ(nullptr); + const double top = pis.sliced_ff->topZ(nullptr); return {bot, top}; } -ReParticle* preprocessor::sliceFormFactor(const IBornFF& ff, - ZLimits limits, const IRotation* rot, - R3 translation) +/* +IReParticle* ParticleComposition::createFormFactor() const { - const SlicingEffects effects = computeSlicingEffects(limits, translation, m_height); + if (m_particles.empty()) + return {}; + auto* result = new ReCompound; + auto particles = decompose(); + for (const auto& particle : particles) { + std::unique_ptr<IReParticle> particle_ff(particle->createFormFactor()); + result->addFormFactor(*particle_ff); + } + return result; +} +*/ +ReParticle* preprocessor::sliceFormFactor(const IBornFF* ff, ZLimits limits, const IRotation* rot, + R3 translation) +{ std::unique_ptr<IBornFF> slicedff; - if (const auto& f = dynamic_cast<const FormFactorAnisoPyramid&>(ff)) { - double dbase_edge = 2 * effects.dz_bottom * Math::cot(f.alpha()); + + if (const auto* f = dynamic_cast<const FormFactorAnisoPyramid*>(ff)) { + const SlicingEffects effects = computeSlicingEffects(limits, translation, f->height()); + double dbase_edge = 2 * effects.dz_bottom * Math::cot(f->alpha()); slicedff = std::make_unique<FormFactorAnisoPyramid>( - f.length() - dbase_edge, width() - dbase_edge, - f.height() - effects.dz_bottom - effects.dz_top, f.alpha()); - } else - throw std::runtime_error("Slicing not implemented for " + ff.shapeName()); + f->length() - dbase_edge, f->width() - dbase_edge, + f->height() - effects.dz_bottom - effects.dz_top, f->alpha()); + return ReParticle::createTransformedFormFactor(*slicedff, rot, effects.position); - return ReParticle::createTransformedFormFactor(*slicedff, rot, effects.position); -} + } else if (const auto* f = dynamic_cast<const FormFactorBox*>(ff)) { + const SlicingEffects effects = computeSlicingEffects(limits, translation, f->height()); + slicedff = std::make_unique<FormFactorBox>( + f->length(), f->width(), + f->height() - effects.dz_bottom - effects.dz_top); + return ReParticle::createTransformedFormFactor(*slicedff, rot, effects.position); -/* -ReParticle* FormFactorBox::sliceFormFactor(ZLimits limits, const IRotation* rot, - R3 translation) const -{ - auto effects = computeSlicingEffects(limits, translation, m_height); - FormFactorBox slicedff(m_length, m_width, m_height - effects.dz_bottom - effects.dz_top); - return ReParticle::createTransformedFormFactor(slicedff, rot, effects.position); + } else + throw std::runtime_error("Slicing not implemented for " + ff->shapeName()); } +/* ReParticle* FormFactorCone6::sliceFormFactor(ZLimits limits, const IRotation* rot, R3 translation) const { @@ -277,130 +310,105 @@ ReParticle* FormFactorTruncatedSpheroid::sliceFormFactor(ZLimits limits, const I } +*/ -ReParticle* preprocessor::createSlicedFormFactor(IBornFF& ff, - ZLimits limits, const IRotation* rot, - R3 translation) -{ - if (shapeIsContainedInLimits(ff, limits, rot, translation)) - return ReParticle::createTransformedFormFactor(ff, rot, translation); - if (shapeOutsideLimits(ff, limits, rot, translation)) - return nullptr; - if (ff.canSliceAnalytically(rot)) - return preprocessor::sliceFormFactor(ff, limits, rot, translation); - throw std::runtime_error("Slicing of " + className() - + " not supported for the given rotation!"); -} - - -ParticleInSlice ParticleCoreShell::createParticleInSlice(const ZLimits& limits) const +ParticleInSlice preprocessor::createParticleInSlice( + const IParticle* particle, const ZLimits& limits) { - ASSERT(m_core && m_shell); - - // core - std::unique_ptr<Particle> P_core(m_core->clone()); - if (m_rotation) - P_core->rotate(*m_rotation); - P_core->translate(m_position); - auto sliced_core = P_core->createParticleInSlice(limits); - - // shell - std::unique_ptr<Particle> P_shell(m_shell->clone()); - if (m_rotation) - P_shell->rotate(*m_rotation); - P_shell->translate(m_position); - auto sliced_shell = P_shell->createParticleInSlice(limits); - if (!sliced_shell.sliced_ff) - return {}; - - ParticleInSlice result; - // if core out of limits, return sliced shell - if (!sliced_core.sliced_ff) { - result.sliced_ff = std::move(sliced_shell.sliced_ff); + if (const auto* p = dynamic_cast<const Particle*>(particle)) { + ASSERT(p->formfactor()); + std::unique_ptr<ReParticle> sliced_ff( + createSlicedFormFactor(p->formfactor(), limits, p->rotation(), p->particlePosition())); + if (!sliced_ff) + return {}; + double volume = sliced_ff->volume(); + Material transformed_material( + p->rotation() ? p->material()->rotatedMaterial(p->rotation()->rotMatrix()) + : *p->material()); + sliced_ff->setMaterial(transformed_material); + return {std::move(sliced_ff), {{{volume, transformed_material}}}}; + + } else if (const auto* p = dynamic_cast<const ParticleCoreShell*>(particle)) { + const Particle* core = p->coreParticle(); + const Particle* shell = p->shellParticle(); + ASSERT(core && shell); + + // core + std::unique_ptr<Particle> P_core(core->clone()); + if (p->rotation()) + P_core->rotate(*p->rotation()); + P_core->translate(p->particlePosition()); + ParticleInSlice sliced_core = createParticleInSlice(P_core.get(), limits); + + // shell + std::unique_ptr<Particle> P_shell(shell->clone()); + if (p->rotation()) + P_shell->rotate(*p->rotation()); + P_shell->translate(p->particlePosition()); + ParticleInSlice sliced_shell = createParticleInSlice(P_shell.get(), limits); + if (!sliced_shell.sliced_ff) + return {}; + + ParticleInSlice result; + // if core out of limits, return sliced shell + if (!sliced_core.sliced_ff) { + result.sliced_ff.reset(std::move(sliced_shell.sliced_ff.get())); + result.admixtures.push_back(sliced_shell.admixtures.back()); + return result; + } + + // set core ambient material + if (sliced_shell.admixtures.size() != 1) + return {}; + auto shell_material = sliced_shell.admixtures[0].material; + sliced_core.sliced_ff->setAmbientMaterial(shell_material); + + // construct sliced particle + sliced_shell.admixtures.back().fraction -= sliced_core.admixtures.back().fraction; + result.sliced_ff.reset(new ReCoreShell( + sliced_core.sliced_ff.release(), + sliced_shell.sliced_ff.release())); + result.admixtures.push_back(sliced_core.admixtures.back()); result.admixtures.push_back(sliced_shell.admixtures.back()); + return result; - } - // set core ambient material - if (sliced_shell.admixtures.size() != 1) - return {}; - auto shell_material = sliced_shell.admixtures[0].material; - sliced_core.sliced_ff->setAmbientMaterial(shell_material); + } else if (const auto* p = dynamic_cast<const ParticleComposition*>(particle)) { + throw std::runtime_error("ParticleComposition does not yet support slicing"); - // construct sliced particle - sliced_shell.admixtures.back().fraction -= sliced_core.admixtures.back().fraction; - result.sliced_ff = std::make_unique<ReCoreShell>(sliced_core.sliced_ff.release(), - sliced_shell.sliced_ff.release()); - result.admixtures.push_back(sliced_core.admixtures.back()); - result.admixtures.push_back(sliced_shell.admixtures.back()); + } else if (const auto* p = dynamic_cast<const MesoCrystal*>(particle)) { + throw std::runtime_error("MesoCrystal does not yet support slicing"); + /* + ASSERT(m_crystal && m_meso_formfactor); - return result; -} + double unit_cell_volume = m_crystal->lattice()->unitCellVolume(); + if (unit_cell_volume <= 0) + return {}; -ParticleInSlice MesoCrystal::createParticleInSlice(const ZLimits& limits) const -{ - ASSERT(m_crystal && m_meso_formfactor); + ParticleInSlice result; - double unit_cell_volume = m_crystal->lattice()->unitCellVolume(); - if (unit_cell_volume <= 0) - return {}; - - ParticleInSlice result; - - std::unique_ptr<ReParticle> tem_ff( - m_meso_formfactor->createSlicedFormFactor(limits, m_rotation.get(), m_position)); + std::unique_ptr<ReParticle> tem_ff( + m_meso_formfactor->createSlicedFormFactor(limits, m_rotation.get(), m_position)); - const std::unique_ptr<Crystal> new_crystal( - m_crystal->transformed(m_rotation.get(), m_position)); - const std::unique_ptr<IReParticle> new_basis_ff(new_crystal->basis()->createFormFactor()); + const std::unique_ptr<Crystal> new_crystal( + m_crystal->transformed(m_rotation.get(), m_position)); + const std::unique_ptr<IReParticle> new_basis_ff(new_crystal->basis()->createFormFactor()); - result.sliced_ff.reset(new ReMesocrystal(*new_crystal->lattice(), *new_basis_ff, *tem_ff, + result.sliced_ff.reset(new ReMesocrystal(*new_crystal->lattice(), *new_basis_ff, *tem_ff, new_crystal->position_variance())); - Admixtures& regions = result.admixtures; - ASSERT(regions.empty()); - for (const auto& particle : m_crystal->basis()->decompose()) { - ParticleInSlice pis = particle->createParticleInSlice({}); - regions.insert(regions.end(), pis.admixtures.begin(), pis.admixtures.end()); - } - for (auto& region : regions) - region.fraction *= m_meso_formfactor->volume() / unit_cell_volume; - - return result; -} - -ParticleInSlice ParticleComposition::createParticleInSlice(const ZLimits&) const -{ - throw std::runtime_error("ParticleComposition does not yet support slicing"); -} + Admixtures& regions = result.admixtures; + ASSERT(regions.empty()); + for (const auto& particle : m_crystal->basis()->decompose()) { + ParticleInSlice pis = particle->createParticleInSlice({}); + regions.insert(regions.end(), pis.admixtures.begin(), pis.admixtures.end()); + } + for (auto& region : regions) + region.fraction *= m_meso_formfactor->volume() / unit_cell_volume; - -ParticleInSlice Particle::createParticleInSlice(const ZLimits& limits) const -{ - ASSERT(m_formfactor); - std::unique_ptr<ReParticle> sliced_ff( - m_formfactor->createSlicedFormFactor(limits, m_rotation.get(), m_position)); - if (!sliced_ff) - return {}; - double volume = sliced_ff->volume(); - Material transformed_material(m_rotation ? m_material.rotatedMaterial(m_rotation->rotMatrix()) - : m_material); - sliced_ff->setMaterial(transformed_material); - return {std::move(sliced_ff), {{{volume, transformed_material}}}}; -} - -IReParticle* ParticleComposition::createFormFactor() const -{ - if (m_particles.empty()) - return {}; - auto* result = new ReCompound; - auto particles = decompose(); - for (const auto& particle : particles) { - std::unique_ptr<IReParticle> particle_ff(particle->createFormFactor()); - result->addFormFactor(*particle_ff); - } - return result; + return result; + */ + } else + ASSERT(0); } - -*/ diff --git a/Resample/Processed/Slicer.h b/Resample/Processed/Slicer.h index ec8c72b63343401dd1694d4dc2034145f888b61c..149346f076ae00a158c4532f981fa10be8109c60 100644 --- a/Resample/Processed/Slicer.h +++ b/Resample/Processed/Slicer.h @@ -23,20 +23,18 @@ #include <heinz/Vectors3D.h> class IBornFF; -class ZLimits; class IParticle; class IRotation; +class ParticleInSlice; class ReParticle; +class ZLimits; namespace preprocessor { -ReParticle* sliceFormFactor(const IBornFF& ff, - ZLimits limits, const IRotation* rot, - R3 translation); +ReParticle* sliceFormFactor(const IBornFF* ff, ZLimits limits, const IRotation* rot, + R3 translation); -ReParticle* createSlicedFormFactor(IBornFF& ff, - ZLimits limits, const IRotation* rot, - R3 translation); +ParticleInSlice createParticleInSlice(const IParticle* particle, const ZLimits&); ZLimits zSpan(const IParticle* particle); diff --git a/Resample/Slice/ProfileHelper.cpp b/Resample/Slice/ProfileHelper.cpp index f5ac2e71472cf090480eaf45ac2bdffa8cf3dc39..bbbf85223afa4315fb76302fa50df1d2c2e54823 100644 --- a/Resample/Slice/ProfileHelper.cpp +++ b/Resample/Slice/ProfileHelper.cpp @@ -68,9 +68,8 @@ std::pair<double, double> ProfileHelper::defaultLimits() const const LayerRoughness* topRoughness = m_stack.at(1).topRoughness(); const LayerRoughness* bottomRoughness = m_stack.back().topRoughness(); - double top_margin = topRoughness && topRoughness->sigma() > 0 - ? 5.0 * topRoughness->sigma() - : default_margin; + double top_margin = + topRoughness && topRoughness->sigma() > 0 ? 5.0 * topRoughness->sigma() : default_margin; double bottom_margin = bottomRoughness && bottomRoughness->sigma() > 0 ? 5.0 * bottomRoughness->sigma() : default_margin; diff --git a/Sample/Particle/Particle.h b/Sample/Particle/Particle.h index 7c8a8af525dcc46259f73eea7594d80eeca370af..d991f55a1017a7c70450378700324a5eb0bd211c 100644 --- a/Sample/Particle/Particle.h +++ b/Sample/Particle/Particle.h @@ -34,7 +34,7 @@ public: const Material* material() const override { return &m_material; } - const IBornFF* formFactor() const { return m_formfactor.get(); } + const IBornFF* formfactor() const { return m_formfactor.get(); } private: const Material m_material; diff --git a/Sample/Scattering/IBornFF.h b/Sample/Scattering/IBornFF.h index 307401c02b647076a52a1388cd5e50083c769043..4342ae498bb311335d8ef318d1433afe15011dbb 100644 --- a/Sample/Scattering/IBornFF.h +++ b/Sample/Scattering/IBornFF.h @@ -60,7 +60,6 @@ public: //! Creates the Python constructor of this class (or derived classes) virtual std::string pythonConstructor() const; -protected: //! Default implementation only allows rotations along z-axis virtual bool canSliceAnalytically(const IRotation* rot) const; @@ -71,6 +70,7 @@ protected: virtual Eigen::Matrix2cd formfactor_pol(C3 q) const; #endif +protected: //! IShape3D object, used to retrieve vertices (which may be approximate in the case //! of round shapes). For soft particles, this will be a hard mean shape. std::unique_ptr<IShape3D> m_shape3D; diff --git a/Tests/Unit/GUI/TestGroupItem.cpp b/Tests/Unit/GUI/TestGroupItem.cpp index 2496320e61cb1b0056811aa25ad637fc47a2a56c..f97612c62f6f10ca0e463fe6ef093072d503d26b 100644 --- a/Tests/Unit/GUI/TestGroupItem.cpp +++ b/Tests/Unit/GUI/TestGroupItem.cpp @@ -53,7 +53,7 @@ TEST_F(TestGroupItem, CreateGroup) { SessionModel model("TestModel"); - GroupInfo groupInfo = formFactorGroupInfo(); + GroupInfo groupInfo = formfactorGroupInfo(); EXPECT_EQ(groupInfo.defaultType(), CylinderItem::M_TYPE); auto* groupItem = model.insertItem<GroupItem>(); diff --git a/Tests/Unit/GUI/TestParticleItem.cpp b/Tests/Unit/GUI/TestParticleItem.cpp index 04145e20defc4e8681507d6841e1396b6a758316..5de7f9bc41e52155a7c92df8e24e00f63889db41 100644 --- a/Tests/Unit/GUI/TestParticleItem.cpp +++ b/Tests/Unit/GUI/TestParticleItem.cpp @@ -21,7 +21,7 @@ TEST_F(TestParticleItem, InitialState) EXPECT_EQ(item->children().size(), 4); EXPECT_TRUE(ItemWithParticles::isTransformationTagName(item->defaultTag())); - GroupItem* group = item->formFactorItem(); + GroupItem* group = item->formfactorItem(); EXPECT_EQ(group->displayName(), "Form Factor"); EXPECT_EQ(group->children().size(), 1); } diff --git a/Tests/Unit/GUI/TestRealSpaceBuilderUtils.cpp b/Tests/Unit/GUI/TestRealSpaceBuilderUtils.cpp index 94999baa23debefc6290a828750d7286a98330a8..b5aa1cbc9252eee24a1326c4147c19586a2c982a 100644 --- a/Tests/Unit/GUI/TestRealSpaceBuilderUtils.cpp +++ b/Tests/Unit/GUI/TestRealSpaceBuilderUtils.cpp @@ -162,12 +162,12 @@ TEST_F(TestRealSpaceBuilderUtils, singleParticle3DContainer) particleItem->setMaterial(materialModel.defaultMaterial()); particleItem->setMaterialModel(&materialModel); EXPECT_EQ(particleItem->abundance(), 1.0); - EXPECT_TRUE(particleItem->formFactor()->hasModelType<CylinderItem>()); + EXPECT_TRUE(particleItem->formfactor()->hasModelType<CylinderItem>()); particleItem->setAbundance(8.0); EXPECT_EQ(particleItem->abundance(), 8.0); particleItem->setFormFactorType<BoxItem>(); - EXPECT_TRUE(particleItem->formFactor()->hasModelType<BoxItem>()); + EXPECT_TRUE(particleItem->formfactor()->hasModelType<BoxItem>()); // Create a 3D particle from particleItem and associate it to a Particle3DContainer object const auto* pItem = dynamic_cast<const ParticleItem*>(particleItem); diff --git a/Tests/Unit/Numeric/FormFactorSpecializationTest.cpp b/Tests/Unit/Numeric/FormFactorSpecializationTest.cpp index b53e9f3af485274edb3c20afb6861d8c7690045c..9879b9b74d22e2fb70d36826978aa38d112de7ca 100644 --- a/Tests/Unit/Numeric/FormFactorSpecializationTest.cpp +++ b/Tests/Unit/Numeric/FormFactorSpecializationTest.cpp @@ -11,7 +11,7 @@ protected: void run_test(IBornFF* p0, IBornFF* p1, double eps, double qmag1, double qmag2) { - formFactorTest::run_test_for_many_q([&](C3 q) { test_ff_eq(q, p0, p1, eps); }, qmag1, + formfactorTest::run_test_for_many_q([&](C3 q) { test_ff_eq(q, p0, p1, eps); }, qmag1, qmag2); } diff --git a/Tests/Unit/Numeric/FormFactorSymmetryTest.cpp b/Tests/Unit/Numeric/FormFactorSymmetryTest.cpp index d08e3a254369895eafddac7315612526dff8199c..c84165200ae220dca9e75f612ee353eef8f8bc4c 100644 --- a/Tests/Unit/Numeric/FormFactorSymmetryTest.cpp +++ b/Tests/Unit/Numeric/FormFactorSymmetryTest.cpp @@ -38,7 +38,7 @@ private: protected: void run_test(IBornFF* ff, transform_t trafo, double eps, double qmag1, double qmag2) { - formFactorTest::run_test_for_many_q([&](C3 q) { test_qq_eq(ff, q, trafo(q), eps); }, qmag1, + formfactorTest::run_test_for_many_q([&](C3 q) { test_qq_eq(ff, q, trafo(q), eps); }, qmag1, qmag2); } }; diff --git a/Tests/Unit/Numeric/MultiQTestbed.cpp b/Tests/Unit/Numeric/MultiQTestbed.cpp index 08e35bf471c42d94bb90d1de1e54ff37acfa066c..d1648a36b8347d94f4ab8844856c2befd1a0ef9f 100644 --- a/Tests/Unit/Numeric/MultiQTestbed.cpp +++ b/Tests/Unit/Numeric/MultiQTestbed.cpp @@ -6,7 +6,7 @@ using ::testing::Combine; using ::testing::Values; using ::testing::internal::ParamGenerator; -namespace formFactorTest { +namespace formfactorTest { const auto qlist = testing::Combine( testing::Values(C3({1, 0, 0}), C3({0, 1, 0}), C3({0, 0, 1}), C3({1, 1, 0}), C3({1, 0, 1}), @@ -37,4 +37,4 @@ void run_test_for_many_q(std::function<void(C3)> run_one_test, double qmag_min, } } -} // namespace formFactorTest +} // namespace formfactorTest diff --git a/Tests/Unit/Numeric/MultiQTestbed.h b/Tests/Unit/Numeric/MultiQTestbed.h index f2f6ace122e6be20b5932b17851d10492ab49bc2..8591518eea700ea3356f448cd9f3ea091de560eb 100644 --- a/Tests/Unit/Numeric/MultiQTestbed.h +++ b/Tests/Unit/Numeric/MultiQTestbed.h @@ -6,11 +6,11 @@ //! Driver for FormFactorSpecializationTest and FormFactorSymmetryTest. -namespace formFactorTest { +namespace formfactorTest { //! Runs callback function "run_one_test(q)" for a huge number of different vectors q. void run_test_for_many_q(std::function<void(C3)> run_one_test, double qmag_min, double qmag_max); -} // namespace formFactorTest +} // namespace formfactorTest #endif // BORNAGAIN_TESTS_UNIT_NUMERIC_MULTIQTESTBED_H diff --git a/auto/Wrap/doxygenResample.i b/auto/Wrap/doxygenResample.i index a0c7acc61effb0ccbafc35764aced9c9ba688e1e..558c7d287ff88dba36f1a4f7dc80e910990ca0b3 100644 --- a/auto/Wrap/doxygenResample.i +++ b/auto/Wrap/doxygenResample.i @@ -367,7 +367,7 @@ C++ includes: ProcessedLayout.h %feature("docstring") ProcessedLayout::surfaceDensity "double ProcessedLayout::surfaceDensity() const "; -%feature("docstring") ProcessedLayout::formFactorList "const std::vector<std::unique_ptr<const CoherentFFSum> >& ProcessedLayout::formFactorList() const +%feature("docstring") ProcessedLayout::formfactorList "const std::vector<std::unique_ptr<const CoherentFFSum> >& ProcessedLayout::formfactorList() const "; %feature("docstring") ProcessedLayout::interferenceFunction "const IInterference* ProcessedLayout::interferenceFunction() const @@ -1113,10 +1113,10 @@ Computes the Fresnel R coefficient for the top layer only. Introduced in order t // File: namespacepreprocessor.xml -%feature("docstring") preprocessor::sliceFormFactor "ReParticle * preprocessor::sliceFormFactor(const IBornFF &ff, ZLimits limits, const IRotation *rot, R3 translation) +%feature("docstring") preprocessor::sliceFormFactor "ReParticle * preprocessor::sliceFormFactor(const IBornFF *ff, ZLimits limits, const IRotation *rot, R3 translation) "; -%feature("docstring") preprocessor::createSlicedFormFactor "ReParticle* preprocessor::createSlicedFormFactor(IBornFF &ff, ZLimits limits, const IRotation *rot, R3 translation) +%feature("docstring") preprocessor::createParticleInSlice "ParticleInSlice preprocessor::createParticleInSlice(const IParticle *particle, const ZLimits &) "; %feature("docstring") preprocessor::zSpan "ZLimits preprocessor::zSpan(const IParticle *particle) diff --git a/auto/Wrap/doxygenSample.i b/auto/Wrap/doxygenSample.i index 7234e43403d8161c4fc6542610149b88abc65618..3c4f1b7e08030d96a7dce0679ab2989af39a25dd 100644 --- a/auto/Wrap/doxygenSample.i +++ b/auto/Wrap/doxygenSample.i @@ -2073,6 +2073,16 @@ Returns the (approximate in some cases) radial size of the particle of this form Creates the Python constructor of this class (or derived classes) "; +%feature("docstring") IBornFF::canSliceAnalytically "bool IBornFF::canSliceAnalytically(const IRotation *rot) const + +Default implementation only allows rotations along z-axis. +"; + +%feature("docstring") IBornFF::formfactor_pol "Eigen::Matrix2cd IBornFF::formfactor_pol(C3 q) const + +Returns scattering amplitude for complex scattering wavevector q=k_i-k_f in case of matrix interactions. Default implementation calls formfactor(q) and multiplies with the unit matrix. +"; + // File: classICosineRipple.xml %feature("docstring") ICosineRipple " @@ -4072,7 +4082,7 @@ Returns a clone of this ISampleNode object. Returns nullptr, unless overwritten to return a specific material. "; -%feature("docstring") Particle::formFactor "const IBornFF* Particle::formFactor() const +%feature("docstring") Particle::formfactor "const IBornFF* Particle::formfactor() const "; diff --git a/auto/Wrap/libBornAgainSample.py b/auto/Wrap/libBornAgainSample.py index 71933ec2568a85affb580b9bff4a2a0095078ace..a913f22283b7fcdcb2d53dbd42303ef9fe0fb527 100644 --- a/auto/Wrap/libBornAgainSample.py +++ b/auto/Wrap/libBornAgainSample.py @@ -3151,7 +3151,13 @@ class IBornFF(ISampleNode): return _libBornAgainSample.IBornFF_pythonConstructor(self) def canSliceAnalytically(self, rot): - r"""canSliceAnalytically(IBornFF self, IRotation rot) -> bool""" + r""" + canSliceAnalytically(IBornFF self, IRotation rot) -> bool + bool IBornFF::canSliceAnalytically(const IRotation *rot) const + + Default implementation only allows rotations along z-axis. + + """ return _libBornAgainSample.IBornFF_canSliceAnalytically(self, rot) def __disown__(self): self.this.disown() @@ -3969,13 +3975,13 @@ class Particle(IParticle): """ return _libBornAgainSample.Particle_material(self) - def formFactor(self): + def formfactor(self): r""" - formFactor(Particle self) -> IBornFF - const IBornFF* Particle::formFactor() const + formfactor(Particle self) -> IBornFF + const IBornFF* Particle::formfactor() const """ - return _libBornAgainSample.Particle_formFactor(self) + return _libBornAgainSample.Particle_formfactor(self) # Register Particle in _libBornAgainSample: _libBornAgainSample.Particle_swigregister(Particle) diff --git a/auto/Wrap/libBornAgainSample_wrap.cpp b/auto/Wrap/libBornAgainSample_wrap.cpp index bcb105333460900f9eecc2150017572a144931a8..c8baab95017674979d9e97f369c6cc6e9934d221 100644 --- a/auto/Wrap/libBornAgainSample_wrap.cpp +++ b/auto/Wrap/libBornAgainSample_wrap.cpp @@ -8137,7 +8137,6 @@ bool SwigDirector_IBornFF::canSliceAnalytically(IRotation const *rot) const { swig::SwigVar_PyObject obj0; obj0 = SWIG_NewPointerObj(SWIG_as_voidptr(rot), SWIGTYPE_p_IRotation, 0 ); - swig_set_inner("canSliceAnalytically", true); if (!swig_get_self()) { Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call IBornFF.__init__."); } @@ -8150,7 +8149,6 @@ bool SwigDirector_IBornFF::canSliceAnalytically(IRotation const *rot) const { swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar("canSliceAnalytically"); swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name ,(PyObject *)obj0, NULL); #endif - swig_set_inner("canSliceAnalytically", false); if (!result) { PyObject *error = PyErr_Occurred(); if (error) { @@ -37780,7 +37778,6 @@ SWIGINTERN PyObject *_wrap_IBornFF_canSliceAnalytically(PyObject *SWIGUNUSEDPARM PyObject *swig_obj[2] ; Swig::Director *director = 0; bool upcall = false; - SwigDirector_IBornFF *darg = 0; bool result; if (!SWIG_Python_UnpackTuple(args, "IBornFF_canSliceAnalytically", 2, 2, swig_obj)) SWIG_fail; @@ -37795,17 +37792,12 @@ SWIGINTERN PyObject *_wrap_IBornFF_canSliceAnalytically(PyObject *SWIGUNUSEDPARM } arg2 = reinterpret_cast< IRotation * >(argp2); director = SWIG_DIRECTOR_CAST(arg1); - if (!director || !(director->swig_get_inner("canSliceAnalytically"))) { - SWIG_SetErrorMsg(PyExc_RuntimeError,"accessing protected member canSliceAnalytically"); - SWIG_fail; - } upcall = (director && (director->swig_get_self()==swig_obj[0])); try { - darg = dynamic_cast<SwigDirector_IBornFF *>(arg1); if (upcall) { - result = (bool)((SwigDirector_IBornFF const *)darg)->canSliceAnalyticallySwigPublic((IRotation const *)arg2); + result = (bool)((IBornFF const *)arg1)->IBornFF::canSliceAnalytically((IRotation const *)arg2); } else { - result = (bool)((SwigDirector_IBornFF const *)darg)->canSliceAnalytically((IRotation const *)arg2); + result = (bool)((IBornFF const *)arg1)->canSliceAnalytically((IRotation const *)arg2); } } catch (Swig::DirectorException&) { SWIG_fail; @@ -40434,7 +40426,7 @@ fail: } -SWIGINTERN PyObject *_wrap_Particle_formFactor(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Particle_formfactor(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; Particle *arg1 = (Particle *) 0 ; void *argp1 = 0 ; @@ -40447,10 +40439,10 @@ SWIGINTERN PyObject *_wrap_Particle_formFactor(PyObject *SWIGUNUSEDPARM(self), P swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Particle, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Particle_formFactor" "', argument " "1"" of type '" "Particle const *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Particle_formfactor" "', argument " "1"" of type '" "Particle const *""'"); } arg1 = reinterpret_cast< Particle * >(argp1); - result = (IBornFF *)((Particle const *)arg1)->formFactor(); + result = (IBornFF *)((Particle const *)arg1)->formfactor(); director = SWIG_DIRECTOR_CAST(result); if (director) { resultobj = director->swig_get_self(); @@ -64619,7 +64611,13 @@ static PyMethodDef SwigMethods[] = { "Creates the Python constructor of this class (or derived classes) \n" "\n" ""}, - { "IBornFF_canSliceAnalytically", _wrap_IBornFF_canSliceAnalytically, METH_VARARGS, "IBornFF_canSliceAnalytically(IBornFF self, IRotation rot) -> bool"}, + { "IBornFF_canSliceAnalytically", _wrap_IBornFF_canSliceAnalytically, METH_VARARGS, "\n" + "IBornFF_canSliceAnalytically(IBornFF self, IRotation rot) -> bool\n" + "bool IBornFF::canSliceAnalytically(const IRotation *rot) const\n" + "\n" + "Default implementation only allows rotations along z-axis. \n" + "\n" + ""}, { "disown_IBornFF", _wrap_disown_IBornFF, METH_O, NULL}, { "IBornFF_swigregister", IBornFF_swigregister, METH_O, NULL}, { "IBornFF_swiginit", IBornFF_swiginit, METH_VARARGS, NULL}, @@ -65084,9 +65082,9 @@ static PyMethodDef SwigMethods[] = { "Returns nullptr, unless overwritten to return a specific material. \n" "\n" ""}, - { "Particle_formFactor", _wrap_Particle_formFactor, METH_O, "\n" - "Particle_formFactor(Particle self) -> IBornFF\n" - "const IBornFF* Particle::formFactor() const\n" + { "Particle_formfactor", _wrap_Particle_formfactor, METH_O, "\n" + "Particle_formfactor(Particle self) -> IBornFF\n" + "const IBornFF* Particle::formfactor() const\n" "\n" ""}, { "Particle_swigregister", Particle_swigregister, METH_O, NULL}, diff --git a/auto/Wrap/libBornAgainSample_wrap.h b/auto/Wrap/libBornAgainSample_wrap.h index 7ef6b34c4937c64654ee60663d3d2b9792449686..35d0c3ecbc5511f048560d7010b7fd5af2c94d3a 100644 --- a/auto/Wrap/libBornAgainSample_wrap.h +++ b/auto/Wrap/libBornAgainSample_wrap.h @@ -81,9 +81,6 @@ public: virtual complex_t formfactor(C3 q) const; virtual std::string pythonConstructor() const; virtual bool canSliceAnalytically(IRotation const *rot) const; - virtual bool canSliceAnalyticallySwigPublic(IRotation const *rot) const { - return IBornFF::canSliceAnalytically(rot); - } /* Internal director utilities */ public: