From a00661837a055efd577e78c21e49464440b81254 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 7 Nov 2023 16:00:01 +0100
Subject: [PATCH] merge remaining pixel classes

---
 Base/Pixel/IPixel.h                          | 37 ----------------
 Base/Pixel/{SphericalPixel.cpp => Pixel.cpp} | 22 +++++-----
 Base/Pixel/{SphericalPixel.h => Pixel.h}     | 28 ++++++------
 Device/Detector/Detector2D.cpp               |  6 +--
 Device/Detector/Detector2D.h                 |  6 +--
 Device/Detector/IDetector.h                  |  6 +--
 Device/Detector/OffspecDetector.cpp          |  6 +--
 Device/Detector/OffspecDetector.h            |  6 +--
 Device/Detector/SphericalDetector.cpp        |  6 +--
 Device/Detector/SphericalDetector.h          |  6 +--
 Resample/Element/DiffuseElement.cpp          |  4 +-
 Resample/Element/DiffuseElement.h            |  6 +--
 Sim/Simulation/OffspecSimulation.cpp         |  2 +-
 Sim/Simulation/OffspecSimulation.h           |  6 +--
 Sim/Simulation/ScatteringSimulation.cpp      |  2 +-
 Sim/Simulation/ScatteringSimulation.h        |  4 +-
 auto/Wrap/libBornAgainDevice.py              |  6 +--
 auto/Wrap/libBornAgainDevice_wrap.cpp        | 46 ++++++++++----------
 18 files changed, 84 insertions(+), 121 deletions(-)
 delete mode 100644 Base/Pixel/IPixel.h
 rename Base/Pixel/{SphericalPixel.cpp => Pixel.cpp} (68%)
 rename Base/Pixel/{SphericalPixel.h => Pixel.h} (52%)

diff --git a/Base/Pixel/IPixel.h b/Base/Pixel/IPixel.h
deleted file mode 100644
index 093c5e804ef..00000000000
--- a/Base/Pixel/IPixel.h
+++ /dev/null
@@ -1,37 +0,0 @@
-//  ************************************************************************************************
-//
-//  BornAgain: simulate and fit reflection and scattering
-//
-//! @file      Base/Pixel/IPixel.h
-//! @brief     Defines and implements interface IPixel.
-//!
-//! @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)
-//
-//  ************************************************************************************************
-
-#ifdef SWIG
-#error no need to expose this header to Swig
-#endif // SWIG
-#ifndef BORNAGAIN_BASE_PIXEL_IPIXEL_H
-#define BORNAGAIN_BASE_PIXEL_IPIXEL_H
-
-#include <heinz/Vectors3D.h>
-
-//! Interface for a function that maps [0,1]x[0,1] to the kvectors in a pixel.
-//! Abstract base class for SphericalPixel and RectangularPixel.
-
-class IPixel {
-public:
-    virtual ~IPixel() = default;
-
-    virtual IPixel* clone() const = 0;
-    virtual IPixel* createZeroSizePixel(double x, double y) const = 0;
-    virtual R3 getK(double x, double y, double wavelength) const = 0;
-    virtual double integrationFactor(double x, double y) const = 0;
-    virtual double solidAngle() const = 0;
-};
-
-#endif // BORNAGAIN_BASE_PIXEL_IPIXEL_H
diff --git a/Base/Pixel/SphericalPixel.cpp b/Base/Pixel/Pixel.cpp
similarity index 68%
rename from Base/Pixel/SphericalPixel.cpp
rename to Base/Pixel/Pixel.cpp
index e0bd89d4263..c96b71897ab 100644
--- a/Base/Pixel/SphericalPixel.cpp
+++ b/Base/Pixel/Pixel.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      Base/Pixel/SphericalPixel.cpp
-//! @brief     Implements class SphericalPixel.
+//! @file      Base/Pixel/Pixel.cpp
+//! @brief     Implements class Pixel.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,11 +12,11 @@
 //
 //  ************************************************************************************************
 
-#include "Base/Pixel/SphericalPixel.h"
+#include "Base/Pixel/Pixel.h"
 #include "Base/Axis/Bin.h"
 #include "Base/Vector/GisasDirection.h"
 
-SphericalPixel::SphericalPixel(const Bin1D& alpha_bin, const Bin1D& phi_bin)
+Pixel::Pixel(const Bin1D& alpha_bin, const Bin1D& phi_bin)
     : m_alpha(alpha_bin.lowerBound())
     , m_phi(phi_bin.lowerBound())
     , m_dalpha(alpha_bin.binSize())
@@ -26,26 +26,26 @@ SphericalPixel::SphericalPixel(const Bin1D& alpha_bin, const Bin1D& phi_bin)
     m_solid_angle = solid_angle_value <= 0.0 ? 1.0 : solid_angle_value;
 }
 
-SphericalPixel* SphericalPixel::clone() const
+Pixel* Pixel::clone() const
 {
-    return new SphericalPixel(*this);
+    return new Pixel(*this);
 }
 
