diff --git a/GUI/Model/From/GUISampleBuilder.cpp b/GUI/Model/From/GUISampleBuilder.cpp index 10f31c553279b1408fad965efef161d7ae6aa145..56cd8f585dc89c72b24b3a4a935578afdc2d3a60 100644 --- a/GUI/Model/From/GUISampleBuilder.cpp +++ b/GUI/Model/From/GUISampleBuilder.cpp @@ -149,7 +149,7 @@ void GUISampleBuilder::copyParticle(const IParticle* iparticle, FromDomain::setFormFactor(mesoItem, meso->outerShape()); FromDomain::setRotation(mesoItem, meso->rotation()); - auto lattice = meso->particleStructure().transformedLattice(); + auto lattice = meso->particleStructure().rotatedLattice(); mesoItem->setVectorA(lattice.getBasisVectorA()); mesoItem->setVectorB(lattice.getBasisVectorB()); mesoItem->setVectorC(lattice.getBasisVectorC()); diff --git a/Sample/Lattice/Lattice3D.cpp b/Sample/Lattice/Lattice3D.cpp index ce95e1d765e509814b35731b657b4ceab3bb6eab..ec17a00adf1945a4fcdbaffb3d26653bedd0b4d2 100644 --- a/Sample/Lattice/Lattice3D.cpp +++ b/Sample/Lattice/Lattice3D.cpp @@ -31,11 +31,11 @@ Lattice3D::Lattice3D(const Lattice3D& lattice) : Lattice3D(lattice.m_a, lattice. Lattice3D::~Lattice3D() = default; -Lattice3D Lattice3D::transformed(const RotMatrix& transform) const +Lattice3D Lattice3D::rotated(const RotMatrix& rotMatrix) const { - R3 q1 = transform.transformed(m_a); - R3 q2 = transform.transformed(m_b); - R3 q3 = transform.transformed(m_c); + R3 q1 = rotMatrix.transformed(m_a); + R3 q2 = rotMatrix.transformed(m_b); + R3 q3 = rotMatrix.transformed(m_c); Lattice3D result = {q1, q2, q3}; if (m_selection_rule) result.setSelectionRule(*m_selection_rule); diff --git a/Sample/Lattice/Lattice3D.h b/Sample/Lattice/Lattice3D.h index 2fb174a29b94e2625731c74d65ba88a86799bc5b..30db2c1f3c96dbb818de7a0e6edffef292924072 100644 --- a/Sample/Lattice/Lattice3D.h +++ b/Sample/Lattice/Lattice3D.h @@ -37,8 +37,8 @@ public: ~Lattice3D() override; Lattice3D& operator=(const Lattice3D&) = delete; - //! Creates transformed lattice - Lattice3D transformed(const RotMatrix& transform) const; + //! Creates rotated lattice + Lattice3D rotated(const RotMatrix& rotMatrix) const; //! Returns basis vector a R3 getBasisVectorA() const { return m_a; } diff --git a/Sample/Particle/Crystal.cpp b/Sample/Particle/Crystal.cpp index d011422b4126f5c150e91da8ec222d8af5f431b7..20c137052dce9ac20f39621b3638acc172e2570a 100644 --- a/Sample/Particle/Crystal.cpp +++ b/Sample/Particle/Crystal.cpp @@ -42,13 +42,13 @@ Crystal* Crystal::clone() const IFormFactor* Crystal::createTotalFormFactor(const IFormFactor& meso_crystal_form_factor, const IRotation* rotation, const R3& translation) const { - Lattice3D transformed_lattice = transformedLattice(rotation); + Lattice3D rotated_lattice = rotatedLattice(rotation); std::unique_ptr<IParticle> basis_clone{m_basis->clone()}; if (rotation) basis_clone->rotate(*rotation); basis_clone->translate(translation); const std::unique_ptr<IFormFactor> basis_ff(basis_clone->createFormFactor()); - return new FormFactorCrystal(transformed_lattice, *basis_ff, meso_crystal_form_factor, + return new FormFactorCrystal(rotated_lattice, *basis_ff, meso_crystal_form_factor, m_position_variance); } @@ -70,11 +70,11 @@ Admixtures Crystal::admixtures() const return result; } -Lattice3D Crystal::transformedLattice(const IRotation* rotation) const +Lattice3D Crystal::rotatedLattice(const IRotation* rotation) const { if (!rotation) return m_lattice; - return m_lattice.transformed(rotation->getRotMatrix()); + return m_lattice.rotated(rotation->getRotMatrix()); } std::vector<const INode*> Crystal::getChildren() const diff --git a/Sample/Particle/Crystal.h b/Sample/Particle/Crystal.h index b33e4d2c6cccb8a12e7a174bbc21c8c2014d0af7..e7926a1f3a1f86a05a89ef1e9cb87dcfc1804349 100644 --- a/Sample/Particle/Crystal.h +++ b/Sample/Particle/Crystal.h @@ -48,7 +48,7 @@ public: Admixtures admixtures() const; - Lattice3D transformedLattice(const IRotation* rotation = nullptr) const; + Lattice3D rotatedLattice(const IRotation* rotation = nullptr) const; // TODO provide Py example std::vector<const INode*> getChildren() const override; const IParticle* basis() const; diff --git a/Tests/Unit/Sample/LatticeTest.cpp b/Tests/Unit/Sample/LatticeTest.cpp index f2d01aef345d8b2ca25dc7bfc5649d74afa6d59f..2670b84c430b362f8e5ba1c25f871d3004b853e1 100644 --- a/Tests/Unit/Sample/LatticeTest.cpp +++ b/Tests/Unit/Sample/LatticeTest.cpp @@ -42,7 +42,7 @@ TEST_F(LatticeTest, reciprocalTest) EXPECT_EQ(m_rc, b3); } -// tests whether Lattice has been transformed correctly +// tests whether Lattice has been rotated correctly TEST_F(LatticeTest, transformTest) { R3 a1(1, 0, 0); @@ -52,7 +52,7 @@ TEST_F(LatticeTest, transformTest) // use rotation by 90 degrees around z axis as a transformation RotMatrix tr = RotMatrix::createRotateZ(M_TWOPI / 4); - Lattice3D ltr = l1.transformed(tr); + Lattice3D ltr = l1.rotated(tr); // use EXPECT_NEAR as transform (matrix multiplication) uses double value for rotation angle // e.g. Rotating the vector (1,0,0) by 2*PI about z would give something like (0.99999,0,0) diff --git a/auto/Wrap/doxygenSample.i b/auto/Wrap/doxygenSample.i index c3d3ef4d8c28e3c4dd5c97b461d82d61ca3dfe34..5bd447167d935f7eaee756d617ed15b122b06ace 100644 --- a/auto/Wrap/doxygenSample.i +++ b/auto/Wrap/doxygenSample.i @@ -175,7 +175,7 @@ Returns a clone of this ISampleNode object. %feature("docstring") Crystal::admixtures "Admixtures Crystal::admixtures() const "; -%feature("docstring") Crystal::transformedLattice "Lattice3D Crystal::transformedLattice(const IRotation *rotation=nullptr) const +%feature("docstring") Crystal::rotatedLattice "Lattice3D Crystal::rotatedLattice(const IRotation *rotation=nullptr) const "; %feature("docstring") Crystal::getChildren "std::vector< const INode * > Crystal::getChildren() const override @@ -3905,9 +3905,9 @@ C++ includes: Lattice3D.h %feature("docstring") Lattice3D::~Lattice3D "Lattice3D::~Lattice3D() override "; -%feature("docstring") Lattice3D::transformed "Lattice3D Lattice3D::transformed(const RotMatrix &transform) const +%feature("docstring") Lattice3D::rotated "Lattice3D Lattice3D::rotated(const RotMatrix &rotMatrix) const -Creates transformed lattice. +Creates rotated lattice. "; %feature("docstring") Lattice3D::getBasisVectorA "R3 Lattice3D::getBasisVectorA() const diff --git a/auto/Wrap/libBornAgainSample.py b/auto/Wrap/libBornAgainSample.py index 209e72d1a0267c63a7e5b3b31e22eab31a3801e0..51c04b8353f336e15231acb5869fa8d47a80362d 100644 --- a/auto/Wrap/libBornAgainSample.py +++ b/auto/Wrap/libBornAgainSample.py @@ -4282,13 +4282,13 @@ class Crystal(ISampleNode): """ return _libBornAgainSample.Crystal_admixtures(self) - def transformedLattice(self, rotation=None): + def rotatedLattice(self, rotation=None): r""" - transformedLattice(Crystal self, IRotation rotation=None) -> Lattice3D - Lattice3D Crystal::transformedLattice(const IRotation *rotation=nullptr) const + rotatedLattice(Crystal self, IRotation rotation=None) -> Lattice3D + Lattice3D Crystal::rotatedLattice(const IRotation *rotation=nullptr) const """ - return _libBornAgainSample.Crystal_transformedLattice(self, rotation) + return _libBornAgainSample.Crystal_rotatedLattice(self, rotation) def getChildren(self): r""" @@ -11071,15 +11071,15 @@ class Lattice3D(libBornAgainParam.INode): _libBornAgainSample.Lattice3D_swiginit(self, _libBornAgainSample.new_Lattice3D(*args)) __swig_destroy__ = _libBornAgainSample.delete_Lattice3D - def transformed(self, transform): + def rotated(self, rotMatrix): r""" - transformed(Lattice3D self, RotMatrix transform) -> Lattice3D - Lattice3D Lattice3D::transformed(const RotMatrix &transform) const + rotated(Lattice3D self, RotMatrix rotMatrix) -> Lattice3D + Lattice3D Lattice3D::rotated(const RotMatrix &rotMatrix) const - Creates transformed lattice. + Creates rotated lattice. """ - return _libBornAgainSample.Lattice3D_transformed(self, transform) + return _libBornAgainSample.Lattice3D_rotated(self, rotMatrix) def getBasisVectorA(self): r""" diff --git a/auto/Wrap/libBornAgainSample_wrap.cpp b/auto/Wrap/libBornAgainSample_wrap.cpp index 9b346171e8b414fe5dbdc7513175279b8c8d56c1..905f7f8ab7f9c03b94aa1522c4035da933178dc4 100644 --- a/auto/Wrap/libBornAgainSample_wrap.cpp +++ b/auto/Wrap/libBornAgainSample_wrap.cpp @@ -43104,7 +43104,7 @@ fail: } -SWIGINTERN PyObject *_wrap_Crystal_transformedLattice__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { +SWIGINTERN PyObject *_wrap_Crystal_rotatedLattice__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; Crystal *arg1 = (Crystal *) 0 ; IRotation *arg2 = (IRotation *) 0 ; @@ -43117,15 +43117,15 @@ SWIGINTERN PyObject *_wrap_Crystal_transformedLattice__SWIG_0(PyObject *SWIGUNUS if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Crystal, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Crystal_transformedLattice" "', argument " "1"" of type '" "Crystal const *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Crystal_rotatedLattice" "', argument " "1"" of type '" "Crystal const *""'"); } arg1 = reinterpret_cast< Crystal * >(argp1); res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_IRotation, 0 | 0 ); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Crystal_transformedLattice" "', argument " "2"" of type '" "IRotation const *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Crystal_rotatedLattice" "', argument " "2"" of type '" "IRotation const *""'"); } arg2 = reinterpret_cast< IRotation * >(argp2); - result = ((Crystal const *)arg1)->transformedLattice((IRotation const *)arg2); + result = ((Crystal const *)arg1)->rotatedLattice((IRotation const *)arg2); resultobj = SWIG_NewPointerObj((new Lattice3D(static_cast< const Lattice3D& >(result))), SWIGTYPE_p_Lattice3D, SWIG_POINTER_OWN | 0 ); return resultobj; fail: @@ -43133,7 +43133,7 @@ fail: } -SWIGINTERN PyObject *_wrap_Crystal_transformedLattice__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { +SWIGINTERN PyObject *_wrap_Crystal_rotatedLattice__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; Crystal *arg1 = (Crystal *) 0 ; void *argp1 = 0 ; @@ -43143,10 +43143,10 @@ SWIGINTERN PyObject *_wrap_Crystal_transformedLattice__SWIG_1(PyObject *SWIGUNUS if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Crystal, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Crystal_transformedLattice" "', argument " "1"" of type '" "Crystal const *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Crystal_rotatedLattice" "', argument " "1"" of type '" "Crystal const *""'"); } arg1 = reinterpret_cast< Crystal * >(argp1); - result = ((Crystal const *)arg1)->transformedLattice(); + result = ((Crystal const *)arg1)->rotatedLattice(); resultobj = SWIG_NewPointerObj((new Lattice3D(static_cast< const Lattice3D& >(result))), SWIGTYPE_p_Lattice3D, SWIG_POINTER_OWN | 0 ); return resultobj; fail: @@ -43154,13 +43154,13 @@ fail: } -SWIGINTERN PyObject *_wrap_Crystal_transformedLattice(PyObject *self, PyObject *args) { +SWIGINTERN PyObject *_wrap_Crystal_rotatedLattice(PyObject *self, PyObject *args) { Py_ssize_t argc; PyObject *argv[3] = { 0 }; - if (!(argc = SWIG_Python_UnpackTuple(args, "Crystal_transformedLattice", 0, 2, argv))) SWIG_fail; + if (!(argc = SWIG_Python_UnpackTuple(args, "Crystal_rotatedLattice", 0, 2, argv))) SWIG_fail; --argc; if (argc == 1) { int _v; @@ -43168,7 +43168,7 @@ SWIGINTERN PyObject *_wrap_Crystal_transformedLattice(PyObject *self, PyObject * int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Crystal, 0); _v = SWIG_CheckState(res); if (_v) { - return _wrap_Crystal_transformedLattice__SWIG_1(self, argc, argv); + return _wrap_Crystal_rotatedLattice__SWIG_1(self, argc, argv); } } if (argc == 2) { @@ -43181,16 +43181,16 @@ SWIGINTERN PyObject *_wrap_Crystal_transformedLattice(PyObject *self, PyObject * int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_IRotation, 0); _v = SWIG_CheckState(res); if (_v) { - return _wrap_Crystal_transformedLattice__SWIG_0(self, argc, argv); + return _wrap_Crystal_rotatedLattice__SWIG_0(self, argc, argv); } } } fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'Crystal_transformedLattice'.\n" + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'Crystal_rotatedLattice'.\n" " Possible C/C++ prototypes are:\n" - " Crystal::transformedLattice(IRotation const *) const\n" - " Crystal::transformedLattice() const\n"); + " Crystal::rotatedLattice(IRotation const *) const\n" + " Crystal::rotatedLattice() const\n"); return 0; } @@ -65978,7 +65978,7 @@ fail: } -SWIGINTERN PyObject *_wrap_Lattice3D_transformed(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Lattice3D_rotated(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; Lattice3D *arg1 = (Lattice3D *) 0 ; RotMatrix *arg2 = 0 ; @@ -65989,21 +65989,21 @@ SWIGINTERN PyObject *_wrap_Lattice3D_transformed(PyObject *SWIGUNUSEDPARM(self), PyObject *swig_obj[2] ; SwigValueWrapper< Lattice3D > result; - if (!SWIG_Python_UnpackTuple(args, "Lattice3D_transformed", 2, 2, swig_obj)) SWIG_fail; + if (!SWIG_Python_UnpackTuple(args, "Lattice3D_rotated", 2, 2, swig_obj)) SWIG_fail; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Lattice3D, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Lattice3D_transformed" "', argument " "1"" of type '" "Lattice3D const *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Lattice3D_rotated" "', argument " "1"" of type '" "Lattice3D const *""'"); } arg1 = reinterpret_cast< Lattice3D * >(argp1); res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_RotMatrix, 0 | 0); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Lattice3D_transformed" "', argument " "2"" of type '" "RotMatrix const &""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Lattice3D_rotated" "', argument " "2"" of type '" "RotMatrix const &""'"); } if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Lattice3D_transformed" "', argument " "2"" of type '" "RotMatrix const &""'"); + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Lattice3D_rotated" "', argument " "2"" of type '" "RotMatrix const &""'"); } arg2 = reinterpret_cast< RotMatrix * >(argp2); - result = ((Lattice3D const *)arg1)->transformed((RotMatrix const &)*arg2); + result = ((Lattice3D const *)arg1)->rotated((RotMatrix const &)*arg2); resultobj = SWIG_NewPointerObj((new Lattice3D(static_cast< const Lattice3D& >(result))), SWIGTYPE_p_Lattice3D, SWIG_POINTER_OWN | 0 ); return resultobj; fail: @@ -69184,9 +69184,9 @@ static PyMethodDef SwigMethods[] = { "Admixtures Crystal::admixtures() const\n" "\n" ""}, - { "Crystal_transformedLattice", _wrap_Crystal_transformedLattice, METH_VARARGS, "\n" - "Crystal_transformedLattice(Crystal self, IRotation rotation=None) -> Lattice3D\n" - "Lattice3D Crystal::transformedLattice(const IRotation *rotation=nullptr) const\n" + { "Crystal_rotatedLattice", _wrap_Crystal_rotatedLattice, METH_VARARGS, "\n" + "Crystal_rotatedLattice(Crystal self, IRotation rotation=None) -> Lattice3D\n" + "Lattice3D Crystal::rotatedLattice(const IRotation *rotation=nullptr) const\n" "\n" ""}, { "Crystal_getChildren", _wrap_Crystal_getChildren, METH_O, "\n" @@ -72945,11 +72945,11 @@ static PyMethodDef SwigMethods[] = { "Lattice3D::~Lattice3D() override\n" "\n" ""}, - { "Lattice3D_transformed", _wrap_Lattice3D_transformed, METH_VARARGS, "\n" - "Lattice3D_transformed(Lattice3D self, RotMatrix transform) -> Lattice3D\n" - "Lattice3D Lattice3D::transformed(const RotMatrix &transform) const\n" + { "Lattice3D_rotated", _wrap_Lattice3D_rotated, METH_VARARGS, "\n" + "Lattice3D_rotated(Lattice3D self, RotMatrix rotMatrix) -> Lattice3D\n" + "Lattice3D Lattice3D::rotated(const RotMatrix &rotMatrix) const\n" "\n" - "Creates transformed lattice. \n" + "Creates rotated lattice. \n" "\n" ""}, { "Lattice3D_getBasisVectorA", _wrap_Lattice3D_getBasisVectorA, METH_O, "\n"