From f938437012a7f355e33ae59c53793c04fc08a28c Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Wed, 16 Nov 2022 13:51:04 +0100 Subject: [PATCH] rm DetectorContext --- Device/Detector/DetectorContext.cpp | 34 ----------------------- Device/Detector/DetectorContext.h | 43 ----------------------------- 2 files changed, 77 deletions(-) delete mode 100644 Device/Detector/DetectorContext.cpp delete mode 100644 Device/Detector/DetectorContext.h diff --git a/Device/Detector/DetectorContext.cpp b/Device/Detector/DetectorContext.cpp deleted file mode 100644 index e0db00f5326..00000000000 --- a/Device/Detector/DetectorContext.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// ************************************************************************************************ -// -// BornAgain: simulate and fit reflection and scattering -// -//! @file Device/Detector/DetectorContext.cpp -//! @brief Implements DetectorContext class. -//! -//! @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 "Device/Detector/DetectorContext.h" -#include "Base/Pixel/IPixel.h" -#include "Device/Detector/IDetector.h" - -DetectorContext::DetectorContext(const IDetector* detector) - : m_active_indices(detector->active_indices()) -{ - m_pixels.reserve(m_active_indices.size()); - for (auto detector_index : m_active_indices) - m_pixels.emplace_back(detector->createPixel(detector_index)); -} - -//! Creates pixel for given element index. Element index is sequential index in a vector -//! of DiffuseElements. Corresponds to sequence of detector bins inside ROI and outside -//! of masked areas. - -std::unique_ptr<const IPixel> DetectorContext::createPixel(size_t element_index) const -{ - return std::unique_ptr<IPixel>(m_pixels[element_index]->clone()); -} diff --git a/Device/Detector/DetectorContext.h b/Device/Detector/DetectorContext.h deleted file mode 100644 index 890d4065fbd..00000000000 --- a/Device/Detector/DetectorContext.h +++ /dev/null @@ -1,43 +0,0 @@ -// ************************************************************************************************ -// -// BornAgain: simulate and fit reflection and scattering -// -//! @file Device/Detector/DetectorContext.h -//! @brief Define DetectorContext class. -//! -//! @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 USER_API -#ifndef BORNAGAIN_DEVICE_DETECTOR_DETECTORCONTEXT_H -#define BORNAGAIN_DEVICE_DETECTOR_DETECTORCONTEXT_H - -#include "Base/Types/OwningVector.h" -#include <memory> -#include <vector> - -class IDetector; -class IPixel; - -//! Holds precalculated information for faster DiffuseElement generation. Used by ISimulation2D. - -class DetectorContext { -public: - DetectorContext(const IDetector* detector); - - DetectorContext(const DetectorContext& other) = delete; - DetectorContext& operator=(const DetectorContext& other) = delete; - - std::unique_ptr<const IPixel> createPixel(size_t element_index) const; - -private: - const std::vector<size_t> m_active_indices; //! The sequence of bin indices (unmasked, in ROI) - OwningVector<const IPixel> m_pixels; //! All unmasked pixels inside ROI. -}; - -#endif // BORNAGAIN_DEVICE_DETECTOR_DETECTORCONTEXT_H -#endif // USER_API -- GitLab