From c8f456328c8155ccd1a04588bc646032c9f70b3d Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Mon, 28 Sep 2020 15:39:39 +0200
Subject: [PATCH] Core API simplification: remove c'tors XSimulation(sample)

---
 Core/Simulation/DepthProbeSimulation.cpp      |   5 -
 Core/Simulation/DepthProbeSimulation.h        |   1 -
 Core/Simulation/GISASSimulation.cpp           |   5 -
 Core/Simulation/GISASSimulation.h             |   1 -
 Core/Simulation/OffSpecSimulation.cpp         |   5 -
 Core/Simulation/OffSpecSimulation.h           |   2 -
 Core/Simulation/Simulation.cpp                |   6 -
 Core/Simulation/Simulation.h                  |   2 -
 Core/Simulation/Simulation2D.cpp              |   2 -
 Core/Simulation/Simulation2D.h                |   1 -
 Core/Simulation/SpecularSimulation.cpp        |   5 -
 Core/Simulation/SpecularSimulation.h          |   1 -
 .../Models/DomainSimulationBuilder.cpp        |  67 +++--
 .../Python/PyFit/fitobjective_api.py          |   3 +-
 .../Core/Fitting/FittingTestHelper.h          |   3 +-
 .../Core/Other/GISASSimulationTest.cpp        |   8 +-
 auto/Wrap/libBornAgainCore.py                 |  20 +-
 auto/Wrap/libBornAgainCore_wrap.cpp           | 248 ++----------------
 18 files changed, 65 insertions(+), 320 deletions(-)

diff --git a/Core/Simulation/DepthProbeSimulation.cpp b/Core/Simulation/DepthProbeSimulation.cpp
index f1785958a9d..b65d7e4de0d 100644
--- a/Core/Simulation/DepthProbeSimulation.cpp
+++ b/Core/Simulation/DepthProbeSimulation.cpp
@@ -39,11 +39,6 @@ DepthProbeSimulation::DepthProbeSimulation() : Simulation()
     initialize();
 }
 
-DepthProbeSimulation::DepthProbeSimulation(const MultiLayer& sample) : Simulation(sample)
-{
-    initialize();
-}
-
 DepthProbeSimulation::~DepthProbeSimulation() = default;
 
 DepthProbeSimulation* DepthProbeSimulation::clone() const
diff --git a/Core/Simulation/DepthProbeSimulation.h b/Core/Simulation/DepthProbeSimulation.h
index 74ab12a4c87..cb144e9916a 100644
--- a/Core/Simulation/DepthProbeSimulation.h
+++ b/Core/Simulation/DepthProbeSimulation.h
@@ -35,7 +35,6 @@ class DepthProbeSimulation : public Simulation
 {
 public:
     DepthProbeSimulation();
-    DepthProbeSimulation(const MultiLayer& sample);
     ~DepthProbeSimulation() override;
 
     DepthProbeSimulation* clone() const override;
diff --git a/Core/Simulation/GISASSimulation.cpp b/Core/Simulation/GISASSimulation.cpp
index aa550013de8..5576b5ef405 100644
--- a/Core/Simulation/GISASSimulation.cpp
+++ b/Core/Simulation/GISASSimulation.cpp
@@ -26,11 +26,6 @@ GISASSimulation::GISASSimulation()
     initialize();
 }
 