-SphericalPixel* SphericalPixel::createZeroSizePixel(double x, double y) const
+Pixel* Pixel::createZeroSizePixel(double x, double y) const
 {
     const double phi = m_phi + x * m_dphi;
     const double alpha = m_alpha + y * m_dalpha;
-    return new SphericalPixel(Bin1D::At(alpha), Bin1D::At(phi));
+    return new Pixel(Bin1D::At(alpha), Bin1D::At(phi));
 }
 
-R3 SphericalPixel::getK(double x, double y, double wavelength) const
+R3 Pixel::getK(double x, double y, double wavelength) const
 {
     const double phi = m_phi + x * m_dphi;
     const double alpha = m_alpha + y * m_dalpha;
     return vecOfLambdaAlphaPhi(wavelength, alpha, phi);
 }
 
-double SphericalPixel::integrationFactor(double /* x */, double y) const
+double Pixel::integrationFactor(double /* x */, double y) const
 {
     if (m_dalpha == 0.0)
         return 1.0;
@@ -53,7 +53,7 @@ double SphericalPixel::integrationFactor(double /* x */, double y) const
     return std::cos(alpha) * m_dalpha / (std::sin(m_alpha + m_dalpha) - std::sin(m_alpha));
 }
 
-double SphericalPixel::solidAngle() const
+double Pixel::solidAngle() const
 {
     return m_solid_angle;
 }
diff --git a/Base/Pixel/SphericalPixel.h b/Base/Pixel/Pixel.h
similarity index 52%
rename from Base/Pixel/SphericalPixel.h
rename to Base/Pixel/Pixel.h
index 8476810924c..29a8c0bfd75 100644
--- a/Base/Pixel/SphericalPixel.h
+++ b/Base/Pixel/Pixel.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      Base/Pixel/SphericalPixel.h
-//! @brief     Defines class SphericalPixel.
+//! @file      Base/Pixel/Pixel.h
+//! @brief     Defines and implements interface Pixel.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -15,24 +15,24 @@
 #ifdef SWIG
 #error no need to expose this header to Swig
 #endif // SWIG
-#ifndef BORNAGAIN_BASE_PIXEL_SPHERICALPIXEL_H
-#define BORNAGAIN_BASE_PIXEL_SPHERICALPIXEL_H
+#ifndef BORNAGAIN_BASE_PIXEL_PIXEL_H
+#define BORNAGAIN_BASE_PIXEL_PIXEL_H
 
-#include "Base/Pixel/IPixel.h"
+#include <heinz/Vectors3D.h>
 
 class Bin1D;
 
-//! A pixel in a SphericalDetector
+//! A rectangular pixel in a two-dimensional SphericalDetector.
 
-class SphericalPixel : public IPixel {
+class Pixel {
 public:
-    SphericalPixel(const Bin1D& alpha_bin, const Bin1D& phi_bin);
+    Pixel(const Bin1D& alpha_bin, const Bin1D& phi_bin);
 
-    SphericalPixel* clone() const override;
-    SphericalPixel* createZeroSizePixel(double x, double y) const override;
-    R3 getK(double x, double y, double wavelength) const override;
-    double integrationFactor(double x, double y) const override;
-    double solidAngle() const override;
+    Pixel* clone() const;
+    Pixel* createZeroSizePixel(double x, double y) const;
+    R3 getK(double x, double y, double wavelength) const;
+    double integrationFactor(double x, double y) const;
+    double solidAngle() const;
 
 private:
     const double m_alpha;
@@ -42,4 +42,4 @@ private:
     mutable double m_solid_angle;
 };
 
-#endif // BORNAGAIN_BASE_PIXEL_SPHERICALPIXEL_H
+#endif // BORNAGAIN_BASE_PIXEL_PIXEL_H
diff --git a/Device/Detector/Detector2D.cpp b/Device/Detector/Detector2D.cpp
index 6d50ca9908c..de44605b26b 100644
--- a/Device/Detector/Detector2D.cpp
+++ b/Device/Detector/Detector2D.cpp
@@ -16,7 +16,7 @@
 #include "Base/Axis/Frame.h"
 #include "Base/Axis/MakeScale.h"
 #include "Base/Axis/Scale.h"
-#include "Base/Pixel/SphericalPixel.h"
+#include "Base/Pixel/Pixel.h"
 #include "Base/Util/Assert.h"
 #include "Device/Beam/Beam.h"
 #include "Device/Resolution/IDetectorResolution.h"
@@ -73,14 +73,14 @@ void Detector2D::precompute()
 }
 
 
-IPixel* Detector2D::createPixel(size_t index) const
+Pixel* Detector2D::createPixel(size_t index) const
 {
     const size_t phi_index = axisBinIndex(index, 0);
     const size_t alpha_index = axisBinIndex(index, 1);
 
     const Bin1D alpha_bin = m_scattering_alpha->bin(alpha_index);
     const Bin1D phi_bin = m_scattering_phi->bin(phi_index);
-    return new SphericalPixel(alpha_bin, phi_bin);
+    return new Pixel(alpha_bin, phi_bin);
 }
 
 size_t Detector2D::indexOfSpecular(const Beam& beam) const
