From d22473d9b454fc677faf329e55310076b08aabc3 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Sat, 21 May 2022 15:54:38 +0200 Subject: [PATCH] rm Instrument::createScatteringCoords() --- Device/Instrument/Instrument.cpp | 7 ------- Device/Instrument/Instrument.h | 2 -- Sim/Simulation/ScatteringSimulation.cpp | 8 ++++--- auto/Wrap/doxygenDevice.i | 3 --- auto/Wrap/libBornAgainDevice.py | 8 ------- auto/Wrap/libBornAgainDevice_wrap.cpp | 28 ------------------------- 6 files changed, 5 insertions(+), 51 deletions(-) diff --git a/Device/Instrument/Instrument.cpp b/Device/Instrument/Instrument.cpp index ecc9539b9aa..9997729ab13 100644 --- a/Device/Instrument/Instrument.cpp +++ b/Device/Instrument/Instrument.cpp @@ -128,10 +128,3 @@ void Instrument::setPolFilters(const R3& polarizer_dir, const R3& analyzer_dir, if (analyzer_dir.mag() > 0.0) m_detector->setAnalyzer(analyzer_dir, analyzer_efficiency, analyzer_transmission); } - -CoordSystem2D* Instrument::createScatteringCoords() const -{ - const auto* detector = dynamic_cast<const IDetector2D*>(getDetector()); - ASSERT(detector); - return detector->scatteringCoords(beam()); -} diff --git a/Device/Instrument/Instrument.h b/Device/Instrument/Instrument.h index 9bf69e125b3..2d7c0e26529 100644 --- a/Device/Instrument/Instrument.h +++ b/Device/Instrument/Instrument.h @@ -61,8 +61,6 @@ public: std::vector<const INode*> nodeChildren() const override; - CoordSystem2D* createScatteringCoords() const; - protected: std::unique_ptr<Beam> m_beam; std::unique_ptr<IDetector> m_detector; diff --git a/Sim/Simulation/ScatteringSimulation.cpp b/Sim/Simulation/ScatteringSimulation.cpp index 23db83ac6bf..1fca8e28891 100644 --- a/Sim/Simulation/ScatteringSimulation.cpp +++ b/Sim/Simulation/ScatteringSimulation.cpp @@ -15,7 +15,7 @@ #include "Sim/Simulation/ScatteringSimulation.h" #include "Device/Coord/CoordSystem2D.h" #include "Device/Data/Powerfield.h" -#include "Device/Detector/IDetector.h" +#include "Device/Detector/IDetector2D.h" #include "Device/Histo/SimulationResult.h" #include "Resample/Element/DiffuseElement.h" @@ -36,7 +36,7 @@ void ScatteringSimulation::prepareSimulation() SimulationResult ScatteringSimulation::pack_result() { - auto* const coordsys = instrument().createScatteringCoords(); + auto* const coordsys = createCoordSystem(); const std::unique_ptr<Powerfield<double>> data(detector().createDetectorIntensity(m_eles)); return {*data, *coordsys}; } @@ -52,7 +52,9 @@ size_t ScatteringSimulation::intensityMapSize() const #ifndef SWIG ICoordSystem* ScatteringSimulation::createCoordSystem() const { - return instrument().createScatteringCoords(); + const auto* det2D = dynamic_cast<const IDetector2D*>(instrument().getDetector()); + ASSERT(det2D); + return det2D->scatteringCoords(instrument().beam()); } #endif diff --git a/auto/Wrap/doxygenDevice.i b/auto/Wrap/doxygenDevice.i index 3ea182e7055..773cf7b4d67 100644 --- a/auto/Wrap/doxygenDevice.i +++ b/auto/Wrap/doxygenDevice.i @@ -1567,9 +1567,6 @@ init detector with beam settings %feature("docstring") Instrument::nodeChildren "std::vector< const INode * > Instrument::nodeChildren() const override "; -%feature("docstring") Instrument::createScatteringCoords "CoordSystem2D * Instrument::createScatteringCoords() const -"; - // File: classIOFactory.xml %feature("docstring") IOFactory " diff --git a/auto/Wrap/libBornAgainDevice.py b/auto/Wrap/libBornAgainDevice.py index 0ee745a1af4..d7b36dbcedf 100644 --- a/auto/Wrap/libBornAgainDevice.py +++ b/auto/Wrap/libBornAgainDevice.py @@ -4344,14 +4344,6 @@ class Instrument(libBornAgainParam.INode): """ return _libBornAgainDevice.Instrument_nodeChildren(self) - def createScatteringCoords(self): - r""" - createScatteringCoords(Instrument self) -> CoordSystem2D * - CoordSystem2D * Instrument::createScatteringCoords() const - - """ - return _libBornAgainDevice.Instrument_createScatteringCoords(self) - # Register Instrument in _libBornAgainDevice: _libBornAgainDevice.Instrument_swigregister(Instrument) diff --git a/auto/Wrap/libBornAgainDevice_wrap.cpp b/auto/Wrap/libBornAgainDevice_wrap.cpp index 7883c8b39d2..fffb66a3091 100644 --- a/auto/Wrap/libBornAgainDevice_wrap.cpp +++ b/auto/Wrap/libBornAgainDevice_wrap.cpp @@ -36317,29 +36317,6 @@ fail: } -SWIGINTERN PyObject *_wrap_Instrument_createScatteringCoords(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Instrument *arg1 = (Instrument *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - CoordSystem2D *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Instrument, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Instrument_createScatteringCoords" "', argument " "1"" of type '" "Instrument const *""'"); - } - arg1 = reinterpret_cast< Instrument * >(argp1); - result = (CoordSystem2D *)((Instrument const *)arg1)->createScatteringCoords(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CoordSystem2D, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - SWIGINTERN PyObject *Instrument_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; @@ -43548,11 +43525,6 @@ static PyMethodDef SwigMethods[] = { "std::vector< const INode * > Instrument::nodeChildren() const override\n" "\n" ""}, - { "Instrument_createScatteringCoords", _wrap_Instrument_createScatteringCoords, METH_O, "\n" - "Instrument_createScatteringCoords(Instrument self) -> CoordSystem2D *\n" - "CoordSystem2D * Instrument::createScatteringCoords() const\n" - "\n" - ""}, { "Instrument_swigregister", Instrument_swigregister, METH_O, NULL}, { "Instrument_swiginit", Instrument_swiginit, METH_VARARGS, NULL}, { "FindPeaks", _wrap_FindPeaks, METH_VARARGS, "\n" -- GitLab