From c57a015edc6457a2652ea23c3ad1ed22bbb73fe4 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Fri, 13 Nov 2020 15:50:40 +0100 Subject: [PATCH] lattice orientation: rename fct, insert 'const' --- Sample/Lattice/ILatticeOrientation.cpp | 2 +- Sample/Lattice/ILatticeOrientation.h | 4 ++-- Sample/Lattice/LatticeUtils.cpp | 24 ++++++++++++------------ auto/Wrap/doxygenSample.i | 11 ++++++++--- auto/Wrap/libBornAgainSample.py | 25 ++++++++++++++++--------- auto/Wrap/libBornAgainSample_wrap.cpp | 24 ++++++++++++------------ 6 files changed, 51 insertions(+), 39 deletions(-) diff --git a/Sample/Lattice/ILatticeOrientation.cpp b/Sample/Lattice/ILatticeOrientation.cpp index db239c6a3dd..212d83c6eb8 100644 --- a/Sample/Lattice/ILatticeOrientation.cpp +++ b/Sample/Lattice/ILatticeOrientation.cpp @@ -56,7 +56,7 @@ void MillerIndexOrientation::usePrimitiveLattice(const Lattice& lattice) lattice.getBasisVectorC()); } -Transform3D MillerIndexOrientation::transformationMatrix() const +Transform3D MillerIndexOrientation::transformation() const { auto dir_1 = m_prim_lattice.getMillerDirection(m_ind1.h, m_ind1.k, m_ind1.l); auto dir_2 = m_prim_lattice.getMillerDirection(m_ind2.h, m_ind2.k, m_ind2.l); diff --git a/Sample/Lattice/ILatticeOrientation.h b/Sample/Lattice/ILatticeOrientation.h index 22727e546e9..9b6c5196272 100644 --- a/Sample/Lattice/ILatticeOrientation.h +++ b/Sample/Lattice/ILatticeOrientation.h @@ -30,7 +30,7 @@ public: virtual void usePrimitiveLattice(const Lattice& lattice) = 0; - virtual Transform3D transformationMatrix() const = 0; + virtual Transform3D transformation() const = 0; }; //! A direction in reciprocal space, specified by double-valued indices hkl. @@ -57,7 +57,7 @@ public: void usePrimitiveLattice(const Lattice& lattice) override; - Transform3D transformationMatrix() const override; + Transform3D transformation() const override; private: bool checkAlignment() const; diff --git a/Sample/Lattice/LatticeUtils.cpp b/Sample/Lattice/LatticeUtils.cpp index 79568358765..44ffbe342c9 100644 --- a/Sample/Lattice/LatticeUtils.cpp +++ b/Sample/Lattice/LatticeUtils.cpp @@ -18,30 +18,30 @@ Lattice LatticeUtils::createFCCLattice(double lattice_constant, const ILatticeOrientation& orientation) { - Lattice prim_cubic = Lattice::createCubicLattice(1.0); + const Lattice prim_cubic = Lattice::createCubicLattice(1.0); std::unique_ptr<ILatticeOrientation> P_orientation(orientation.clone()); P_orientation->usePrimitiveLattice(prim_cubic); - auto rotation = P_orientation->transformationMatrix(); - Lattice fcc = Lattice::createFCCLattice(lattice_constant); - return fcc.createTransformedLattice(rotation); + const Transform3D trafo = P_orientation->transformation(); + const Lattice fcc = Lattice::createFCCLattice(lattice_constant); + return fcc.createTransformedLattice(trafo); } Lattice LatticeUtils::createHCPLattice(double a, double c, const ILatticeOrientation& orientation) { - Lattice prim_hexagonal = Lattice::createHexagonalLattice(1.0, c / a); + const Lattice prim_hexagonal = Lattice::createHexagonalLattice(1.0, c / a); std::unique_ptr<ILatticeOrientation> P_orientation(orientation.clone()); P_orientation->usePrimitiveLattice(prim_hexagonal); - auto rotation = P_orientation->transformationMatrix(); - Lattice hcp = Lattice::createHCPLattice(a, c); - return hcp.createTransformedLattice(rotation); + const Transform3D trafo = P_orientation->transformation(); + const Lattice hcp = Lattice::createHCPLattice(a, c); + return hcp.createTransformedLattice(trafo); } Lattice LatticeUtils::createBCTLattice(double a, double c, const ILatticeOrientation& orientation) { - Lattice prim_tetragonal = Lattice::createTetragonalLattice(1.0, c / a); + const Lattice prim_tetragonal = Lattice::createTetragonalLattice(1.0, c / a); std::unique_ptr<ILatticeOrientation> P_orientation(orientation.clone()); P_orientation->usePrimitiveLattice(prim_tetragonal); - auto rotation = P_orientation->transformationMatrix(); - Lattice hcp = Lattice::createBCTLattice(a, c); - return hcp.createTransformedLattice(rotation); + const Transform3D trafo = P_orientation->transformation(); + const Lattice hcp = Lattice::createBCTLattice(a, c); + return hcp.createTransformedLattice(trafo); } diff --git a/auto/Wrap/doxygenSample.i b/auto/Wrap/doxygenSample.i index a948f8eb027..7edc2673734 100644 --- a/auto/Wrap/doxygenSample.i +++ b/auto/Wrap/doxygenSample.i @@ -3640,7 +3640,12 @@ Calculates the intensity for scalar particles/interactions. // File: classILatticeOrientation.xml -%feature("docstring") ILatticeOrientation ""; +%feature("docstring") ILatticeOrientation " + +Pure virtual base of classes that specify a lattice orientation. Currently only inherited by MillerIndexOrientation. + +C++ includes: ILatticeOrientation.h +"; %feature("docstring") ILatticeOrientation::~ILatticeOrientation "ILatticeOrientation::~ILatticeOrientation() "; @@ -3651,7 +3656,7 @@ Calculates the intensity for scalar particles/interactions. %feature("docstring") ILatticeOrientation::usePrimitiveLattice "virtual void ILatticeOrientation::usePrimitiveLattice(const Lattice &lattice)=0 "; -%feature("docstring") ILatticeOrientation::transformationMatrix "virtual Transform3D ILatticeOrientation::transformationMatrix() const =0 +%feature("docstring") ILatticeOrientation::transformation "virtual Transform3D ILatticeOrientation::transformation() const =0 "; @@ -5853,7 +5858,7 @@ This constructor is best explained by an example. Arguments QX, (1,1,0), QY, (0, %feature("docstring") MillerIndexOrientation::usePrimitiveLattice "void MillerIndexOrientation::usePrimitiveLattice(const Lattice &lattice) override "; -%feature("docstring") MillerIndexOrientation::transformationMatrix "Transform3D MillerIndexOrientation::transformationMatrix() const override +%feature("docstring") MillerIndexOrientation::transformation "Transform3D MillerIndexOrientation::transformation() const override "; diff --git a/auto/Wrap/libBornAgainSample.py b/auto/Wrap/libBornAgainSample.py index 3c6988c5fda..25047a220a6 100644 --- a/auto/Wrap/libBornAgainSample.py +++ b/auto/Wrap/libBornAgainSample.py @@ -11382,7 +11382,14 @@ class FormFactorSphereLogNormalRadius(IFormFactorBorn): _libBornAgainSample.FormFactorSphereLogNormalRadius_swigregister(FormFactorSphereLogNormalRadius) class ILatticeOrientation(object): - r"""Proxy of C++ ILatticeOrientation class.""" + r""" + + + Pure virtual base of classes that specify a lattice orientation. Currently only inherited by MillerIndexOrientation. + + C++ includes: ILatticeOrientation.h + + """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") @@ -11407,13 +11414,13 @@ class ILatticeOrientation(object): """ return _libBornAgainSample.ILatticeOrientation_usePrimitiveLattice(self, lattice) - def transformationMatrix(self): + def transformation(self): r""" - transformationMatrix(ILatticeOrientation self) -> Transform3D - virtual Transform3D ILatticeOrientation::transformationMatrix() const =0 + transformation(ILatticeOrientation self) -> Transform3D + virtual Transform3D ILatticeOrientation::transformation() const =0 """ - return _libBornAgainSample.ILatticeOrientation_transformationMatrix(self) + return _libBornAgainSample.ILatticeOrientation_transformation(self) # Register ILatticeOrientation in _libBornAgainSample: _libBornAgainSample.ILatticeOrientation_swigregister(ILatticeOrientation) @@ -11492,13 +11499,13 @@ class MillerIndexOrientation(ILatticeOrientation): """ return _libBornAgainSample.MillerIndexOrientation_usePrimitiveLattice(self, lattice) - def transformationMatrix(self): + def transformation(self): r""" - transformationMatrix(MillerIndexOrientation self) -> Transform3D - Transform3D MillerIndexOrientation::transformationMatrix() const override + transformation(MillerIndexOrientation self) -> Transform3D + Transform3D MillerIndexOrientation::transformation() const override """ - return _libBornAgainSample.MillerIndexOrientation_transformationMatrix(self) + return _libBornAgainSample.MillerIndexOrientation_transformation(self) # Register MillerIndexOrientation in _libBornAgainSample: _libBornAgainSample.MillerIndexOrientation_swigregister(MillerIndexOrientation) diff --git a/auto/Wrap/libBornAgainSample_wrap.cpp b/auto/Wrap/libBornAgainSample_wrap.cpp index b4b7786a4ee..2ab5babeec9 100644 --- a/auto/Wrap/libBornAgainSample_wrap.cpp +++ b/auto/Wrap/libBornAgainSample_wrap.cpp @@ -67868,7 +67868,7 @@ fail: } -SWIGINTERN PyObject *_wrap_ILatticeOrientation_transformationMatrix(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_ILatticeOrientation_transformation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; ILatticeOrientation *arg1 = (ILatticeOrientation *) 0 ; void *argp1 = 0 ; @@ -67880,10 +67880,10 @@ SWIGINTERN PyObject *_wrap_ILatticeOrientation_transformationMatrix(PyObject *SW swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ILatticeOrientation, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ILatticeOrientation_transformationMatrix" "', argument " "1"" of type '" "ILatticeOrientation const *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ILatticeOrientation_transformation" "', argument " "1"" of type '" "ILatticeOrientation const *""'"); } arg1 = reinterpret_cast< ILatticeOrientation * >(argp1); - result = ((ILatticeOrientation const *)arg1)->transformationMatrix(); + result = ((ILatticeOrientation const *)arg1)->transformation(); resultobj = SWIG_NewPointerObj((new Transform3D(static_cast< const Transform3D& >(result))), SWIGTYPE_p_Transform3D, SWIG_POINTER_OWN | 0 ); return resultobj; fail: @@ -68264,7 +68264,7 @@ fail: } -SWIGINTERN PyObject *_wrap_MillerIndexOrientation_transformationMatrix(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_MillerIndexOrientation_transformation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; MillerIndexOrientation *arg1 = (MillerIndexOrientation *) 0 ; void *argp1 = 0 ; @@ -68276,10 +68276,10 @@ SWIGINTERN PyObject *_wrap_MillerIndexOrientation_transformationMatrix(PyObject swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_MillerIndexOrientation, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MillerIndexOrientation_transformationMatrix" "', argument " "1"" of type '" "MillerIndexOrientation const *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MillerIndexOrientation_transformation" "', argument " "1"" of type '" "MillerIndexOrientation const *""'"); } arg1 = reinterpret_cast< MillerIndexOrientation * >(argp1); - result = ((MillerIndexOrientation const *)arg1)->transformationMatrix(); + result = ((MillerIndexOrientation const *)arg1)->transformation(); resultobj = SWIG_NewPointerObj((new Transform3D(static_cast< const Transform3D& >(result))), SWIGTYPE_p_Transform3D, SWIG_POINTER_OWN | 0 ); return resultobj; fail: @@ -76881,9 +76881,9 @@ static PyMethodDef SwigMethods[] = { "virtual void ILatticeOrientation::usePrimitiveLattice(const Lattice &lattice)=0\n" "\n" ""}, - { "ILatticeOrientation_transformationMatrix", _wrap_ILatticeOrientation_transformationMatrix, METH_O, "\n" - "ILatticeOrientation_transformationMatrix(ILatticeOrientation self) -> Transform3D\n" - "virtual Transform3D ILatticeOrientation::transformationMatrix() const =0\n" + { "ILatticeOrientation_transformation", _wrap_ILatticeOrientation_transformation, METH_O, "\n" + "ILatticeOrientation_transformation(ILatticeOrientation self) -> Transform3D\n" + "virtual Transform3D ILatticeOrientation::transformation() const =0\n" "\n" ""}, { "ILatticeOrientation_swigregister", ILatticeOrientation_swigregister, METH_O, NULL}, @@ -76923,9 +76923,9 @@ static PyMethodDef SwigMethods[] = { "void MillerIndexOrientation::usePrimitiveLattice(const Lattice &lattice) override\n" "\n" ""}, - { "MillerIndexOrientation_transformationMatrix", _wrap_MillerIndexOrientation_transformationMatrix, METH_O, "\n" - "MillerIndexOrientation_transformationMatrix(MillerIndexOrientation self) -> Transform3D\n" - "Transform3D MillerIndexOrientation::transformationMatrix() const override\n" + { "MillerIndexOrientation_transformation", _wrap_MillerIndexOrientation_transformation, METH_O, "\n" + "MillerIndexOrientation_transformation(MillerIndexOrientation self) -> Transform3D\n" + "Transform3D MillerIndexOrientation::transformation() const override\n" "\n" ""}, { "MillerIndexOrientation_swigregister", MillerIndexOrientation_swigregister, METH_O, NULL}, -- GitLab