-GISASSimulation::GISASSimulation(const MultiLayer& p_sample) : Simulation2D(p_sample)
-{
-    initialize();
-}
-
 void GISASSimulation::prepareSimulation()
 {
     if (m_instrument.getDetectorDimension() != 2)
diff --git a/Core/Simulation/GISASSimulation.h b/Core/Simulation/GISASSimulation.h
index 96d0c413c4c..7a553f97639 100644
--- a/Core/Simulation/GISASSimulation.h
+++ b/Core/Simulation/GISASSimulation.h
@@ -28,7 +28,6 @@ class GISASSimulation : public Simulation2D
 {
 public:
     GISASSimulation();
-    GISASSimulation(const MultiLayer& p_sample);
     ~GISASSimulation() {}
 
     GISASSimulation* clone() const override { return new GISASSimulation(*this); }
diff --git a/Core/Simulation/OffSpecSimulation.cpp b/Core/Simulation/OffSpecSimulation.cpp
index 13bd70d7288..e6c5587af7c 100644
--- a/Core/Simulation/OffSpecSimulation.cpp
+++ b/Core/Simulation/OffSpecSimulation.cpp
@@ -28,11 +28,6 @@ OffSpecSimulation::OffSpecSimulation()
     initialize();
 }
 
-OffSpecSimulation::OffSpecSimulation(const MultiLayer& p_sample) : Simulation2D(p_sample)
-{
-    initialize();
-}
-
 void OffSpecSimulation::prepareSimulation()
 {
     checkInitialization();
diff --git a/Core/Simulation/OffSpecSimulation.h b/Core/Simulation/OffSpecSimulation.h
index b9807a23d44..ae01237923e 100644
--- a/Core/Simulation/OffSpecSimulation.h
+++ b/Core/Simulation/OffSpecSimulation.h
@@ -27,8 +27,6 @@ class OffSpecSimulation : public Simulation2D
 {
 public:
     OffSpecSimulation();
-    OffSpecSimulation(const MultiLayer& p_sample);
-
     ~OffSpecSimulation() final {}
 
     OffSpecSimulation* clone() const override { return new OffSpecSimulation(*this); }
diff --git a/Core/Simulation/Simulation.cpp b/Core/Simulation/Simulation.cpp
index 6809cb542a0..198a9f09516 100644
--- a/Core/Simulation/Simulation.cpp
+++ b/Core/Simulation/Simulation.cpp
@@ -111,12 +111,6 @@ Simulation::Simulation()
     initialize();
 }
 
-Simulation::Simulation(const MultiLayer& sample)
-{
-    initialize();
-    m_sample_provider.setSample(sample);
-}
-
 Simulation::Simulation(const Simulation& other)
     : ICloneable(), INode(), m_sample_provider(other.m_sample_provider), m_options(other.m_options),
       m_distribution_handler(other.m_distribution_handler), m_progress(other.m_progress),
diff --git a/Core/Simulation/Simulation.h b/Core/Simulation/Simulation.h
index b51c92284e0..a81e66c757d 100644
--- a/Core/Simulation/Simulation.h
+++ b/Core/Simulation/Simulation.h
@@ -39,8 +39,6 @@ class Simulation : public ICloneable, public INode
 {
 public:
     Simulation();
-    Simulation(const MultiLayer& sample);
-//    Simulation(const std::shared_ptr<ISampleBuilder>& sample_builder);
     virtual ~Simulation();
 
     virtual Simulation* clone() const = 0;
diff --git a/Core/Simulation/Simulation2D.cpp b/Core/Simulation/Simulation2D.cpp
index 08c96bf7753..830e5054331 100644
--- a/Core/Simulation/Simulation2D.cpp
+++ b/Core/Simulation/Simulation2D.cpp
@@ -22,8 +22,6 @@
 
 Simulation2D::Simulation2D() = default;
 
-Simulation2D::Simulation2D(const MultiLayer& p_sample) : Simulation(p_sample) {}
-
 Simulation2D::~Simulation2D() = default;
 
 void Simulation2D::prepareSimulation()
diff --git a/Core/Simulation/Simulation2D.h b/Core/Simulation/Simulation2D.h
index b1685521a53..abba751dbc8 100644
--- a/Core/Simulation/Simulation2D.h
+++ b/Core/Simulation/Simulation2D.h
@@ -28,7 +28,6 @@ class Simulation2D : public Simulation
 {
 public:
     Simulation2D();
-    Simulation2D(const MultiLayer& p_sample);
     ~Simulation2D() override;
 
     Simulation2D* clone() const override = 0;
diff --git a/Core/Simulation/SpecularSimulation.cpp b/Core/Simulation/SpecularSimulation.cpp
index f1db4ee53d7..14b465b9641 100644
--- a/Core/Simulation/SpecularSimulation.cpp
+++ b/Core/Simulation/SpecularSimulation.cpp
@@ -47,11 +47,6 @@ SpecularSimulation::SpecularSimulation() : Simulation()
     initialize();
 }
 
-SpecularSimulation::SpecularSimulation(const MultiLayer& sample) : Simulation(sample)
-{
-    initialize();
-}
-
 SpecularSimulation::~SpecularSimulation() = default;
 
 SpecularSimulation* SpecularSimulation::clone() const
diff --git a/Core/Simulation/SpecularSimulation.h b/Core/Simulation/SpecularSimulation.h
index 76dba42e853..04e003bd895 100644
--- a/Core/Simulation/SpecularSimulation.h
+++ b/Core/Simulation/SpecularSimulation.h
@@ -35,7 +35,6 @@ class SpecularSimulation : public Simulation
 {
 public:
     SpecularSimulation();
-    SpecularSimulation(const MultiLayer& sample);
     ~SpecularSimulation() override;
 
     SpecularSimulation* clone() const override;
diff --git a/GUI/coregui/Models/DomainSimulationBuilder.cpp b/GUI/coregui/Models/DomainSimulationBuilder.cpp
index dc11ed2a151..c962d3e8c43 100644
--- a/GUI/coregui/Models/DomainSimulationBuilder.cpp
+++ b/GUI/coregui/Models/DomainSimulationBuilder.cpp
@@ -97,39 +97,38 @@ void addBackgroundToSimulation(const InstrumentItem& instrument, Simulation& sim
 }
 
 std::unique_ptr<GISASSimulation> createGISASSimulation(std::unique_ptr<MultiLayer> P_multilayer,
-                                                       const GISASInstrumentItem* gisasInstrument,
+                                                       const GISASInstrumentItem* instrument,
                                                        const SimulationOptionsItem* optionsItem)
 {
-    std::unique_ptr<GISASSimulation> gisas(new GISASSimulation);
-    auto P_instrument = DomainObjectBuilder::buildInstrument(*gisasInstrument);
-    gisas->setSample(*P_multilayer);
-    gisas->setInstrument(*P_instrument);
-    TransformToDomain::addDistributionParametersToSimulation(*gisasInstrument->beamItem(),
-                                                             *gisas.get());
+    std::unique_ptr<GISASSimulation> ret(new GISASSimulation);
+    auto P_instrument = DomainObjectBuilder::buildInstrument(*instrument);
+    ret->setSample(*P_multilayer);
+    ret->setInstrument(*P_instrument);
+    TransformToDomain::addDistributionParametersToSimulation(*instrument->beamItem(), *ret);
 
     // Simulation options
     if (optionsItem)
-        TransformToDomain::setSimulationOptions(gisas.get(), *optionsItem);
+        TransformToDomain::setSimulationOptions(ret.get(), *optionsItem);
 
-    addBackgroundToSimulation(*gisasInstrument, *gisas);
+    addBackgroundToSimulation(*instrument, *ret);
 
-    return gisas;
+    return ret;
 }
 
 std::unique_ptr<OffSpecSimulation>
 createOffSpecSimulation(std::unique_ptr<MultiLayer> P_multilayer,
-                        const OffSpecInstrumentItem* offspecInstrument,
+                        const OffSpecInstrumentItem* instrument,
                         const SimulationOptionsItem* optionsItem)
 {
-    std::unique_ptr<OffSpecSimulation> offspec(new OffSpecSimulation);
-    auto P_instrument = DomainObjectBuilder::buildInstrument(*offspecInstrument);
-    offspec->setSample(*P_multilayer);
-    offspec->setInstrument(*P_instrument);
+    std::unique_ptr<OffSpecSimulation> ret(new OffSpecSimulation);
+    auto P_instrument = DomainObjectBuilder::buildInstrument(*instrument);
+    ret->setSample(*P_multilayer);
+    ret->setInstrument(*P_instrument);
 
-    auto beamItem = offspecInstrument->beamItem();
+    auto beamItem = instrument->beamItem();
     auto axisItem = dynamic_cast<BasicAxisItem*>(
-        offspecInstrument->getItem(OffSpecInstrumentItem::P_ALPHA_AXIS));
-    offspec->setBeamParameters(beamItem->getWavelength(), *axisItem->createAxis(Units::degree),
+        instrument->getItem(OffSpecInstrumentItem::P_ALPHA_AXIS));
+    ret->setBeamParameters(beamItem->getWavelength(), *axisItem->createAxis(Units::degree),
                                beamItem->getAzimuthalAngle());
 
     // TODO Take care about distributions
@@ -138,22 +137,22 @@ createOffSpecSimulation(std::unique_ptr<MultiLayer> P_multilayer,
 
     // Simulation options
     if (optionsItem)
-        TransformToDomain::setSimulationOptions(offspec.get(), *optionsItem);
+        TransformToDomain::setSimulationOptions(ret.get(), *optionsItem);
 
-    addBackgroundToSimulation(*offspecInstrument, *offspec);
+    addBackgroundToSimulation(*instrument, *ret);
 
-    return offspec;
+    return ret;
 }
 
 std::unique_ptr<SpecularSimulation>
 createSpecularSimulation(std::unique_ptr<MultiLayer> P_multilayer,
-                         const SpecularInstrumentItem* specular_instrument,
+                         const SpecularInstrumentItem* instrument,
                          const SimulationOptionsItem* options_item)
 {
-    std::unique_ptr<SpecularSimulation> specular_simulation =
-        std::make_unique<SpecularSimulation>(*P_multilayer);
+    std::unique_ptr<SpecularSimulation> ret = std::make_unique<SpecularSimulation>();
+    ret->setSample(*P_multilayer);
 
-    auto beam_item = specular_instrument->beamItem();
+    auto beam_item = instrument->beamItem();
     const auto axis_item = beam_item->currentInclinationAxisItem();
     const auto footprint = beam_item->currentFootprintItem();
 
@@ -162,16 +161,16 @@ createSpecularSimulation(std::unique_ptr<MultiLayer> P_multilayer,
 
     TransformToDomain::addBeamDivergencesToScan(*beam_item, scan);
 
-    specular_simulation->setBeamIntensity(beam_item->getIntensity());
-    specular_simulation->setScan(scan);
+    ret->setBeamIntensity(beam_item->getIntensity());
+    ret->setScan(scan);
 
     // Simulation options
     if (options_item)
-        TransformToDomain::setSimulationOptions(specular_simulation.get(), *options_item);
+        TransformToDomain::setSimulationOptions(ret.get(), *options_item);
 
-    addBackgroundToSimulation(*specular_instrument, *specular_simulation);
+    addBackgroundToSimulation(*instrument, *ret);
 
-    return specular_simulation;
+    return ret;
 }
 
 std::unique_ptr<DepthProbeSimulation>
@@ -179,13 +178,13 @@ createDepthProbeSimulation(std::unique_ptr<MultiLayer> P_multilayer,
                            const DepthProbeInstrumentItem* instrument,
                            const SimulationOptionsItem* options_item)
 {
-    std::unique_ptr<DepthProbeSimulation> simulation = instrument->createSimulation();
-    simulation->setSample(*P_multilayer.get());
+    std::unique_ptr<DepthProbeSimulation> ret = instrument->createSimulation();
+    ret->setSample(*P_multilayer);
 
     if (options_item)
-        TransformToDomain::setSimulationOptions(simulation.get(), *options_item);
+        TransformToDomain::setSimulationOptions(ret.get(), *options_item);
 
-    return simulation;
+    return ret;
 }
 
 } // namespace
diff --git a/Tests/Functional/Python/PyFit/fitobjective_api.py b/Tests/Functional/Python/PyFit/fitobjective_api.py
index fc58382e987..3de3426e853 100644
--- a/Tests/Functional/Python/PyFit/fitobjective_api.py
+++ b/Tests/Functional/Python/PyFit/fitobjective_api.py
@@ -29,7 +29,8 @@ class SimulationBuilder:
         ml.addLayer(ba.Layer(material))
         ml.addLayer(ba.Layer(material))
 
-        simulation = ba.GISASSimulation(ml)
+        simulation = ba.GISASSimulation()
+        simulation.setSample(ml)
         simulation.setDetectorParameters(self.m_ncol, 0.0, 1.0, self.m_nrow, 0.0, 1.0)
         return simulation
 
diff --git a/Tests/UnitTests/Core/Fitting/FittingTestHelper.h b/Tests/UnitTests/Core/Fitting/FittingTestHelper.h
index 32e8786857d..fc4043d3a0a 100644
--- a/Tests/UnitTests/Core/Fitting/FittingTestHelper.h
+++ b/Tests/UnitTests/Core/Fitting/FittingTestHelper.h
@@ -33,7 +33,8 @@ public:
         multilayer.addLayer(Layer(material));
         multilayer.addLayer(Layer(material));
 
-        std::unique_ptr<GISASSimulation> result(new GISASSimulation(multilayer));
+        std::unique_ptr<GISASSimulation> result(new GISASSimulation());
+        result->setSample(multilayer);
         result->setDetectorParameters(m_nx, m_xmin, m_xmax, m_ny, m_ymin, m_ymax);
 
         m_builder_calls++;
diff --git a/Tests/UnitTests/Core/Other/GISASSimulationTest.cpp b/Tests/UnitTests/Core/Other/GISASSimulationTest.cpp
index 2852c32f19a..e32f0460bcd 100644
--- a/Tests/UnitTests/Core/Other/GISASSimulationTest.cpp
+++ b/Tests/UnitTests/Core/Other/GISASSimulationTest.cpp
@@ -17,8 +17,8 @@ TEST_F(GISASSimulationTest, SimulationInitialState)
 
 TEST_F(GISASSimulationTest, SimulationConstruction)
 {
-    MultiLayer multi_layer;
-    GISASSimulation simulation(multi_layer);
+    GISASSimulation simulation;
+    simulation.setSample(MultiLayer());
     EXPECT_NE(nullptr, simulation.sample());
     EXPECT_EQ(0u, simulation.intensityMapSize());
     EXPECT_THROW(simulation.result(), std::runtime_error);
@@ -44,8 +44,8 @@ TEST_F(GISASSimulationTest, SimulationClone1)
 
 TEST_F(GISASSimulationTest, SimulationClone2)
 {
-    MultiLayer multi_layer;
-    GISASSimulation simulation(multi_layer);
+    GISASSimulation simulation;
+    simulation.setSample(MultiLayer());
     simulation.setDetectorParameters(10, -2.0, 2.0, 20, 0.0, 2.0);
     auto p_clone = simulation.clone();
     EXPECT_NE(nullptr, p_clone->sample());
diff --git a/auto/Wrap/libBornAgainCore.py b/auto/Wrap/libBornAgainCore.py
index eb270f8955c..ad1cff7dedf 100644
--- a/auto/Wrap/libBornAgainCore.py
+++ b/auto/Wrap/libBornAgainCore.py
@@ -17616,14 +17616,13 @@ class GISASSimulation(Simulation2D):
     thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
     __repr__ = _swig_repr
 
-    def __init__(self, *args):
+    def __init__(self):
         r"""
         __init__(GISASSimulation self) -> GISASSimulation
-        __init__(GISASSimulation self, MultiLayer p_sample) -> GISASSimulation
         GISASSimulation::GISASSimulation(const std::shared_ptr< ISampleBuilder > p_sample_builder)
 
         """
-        _libBornAgainCore.GISASSimulation_swiginit(self, _libBornAgainCore.new_GISASSimulation(*args))
+        _libBornAgainCore.GISASSimulation_swiginit(self, _libBornAgainCore.new_GISASSimulation())
     __swig_destroy__ = _libBornAgainCore.delete_GISASSimulation
 
     def clone(self):
@@ -17693,14 +17692,13 @@ class DepthProbeSimulation(Simulation):
     thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
     __repr__ = _swig_repr
 
-    def __init__(self, *args):
+    def __init__(self):
         r"""
         __init__(DepthProbeSimulation self) -> DepthProbeSimulation
-        __init__(DepthProbeSimulation self, MultiLayer sample) -> DepthProbeSimulation
         DepthProbeSimulation::DepthProbeSimulation(const std::shared_ptr< ISampleBuilder > sample_builder)
 
         """
-        _libBornAgainCore.DepthProbeSimulation_swiginit(self, _libBornAgainCore.new_DepthProbeSimulation(*args))
+        _libBornAgainCore.DepthProbeSimulation_swiginit(self, _libBornAgainCore.new_DepthProbeSimulation())
     __swig_destroy__ = _libBornAgainCore.delete_DepthProbeSimulation
 
     def clone(self):
@@ -17797,14 +17795,13 @@ class SpecularSimulation(Simulation):
     thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
     __repr__ = _swig_repr
 
-    def __init__(self, *args):
+    def __init__(self):
         r"""
         __init__(SpecularSimulation self) -> SpecularSimulation
-        __init__(SpecularSimulation self, MultiLayer sample) -> SpecularSimulation
         SpecularSimulation::SpecularSimulation(const std::shared_ptr< ISampleBuilder > sample_builder)
 
         """
-        _libBornAgainCore.SpecularSimulation_swiginit(self, _libBornAgainCore.new_SpecularSimulation(*args))
+        _libBornAgainCore.SpecularSimulation_swiginit(self, _libBornAgainCore.new_SpecularSimulation())
     __swig_destroy__ = _libBornAgainCore.delete_SpecularSimulation
 
     def clone(self):
@@ -17906,14 +17903,13 @@ class OffSpecSimulation(Simulation2D):
     thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
     __repr__ = _swig_repr
 
-    def __init__(self, *args):
+    def __init__(self):
         r"""
         __init__(OffSpecSimulation self) -> OffSpecSimulation
-        __init__(OffSpecSimulation self, MultiLayer p_sample) -> OffSpecSimulation
         OffSpecSimulation::OffSpecSimulation(const std::shared_ptr< class ISampleBuilder > p_sample_builder)
 
         """
-        _libBornAgainCore.OffSpecSimulation_swiginit(self, _libBornAgainCore.new_OffSpecSimulation(*args))
+        _libBornAgainCore.OffSpecSimulation_swiginit(self, _libBornAgainCore.new_OffSpecSimulation())
     __swig_destroy__ = _libBornAgainCore.delete_OffSpecSimulation
 
     def clone(self):
diff --git a/auto/Wrap/libBornAgainCore_wrap.cpp b/auto/Wrap/libBornAgainCore_wrap.cpp
index 0244c405e26..423567fb7df 100644
--- a/auto/Wrap/libBornAgainCore_wrap.cpp
+++ b/auto/Wrap/libBornAgainCore_wrap.cpp
@@ -102084,11 +102084,11 @@ SWIGINTERN PyObject *Simulation2D_swigregister(PyObject *SWIGUNUSEDPARM(self), P
   return SWIG_Py_Void();
 }
 
-SWIGINTERN PyObject *_wrap_new_GISASSimulation__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
+SWIGINTERN PyObject *_wrap_new_GISASSimulation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   GISASSimulation *result = 0 ;
   
-  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
+  if (!SWIG_Python_UnpackTuple(args, "new_GISASSimulation", 0, 0, 0)) SWIG_fail;
   result = (GISASSimulation *)new GISASSimulation();
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GISASSimulation, SWIG_POINTER_NEW |  0 );
   return resultobj;
@@ -102097,59 +102097,6 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_new_GISASSimulation__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) {
-  PyObject *resultobj = 0;
-  MultiLayer *arg1 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  GISASSimulation *result = 0 ;
-  
-  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_MultiLayer,  0  | 0);
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_GISASSimulation" "', argument " "1"" of type '" "MultiLayer const &""'"); 
-  }
-  if (!argp1) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_GISASSimulation" "', argument " "1"" of type '" "MultiLayer const &""'"); 
-  }
-  arg1 = reinterpret_cast< MultiLayer * >(argp1);
-  result = (GISASSimulation *)new GISASSimulation((MultiLayer const &)*arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GISASSimulation, SWIG_POINTER_NEW |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_new_GISASSimulation(PyObject *self, PyObject *args) {
-  Py_ssize_t argc;
-  PyObject *argv[2] = {
-    0
-  };
-  
-  if (!(argc = SWIG_Python_UnpackTuple(args, "new_GISASSimulation", 0, 1, argv))) SWIG_fail;
-  --argc;
-  if (argc == 0) {
-    return _wrap_new_GISASSimulation__SWIG_0(self, argc, argv);
-  }
-  if (argc == 1) {
-    int _v;
-    int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_MultiLayer, SWIG_POINTER_NO_NULL | 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      return _wrap_new_GISASSimulation__SWIG_1(self, argc, argv);
-    }
-  }
-  
-fail:
-  SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_GISASSimulation'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    GISASSimulation::GISASSimulation()\n"
-    "    GISASSimulation::GISASSimulation(MultiLayer const &)\n");
-  return 0;
-}
-
-
 SWIGINTERN PyObject *_wrap_delete_GISASSimulation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   GISASSimulation *arg1 = (GISASSimulation *) 0 ;
@@ -102348,11 +102295,11 @@ SWIGINTERN PyObject *GISASSimulation_swiginit(PyObject *SWIGUNUSEDPARM(self), Py
   return SWIG_Python_InitShadowInstance(args);
 }
 
-SWIGINTERN PyObject *_wrap_new_DepthProbeSimulation__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
+SWIGINTERN PyObject *_wrap_new_DepthProbeSimulation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   DepthProbeSimulation *result = 0 ;
   
-  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
+  if (!SWIG_Python_UnpackTuple(args, "new_DepthProbeSimulation", 0, 0, 0)) SWIG_fail;
   result = (DepthProbeSimulation *)new DepthProbeSimulation();
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DepthProbeSimulation, SWIG_POINTER_NEW |  0 );
   return resultobj;
@@ -102361,59 +102308,6 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_new_DepthProbeSimulation__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) {
-  PyObject *resultobj = 0;
-  MultiLayer *arg1 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  DepthProbeSimulation *result = 0 ;
-  
-  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_MultiLayer,  0  | 0);
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_DepthProbeSimulation" "', argument " "1"" of type '" "MultiLayer const &""'"); 
-  }
-  if (!argp1) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DepthProbeSimulation" "', argument " "1"" of type '" "MultiLayer const &""'"); 
-  }
-  arg1 = reinterpret_cast< MultiLayer * >(argp1);
-  result = (DepthProbeSimulation *)new DepthProbeSimulation((MultiLayer const &)*arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DepthProbeSimulation, SWIG_POINTER_NEW |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_new_DepthProbeSimulation(PyObject *self, PyObject *args) {
-  Py_ssize_t argc;
-  PyObject *argv[2] = {
-    0
-  };
-  
-  if (!(argc = SWIG_Python_UnpackTuple(args, "new_DepthProbeSimulation", 0, 1, argv))) SWIG_fail;
-  --argc;
-  if (argc == 0) {
-    return _wrap_new_DepthProbeSimulation__SWIG_0(self, argc, argv);
-  }
-  if (argc == 1) {
-    int _v;
-    int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_MultiLayer, SWIG_POINTER_NO_NULL | 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      return _wrap_new_DepthProbeSimulation__SWIG_1(self, argc, argv);
-    }
-  }
-  
-fail:
-  SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_DepthProbeSimulation'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    DepthProbeSimulation::DepthProbeSimulation()\n"
-    "    DepthProbeSimulation::DepthProbeSimulation(MultiLayer const &)\n");
-  return 0;
-}
-
-
 SWIGINTERN PyObject *_wrap_delete_DepthProbeSimulation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   DepthProbeSimulation *arg1 = (DepthProbeSimulation *) 0 ;
