From 989c49ab2e3063fd3bceee5012ae0ec21871cbea Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Wed, 22 Feb 2023 15:54:59 +0100 Subject: [PATCH] rm fct Instrument2DItem::createInstrument and class Instrument --- GUI/Model/Device/Instrument.cpp | 25 ------------------ GUI/Model/Device/Instrument.h | 38 ---------------------------- GUI/Model/Device/InstrumentItems.cpp | 18 +++---------- GUI/Model/Device/InstrumentItems.h | 3 --- 4 files changed, 4 insertions(+), 80 deletions(-) delete mode 100644 GUI/Model/Device/Instrument.cpp delete mode 100644 GUI/Model/Device/Instrument.h diff --git a/GUI/Model/Device/Instrument.cpp b/GUI/Model/Device/Instrument.cpp deleted file mode 100644 index abe8cc51c3e..00000000000 --- a/GUI/Model/Device/Instrument.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// ************************************************************************************************ -// -// BornAgain: simulate and fit reflection and scattering -// -//! @file GUI/Model/Device/Instrument.cpp -//! @brief Implements class Instrument. -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2018 -//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) -// -// ************************************************************************************************ - -#include "GUI/Model/Device/Instrument.h" -#include "Device/Beam/Beam.h" -#include "Device/Detector/IDetector.h" - -Instrument::Instrument(const std::shared_ptr<Beam>& beam, const IDetector& detector) - : m_beam(beam) - , m_detector(detector.clone()) -{ -} - -Instrument::~Instrument() = default; diff --git a/GUI/Model/Device/Instrument.h b/GUI/Model/Device/Instrument.h deleted file mode 100644 index dcb8c0158f7..00000000000 --- a/GUI/Model/Device/Instrument.h +++ /dev/null @@ -1,38 +0,0 @@ -// ************************************************************************************************ -// -// BornAgain: simulate and fit reflection and scattering -// -//! @file GUI/Model/Device/Instrument.h -//! @brief Defines class Instrument. -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2018 -//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) -// -// ************************************************************************************************ - -#ifndef BORNAGAIN_GUI_MODEL_DEVICE_INSTRUMENT_H -#define BORNAGAIN_GUI_MODEL_DEVICE_INSTRUMENT_H - -#include <memory> - -class Beam; -class IDetector; - -//! Assembles beam, detector and their relative positions with respect to the sample. - -class Instrument { -public: - Instrument(const std::shared_ptr<Beam>& beam, const IDetector& detector); - ~Instrument(); - - const Beam* beam() const { return m_beam.get(); } - const IDetector& detector() const { return *m_detector; } - -protected: - std::shared_ptr<Beam> m_beam; - std::unique_ptr<IDetector> m_detector; -}; - -#endif // BORNAGAIN_GUI_MODEL_DEVICE_INSTRUMENT_H diff --git a/GUI/Model/Device/InstrumentItems.cpp b/GUI/Model/Device/InstrumentItems.cpp index 09f3ac7336a..10fbf705b86 100644 --- a/GUI/Model/Device/InstrumentItems.cpp +++ b/GUI/Model/Device/InstrumentItems.cpp @@ -31,7 +31,6 @@ #include "GUI/Model/Device/BeamWavelengthItem.h" #include "GUI/Model/Device/DetectorItems.h" #include "GUI/Model/Device/FootprintItems.h" -#include "GUI/Model/Device/Instrument.h" #include "GUI/Model/Device/InstrumentItems.h" #include "GUI/Model/Device/PointwiseAxisItem.h" #include "GUI/Model/Device/RectangularDetectorItem.h" @@ -593,15 +592,6 @@ void Instrument2DItem::importMasks(const MaskContainerItem* maskContainer) detectorItem()->importMasks(maskContainer); } -std::shared_ptr<Instrument> Instrument2DItem::createInstrument() const -{ - auto beam = beamItem()->createBeam(); - auto detector = detectorItem()->createDetector(); - detector->setDetectorNormal(beam->ki()); - - return std::make_shared<Instrument>(beam, *detector); -} - // ************************************************************************************************ // class GISASInstrumentItem // ************************************************************************************************ @@ -637,8 +627,7 @@ QString GISASInstrumentItem::instrumentType() const const ICoordSystem* GISASInstrumentItem::createCoordSystem() const { - const auto instrument = createInstrument(); - return instrument->detector().scatteringCoords(*instrument->beam()); + return createDetector()->scatteringCoords(*beamItem()->createBeam()); } std::unique_ptr<IDetector> GISASInstrumentItem::createDetector() const @@ -766,8 +755,9 @@ const ICoordSystem* OffspecInstrumentItem::createCoordSystem() const IAxis* alphaAxis = new FixedBinAxis("alpha", m_alphaAxis.nbins(), m_alphaAxis.min() * Units::deg, m_alphaAxis.max() * Units::deg); - const auto instrument = createInstrument(); - const auto* det = dynamic_cast<const SphericalDetector*>(&instrument->detector()); + + const auto* det = + dynamic_cast<const SphericalDetector*>(detectorItem()->createDetector().get()); ASSERT(det); return det->offspecCoords(alphaAxis); } diff --git a/GUI/Model/Device/InstrumentItems.h b/GUI/Model/Device/InstrumentItems.h index 99cc50b6677..4db19ffc33c 100644 --- a/GUI/Model/Device/InstrumentItems.h +++ b/GUI/Model/Device/InstrumentItems.h @@ -30,7 +30,6 @@ class BackgroundItem; class DataItem; class DepthprobeSimulation; -class Instrument; class ISimulation; class MaskContainerItem; class MultiLayer; @@ -201,8 +200,6 @@ public: void importMasks(const MaskContainerItem* maskContainer) override; - std::shared_ptr<Instrument> createInstrument() const; - static bool isDetectorPropertyName(const QString& name); bool isExpandDetector() const { return m_expandDetector; } -- GitLab