diff --git a/Base/Axis/Frame.cpp b/Base/Axis/Frame.cpp index 293a1c0224a501239c59c87e3174a2f68d81237e..f97812be0224bde55cab0f2dee9c7f4b2b7b451f 100644 --- a/Base/Axis/Frame.cpp +++ b/Base/Axis/Frame.cpp @@ -138,6 +138,26 @@ Frame* Frame::plottableFrame() const return new Frame(std::move(outaxes)); } +Frame* Frame::angularFrame(double lambda, double alpha_i) const +{ + ASSERT(rank() == 2); + + auto* phi_f_scale = new Scale(xAxis().phi_f_Scale(lambda)); + auto* alpha_f_scale = new Scale(yAxis().alpha_f_Scale(lambda, alpha_i)); + + return new Frame(phi_f_scale, alpha_f_scale); +} + +Frame* Frame::qSpaceFrame(double lambda, double alpha_i) const +{ + ASSERT(rank() == 2); + + auto* qy_scale = new Scale(xAxis().qy_Scale(lambda)); + auto* qz_scale = new Scale(yAxis().qz_Scale(lambda, alpha_i)); + + return new Frame(qy_scale, qz_scale); +} + Frame* Frame::flat() const { std::vector<const Scale*> outaxes; diff --git a/Base/Axis/Frame.h b/Base/Axis/Frame.h index 622c4eeb373313ea9287ce41e64f46c34f06de4a..faccd4292c79de78cb47a4cfb57c993ae9a36e7f 100644 --- a/Base/Axis/Frame.h +++ b/Base/Axis/Frame.h @@ -73,6 +73,8 @@ public: bool operator==(const Frame&) const; Frame* plottableFrame() const; + Frame* angularFrame(double lambda, double alpha_i) const; + Frame* qSpaceFrame(double lambda, double alpha_i) const; Frame* flat() const; #ifndef SWIG diff --git a/auto/Wrap/libBornAgainBase.py b/auto/Wrap/libBornAgainBase.py index 6591da4a468f9a1009d8fd7297a0771555f2356f..ede305e18de66f50b1acfb4b902524c506c87916 100644 --- a/auto/Wrap/libBornAgainBase.py +++ b/auto/Wrap/libBornAgainBase.py @@ -1994,6 +1994,14 @@ class Frame(object): r"""plottableFrame(Frame self) -> Frame""" return _libBornAgainBase.Frame_plottableFrame(self) + def angularFrame(self, _lambda, alpha_i): + r"""angularFrame(Frame self, double _lambda, double alpha_i) -> Frame""" + return _libBornAgainBase.Frame_angularFrame(self, _lambda, alpha_i) + + def qSpaceFrame(self, _lambda, alpha_i): + r"""qSpaceFrame(Frame self, double _lambda, double alpha_i) -> Frame""" + return _libBornAgainBase.Frame_qSpaceFrame(self, _lambda, alpha_i) + def flat(self): r"""flat(Frame self) -> Frame""" return _libBornAgainBase.Frame_flat(self) diff --git a/auto/Wrap/libBornAgainBase_wrap.cpp b/auto/Wrap/libBornAgainBase_wrap.cpp index 583894e19883a6c7aef6f79e37571df70cb21851..317244d4a27d04af76fadb49b4a07747e7fe0566 100644 --- a/auto/Wrap/libBornAgainBase_wrap.cpp +++ b/auto/Wrap/libBornAgainBase_wrap.cpp @@ -27866,6 +27866,104 @@ fail: } +SWIGINTERN PyObject *_wrap_Frame_angularFrame(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + Frame *arg1 = (Frame *) 0 ; + double arg2 ; + double arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + double val2 ; + int ecode2 = 0 ; + double val3 ; + int ecode3 = 0 ; + PyObject *swig_obj[3] ; + Frame *result = 0 ; + + (void)self; + if (!SWIG_Python_UnpackTuple(args, "Frame_angularFrame", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Frame, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Frame_angularFrame" "', argument " "1"" of type '" "Frame const *""'"); + } + arg1 = reinterpret_cast< Frame * >(argp1); + ecode2 = SWIG_AsVal_double(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Frame_angularFrame" "', argument " "2"" of type '" "double""'"); + } + arg2 = static_cast< double >(val2); + ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Frame_angularFrame" "', argument " "3"" of type '" "double""'"); + } + arg3 = static_cast< double >(val3); + { + try { + result = (Frame *)((Frame const *)arg1)->angularFrame(arg2,arg3); + } catch (const std::exception& ex) { + // message shown in the Python interpreter + const std::string msg { + "BornAgain C++ Exception: " + std::string(ex.what()) + }; + SWIG_exception(SWIG_RuntimeError, msg.c_str()); + } + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Frame, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Frame_qSpaceFrame(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + Frame *arg1 = (Frame *) 0 ; + double arg2 ; + double arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + double val2 ; + int ecode2 = 0 ; + double val3 ; + int ecode3 = 0 ; + PyObject *swig_obj[3] ; + Frame *result = 0 ; + + (void)self; + if (!SWIG_Python_UnpackTuple(args, "Frame_qSpaceFrame", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Frame, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Frame_qSpaceFrame" "', argument " "1"" of type '" "Frame const *""'"); + } + arg1 = reinterpret_cast< Frame * >(argp1); + ecode2 = SWIG_AsVal_double(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Frame_qSpaceFrame" "', argument " "2"" of type '" "double""'"); + } + arg2 = static_cast< double >(val2); + ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Frame_qSpaceFrame" "', argument " "3"" of type '" "double""'"); + } + arg3 = static_cast< double >(val3); + { + try { + result = (Frame *)((Frame const *)arg1)->qSpaceFrame(arg2,arg3); + } catch (const std::exception& ex) { + // message shown in the Python interpreter + const std::string msg { + "BornAgain C++ Exception: " + std::string(ex.what()) + }; + SWIG_exception(SWIG_RuntimeError, msg.c_str()); + } + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Frame, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_Frame_flat(PyObject *self, PyObject *args) { PyObject *resultobj = 0; Frame *arg1 = (Frame *) 0 ; @@ -30496,6 +30594,8 @@ static PyMethodDef SwigMethods[] = { { "Frame_hasSameSizes", _wrap_Frame_hasSameSizes, METH_VARARGS, "Frame_hasSameSizes(Frame self, Frame arg2) -> bool"}, { "Frame___eq__", _wrap_Frame___eq__, METH_VARARGS, "Frame___eq__(Frame self, Frame arg2) -> bool"}, { "Frame_plottableFrame", _wrap_Frame_plottableFrame, METH_O, "Frame_plottableFrame(Frame self) -> Frame"}, + { "Frame_angularFrame", _wrap_Frame_angularFrame, METH_VARARGS, "Frame_angularFrame(Frame self, double _lambda, double alpha_i) -> Frame"}, + { "Frame_qSpaceFrame", _wrap_Frame_qSpaceFrame, METH_VARARGS, "Frame_qSpaceFrame(Frame self, double _lambda, double alpha_i) -> Frame"}, { "Frame_flat", _wrap_Frame_flat, METH_O, "Frame_flat(Frame self) -> Frame"}, { "Frame_swigregister", Frame_swigregister, METH_O, NULL}, { "Frame_swiginit", Frame_swiginit, METH_VARARGS, NULL},