@@ -102837,11 +102731,11 @@ SWIGINTERN PyObject *DepthProbeSimulation_swiginit(PyObject *SWIGUNUSEDPARM(self
   return SWIG_Python_InitShadowInstance(args);
 }
 
-SWIGINTERN PyObject *_wrap_new_SpecularSimulation__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
+SWIGINTERN PyObject *_wrap_new_SpecularSimulation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   SpecularSimulation *result = 0 ;
   
-  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
+  if (!SWIG_Python_UnpackTuple(args, "new_SpecularSimulation", 0, 0, 0)) SWIG_fail;
   result = (SpecularSimulation *)new SpecularSimulation();
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_SpecularSimulation, SWIG_POINTER_NEW |  0 );
   return resultobj;
@@ -102850,59 +102744,6 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_new_SpecularSimulation__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) {
-  PyObject *resultobj = 0;
-  MultiLayer *arg1 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  SpecularSimulation *result = 0 ;
-  
-  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_MultiLayer,  0  | 0);
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_SpecularSimulation" "', argument " "1"" of type '" "MultiLayer const &""'"); 
-  }
-  if (!argp1) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_SpecularSimulation" "', argument " "1"" of type '" "MultiLayer const &""'"); 
-  }
-  arg1 = reinterpret_cast< MultiLayer * >(argp1);
-  result = (SpecularSimulation *)new SpecularSimulation((MultiLayer const &)*arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_SpecularSimulation, SWIG_POINTER_NEW |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_new_SpecularSimulation(PyObject *self, PyObject *args) {
-  Py_ssize_t argc;
-  PyObject *argv[2] = {
-    0
-  };
-  
-  if (!(argc = SWIG_Python_UnpackTuple(args, "new_SpecularSimulation", 0, 1, argv))) SWIG_fail;
-  --argc;
-  if (argc == 0) {
-    return _wrap_new_SpecularSimulation__SWIG_0(self, argc, argv);
-  }
-  if (argc == 1) {
-    int _v;
-    int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_MultiLayer, SWIG_POINTER_NO_NULL | 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      return _wrap_new_SpecularSimulation__SWIG_1(self, argc, argv);
-    }
-  }
-  
-fail:
-  SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_SpecularSimulation'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    SpecularSimulation::SpecularSimulation()\n"
-    "    SpecularSimulation::SpecularSimulation(MultiLayer const &)\n");
-  return 0;
-}
-
-
 SWIGINTERN PyObject *_wrap_delete_SpecularSimulation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   SpecularSimulation *arg1 = (SpecularSimulation *) 0 ;
