diff --git a/Sample/Particle/Particle.cpp b/Sample/Particle/Particle.cpp index 91040bf94101b8f35124e4b4840f580fc5f3fb4e..70fd7f34f120d8088cd84c010aabc62eadbb52c5 100644 --- a/Sample/Particle/Particle.cpp +++ b/Sample/Particle/Particle.cpp @@ -24,12 +24,6 @@ Particle::Particle(Material material, const IFormFactor& formfactor) { } -Particle::Particle(Material material, const IFormFactor& formfactor, const IRotation& rotation) - : Particle(material, formfactor) -{ - rotate(rotation); -} - Particle::~Particle() = default; Particle* Particle::clone() const diff --git a/Sample/Particle/Particle.h b/Sample/Particle/Particle.h index fd3ce0f4048835f556ee17184371059a9a72a176..7a670c838a76e11d7cd6fade2402d0001acbf6cf 100644 --- a/Sample/Particle/Particle.h +++ b/Sample/Particle/Particle.h @@ -26,7 +26,6 @@ class IFormFactor; class Particle : public IParticle { public: Particle(Material material, const IFormFactor& formfactor); - Particle(Material material, const IFormFactor& formfactor, const IRotation& rotation); ~Particle() override; Particle* clone() const override; diff --git a/Sample/StandardSamples/CustomMorphologyBuilder.cpp b/Sample/StandardSamples/CustomMorphologyBuilder.cpp index 3ef0a607e29da72c839da0b4237afa7b3a87754e..3e4871e587dda02f2a50447358cdfe8658ad6421 100644 --- a/Sample/StandardSamples/CustomMorphologyBuilder.cpp +++ b/Sample/StandardSamples/CustomMorphologyBuilder.cpp @@ -42,63 +42,72 @@ MultiLayer* ExemplarySamples::createCustomMorphology() Box ff2(2.0, 4.0, 1.0); R3 pos2(5.0, 5.0, 0.0); RotationZ m2(10 * deg); - Particle p2(mat_particle, ff2, m2); + Particle p2(mat_particle, ff2); + p2.rotate(m2); p2.translate(pos2); particle_layout.addParticle(p2, 0.5); // add particle number 3: Box ff3(2.0, 6.0, 1.0); R3 pos3(-5.0, -5.0, 0.0); RotationZ m3(20 * deg); - Particle p3(mat_particle, ff3, m3); + Particle p3(mat_particle, ff3); + p3.rotate(m3); p3.translate(pos3); particle_layout.addParticle(p3, 0.5); // add particle number 4: Box ff4(2.0, 8.0, 1.0); R3 pos4(5.0, -5.0, 0.0); RotationZ m4(30 * deg); - Particle p4(mat_particle, ff4, m4); + Particle p4(mat_particle, ff4); + p4.rotate(m4); p4.translate(pos4); particle_layout.addParticle(p4, 0.5); // add particle number 5: Box ff5(2.0, 10.0, 1.0); R3 pos5(-5.0, 5.0, 0.0); RotationZ m5(40 * deg); - Particle p5(mat_particle, ff5, m5); + Particle p5(mat_particle, ff5); + p5.rotate(m5); p5.translate(pos5); particle_layout.addParticle(p5, 0.5); // add particle number 6: Box ff6(2.0, 2.0, 1.0); R3 pos6(0.0, 0.0, 0.0); RotationZ m6(50 * deg); - Particle p6(mat_particle, ff6, m6); + Particle p6(mat_particle, ff6); + p6.rotate(m6); p6.translate(pos6); particle_layout.addParticle(p6, 0.5); // add particle number 7: Box ff7(2.0, 4.0, 1.0); R3 pos7(5.0, 5.0, 0.0); RotationZ m7(60 * deg); - Particle p7(mat_particle, ff7, m7); + Particle p7(mat_particle, ff7); + p7.rotate(m7); p7.translate(pos7); particle_layout.addParticle(p7, 0.5); // add particle number 8: Box ff8(2.0, 6.0, 1.0); R3 pos8(-5.0, -5.0, 0.0); RotationZ m8(70 * deg); - Particle p8(mat_particle, ff8, m8); + Particle p8(mat_particle, ff8); + p8.rotate(m8); p8.translate(pos8); particle_layout.addParticle(p8, 0.5); // add particle number 9: Box ff9(2.0, 8.0, 1.0); R3 pos9(5.0, -5.0, 0.0); RotationZ m9(80 * deg); - Particle p9(mat_particle, ff9, m9); + Particle p9(mat_particle, ff9); + p9.rotate(m9); p9.translate(pos9); particle_layout.addParticle(p9, 0.5); // add particle number 10: Box ff10(2.0, 10.0, 1.0); R3 pos10(-5.0, 5.0, 0.0); RotationZ m10(90 * deg); - Particle p10(mat_particle, ff10, m10); + Particle p10(mat_particle, ff10); + p10.rotate(m10); p10.translate(pos10); particle_layout.addParticle(p10, 0.5); vacuum_layer.addLayout(particle_layout); diff --git a/auto/Wrap/libBornAgainSample.py b/auto/Wrap/libBornAgainSample.py index 360b94a8c86888228709196dccb7e5fd2cdae2e5..3c3e8a66c8e67a62c69b5fd0fe9ef46f8a0612d6 100644 --- a/auto/Wrap/libBornAgainSample.py +++ b/auto/Wrap/libBornAgainSample.py @@ -3098,12 +3098,9 @@ class Particle(IParticle): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr - def __init__(self, *args): - r""" - __init__(Particle self, Material material, IFormFactor formfactor) -> Particle - __init__(Particle self, Material material, IFormFactor formfactor, IRotation rotation) -> Particle - """ - _libBornAgainSample.Particle_swiginit(self, _libBornAgainSample.new_Particle(*args)) + def __init__(self, material, formfactor): + r"""__init__(Particle self, Material material, IFormFactor formfactor) -> Particle""" + _libBornAgainSample.Particle_swiginit(self, _libBornAgainSample.new_Particle(material, formfactor)) __swig_destroy__ = _libBornAgainSample.delete_Particle def clone(self): diff --git a/auto/Wrap/libBornAgainSample_wrap.cpp b/auto/Wrap/libBornAgainSample_wrap.cpp index b753164cdeb2700b98a8fc664197fcb939262e3f..0d85bd5748227e601b01f08e2064c943a52c4545 100644 --- a/auto/Wrap/libBornAgainSample_wrap.cpp +++ b/auto/Wrap/libBornAgainSample_wrap.cpp @@ -36908,7 +36908,7 @@ SWIGINTERN PyObject *Mesocrystal_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObje return SWIG_Python_InitShadowInstance(args); } -SWIGINTERN PyObject *_wrap_new_Particle__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) { +SWIGINTERN PyObject *_wrap_new_Particle(PyObject *self, PyObject *args) { PyObject *resultobj = 0; SwigValueWrapper< Material > arg1 ; IFormFactor *arg2 = 0 ; @@ -36916,9 +36916,10 @@ SWIGINTERN PyObject *_wrap_new_Particle__SWIG_0(PyObject *self, Py_ssize_t nobjs int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; + PyObject *swig_obj[2] ; Particle *result = 0 ; - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + if (!SWIG_Python_UnpackTuple(args, "new_Particle", 2, 2, swig_obj)) SWIG_fail; { res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_Material, 0 | 0); if (!SWIG_IsOK(res1)) { @@ -36948,103 +36949,6 @@ fail: } -SWIGINTERN PyObject *_wrap_new_Particle__SWIG_1(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - SwigValueWrapper< Material > arg1 ; - IFormFactor *arg2 = 0 ; - IRotation *arg3 = 0 ; - void *argp1 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - Particle *result = 0 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - { - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_Material, 0 | 0); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Particle" "', argument " "1"" of type '" "Material""'"); - } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Particle" "', argument " "1"" of type '" "Material""'"); - } else { - Material * temp = reinterpret_cast< Material * >(argp1); - arg1 = *temp; - if (SWIG_IsNewObj(res1)) delete temp; - } - } - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_IFormFactor, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Particle" "', argument " "2"" of type '" "IFormFactor const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Particle" "', argument " "2"" of type '" "IFormFactor const &""'"); - } - arg2 = reinterpret_cast< IFormFactor * >(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_IRotation, 0 | 0); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_Particle" "', argument " "3"" of type '" "IRotation const &""'"); - } - if (!argp3) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Particle" "', argument " "3"" of type '" "IRotation const &""'"); - } - arg3 = reinterpret_cast< IRotation * >(argp3); - result = (Particle *)new Particle(arg1,(IFormFactor const &)*arg2,(IRotation const &)*arg3); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Particle, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_Particle(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "new_Particle", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v = 0; - int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_Material, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_IFormFactor, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_Particle__SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v = 0; - int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_Material, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_IFormFactor, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_IRotation, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_Particle__SWIG_1(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_Particle'.\n" - " Possible C/C++ prototypes are:\n" - " Particle::Particle(Material,IFormFactor const &)\n" - " Particle::Particle(Material,IFormFactor const &,IRotation const &)\n"); - return 0; -} - - SWIGINTERN PyObject *_wrap_delete_Particle(PyObject *self, PyObject *args) { PyObject *resultobj = 0; Particle *arg1 = (Particle *) 0 ; @@ -61361,10 +61265,7 @@ static PyMethodDef SwigMethods[] = { { "Mesocrystal_validate", _wrap_Mesocrystal_validate, METH_O, "Mesocrystal_validate(Mesocrystal self) -> std::string"}, { "Mesocrystal_swigregister", Mesocrystal_swigregister, METH_O, NULL}, { "Mesocrystal_swiginit", Mesocrystal_swiginit, METH_VARARGS, NULL}, - { "new_Particle", _wrap_new_Particle, METH_VARARGS, "\n" - "Particle(Material material, IFormFactor formfactor)\n" - "new_Particle(Material material, IFormFactor formfactor, IRotation rotation) -> Particle\n" - ""}, + { "new_Particle", _wrap_new_Particle, METH_VARARGS, "new_Particle(Material material, IFormFactor formfactor) -> Particle"}, { "delete_Particle", _wrap_delete_Particle, METH_O, "delete_Particle(Particle self)"}, { "Particle_clone", _wrap_Particle_clone, METH_O, "Particle_clone(Particle self) -> Particle"}, { "Particle_className", _wrap_Particle_className, METH_O, "Particle_className(Particle self) -> std::string"},