diff --git a/Examples/scatter2d/MagneticSpheres.py b/Examples/scatter2d/MagneticSpheres.py index e694e364dc9b1ef131b433f33ef71061dab32d2d..400f0c9e6e4d44dd50ebb63250a900cb612244ba 100755 --- a/Examples/scatter2d/MagneticSpheres.py +++ b/Examples/scatter2d/MagneticSpheres.py @@ -30,7 +30,6 @@ def get_sample(): # Define particle layouts layout = ba.ParticleLayout() layout.addParticle(particle, 1) - layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.01) # Define layers diff --git a/GUI/Model/FromCore/ItemizeSample.cpp b/GUI/Model/FromCore/ItemizeSample.cpp index 8ee9a8b2dcbe64311237147d6e4d643b89fb29fd..d0a147156a8be7ad905acfe0c0702468d54bf35f 100644 --- a/GUI/Model/FromCore/ItemizeSample.cpp +++ b/GUI/Model/FromCore/ItemizeSample.cpp @@ -659,7 +659,6 @@ MultiLayerItem* itemizeSample(const MultiLayer& sample, const QString& nodeName) for (const auto* layout : layer->layouts()) { auto* layoutItem = layerItem->addLayout(); layoutItem->ownDensity().set(layout->totalParticleSurfaceDensity()); - layoutItem->weight().set(layout->weight()); setInterference(layoutItem, layout->interferenceFunction()); // create particles/particle compositions diff --git a/GUI/Model/Model/ParameterTreeUtils.cpp b/GUI/Model/Model/ParameterTreeUtils.cpp index f8a49a0ef740e7d7c932f99efe3cb948e91f3e62..6ca7468dad5edd4dddf70ef20a328efc256656c8 100644 --- a/GUI/Model/Model/ParameterTreeUtils.cpp +++ b/GUI/Model/Model/ParameterTreeUtils.cpp @@ -131,7 +131,6 @@ void ParameterTreeBuilder::addSample() auto* label = new ParameterLabelItem("Layout" + QString::number(iLayout++), layerLabel); if (!layout->totalDensityIsDefinedByInterference()) addParameterItem(label, layout->ownDensity()); - addParameterItem(label, layout->weight()); addInterference(label, layout); @@ -159,7 +158,6 @@ void ParameterTreeBuilder::addParameterItem(ParameterLabelItem* parent, const Ve addParameterItem(label, d.z); } - void ParameterTreeBuilder::addParameterItem( ParameterLabelItem* parent, const std::variant<VectorDescriptor, DoubleDescriptor>& v) { diff --git a/GUI/Model/Sample/ParticleLayoutItem.cpp b/GUI/Model/Sample/ParticleLayoutItem.cpp index cb19e9117c66195b67c94b6275a04e4077a6bc00..2dbdf9bfe3976f4a08c3557f622a8224dd6d07e0 100644 --- a/GUI/Model/Sample/ParticleLayoutItem.cpp +++ b/GUI/Model/Sample/ParticleLayoutItem.cpp @@ -29,10 +29,6 @@ ParticleLayoutItem::ParticleLayoutItem(const MaterialItems* materials) "Number of particles per area (particle surface density).\n " "Should be defined for disordered and 1d-ordered particle collections.", 0.01, Unit::nanometerMinus2, 10, RealLimits::nonnegative(), "density"); - m_weight.init("Weight", - "Weight of this particle layout.\nShould be used when multiple layouts define " - "different domains in the sample.", - 1.0, Unit::unitless, "weight"); m_interference.init<InterferenceItemCatalog>("Interference function", "", "interference"); } @@ -80,11 +76,6 @@ double ParticleLayoutItem::totalDensityValue() const ASSERT(false); } -DoubleDescriptor ParticleLayoutItem::weight() const -{ - return m_weight; -} - QVector<ItemWithParticles*> ParticleLayoutItem::particles() const { return m_particles; @@ -134,7 +125,6 @@ void ParticleLayoutItem::serialize(Streamer& s) { s.assertVersion(0); Serialize::rwProperty(s, m_ownDensity); - Serialize::rwProperty(s, m_weight); Serialize::rwSelected<InterferenceItemCatalog>(s, m_interference); Serialize::rwCatalogized<ItemWithParticlesCatalog>(s, "Particles", m_particles, m_materials); } diff --git a/GUI/Model/Sample/ParticleLayoutItem.h b/GUI/Model/Sample/ParticleLayoutItem.h index bc6b0a6faad3e6da6b321b5fe29e5124215fd30d..bd60f0363ddb3bfc96a586a20f871ef7ed6574bb 100644 --- a/GUI/Model/Sample/ParticleLayoutItem.h +++ b/GUI/Model/Sample/ParticleLayoutItem.h @@ -42,7 +42,6 @@ public: //! interference is defining the density, this is the interference-calculated density. DoubleDescriptor totalDensity() const; double totalDensityValue() const; - DoubleDescriptor weight() const; //! The particles this layout contains. //! @@ -71,7 +70,6 @@ public: private: DoubleProperty m_ownDensity; - DoubleProperty m_weight; SelectionProperty<InterferenceItem*> m_interference; QVector<ItemWithParticles*> m_particles; const MaterialItems* m_materials; diff --git a/GUI/Model/ToCore/SampleToCore.cpp b/GUI/Model/ToCore/SampleToCore.cpp index 6cb240b8d436a470e3f05876b5b2a51f8412f65b..6ba05e7c1e031d558daec2ee76e676f1e2e980ff 100644 --- a/GUI/Model/ToCore/SampleToCore.cpp +++ b/GUI/Model/ToCore/SampleToCore.cpp @@ -62,9 +62,7 @@ std::unique_ptr<ParticleLayout> createParticleLayout(const ParticleLayoutItem& i { auto layout = std::make_unique<ParticleLayout>(); double total_density = item.totalDensity(); - double layout_weight = item.weight(); layout->setTotalParticleSurfaceDensity(total_density); - layout->setWeight(layout_weight); return layout; } diff --git a/GUI/View/SampleDesigner/ParticleLayoutForm.cpp b/GUI/View/SampleDesigner/ParticleLayoutForm.cpp index f38a8d07aa54883aff1ebbb66ebbc0ca1311322c..c66f3563bab12bb47556dfcd4f29e524be5b28ff 100644 --- a/GUI/View/SampleDesigner/ParticleLayoutForm.cpp +++ b/GUI/View/SampleDesigner/ParticleLayoutForm.cpp @@ -40,7 +40,6 @@ ParticleLayoutForm::ParticleLayoutForm(LayerForm* parent, ParticleLayoutItem* la m_totalDensitySpinBox = layouter.widgetAt<DoubleSpinBox*>(rowOfTotalDensity, QFormLayout::FieldRole); ASSERT(m_totalDensitySpinBox); - layouter.addValue(m_layoutItem->weight()); layouter.addRow(new InterferenceForm(this, layoutItem, ec)); for (auto* particle : m_layoutItem->particles()) diff --git a/Resample/Processed/ReSample.cpp b/Resample/Processed/ReSample.cpp index 35c8589c5b7e6acb38d11f41bcd88f4880cd8ae5..38b6afb61a52f1ca5d590de04ebbafc23092bc02 100644 --- a/Resample/Processed/ReSample.cpp +++ b/Resample/Processed/ReSample.cpp @@ -221,7 +221,7 @@ reLayout makereLayout(const ParticleLayout& layout, const SliceStack& slices, do { const double layout_abundance = layout.totalAbundance(); ASSERT(layout_abundance > 0); - const double surface_density = layout.weightedParticleSurfaceDensity(); + const double surface_density = layout.totalParticleSurfaceDensity(); OwningVector<const CoherentFFSum> formfactors; std::map<size_t, Admixtures> slice2admixtures; diff --git a/Sample/Aggregate/ParticleLayout.cpp b/Sample/Aggregate/ParticleLayout.cpp index ff1ab7d7ee70cc751416840dbb5da22d805a32ee..1b597ce10d8b5815a73a71f4cede41e7c54f572a 100644 --- a/Sample/Aggregate/ParticleLayout.cpp +++ b/Sample/Aggregate/ParticleLayout.cpp @@ -37,7 +37,6 @@ ParticleLayout* ParticleLayout::clone() const result->setAndRegisterInterference(m_interparticle->clone()); result->setTotalParticleSurfaceDensity(totalParticleSurfaceDensity()); - result->setWeight(weight()); return result; } @@ -95,11 +94,6 @@ double ParticleLayout::totalParticleSurfaceDensity() const return iff_density > 0.0 ? iff_density : m_total_particle_density; } -double ParticleLayout::weightedParticleSurfaceDensity() const -{ - return weight() * totalParticleSurfaceDensity(); -} - //! Sets total particle surface density. //! @param particle_density: number of particles per square nanometer void ParticleLayout::setTotalParticleSurfaceDensity(double particle_density) diff --git a/Sample/Aggregate/ParticleLayout.h b/Sample/Aggregate/ParticleLayout.h index 04b275f9cacb04c61806c37f1b2911537a3811dc..3c79c1da0ccf65bbf57a32848bab4263faad19b8 100644 --- a/Sample/Aggregate/ParticleLayout.h +++ b/Sample/Aggregate/ParticleLayout.h @@ -49,21 +49,12 @@ public: double totalParticleSurfaceDensity() const; void setTotalParticleSurfaceDensity(double particle_density); - //! Returns the relative weight of this layout - double weight() const { return m_weight; } - - //! Sets the relative weight of this layout - void setWeight(double weight) { m_weight = weight; } - - double weightedParticleSurfaceDensity() const; - std::string validate() const override; private: void addAndRegisterAbstractParticle(IParticle* child); void setAndRegisterInterference(IInterference* child); - double m_weight{1}; double m_total_particle_density{.01}; OwningVector<IParticle> m_particles; //!< Vector of particle types std::unique_ptr<IInterference> m_interparticle; diff --git a/Sim/Export/SampleToPython.cpp b/Sim/Export/SampleToPython.cpp index 3d9a46567d720514c406f898e29e61f32fc65a01..77b48827128d3c068d71a8cd5b92c690b01de34e 100644 --- a/Sim/Export/SampleToPython.cpp +++ b/Sim/Export/SampleToPython.cpp @@ -359,7 +359,6 @@ std::string SampleToPython::defineParticleLayouts() const } if (const auto* iff = NodeUtils::OnlyChildOfType<IInterference>(*s)) result << indent() << key << ".setInterference(" << m_objs->obj2key(iff) << ")\n"; - result << indent() << key << ".setWeight(" << s->weight() << ")\n"; result << indent() << key << ".setTotalParticleSurfaceDensity(" << s->totalParticleSurfaceDensity() << ")\n"; } diff --git a/Tests/Unit/Resample/MultilayerAveragingTest.cpp b/Tests/Unit/Resample/MultilayerAveragingTest.cpp index 1fe344c89606487f071b34c54df579bc76543563..55efa192b7dea6f92ad97bf674160ef87801fb92 100644 --- a/Tests/Unit/Resample/MultilayerAveragingTest.cpp +++ b/Tests/Unit/Resample/MultilayerAveragingTest.cpp @@ -34,12 +34,10 @@ TEST_F(MultilayerAveragingTest, AverageMultilayer) ParticleLayout layout_1; layout_1.addParticle(particle); layout_1.setInterference(interf_1); - EXPECT_DOUBLE_EQ(layout_1.weight(), 1.0); ParticleLayout layout_2; layout_2.addParticle(particle); layout_2.setInterference(interf_2); - EXPECT_DOUBLE_EQ(layout_2.weight(), 1.0); Layer layer_1(vacuum); Layer layer_2(stone); @@ -55,11 +53,6 @@ TEST_F(MultilayerAveragingTest, AverageMultilayer) const auto sample_1 = reSample::make(m_layer, opts); - layout_1.setWeight(0.5); - EXPECT_DOUBLE_EQ(layout_1.weight(), 0.5); - layout_2.setWeight(0.5); - EXPECT_DOUBLE_EQ(layout_2.weight(), 0.5); - Layer layer_21(vacuum); Layer layer_22(stone); diff --git a/auto/Wrap/doxygenBase.i b/auto/Wrap/doxygenBase.i index 27c75850c3ab198ffbca0c4f4846c5a975f92b29..92c5faf818889dc18b0703317528bc622b8c5fe0 100644 --- a/auto/Wrap/doxygenBase.i +++ b/auto/Wrap/doxygenBase.i @@ -671,11 +671,9 @@ IPixel::solidAngle"; // File: classOwningVector.xml %feature("docstring") OwningVector " -The objects pointed to must posses a clone() function. - A vector of unique pointers to objects that are cloneable. -Equips vector<unique_ptr<T>> with copy constructor. For use with polymorphic objects, or in pimpl idiom. +Equips vector<unique_ptr<T>> with copy constructor. For use with polymorphic objects, or in pimpl idiom. If the copy constructor or the copy assignment operator is used, then there must be a function T::clone(). C++ includes: OwningVector.h "; diff --git a/auto/Wrap/doxygenSample.i b/auto/Wrap/doxygenSample.i index 412b3ba86c7a36a7da683130b407e4fbbd1c8ce6..ced97e47a389f7b6bdab6c64028e46f63ccd5d86 100644 --- a/auto/Wrap/doxygenSample.i +++ b/auto/Wrap/doxygenSample.i @@ -3411,19 +3411,6 @@ particle_density: number of particles per square nanometer "; -%feature("docstring") ParticleLayout::weight "double ParticleLayout::weight() const -ParticleLayout::weight -Returns the relative weight of this layout. -"; - -%feature("docstring") ParticleLayout::setWeight "void ParticleLayout::setWeight(double weight) -ParticleLayout::setWeight -Sets the relative weight of this layout. -"; - -%feature("docstring") ParticleLayout::weightedParticleSurfaceDensity "double ParticleLayout::weightedParticleSurfaceDensity() const -ParticleLayout::weightedParticleSurfaceDensity"; - %feature("docstring") ParticleLayout::validate "std::string ParticleLayout::validate() const override ParticleLayout::validate"; diff --git a/auto/Wrap/libBornAgainSample.py b/auto/Wrap/libBornAgainSample.py index a355ff90cd1fc84b251e05819815e507e673499d..cd3713c8c1aca31ccde3e6f73ccc526deb21cd77 100644 --- a/auto/Wrap/libBornAgainSample.py +++ b/auto/Wrap/libBornAgainSample.py @@ -6692,34 +6692,6 @@ class ParticleLayout(ISampleNode): """ return _libBornAgainSample.ParticleLayout_setTotalParticleSurfaceDensity(self, particle_density) - def weight(self): - r""" - weight(ParticleLayout self) -> double - double ParticleLayout::weight() const - ParticleLayout::weight - Returns the relative weight of this layout. - - """ - return _libBornAgainSample.ParticleLayout_weight(self) - - def setWeight(self, weight): - r""" - setWeight(ParticleLayout self, double weight) - void ParticleLayout::setWeight(double weight) - ParticleLayout::setWeight - Sets the relative weight of this layout. - - """ - return _libBornAgainSample.ParticleLayout_setWeight(self, weight) - - def weightedParticleSurfaceDensity(self): - r""" - weightedParticleSurfaceDensity(ParticleLayout self) -> double - double ParticleLayout::weightedParticleSurfaceDensity() const - ParticleLayout::weightedParticleSurfaceDensity - """ - return _libBornAgainSample.ParticleLayout_weightedParticleSurfaceDensity(self) - def validate(self): r""" validate(ParticleLayout self) -> std::string diff --git a/auto/Wrap/libBornAgainSample_wrap.cpp b/auto/Wrap/libBornAgainSample_wrap.cpp index c5a13ce52bd1d6563883e6df7b9bb59cab2ff11f..f0801643c43ccd4c4c231dd42adba617cdc9ce5d 100644 --- a/auto/Wrap/libBornAgainSample_wrap.cpp +++ b/auto/Wrap/libBornAgainSample_wrap.cpp @@ -46107,81 +46107,6 @@ fail: } -SWIGINTERN PyObject *_wrap_ParticleLayout_weight(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - ParticleLayout *arg1 = (ParticleLayout *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - double result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ParticleLayout, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ParticleLayout_weight" "', argument " "1"" of type '" "ParticleLayout const *""'"); - } - arg1 = reinterpret_cast< ParticleLayout * >(argp1); - result = (double)((ParticleLayout const *)arg1)->weight(); - resultobj = SWIG_From_double(static_cast< double >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ParticleLayout_setWeight(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - ParticleLayout *arg1 = (ParticleLayout *) 0 ; - double arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - double val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "ParticleLayout_setWeight", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ParticleLayout, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ParticleLayout_setWeight" "', argument " "1"" of type '" "ParticleLayout *""'"); - } - arg1 = reinterpret_cast< ParticleLayout * >(argp1); - ecode2 = SWIG_AsVal_double(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ParticleLayout_setWeight" "', argument " "2"" of type '" "double""'"); - } - arg2 = static_cast< double >(val2); - (arg1)->setWeight(arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ParticleLayout_weightedParticleSurfaceDensity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - ParticleLayout *arg1 = (ParticleLayout *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - double result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ParticleLayout, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ParticleLayout_weightedParticleSurfaceDensity" "', argument " "1"" of type '" "ParticleLayout const *""'"); - } - arg1 = reinterpret_cast< ParticleLayout * >(argp1); - result = (double)((ParticleLayout const *)arg1)->weightedParticleSurfaceDensity(); - resultobj = SWIG_From_double(static_cast< double >(result)); - return resultobj; -fail: - return NULL; -} - - SWIGINTERN PyObject *_wrap_ParticleLayout_validate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; ParticleLayout *arg1 = (ParticleLayout *) 0 ; @@ -64448,25 +64373,6 @@ static PyMethodDef SwigMethods[] = { "number of particles per square nanometer \n" "\n" ""}, - { "ParticleLayout_weight", _wrap_ParticleLayout_weight, METH_O, "\n" - "ParticleLayout_weight(ParticleLayout self) -> double\n" - "double ParticleLayout::weight() const\n" - "ParticleLayout::weight\n" - "Returns the relative weight of this layout. \n" - "\n" - ""}, - { "ParticleLayout_setWeight", _wrap_ParticleLayout_setWeight, METH_VARARGS, "\n" - "ParticleLayout_setWeight(ParticleLayout self, double weight)\n" - "void ParticleLayout::setWeight(double weight)\n" - "ParticleLayout::setWeight\n" - "Sets the relative weight of this layout. \n" - "\n" - ""}, - { "ParticleLayout_weightedParticleSurfaceDensity", _wrap_ParticleLayout_weightedParticleSurfaceDensity, METH_O, "\n" - "ParticleLayout_weightedParticleSurfaceDensity(ParticleLayout self) -> double\n" - "double ParticleLayout::weightedParticleSurfaceDensity() const\n" - "ParticleLayout::weightedParticleSurfaceDensity\n" - ""}, { "ParticleLayout_validate", _wrap_ParticleLayout_validate, METH_O, "\n" "ParticleLayout_validate(ParticleLayout self) -> std::string\n" "std::string ParticleLayout::validate() const override\n"