diff --git a/Core/Scattering/IFormFactorBorn.cpp b/Core/Scattering/IFormFactorBorn.cpp index 9eb35d02912d53071efc7bb1b9069117222904fd..5da8fae0a5454b42c674bee20174dfae50a72411 100644 --- a/Core/Scattering/IFormFactorBorn.cpp +++ b/Core/Scattering/IFormFactorBorn.cpp @@ -52,7 +52,7 @@ double IFormFactorBorn::topZ(const IRotation& rotation) const bool IFormFactorBorn::canSliceAnalytically(const IRotation& rot) const { - if (IsZRotation(rot)) + if (rot.zInvariant()) return true; return false; } diff --git a/Core/Scattering/Rotations.cpp b/Core/Scattering/Rotations.cpp index ed1da6d5e42bf3d47e7fb79533796f394f015e57..7a030489c5fac5c48765fb271eeb1195d0a16720 100644 --- a/Core/Scattering/Rotations.cpp +++ b/Core/Scattering/Rotations.cpp @@ -50,6 +50,12 @@ bool IRotation::isIdentity() const return getTransform3D().isIdentity(); } +bool IRotation::zInvariant() const +{ + return getTransform3D().isZRotation(); +} + + //! Returns concatenated rotation (first right, then left). IRotation* createProduct(const IRotation& left, const IRotation& right) @@ -60,12 +66,6 @@ IRotation* createProduct(const IRotation& left, const IRotation& right) return p_result; } -bool IsZRotation(const IRotation& rot) -{ - auto transform = rot.getTransform3D(); - return transform.isZRotation(); -} - // --- IdentityRotation ------------------------------------------------------- Transform3D IdentityRotation::getTransform3D() const diff --git a/Core/Scattering/Rotations.h b/Core/Scattering/Rotations.h index 19cfd88f182bfe1689722300a800e619de2cb953..21658cbf094db12c6f7fe2f42d16c6bf519e3a18 100644 --- a/Core/Scattering/Rotations.h +++ b/Core/Scattering/Rotations.h @@ -38,12 +38,12 @@ public: //! Returns true if rotation matrix is identity matrix (no rotations) virtual bool isIdentity() const; + + bool zInvariant() const; }; BA_CORE_API_ IRotation* createProduct(const IRotation& left, const IRotation& right); -bool IsZRotation(const IRotation& rot); - //! The identity rotation, which leaves everything in place. class BA_CORE_API_ IdentityRotation : public IRotation diff --git a/auto/Wrap/libBornAgainCore.py b/auto/Wrap/libBornAgainCore.py index 21dbddc16901edee013545951a4cdf2f2a29b13f..d5b81ce1d78dcf343901c56e22023d22c9946f8d 100644 --- a/auto/Wrap/libBornAgainCore.py +++ b/auto/Wrap/libBornAgainCore.py @@ -8367,16 +8367,6 @@ class IRotation(ISample): """ return _libBornAgainCore.IRotation_createInverse(self) - def accept(self, visitor): - r""" - accept(IRotation self, INodeVisitor visitor) - void IRotation::accept(INodeVisitor *visitor) const - - Calls the INodeVisitor's visit method. - - """ - return _libBornAgainCore.IRotation_accept(self, visitor) - def getTransform3D(self): r""" getTransform3D(IRotation self) -> Transform3D @@ -8397,6 +8387,10 @@ class IRotation(ISample): """ return _libBornAgainCore.IRotation_isIdentity(self) + def zInvariant(self): + r"""zInvariant(IRotation self) -> bool""" + return _libBornAgainCore.IRotation_zInvariant(self) + # Register IRotation in _libBornAgainCore: _libBornAgainCore.IRotation_swigregister(IRotation) @@ -8418,14 +8412,6 @@ def createProduct(left, right): """ return _libBornAgainCore.createProduct(left, right) - -def IsZRotation(rot): - r""" - IsZRotation(IRotation rot) -> bool - bool IsZRotation(const IRotation &rot) - - """ - return _libBornAgainCore.IsZRotation(rot) class IdentityRotation(IRotation): r""" diff --git a/auto/Wrap/libBornAgainCore_wrap.cpp b/auto/Wrap/libBornAgainCore_wrap.cpp index cb4d3f2cb8e63c057cf894e5edb9aa89d186ef1c..22334a629b2c1c9715c7efa32a16ca732c50880c 100644 --- a/auto/Wrap/libBornAgainCore_wrap.cpp +++ b/auto/Wrap/libBornAgainCore_wrap.cpp @@ -69731,59 +69731,53 @@ fail: } -SWIGINTERN PyObject *_wrap_IRotation_accept(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_IRotation_getTransform3D(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; IRotation *arg1 = (IRotation *) 0 ; - INodeVisitor *arg2 = (INodeVisitor *) 0 ; void *argp1 = 0 ; int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; + PyObject *swig_obj[1] ; + Transform3D result; - if (!SWIG_Python_UnpackTuple(args, "IRotation_accept", 2, 2, swig_obj)) SWIG_fail; + if (!args) SWIG_fail; + swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_IRotation, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IRotation_accept" "', argument " "1"" of type '" "IRotation const *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IRotation_getTransform3D" "', argument " "1"" of type '" "IRotation const *""'"); } arg1 = reinterpret_cast< IRotation * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_INodeVisitor, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IRotation_accept" "', argument " "2"" of type '" "INodeVisitor *""'"); - } - arg2 = reinterpret_cast< INodeVisitor * >(argp2); - ((IRotation const *)arg1)->accept(arg2); - resultobj = SWIG_Py_Void(); + result = ((IRotation const *)arg1)->getTransform3D(); + resultobj = SWIG_NewPointerObj((new Transform3D(static_cast< const Transform3D& >(result))), SWIGTYPE_p_Transform3D, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } -SWIGINTERN PyObject *_wrap_IRotation_getTransform3D(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_IRotation_isIdentity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; IRotation *arg1 = (IRotation *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject *swig_obj[1] ; - Transform3D result; + bool result; if (!args) SWIG_fail; swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_IRotation, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IRotation_getTransform3D" "', argument " "1"" of type '" "IRotation const *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IRotation_isIdentity" "', argument " "1"" of type '" "IRotation const *""'"); } arg1 = reinterpret_cast< IRotation * >(argp1); - result = ((IRotation const *)arg1)->getTransform3D(); - resultobj = SWIG_NewPointerObj((new Transform3D(static_cast< const Transform3D& >(result))), SWIGTYPE_p_Transform3D, SWIG_POINTER_OWN | 0 ); + result = (bool)((IRotation const *)arg1)->isIdentity(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } -SWIGINTERN PyObject *_wrap_IRotation_isIdentity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_IRotation_zInvariant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; IRotation *arg1 = (IRotation *) 0 ; void *argp1 = 0 ; @@ -69795,10 +69789,10 @@ SWIGINTERN PyObject *_wrap_IRotation_isIdentity(PyObject *SWIGUNUSEDPARM(self), swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_IRotation, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IRotation_isIdentity" "', argument " "1"" of type '" "IRotation const *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IRotation_zInvariant" "', argument " "1"" of type '" "IRotation const *""'"); } arg1 = reinterpret_cast< IRotation * >(argp1); - result = (bool)((IRotation const *)arg1)->isIdentity(); + result = (bool)((IRotation const *)arg1)->zInvariant(); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: @@ -69849,32 +69843,6 @@ fail: } -SWIGINTERN PyObject *_wrap_IsZRotation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - IRotation *arg1 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_IRotation, 0 | 0); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IsZRotation" "', argument " "1"" of type '" "IRotation const &""'"); - } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "IsZRotation" "', argument " "1"" of type '" "IRotation const &""'"); - } - arg1 = reinterpret_cast< IRotation * >(argp1); - result = (bool)IsZRotation((IRotation const &)*arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - SWIGINTERN PyObject *_wrap_new_IdentityRotation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; IdentityRotation *result = 0 ; @@ -125570,13 +125538,6 @@ static PyMethodDef SwigMethods[] = { "Returns a new IRotation object that is the current object's inverse. \n" "\n" ""}, - { "IRotation_accept", _wrap_IRotation_accept, METH_VARARGS, "\n" - "IRotation_accept(IRotation self, INodeVisitor visitor)\n" - "void IRotation::accept(INodeVisitor *visitor) const\n" - "\n" - "Calls the INodeVisitor's visit method. \n" - "\n" - ""}, { "IRotation_getTransform3D", _wrap_IRotation_getTransform3D, METH_O, "\n" "IRotation_getTransform3D(IRotation self) -> Transform3D\n" "virtual Transform3D IRotation::getTransform3D() const =0\n" @@ -125591,6 +125552,7 @@ static PyMethodDef SwigMethods[] = { "Returns true if rotation matrix is identity matrix (no rotations) \n" "\n" ""}, + { "IRotation_zInvariant", _wrap_IRotation_zInvariant, METH_O, "IRotation_zInvariant(IRotation self) -> bool"}, { "IRotation_swigregister", IRotation_swigregister, METH_O, NULL}, { "createProduct", _wrap_createProduct, METH_VARARGS, "\n" "createProduct(IRotation left, IRotation right) -> IRotation\n" @@ -125599,11 +125561,6 @@ static PyMethodDef SwigMethods[] = { "Returns concatenated rotation (first right, then left). \n" "\n" ""}, - { "IsZRotation", _wrap_IsZRotation, METH_O, "\n" - "IsZRotation(IRotation rot) -> bool\n" - "bool IsZRotation(const IRotation &rot)\n" - "\n" - ""}, { "new_IdentityRotation", _wrap_new_IdentityRotation, METH_NOARGS, "\n" "new_IdentityRotation() -> IdentityRotation\n" "IdentityRotation::IdentityRotation()=default\n"