diff --git a/Device/Detector/Detector2D.h b/Device/Detector/Detector2D.h
index 33048a74e15..bba7aad1a5b 100644
--- a/Device/Detector/Detector2D.h
+++ b/Device/Detector/Detector2D.h
@@ -17,7 +17,7 @@
 
 #include "Device/Detector/IDetector.h"
 
-class IPixel;
+class Pixel;
 
 //! A flat detector with equidistant pixels and cached true scattering angles along the phi and
 //! alpha axes.
@@ -33,8 +33,8 @@ public:
     Detector2D* clone() const override;
     std::string className() const override { return "Detector2D"; }
 
-    //! Creates an IPixel for the given Datafield object and index
-    IPixel* createPixel(size_t index) const override;
+    //! Creates an Pixel for the given Datafield object and index
+    Pixel* createPixel(size_t index) const override;
 
     //! Returns index of pixel that contains the specular wavevector.
     //! If no pixel contains this specular wavevector, the number of pixels is
diff --git a/Device/Detector/IDetector.h b/Device/Detector/IDetector.h
index f5ea4a3aabf..54843ff7ad4 100644
--- a/Device/Detector/IDetector.h
+++ b/Device/Detector/IDetector.h
@@ -22,7 +22,7 @@ class Beam;
 class Datafield;
 class Frame;
 class IDetectorResolution;
-class IPixel;
+class Pixel;
 class IResolutionFunction2D;
 class IShape2D;
 class MaskStack;
@@ -99,8 +99,8 @@ public:
         return m_resolution.get();
     }
 
-    //! Creates an IPixel for the given Datafield object and index
-    virtual const IPixel* createPixel(size_t i) const = 0;
+    //! Creates an Pixel for the given Datafield object and index
+    virtual const Pixel* createPixel(size_t i) const = 0;
 
     //! Returns vector of unmasked detector indices.
     std::vector<size_t> activeIndices() const;
diff --git a/Device/Detector/OffspecDetector.cpp b/Device/Detector/OffspecDetector.cpp
index 13be1a76c80..f71ceae177f 100644
--- a/Device/Detector/OffspecDetector.cpp
+++ b/Device/Detector/OffspecDetector.cpp
@@ -15,7 +15,7 @@
 #include "Device/Detector/OffspecDetector.h"
 #include "Base/Axis/MakeScale.h"
 #include "Base/Axis/Scale.h"
-#include "Base/Pixel/SphericalPixel.h"
+#include "Base/Pixel/Pixel.h"
 #include "Base/Util/Assert.h"
 #include <iostream>
 
@@ -70,7 +70,7 @@ size_t OffspecDetector::totalSize() const
     return result;
 }
 
-IPixel* OffspecDetector::createPixel(size_t index) const
+Pixel* OffspecDetector::createPixel(size_t index) const
 {
     const Scale& phi_axis = axis(0);
     const Scale& alpha_axis = axis(1);
@@ -79,7 +79,7 @@ IPixel* OffspecDetector::createPixel(size_t index) const
 
     const Bin1D alpha_bin = alpha_axis.bin(alpha_index);
     const Bin1D phi_bin = phi_axis.bin(phi_index);
-    return new SphericalPixel(alpha_bin, phi_bin);
+    return new Pixel(alpha_bin, phi_bin);
 }
 
 size_t OffspecDetector::indexOfSpecular(double alpha, double phi) const
diff --git a/Device/Detector/OffspecDetector.h b/Device/Detector/OffspecDetector.h
index 9e950dbbccc..b5c2a1e032e 100644
--- a/Device/Detector/OffspecDetector.h
+++ b/Device/Detector/OffspecDetector.h
@@ -21,7 +21,7 @@
 
 class Scale;
 class IDetectorResolution;
-class IPixel;
+class Pixel;
 
 //! A detector with coordinate axes along angles phi and alpha.
 
@@ -58,8 +58,8 @@ public:
     //! Any region of interest is not taken into account.
     size_t totalSize() const;
 
-    //! Creates an IPixel for the given Datafield object and index
-    IPixel* createPixel(size_t index) const;
+    //! Creates an Pixel for the given Datafield object and index
+    Pixel* createPixel(size_t index) const;
 
     //! Returns index of pixel that contains the specular wavevector.
     //! If no pixel contains this specular wavevector, the number of pixels is
diff --git a/Device/Detector/SphericalDetector.cpp b/Device/Detector/SphericalDetector.cpp
index fdecf03a83a..070b0f7eb37 100644
--- a/Device/Detector/SphericalDetector.cpp
+++ b/Device/Detector/SphericalDetector.cpp
@@ -16,7 +16,7 @@
 #include "Base/Axis/Frame.h"
 #include "Base/Axis/MakeScale.h"
 #include "Base/Axis/Scale.h"
-#include "Base/Pixel/SphericalPixel.h"
+#include "Base/Pixel/Pixel.h"
 #include "Device/Beam/Beam.h"
 #include "Device/Resolution/IDetectorResolution.h"
 
@@ -40,7 +40,7 @@ SphericalDetector* SphericalDetector::clone() const
     return new SphericalDetector(*this);
 }
 