@@ -103134,11 +102975,11 @@ SWIGINTERN PyObject *SpecularSimulation_swiginit(PyObject *SWIGUNUSEDPARM(self),
   return SWIG_Python_InitShadowInstance(args);
 }
 
-SWIGINTERN PyObject *_wrap_new_OffSpecSimulation__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
+SWIGINTERN PyObject *_wrap_new_OffSpecSimulation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   OffSpecSimulation *result = 0 ;
   
-  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
+  if (!SWIG_Python_UnpackTuple(args, "new_OffSpecSimulation", 0, 0, 0)) SWIG_fail;
   result = (OffSpecSimulation *)new OffSpecSimulation();
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OffSpecSimulation, SWIG_POINTER_NEW |  0 );
   return resultobj;
@@ -103147,59 +102988,6 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_new_OffSpecSimulation__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) {
-  PyObject *resultobj = 0;
-  MultiLayer *arg1 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  OffSpecSimulation *result = 0 ;
-  
-  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_MultiLayer,  0  | 0);
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_OffSpecSimulation" "', argument " "1"" of type '" "MultiLayer const &""'"); 
-  }
-  if (!argp1) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_OffSpecSimulation" "', argument " "1"" of type '" "MultiLayer const &""'"); 
-  }
-  arg1 = reinterpret_cast< MultiLayer * >(argp1);
-  result = (OffSpecSimulation *)new OffSpecSimulation((MultiLayer const &)*arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OffSpecSimulation, SWIG_POINTER_NEW |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_new_OffSpecSimulation(PyObject *self, PyObject *args) {
-  Py_ssize_t argc;
-  PyObject *argv[2] = {
-    0
-  };
-  
-  if (!(argc = SWIG_Python_UnpackTuple(args, "new_OffSpecSimulation", 0, 1, argv))) SWIG_fail;
-  --argc;
-  if (argc == 0) {
-    return _wrap_new_OffSpecSimulation__SWIG_0(self, argc, argv);
-  }
-  if (argc == 1) {
-    int _v;
-    int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_MultiLayer, SWIG_POINTER_NO_NULL | 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      return _wrap_new_OffSpecSimulation__SWIG_1(self, argc, argv);
-    }
-  }
-  
-fail:
-  SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_OffSpecSimulation'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    OffSpecSimulation::OffSpecSimulation()\n"
-    "    OffSpecSimulation::OffSpecSimulation(MultiLayer const &)\n");
-  return 0;
-}
-
-
 SWIGINTERN PyObject *_wrap_delete_OffSpecSimulation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   OffSpecSimulation *arg1 = (OffSpecSimulation *) 0 ;