-IPixel* SphericalDetector::createPixel(size_t index) const
+Pixel* SphericalDetector::createPixel(size_t index) const
 {
     const Scale& phi_axis = axis(0);
     const Scale& alpha_axis = axis(1);
@@ -49,7 +49,7 @@ IPixel* SphericalDetector::createPixel(size_t index) const
 
     const Bin1D alpha_bin = alpha_axis.bin(alpha_index);
     const Bin1D phi_bin = phi_axis.bin(phi_index);
-    return new SphericalPixel(alpha_bin, phi_bin);
+    return new Pixel(alpha_bin, phi_bin);
 }
 
 size_t SphericalDetector::indexOfSpecular(const Beam& beam) const
diff --git a/Device/Detector/SphericalDetector.h b/Device/Detector/SphericalDetector.h
index a606d619c19..d9b03891762 100644
--- a/Device/Detector/SphericalDetector.h
+++ b/Device/Detector/SphericalDetector.h
@@ -17,7 +17,7 @@
 
 #include "Device/Detector/IDetector.h"
 
-class IPixel;
+class Pixel;
 
 //! A detector with equidistant coordinate axes along scattering angles phi and alpha.
 
@@ -37,8 +37,8 @@ public:
     SphericalDetector* clone() const override;
     std::string className() const override { return "SphericalDetector"; }
 
-    //! Creates an IPixel for the given Datafield object and index
-    IPixel* createPixel(size_t index) const override;
+    //! Creates an Pixel for the given Datafield object and index
+    Pixel* createPixel(size_t index) const override;
 
     //! Returns index of pixel that contains the specular wavevector.
     //! If no pixel contains this specular wavevector, the number of pixels is
diff --git a/Resample/Element/DiffuseElement.cpp b/Resample/Element/DiffuseElement.cpp
index c1e9ffae492..86898c76e9d 100644
--- a/Resample/Element/DiffuseElement.cpp
+++ b/Resample/Element/DiffuseElement.cpp
@@ -13,7 +13,7 @@
 //  ************************************************************************************************
 
 #include "Resample/Element/DiffuseElement.h"
-#include "Base/Pixel/IPixel.h"
+#include "Base/Pixel/Pixel.h"
 #include "Base/Vector/GisasDirection.h"
 #include "Base/Vector/WavevectorInfo.h"
 #include "Resample/Flux/IFlux.h"
@@ -21,7 +21,7 @@
 using std::numbers::pi;
 
 DiffuseElement::DiffuseElement(double wavelength, double alpha_i, double phi_i,
-                               const IPixel* const pixel, const SpinMatrix& polarizer,
+                               const Pixel* const pixel, const SpinMatrix& polarizer,
                                const SpinMatrix& analyzer, bool isSpecular_,
                                const Fluxes* const fluxes_in, const Fluxes* const fluxes_out)
     : IElement({polarizer, analyzer})
diff --git a/Resample/Element/DiffuseElement.h b/Resample/Element/DiffuseElement.h
index 52e77553e68..193fe3d7ee6 100644
--- a/Resample/Element/DiffuseElement.h
+++ b/Resample/Element/DiffuseElement.h
@@ -25,14 +25,14 @@
 
 class Fluxes;
 class IFlux;