@@ -130551,9 +130339,8 @@ static PyMethodDef SwigMethods[] = {
 		"\n"
 		""},
 	 { "Simulation2D_swigregister", Simulation2D_swigregister, METH_O, NULL},
-	 { "new_GISASSimulation", _wrap_new_GISASSimulation, METH_VARARGS, "\n"
-		"GISASSimulation()\n"
-		"new_GISASSimulation(MultiLayer p_sample) -> GISASSimulation\n"
+	 { "new_GISASSimulation", _wrap_new_GISASSimulation, METH_NOARGS, "\n"
+		"new_GISASSimulation() -> GISASSimulation\n"
 		"GISASSimulation::GISASSimulation(const std::shared_ptr< ISampleBuilder > p_sample_builder)\n"
 		"\n"
 		""},
@@ -130604,9 +130391,8 @@ static PyMethodDef SwigMethods[] = {
 		""},
 	 { "GISASSimulation_swigregister", GISASSimulation_swigregister, METH_O, NULL},
 	 { "GISASSimulation_swiginit", GISASSimulation_swiginit, METH_VARARGS, NULL},
-	 { "new_DepthProbeSimulation", _wrap_new_DepthProbeSimulation, METH_VARARGS, "\n"
-		"DepthProbeSimulation()\n"
-		"new_DepthProbeSimulation(MultiLayer sample) -> DepthProbeSimulation\n"
+	 { "new_DepthProbeSimulation", _wrap_new_DepthProbeSimulation, METH_NOARGS, "\n"
+		"new_DepthProbeSimulation() -> DepthProbeSimulation\n"
 		"DepthProbeSimulation::DepthProbeSimulation(const std::shared_ptr< ISampleBuilder > sample_builder)\n"
 		"\n"
 		""},
@@ -130671,9 +130457,8 @@ static PyMethodDef SwigMethods[] = {
 		""},
 	 { "DepthProbeSimulation_swigregister", DepthProbeSimulation_swigregister, METH_O, NULL},
 	 { "DepthProbeSimulation_swiginit", DepthProbeSimulation_swiginit, METH_VARARGS, NULL},
-	 { "new_SpecularSimulation", _wrap_new_SpecularSimulation, METH_VARARGS, "\n"
-		"SpecularSimulation()\n"
-		"new_SpecularSimulation(MultiLayer sample) -> SpecularSimulation\n"
+	 { "new_SpecularSimulation", _wrap_new_SpecularSimulation, METH_NOARGS, "\n"
+		"new_SpecularSimulation() -> SpecularSimulation\n"
 		"SpecularSimulation::SpecularSimulation(const std::shared_ptr< ISampleBuilder > sample_builder)\n"
 		"\n"
 		""},
@@ -130738,9 +130523,8 @@ static PyMethodDef SwigMethods[] = {
 		""},
 	 { "SpecularSimulation_swigregister", SpecularSimulation_swigregister, METH_O, NULL},
 	 { "SpecularSimulation_swiginit", SpecularSimulation_swiginit, METH_VARARGS, NULL},
-	 { "new_OffSpecSimulation", _wrap_new_OffSpecSimulation, METH_VARARGS, "\n"
-		"OffSpecSimulation()\n"
-		"new_OffSpecSimulation(MultiLayer p_sample) -> OffSpecSimulation\n"
+	 { "new_OffSpecSimulation", _wrap_new_OffSpecSimulation, METH_NOARGS, "\n"
+		"new_OffSpecSimulation() -> OffSpecSimulation\n"
 		"OffSpecSimulation::OffSpecSimulation(const std::shared_ptr< class ISampleBuilder > p_sample_builder)\n"
 		"\n"
 		""},
-- 
GitLab