-class IPixel;
+class Pixel;
 class WavevectorInfo;
 
 //! Data stucture containing both input and output of a single detector cell.
 
 class DiffuseElement : public IElement {
 public:
-    DiffuseElement(double wavelength, double alpha_i, double phi_i, const IPixel* const pixel,
+    DiffuseElement(double wavelength, double alpha_i, double phi_i, const Pixel* const pixel,
                    const SpinMatrix& polarizer, const SpinMatrix& analyzer, bool isSpecular_,
                    const Fluxes* fluxes_in = nullptr, const Fluxes* fluxes_out = nullptr);
     DiffuseElement(const DiffuseElement&) = delete;
@@ -71,7 +71,7 @@ private:
     const double m_phi_i;      //!< incident angle in xy plane
     const R3 m_k_i;            //!< cached value of k_i
     const R3 m_mean_kf;        //!< cached value of mean_kf
-    const IPixel* m_pixel;
+    const Pixel* m_pixel;
     const bool m_is_specular;
     const Fluxes* m_fluxes_in;
     const Fluxes* m_fluxes_out;
diff --git a/Sim/Simulation/OffspecSimulation.cpp b/Sim/Simulation/OffspecSimulation.cpp
index 2317a1e6709..6b62482c588 100644
--- a/Sim/Simulation/OffspecSimulation.cpp
+++ b/Sim/Simulation/OffspecSimulation.cpp
@@ -15,7 +15,7 @@
 #include "Sim/Simulation/OffspecSimulation.h"
 #include "Base/Axis/Frame.h"
 #include "Base/Axis/Scale.h"
-#include "Base/Pixel/IPixel.h"
+#include "Base/Pixel/Pixel.h"
 #include "Base/Progress/ProgressHandler.h"
 #include "Base/Util/Assert.h"
 #include "Device/Beam/IFootprint.h"
diff --git a/Sim/Simulation/OffspecSimulation.h b/Sim/Simulation/OffspecSimulation.h
index c17b257064b..d91cfd278ea 100644
--- a/Sim/Simulation/OffspecSimulation.h
+++ b/Sim/Simulation/OffspecSimulation.h
@@ -20,7 +20,7 @@
 
 class PhysicalScan;
 class Datafield;
-class IPixel;
+class Pixel;
 class OffspecDetector;
 
 //! Off-specular scattering simulation.
@@ -70,8 +70,8 @@ private:
     std::unique_ptr<OffspecDetector> m_detector;
 
     //... Caches:
-    OwningVector<const IPixel> m_pixels; //!< All unmasked pixels inside ROI.
-#endif                                   // SWIG
+    OwningVector<const Pixel> m_pixels; //!< All unmasked pixels inside ROI.
+#endif                                  // SWIG
 };
 
 #endif // BORNAGAIN_SIM_SIMULATION_OFFSPECSIMULATION_H
diff --git a/Sim/Simulation/ScatteringSimulation.cpp b/Sim/Simulation/ScatteringSimulation.cpp
index 89d71281c68..e31afb477cb 100644
--- a/Sim/Simulation/ScatteringSimulation.cpp
+++ b/Sim/Simulation/ScatteringSimulation.cpp
@@ -15,7 +15,7 @@
 #include "Sim/Simulation/ScatteringSimulation.h"
 #include "Base/Axis/Frame.h"
 #include "Base/Axis/Scale.h"
-#include "Base/Pixel/IPixel.h"
+#include "Base/Pixel/Pixel.h"
 #include "Base/Progress/ProgressHandler.h"
 #include "Base/Util/Assert.h"
 #include "Device/Beam/Beam.h"
diff --git a/Sim/Simulation/ScatteringSimulation.h b/Sim/Simulation/ScatteringSimulation.h
index bf98c7e0e19..dcf59293966 100644
--- a/Sim/Simulation/ScatteringSimulation.h
+++ b/Sim/Simulation/ScatteringSimulation.h
@@ -20,7 +20,7 @@
 
 class Beam;
 class IDetector;
-class IPixel;
+class Pixel;
 class IShape2D;
 
 //! GISAS simulation.
@@ -76,7 +76,7 @@ private:
 
     //... Caches:
     std::vector<size_t> m_activeIndices; //!< The sequence of bin indices (unmasked, in ROI)
-    OwningVector<const IPixel> m_pixels; //!< All unmasked pixels inside ROI.
+    OwningVector<const Pixel> m_pixels;  //!< All unmasked pixels inside ROI.
 
 #endif // SWIG
 };
diff --git a/auto/Wrap/libBornAgainDevice.py b/auto/Wrap/libBornAgainDevice.py
index 3d9672df9d6..19cc75e66bf 100644
--- a/auto/Wrap/libBornAgainDevice.py
+++ b/auto/Wrap/libBornAgainDevice.py
@@ -2731,7 +2731,7 @@ class Detector2D(IDetector):
         return _libBornAgainDevice.Detector2D_className(self)
 
     def createPixel(self, index):
-        r"""createPixel(Detector2D self, size_t index) -> IPixel *"""
+        r"""createPixel(Detector2D self, size_t index) -> Pixel *"""
         return _libBornAgainDevice.Detector2D_createPixel(self, index)
 
     def indexOfSpecular(self, beam):
@@ -2782,7 +2782,7 @@ class OffspecDetector(libBornAgainParam.INode):
         return _libBornAgainDevice.OffspecDetector_totalSize(self)
 
     def createPixel(self, index):
-        r"""createPixel(OffspecDetector self, size_t index) -> IPixel *"""
+        r"""createPixel(OffspecDetector self, size_t index) -> Pixel *"""
         return _libBornAgainDevice.OffspecDetector_createPixel(self, index)
 
     def indexOfSpecular(self, alpha, phi):
@@ -2819,7 +2819,7 @@ class SphericalDetector(IDetector):
         return _libBornAgainDevice.SphericalDetector_className(self)
 
     def createPixel(self, index):
-        r"""createPixel(SphericalDetector self, size_t index) -> IPixel *"""
+        r"""createPixel(SphericalDetector self, size_t index) -> Pixel *"""
         return _libBornAgainDevice.SphericalDetector_createPixel(self, index)
 
     def indexOfSpecular(self, beam):
diff --git a/auto/Wrap/libBornAgainDevice_wrap.cpp b/auto/Wrap/libBornAgainDevice_wrap.cpp
index 0b229d2d0a1..499bbdef893 100644
--- a/auto/Wrap/libBornAgainDevice_wrap.cpp
+++ b/auto/Wrap/libBornAgainDevice_wrap.cpp
@@ -3401,13 +3401,13 @@ namespace Swig {
 #define SWIGTYPE_p_IDetectorResolution swig_types[12]
 #define SWIGTYPE_p_IFootprint swig_types[13]
 #define SWIGTYPE_p_INode swig_types[14]
-#define SWIGTYPE_p_IPixel swig_types[15]
-#define SWIGTYPE_p_IResolutionFunction2D swig_types[16]
-#define SWIGTYPE_p_IShape2D swig_types[17]
-#define SWIGTYPE_p_ImportSettings1D swig_types[18]
-#define SWIGTYPE_p_Line swig_types[19]
-#define SWIGTYPE_p_MaskStack swig_types[20]
-#define SWIGTYPE_p_OffspecDetector swig_types[21]
+#define SWIGTYPE_p_IResolutionFunction2D swig_types[15]
+#define SWIGTYPE_p_IShape2D swig_types[16]
+#define SWIGTYPE_p_ImportSettings1D swig_types[17]
+#define SWIGTYPE_p_Line swig_types[18]
+#define SWIGTYPE_p_MaskStack swig_types[19]
+#define SWIGTYPE_p_OffspecDetector swig_types[20]
+#define SWIGTYPE_p_Pixel swig_types[21]
 #define SWIGTYPE_p_PolFilter swig_types[22]
 #define SWIGTYPE_p_Polygon swig_types[23]
 #define SWIGTYPE_p_PolygonPrivate swig_types[24]
@@ -36738,7 +36738,7 @@ SWIGINTERN PyObject *_wrap_Detector2D_createPixel(PyObject *self, PyObject *args
   size_t val2 ;
   int ecode2 = 0 ;
   PyObject *swig_obj[2] ;
-  IPixel *result = 0 ;
+  Pixel *result = 0 ;
   
   if (!SWIG_Python_UnpackTuple(args, "Detector2D_createPixel", 2, 2, swig_obj)) SWIG_fail;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Detector2D, 0 |  0 );
@@ -36753,7 +36753,7 @@ SWIGINTERN PyObject *_wrap_Detector2D_createPixel(PyObject *self, PyObject *args
   arg2 = static_cast< size_t >(val2);
   {
     try {
-      result = (IPixel *)((Detector2D const *)arg1)->createPixel(arg2);
+      result = (Pixel *)((Detector2D const *)arg1)->createPixel(arg2);
     } catch (const std::exception& ex) {
       // message shown in the Python interpreter
       const std::string msg {
@@ -36762,7 +36762,7 @@ SWIGINTERN PyObject *_wrap_Detector2D_createPixel(PyObject *self, PyObject *args
       SWIG_exception(SWIG_RuntimeError, msg.c_str());
     }
   }
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IPixel, 0 |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Pixel, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -37500,7 +37500,7 @@ SWIGINTERN PyObject *_wrap_OffspecDetector_createPixel(PyObject *self, PyObject
   size_t val2 ;
   int ecode2 = 0 ;
   PyObject *swig_obj[2] ;
-  IPixel *result = 0 ;
+  Pixel *result = 0 ;
   
   if (!SWIG_Python_UnpackTuple(args, "OffspecDetector_createPixel", 2, 2, swig_obj)) SWIG_fail;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_OffspecDetector, 0 |  0 );
@@ -37515,7 +37515,7 @@ SWIGINTERN PyObject *_wrap_OffspecDetector_createPixel(PyObject *self, PyObject
   arg2 = static_cast< size_t >(val2);
   {
     try {
-      result = (IPixel *)((OffspecDetector const *)arg1)->createPixel(arg2);
+      result = (Pixel *)((OffspecDetector const *)arg1)->createPixel(arg2);
     } catch (const std::exception& ex) {
       // message shown in the Python interpreter
       const std::string msg {
@@ -37524,7 +37524,7 @@ SWIGINTERN PyObject *_wrap_OffspecDetector_createPixel(PyObject *self, PyObject
       SWIG_exception(SWIG_RuntimeError, msg.c_str());
     }
   }
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IPixel, 0 |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Pixel, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -37985,7 +37985,7 @@ SWIGINTERN PyObject *_wrap_SphericalDetector_createPixel(PyObject *self, PyObjec
   size_t val2 ;
   int ecode2 = 0 ;
   PyObject *swig_obj[2] ;
-  IPixel *result = 0 ;
+  Pixel *result = 0 ;
   
   if (!SWIG_Python_UnpackTuple(args, "SphericalDetector_createPixel", 2, 2, swig_obj)) SWIG_fail;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SphericalDetector, 0 |  0 );
@@ -38000,7 +38000,7 @@ SWIGINTERN PyObject *_wrap_SphericalDetector_createPixel(PyObject *self, PyObjec
   arg2 = static_cast< size_t >(val2);
   {
     try {
-      result = (IPixel *)((SphericalDetector const *)arg1)->createPixel(arg2);
+      result = (Pixel *)((SphericalDetector const *)arg1)->createPixel(arg2);
     } catch (const std::exception& ex) {
       // message shown in the Python interpreter
       const std::string msg {
@@ -38009,7 +38009,7 @@ SWIGINTERN PyObject *_wrap_SphericalDetector_createPixel(PyObject *self, PyObjec
       SWIG_exception(SWIG_RuntimeError, msg.c_str());
     }
   }
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IPixel, 0 |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Pixel, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -42559,7 +42559,7 @@ static PyMethodDef SwigMethods[] = {
 	 { "delete_Detector2D", _wrap_delete_Detector2D, METH_O, "delete_Detector2D(Detector2D self)"},
 	 { "Detector2D_clone", _wrap_Detector2D_clone, METH_O, "Detector2D_clone(Detector2D self) -> Detector2D"},
 	 { "Detector2D_className", _wrap_Detector2D_className, METH_O, "Detector2D_className(Detector2D self) -> std::string"},
-	 { "Detector2D_createPixel", _wrap_Detector2D_createPixel, METH_VARARGS, "Detector2D_createPixel(Detector2D self, size_t index) -> IPixel *"},
+	 { "Detector2D_createPixel", _wrap_Detector2D_createPixel, METH_VARARGS, "Detector2D_createPixel(Detector2D self, size_t index) -> Pixel *"},
 	 { "Detector2D_indexOfSpecular", _wrap_Detector2D_indexOfSpecular, METH_VARARGS, "Detector2D_indexOfSpecular(Detector2D self, Beam beam) -> size_t"},
 	 { "Detector2D_swigregister", Detector2D_swigregister, METH_O, NULL},
 	 { "Detector2D_swiginit", Detector2D_swiginit, METH_VARARGS, NULL},
@@ -42577,7 +42577,7 @@ static PyMethodDef SwigMethods[] = {
 	 { "OffspecDetector_axis", _wrap_OffspecDetector_axis, METH_VARARGS, "OffspecDetector_axis(OffspecDetector self, size_t index) -> Scale"},
 	 { "OffspecDetector_axisBinIndex", _wrap_OffspecDetector_axisBinIndex, METH_VARARGS, "OffspecDetector_axisBinIndex(OffspecDetector self, size_t index, size_t selected_axis) -> size_t"},
 	 { "OffspecDetector_totalSize", _wrap_OffspecDetector_totalSize, METH_O, "OffspecDetector_totalSize(OffspecDetector self) -> size_t"},
-	 { "OffspecDetector_createPixel", _wrap_OffspecDetector_createPixel, METH_VARARGS, "OffspecDetector_createPixel(OffspecDetector self, size_t index) -> IPixel *"},
+	 { "OffspecDetector_createPixel", _wrap_OffspecDetector_createPixel, METH_VARARGS, "OffspecDetector_createPixel(OffspecDetector self, size_t index) -> Pixel *"},
 	 { "OffspecDetector_indexOfSpecular", _wrap_OffspecDetector_indexOfSpecular, METH_VARARGS, "OffspecDetector_indexOfSpecular(OffspecDetector self, double alpha, double phi) -> size_t"},
 	 { "OffspecDetector_analyzer", _wrap_OffspecDetector_analyzer, METH_O, "OffspecDetector_analyzer(OffspecDetector self) -> PolFilter const &"},
 	 { "OffspecDetector_swigregister", OffspecDetector_swigregister, METH_O, NULL},
@@ -42590,7 +42590,7 @@ static PyMethodDef SwigMethods[] = {
 	 { "delete_SphericalDetector", _wrap_delete_SphericalDetector, METH_O, "delete_SphericalDetector(SphericalDetector self)"},
 	 { "SphericalDetector_clone", _wrap_SphericalDetector_clone, METH_O, "SphericalDetector_clone(SphericalDetector self) -> SphericalDetector"},
 	 { "SphericalDetector_className", _wrap_SphericalDetector_className, METH_O, "SphericalDetector_className(SphericalDetector self) -> std::string"},
-	 { "SphericalDetector_createPixel", _wrap_SphericalDetector_createPixel, METH_VARARGS, "SphericalDetector_createPixel(SphericalDetector self, size_t index) -> IPixel *"},
+	 { "SphericalDetector_createPixel", _wrap_SphericalDetector_createPixel, METH_VARARGS, "SphericalDetector_createPixel(SphericalDetector self, size_t index) -> Pixel *"},
 	 { "SphericalDetector_indexOfSpecular", _wrap_SphericalDetector_indexOfSpecular, METH_VARARGS, "SphericalDetector_indexOfSpecular(SphericalDetector self, Beam beam) -> size_t"},
 	 { "SphericalDetector_swigregister", SphericalDetector_swigregister, METH_O, NULL},
 	 { "SphericalDetector_swiginit", SphericalDetector_swiginit, METH_VARARGS, NULL},
@@ -42776,13 +42776,13 @@ static swig_type_info _swigt__p_IDetector = {"_p_IDetector", "IDetector *", 0, 0
 static swig_type_info _swigt__p_IDetectorResolution = {"_p_IDetectorResolution", "IDetectorResolution *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_IFootprint = {"_p_IFootprint", "IFootprint *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_INode = {"_p_INode", "INode *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_IPixel = {"_p_IPixel", "IPixel *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_IResolutionFunction2D = {"_p_IResolutionFunction2D", "IResolutionFunction2D *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_IShape2D = {"_p_IShape2D", "IShape2D *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_ImportSettings1D = {"_p_ImportSettings1D", "ImportSettings1D *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_Line = {"_p_Line", "Line *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_MaskStack = {"_p_MaskStack", "MaskStack *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_OffspecDetector = {"_p_OffspecDetector", "OffspecDetector *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_Pixel = {"_p_Pixel", "Pixel *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_PolFilter = {"_p_PolFilter", "PolFilter *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_Polygon = {"_p_Polygon", "Polygon *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_PolygonPrivate = {"_p_PolygonPrivate", "PolygonPrivate *", 0, 0, (void*)0, 0};
@@ -42863,13 +42863,13 @@ static swig_type_info *swig_type_initial[] = {
   &_swigt__p_IDetectorResolution,
   &_swigt__p_IFootprint,
   &_swigt__p_INode,
-  &_swigt__p_IPixel,
   &_swigt__p_IResolutionFunction2D,
   &_swigt__p_IShape2D,
   &_swigt__p_ImportSettings1D,
   &_swigt__p_Line,
   &_swigt__p_MaskStack,
   &_swigt__p_OffspecDetector,
+  &_swigt__p_Pixel,
   &_swigt__p_PolFilter,
   &_swigt__p_Polygon,
   &_swigt__p_PolygonPrivate,
@@ -42950,13 +42950,13 @@ static swig_cast_info _swigc__p_IDetector[] = {  {&_swigt__p_IDetector, 0, 0, 0}
 static swig_cast_info _swigc__p_IDetectorResolution[] = {  {&_swigt__p_IDetectorResolution, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_IFootprint[] = {  {&_swigt__p_IFootprint, 0, 0, 0},  {&_swigt__p_FootprintGauss, _p_FootprintGaussTo_p_IFootprint, 0, 0},  {&_swigt__p_FootprintSquare, _p_FootprintSquareTo_p_IFootprint, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_INode[] = {  {&_swigt__p_INode, 0, 0, 0},  {&_swigt__p_Beam, _p_BeamTo_p_INode, 0, 0},  {&_swigt__p_Detector2D, _p_Detector2DTo_p_INode, 0, 0},  {&_swigt__p_FootprintGauss, _p_FootprintGaussTo_p_INode, 0, 0},  {&_swigt__p_FootprintSquare, _p_FootprintSquareTo_p_INode, 0, 0},  {&_swigt__p_IDetector, _p_IDetectorTo_p_INode, 0, 0},  {&_swigt__p_IDetectorResolution, _p_IDetectorResolutionTo_p_INode, 0, 0},  {&_swigt__p_IFootprint, _p_IFootprintTo_p_INode, 0, 0},  {&_swigt__p_IResolutionFunction2D, _p_IResolutionFunction2DTo_p_INode, 0, 0},  {&_swigt__p_OffspecDetector, _p_OffspecDetectorTo_p_INode, 0, 0},  {&_swigt__p_ResolutionFunction2DGaussian, _p_ResolutionFunction2DGaussianTo_p_INode, 0, 0},  {&_swigt__p_SphericalDetector, _p_SphericalDetectorTo_p_INode, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_IPixel[] = {  {&_swigt__p_IPixel, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_IResolutionFunction2D[] = {  {&_swigt__p_IResolutionFunction2D, 0, 0, 0},  {&_swigt__p_ResolutionFunction2DGaussian, _p_ResolutionFunction2DGaussianTo_p_IResolutionFunction2D, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_IShape2D[] = {  {&_swigt__p_IShape2D, 0, 0, 0},  {&_swigt__p_Ellipse, _p_EllipseTo_p_IShape2D, 0, 0},  {&_swigt__p_HorizontalLine, _p_HorizontalLineTo_p_IShape2D, 0, 0},  {&_swigt__p_Line, _p_LineTo_p_IShape2D, 0, 0},  {&_swigt__p_Polygon, _p_PolygonTo_p_IShape2D, 0, 0},  {&_swigt__p_Rectangle, _p_RectangleTo_p_IShape2D, 0, 0},  {&_swigt__p_VerticalLine, _p_VerticalLineTo_p_IShape2D, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_ImportSettings1D[] = {  {&_swigt__p_ImportSettings1D, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_Line[] = {  {&_swigt__p_Line, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_MaskStack[] = {  {&_swigt__p_MaskStack, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_OffspecDetector[] = {  {&_swigt__p_OffspecDetector, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_Pixel[] = {  {&_swigt__p_Pixel, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_PolFilter[] = {  {&_swigt__p_PolFilter, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_Polygon[] = {  {&_swigt__p_Polygon, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_PolygonPrivate[] = {  {&_swigt__p_PolygonPrivate, 0, 0, 0},{0, 0, 0, 0}};
@@ -43037,13 +43037,13 @@ static swig_cast_info *swig_cast_initial[] = {
   _swigc__p_IDetectorResolution,
   _swigc__p_IFootprint,
   _swigc__p_INode,
-  _swigc__p_IPixel,
   _swigc__p_IResolutionFunction2D,
   _swigc__p_IShape2D,
   _swigc__p_ImportSettings1D,
   _swigc__p_Line,
   _swigc__p_MaskStack,
   _swigc__p_OffspecDetector,
+  _swigc__p_Pixel,
   _swigc__p_PolFilter,
   _swigc__p_Polygon,
   _swigc__p_PolygonPrivate,
-- 
GitLab