From b2246bb5bab74e20834e3fb6e8cf734c4fa951de Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 11:00:13 +0200
Subject: [PATCH 1/4] same beam inclination limits for all simulations

---
 Core/Simulation/SpecularSimulation.cpp        |  7 -----
 Device/Beam/Beam.cpp                          |  3 +-
 .../Core/Fresnel/SpecularSimulationTest.cpp   | 31 -------------------
 3 files changed, 2 insertions(+), 39 deletions(-)

diff --git a/Core/Simulation/SpecularSimulation.cpp b/Core/Simulation/SpecularSimulation.cpp
index 393065feead..246642d26fa 100644
--- a/Core/Simulation/SpecularSimulation.cpp
+++ b/Core/Simulation/SpecularSimulation.cpp
@@ -196,13 +196,6 @@ void SpecularSimulation::validateParametrization(const ParameterDistribution& pa
 void SpecularSimulation::initialize()
 {
     setName("SpecularSimulation");
-
-    // allow for negative inclinations in the beam of specular simulation
-    // it is required for proper averaging in the case of divergent beam
-    instrument()
-        .beam()
-        .parameter("InclinationAngle")
-        ->setLimits(RealLimits::limited(-M_PI_2, M_PI_2));
 }
 
 void SpecularSimulation::normalize(size_t start_ind, size_t n_elements)
diff --git a/Device/Beam/Beam.cpp b/Device/Beam/Beam.cpp
index 9a2a37aad19..2c31a4718f5 100644
--- a/Device/Beam/Beam.cpp
+++ b/Device/Beam/Beam.cpp
@@ -31,7 +31,8 @@ Beam::Beam(double intensity, double wavelength, const Direction& direction)
     setName("Beam");
     registerParameter("Intensity", &m_intensity).setNonnegative();
     registerParameter("Wavelength", &m_wavelength).setUnit("nm").setNonnegative();
-    registerParameter("InclinationAngle", &m_alpha).setUnit("rad").setLimited(0, INCLINATION_LIMIT);
+    registerParameter("InclinationAngle", &m_alpha).setUnit("rad").setLimited(
+        -INCLINATION_LIMIT, INCLINATION_LIMIT);
     registerParameter("AzimuthalAngle", &m_phi).setUnit("rad").setLimited(-M_PI_2, M_PI_2);
     registerVector("BlochVector", &m_bloch_vector, "");
 }
diff --git a/Tests/UnitTests/Core/Fresnel/SpecularSimulationTest.cpp b/Tests/UnitTests/Core/Fresnel/SpecularSimulationTest.cpp
index 2357afa0753..79b907729f5 100644
--- a/Tests/UnitTests/Core/Fresnel/SpecularSimulationTest.cpp
+++ b/Tests/UnitTests/Core/Fresnel/SpecularSimulationTest.cpp
@@ -21,7 +21,6 @@ protected:
     SpecularSimulationTest();
 
     std::unique_ptr<SpecularSimulation> defaultSimulation();
-    void checkBeamState(const SpecularSimulation& sim);
 
     MultiLayer multilayer;
 };
@@ -59,14 +58,6 @@ std::unique_ptr<SpecularSimulation> SpecularSimulationTest::defaultSimulation()
     return result;
 }
 
-void SpecularSimulationTest::checkBeamState(const SpecularSimulation& sim)
-{
-    const auto* inclination = sim.beam().parameter("InclinationAngle");
-    const auto test_limits = RealLimits::limited(-M_PI_2, M_PI_2);
-    EXPECT_EQ(test_limits, inclination->limits());
-    EXPECT_EQ(0.0, inclination->value());
-}
-
 TEST_F(SpecularSimulationTest, CloneOfEmpty)
 {
     SpecularSimulation sim;
@@ -76,9 +67,6 @@ TEST_F(SpecularSimulationTest, CloneOfEmpty)
     ASSERT_THROW(clone->coordinateAxis(), std::runtime_error);
     EXPECT_EQ(nullptr, clone->sample());
     ASSERT_THROW(clone->result(), std::runtime_error);
-
-    checkBeamState(sim);
-    checkBeamState(*clone);
 }
 
 TEST_F(SpecularSimulationTest, SetAngularScan)
@@ -96,8 +84,6 @@ TEST_F(SpecularSimulationTest, SetAngularScan)
     EXPECT_EQ(0.0, beam.direction().alpha());
     EXPECT_EQ(0.0, beam.direction().phi());
 
-    checkBeamState(sim);
-
     sim.beam().setIntensity(2.0);
     EXPECT_EQ(2.0, beam.intensity());
 
@@ -111,14 +97,11 @@ TEST_F(SpecularSimulationTest, SetAngularScan)
     EXPECT_EQ(1.0, beam.wavelength());
     EXPECT_EQ(0.0, beam.direction().alpha());
     EXPECT_EQ(0.0, beam.direction().phi());
-    checkBeamState(sim2);
 
     SpecularSimulation sim3;
     AngularSpecScan scan3(1.0, 10, -1.0 * Units::deg, 2.0 * Units::deg);
     EXPECT_THROW(sim3.setScan(scan3), std::runtime_error);
 
-    checkBeamState(sim3);
-
     EXPECT_THROW(sim2.setScan(scan2), std::runtime_error);
     EXPECT_EQ(10u, sim2.coordinateAxis()->size());
     EXPECT_EQ(1.0 * Units::deg, sim2.coordinateAxis()->lowerBound());
@@ -129,7 +112,6 @@ TEST_F(SpecularSimulationTest, SetAngularScan)
     EXPECT_EQ(0.0, beam.direction().phi());
 
     sim3.setInstrument(Instrument());
-    checkBeamState(sim3);
 
     SpecularSimulation sim4;
     AngularSpecScan scan4(1.0, 10, .0 * Units::deg, 2.0 * Units::deg);
@@ -171,8 +153,6 @@ TEST_F(SpecularSimulationTest, SetQScan)
     EXPECT_EQ(0.0, beam.direction().alpha());
     EXPECT_EQ(0.0, beam.direction().phi());
 
-    checkBeamState(sim);
-
     sim.beam().setIntensity(2.0);
     EXPECT_EQ(2.0, beam.intensity());
 
@@ -186,7 +166,6 @@ TEST_F(SpecularSimulationTest, SetQScan)
     EXPECT_EQ(1.0, beam.wavelength());
     EXPECT_EQ(0.0, beam.direction().alpha());
     EXPECT_EQ(0.0, beam.direction().phi());
-    checkBeamState(sim2);
 
     SpecularSimulation sim3;
     QSpecScan scan3(10, 1.0, 10.0);
@@ -232,8 +211,6 @@ TEST_F(SpecularSimulationTest, ConstructSimulation)
     EXPECT_NEAR(0.1 * Units::deg, sim_result.axis(Axes::Units::RADIANS).front(),
                 Units::deg * 1e-11);
     EXPECT_NEAR(1.9 * Units::deg, sim_result.axis(Axes::Units::RADIANS).back(), Units::deg * 1e-10);
-
-    checkBeamState(*sim);
 }
 
 TEST_F(SpecularSimulationTest, SimulationClone)
@@ -277,8 +254,6 @@ TEST_F(SpecularSimulationTest, SimulationClone)
     EXPECT_NE(scanClone->coordinateAxis(), scan.coordinateAxis());
     EXPECT_EQ(*scanClone->coordinateAxis(), *scan.coordinateAxis());
 
-    checkBeamState(*clone);
-
     sim.runSimulation();
 
     std::unique_ptr<SpecularSimulation> clone2(sim.clone());
@@ -286,8 +261,6 @@ TEST_F(SpecularSimulationTest, SimulationClone)
 
     const auto output_data = clone_result.data();
     EXPECT_EQ(10u, output_data->getAllocatedSize());
-
-    checkBeamState(*clone2);
 }
 
 TEST_F(SpecularSimulationTest, AddingBeamDistributions)
@@ -308,13 +281,9 @@ TEST_F(SpecularSimulationTest, AddingBeamDistributions)
                  std::runtime_error);
     EXPECT_NO_THROW(sim->addParameterDistribution(wl_pattern.toStdString(), distribution, 5));
 
-    checkBeamState(*sim);
-
     DistributionGaussian distribution2(0.0, 2.0);
     EXPECT_NO_THROW(
         sim->addParameterDistribution(incl_ang_pattern.toStdString(), distribution2, 5));
-
-    checkBeamState(*sim);
 }
 
 TEST_F(SpecularSimulationTest, OutOfRangeAngles)
-- 
GitLab


From 8e428a0db2bd30cf0c0ae300dca0177f15859f1f Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 14:17:01 +0200
Subject: [PATCH 2/4] rm delegating fcts Simulation::getDetector

---
 Core/Export/SimulationToPython.cpp         |  8 +--
 Core/Simulation/ISimulation.h              |  2 -
 Core/Simulation/ISimulation2D.cpp          |  6 +-
 GUI/coregui/Models/TransformFromDomain.cpp |  4 +-
 auto/Wrap/doxygenBase.i                    | 24 ++++++-
 auto/Wrap/doxygenCore.i                    |  6 --
 auto/Wrap/doxygenDevice.i                  | 27 ++++++-
 auto/Wrap/doxygenParam.i                   |  2 +-
 auto/Wrap/libBornAgainCore.py              |  9 ---
 auto/Wrap/libBornAgainCore_wrap.cpp        | 84 ----------------------
 10 files changed, 56 insertions(+), 116 deletions(-)

diff --git a/Core/Export/SimulationToPython.cpp b/Core/Export/SimulationToPython.cpp
index cbaf94f273d..72deff96ea7 100644
--- a/Core/Export/SimulationToPython.cpp
+++ b/Core/Export/SimulationToPython.cpp
@@ -128,7 +128,7 @@ std::string defineScan(const ISpecularScan* scan)
 
 std::string defineDetector(const ISimulation* simulation)
 {
-    const IDetector* const detector = simulation->getDetector();
+    const IDetector* const detector = simulation->instrument().getDetector();
     if (detector->dimension() != 2)
         throw std::runtime_error("defineDetector: "
                                  "detector must be two-dimensional for GISAS");
@@ -202,7 +202,7 @@ std::string defineDetector(const ISimulation* simulation)
 std::string defineDetectorResolutionFunction(const ISimulation* simulation)
 {
     std::ostringstream result;
-    const IDetector* detector = simulation->getDetector();
+    const IDetector* detector = simulation->instrument().getDetector();
 
     if (const IDetectorResolution* resfunc = detector->detectorResolution()) {
         if (auto* convfunc = dynamic_cast<const ConvolutionDetectorResolution*>(resfunc)) {
@@ -225,7 +225,7 @@ std::string defineDetectorResolutionFunction(const ISimulation* simulation)
 std::string defineDetectorPolarizationAnalysis(const ISimulation* simulation)
 {
     std::ostringstream result;
-    const IDetector* detector = simulation->getDetector();
+    const IDetector* detector = simulation->instrument().getDetector();
     kvector_t analyzer_direction = detector->detectionProperties().analyzerDirection();
     double analyzer_efficiency = detector->detectionProperties().analyzerEfficiency();
     double analyzer_total_transmission =
@@ -346,7 +346,7 @@ std::string defineMasks(const ISimulation* simulation)
     std::ostringstream result;
     result << std::setprecision(12);
 
-    const IDetector* detector = simulation->getDetector();
+    const IDetector* detector = simulation->instrument().getDetector();
     const DetectorMask* detectorMask = detector->detectorMask();
     if (detectorMask && detectorMask->numberOfMasks()) {
         result << "\n";
diff --git a/Core/Simulation/ISimulation.h b/Core/Simulation/ISimulation.h
index e1f0317b400..7a4232853c8 100644
--- a/Core/Simulation/ISimulation.h
+++ b/Core/Simulation/ISimulation.h
@@ -58,8 +58,6 @@ public:
     Beam& beam() { return m_instrument.beam(); }
     const Beam& beam() const { return m_instrument.beam(); }
 
-    IDetector* getDetector() { return m_instrument.getDetector(); }
-    const IDetector* getDetector() const { return m_instrument.getDetector(); }
     IDetector& detector() { return m_instrument.detector(); }
     const IDetector& detector() const { return m_instrument.detector(); }
 
diff --git a/Core/Simulation/ISimulation2D.cpp b/Core/Simulation/ISimulation2D.cpp
index 3d4acf1306c..c8036b981bb 100644
--- a/Core/Simulation/ISimulation2D.cpp
+++ b/Core/Simulation/ISimulation2D.cpp
@@ -37,16 +37,14 @@ ISimulation2D::~ISimulation2D() = default;
 
 IDetector2D& ISimulation2D::detector2D()
 {
-    ASSERT(getDetector());
-    IDetector2D* p = dynamic_cast<IDetector2D*>(getDetector());
+    IDetector2D* p = dynamic_cast<IDetector2D*>(instrument().getDetector());
     ASSERT(p);
     return *p;
 }
 
 const IDetector2D& ISimulation2D::detector2D() const
 {
-    ASSERT(getDetector());
-    const IDetector2D* p = dynamic_cast<const IDetector2D*>(getDetector());
+    const IDetector2D* p = dynamic_cast<const IDetector2D*>(instrument().getDetector());
     ASSERT(p);
     return *p;
 }
diff --git a/GUI/coregui/Models/TransformFromDomain.cpp b/GUI/coregui/Models/TransformFromDomain.cpp
index 88ae843677f..f55b3e6251c 100644
--- a/GUI/coregui/Models/TransformFromDomain.cpp
+++ b/GUI/coregui/Models/TransformFromDomain.cpp
@@ -311,7 +311,7 @@ void TransformFromDomain::setSpecularBeamItem(SpecularBeamItem* beam_item,
 void TransformFromDomain::setDetector(Instrument2DItem* instrument_item,
                                       const ISimulation2D& simulation)
 {
-    const IDetector* p_detector = simulation.getDetector();
+    const IDetector* p_detector = simulation.instrument().getDetector();
     setDetectorGeometry(instrument_item, *p_detector);
 
     auto detector_item = instrument_item->detectorItem();
@@ -464,7 +464,7 @@ void TransformFromDomain::setRectangularDetector(RectangularDetectorItem* detect
 void TransformFromDomain::setDetectorMasks(DetectorItem* detector_item,
                                            const ISimulation& simulation)
 {
-    const IDetector* detector = simulation.getDetector();
+    const IDetector* detector = simulation.instrument().getDetector();
     if ((detector->detectorMask() && detector->detectorMask()->numberOfMasks())
         || detector->regionOfInterest()) {
         detector_item->createMaskContainer();
diff --git a/auto/Wrap/doxygenBase.i b/auto/Wrap/doxygenBase.i
index 6b53a9f9f13..ff1cd6976b6 100644
--- a/auto/Wrap/doxygenBase.i
+++ b/auto/Wrap/doxygenBase.i
@@ -1450,9 +1450,9 @@ Returns true if text matches pattern with wildcards '*' and '?'.
 Returns string right-padded with blanks. 
 ";
 
-%feature("docstring")  StringUtils::split "std::vector< std::string > StringUtils::split(const std::string &text, const std::string &delimeter)
+%feature("docstring")  StringUtils::split "std::vector< std::string > StringUtils::split(const std::string &text, const std::string &delimiter)
 
-Split string into vector of string using delimeter.
+Split string into vector of string using delimiter.
 
 Returns token vector obtained by splitting string at delimiters. 
 ";
@@ -1482,11 +1482,31 @@ Returns scientific string representing given value of any numeric type.
 Returns new string which is lower case of text. 
 ";
 
+%feature("docstring")  StringUtils::to_int "bool StringUtils::to_int(const std::string &str, int *result)
+
+Interprets the contained text as an integer and returns it in  result. Space chars at its begin and end will be ignored. If the conversion result is of no interest, but only the convertibility, then you can set  result to nullptr. The conversion is assumed to be successful if:
+every character was consumed by the conversion
+
+the value is not too big for int
+
+the text is not empty Returns true if successful. If not successful, the value in result is not changed. Does not throw anything. 
+";
+
 %feature("docstring")  StringUtils::trim "std::string StringUtils::trim(const std::string &str, const std::string &whitespace=\" \\\\t\")
 
 Cuts any of the chars given in whitespace from start and end of str. 
 ";
 
+%feature("docstring")  StringUtils::trimFront "std::string StringUtils::trimFront(const std::string &str, const std::string &whitespace=\" \\\\t\")
+
+Cuts any of the chars given in whitespace from start. 
+";
+
+%feature("docstring")  StringUtils::startsWith "bool StringUtils::startsWith(const std::string &str, const std::string &substr)
+
+True if the string starts with substr. The comparison is case sensitive. 
+";
+
 
 // File: namespaceSysUtils.xml
 %feature("docstring")  SysUtils::getCurrentDateAndTime "std::string SysUtils::getCurrentDateAndTime()
diff --git a/auto/Wrap/doxygenCore.i b/auto/Wrap/doxygenCore.i
index 30b17854346..52bd8ef3588 100644
--- a/auto/Wrap/doxygenCore.i
+++ b/auto/Wrap/doxygenCore.i
@@ -1019,12 +1019,6 @@ Run a simulation in a MPI environment.
 %feature("docstring")  ISimulation::beam "const Beam& ISimulation::beam() const
 ";
 
-%feature("docstring")  ISimulation::getDetector "IDetector* ISimulation::getDetector()
-";
-
-%feature("docstring")  ISimulation::getDetector "const IDetector* ISimulation::getDetector() const
-";
-
 %feature("docstring")  ISimulation::detector "IDetector& ISimulation::detector()
 ";
 
diff --git a/auto/Wrap/doxygenDevice.i b/auto/Wrap/doxygenDevice.i
index 2db35a08abe..69a0f490ff1 100644
--- a/auto/Wrap/doxygenDevice.i
+++ b/auto/Wrap/doxygenDevice.i
@@ -1980,6 +1980,18 @@ C++ includes: OutputDataReadWriteINT.h
 ";
 
 
+// File: classOutputDataReadWriteNicos.xml
+%feature("docstring") OutputDataReadWriteNicos "
+
+Read/write Nicos files (*.001).
+
+C++ includes: OutputDataReadWriteNicos.h
+";
+
+%feature("docstring")  OutputDataReadWriteNicos::readOutputData "OutputData< double > * OutputDataReadWriteNicos::readOutputData(std::istream &input_stream)
+";
+
+
 // File: classOutputDataReadWriteNumpyTXT.xml
 %feature("docstring") OutputDataReadWriteNumpyTXT "
 
@@ -2806,10 +2818,10 @@ Returns true if area defined by two bins is inside or on border of polygon (more
 // File: namespace_0d63.xml
 
 
-// File: namespace_0d69.xml
+// File: namespace_0d71.xml
 
 
-// File: namespace_0d94.xml
+// File: namespace_0d96.xml
 
 
 // File: namespaceArrayUtils.xml
@@ -2896,6 +2908,11 @@ Returns file main extension (without .gz).
 returns true if file name corresponds to BornAgain native format (compressed or not) 
 ";
 
+%feature("docstring")  DataFormatUtils::isNicosFile "bool DataFormatUtils::isNicosFile(const std::string &file_name)
+
+returns true if file name corresponds to Nicos format (compressed or not) 
+";
+
 %feature("docstring")  DataFormatUtils::isTiffFile "bool DataFormatUtils::isTiffFile(const std::string &file_name)
 
 returns true if file name corresponds to tiff file (can be also compressed) 
@@ -3230,6 +3247,12 @@ make Swappable
 // File: OutputDataReadWriteINT_8h.xml
 
 
+// File: OutputDataReadWriteNicos_8cpp.xml
+
+
+// File: OutputDataReadWriteNicos_8h.xml
+
+
 // File: OutputDataReadWriteNumpyTXT_8cpp.xml
 
 
diff --git a/auto/Wrap/doxygenParam.i b/auto/Wrap/doxygenParam.i
index 527a3363a94..87e44c33fa5 100644
--- a/auto/Wrap/doxygenParam.i
+++ b/auto/Wrap/doxygenParam.i
@@ -188,7 +188,7 @@ set the parameter values of the simulation object to a specific combination of v
 Sets mean distribution values to the parameter pool. 
 ";
 
-%feature("docstring")  DistributionHandler::getDistributions "const DistributionHandler::Distributions_t & DistributionHandler::getDistributions() const
+%feature("docstring")  DistributionHandler::getDistributions "const std::vector< ParameterDistribution > & DistributionHandler::getDistributions() const
 ";
 
 
diff --git a/auto/Wrap/libBornAgainCore.py b/auto/Wrap/libBornAgainCore.py
index 24241cf196b..e2fc2b252c4 100644
--- a/auto/Wrap/libBornAgainCore.py
+++ b/auto/Wrap/libBornAgainCore.py
@@ -3534,15 +3534,6 @@ class ISimulation(libBornAgainBase.ICloneable, libBornAgainParam.INode):
         """
         return _libBornAgainCore.ISimulation_beam(self, *args)
 
-    def getDetector(self, *args):
-        r"""
-        getDetector(ISimulation self) -> IDetector
-        getDetector(ISimulation self) -> IDetector const *
-        const IDetector* ISimulation::getDetector() const
-
-        """
-        return _libBornAgainCore.ISimulation_getDetector(self, *args)
-
     def detector(self, *args):
         r"""
         detector(ISimulation self) -> IDetector
diff --git a/auto/Wrap/libBornAgainCore_wrap.cpp b/auto/Wrap/libBornAgainCore_wrap.cpp
index 7bf472f6aad..cc426f44313 100644
--- a/auto/Wrap/libBornAgainCore_wrap.cpp
+++ b/auto/Wrap/libBornAgainCore_wrap.cpp
@@ -39020,84 +39020,6 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_ISimulation_getDetector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) {
-  PyObject *resultobj = 0;
-  ISimulation *arg1 = (ISimulation *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  IDetector *result = 0 ;
-  
-  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ISimulation, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ISimulation_getDetector" "', argument " "1"" of type '" "ISimulation *""'"); 
-  }
-  arg1 = reinterpret_cast< ISimulation * >(argp1);
-  result = (IDetector *)(arg1)->getDetector();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IDetector, 0 |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_ISimulation_getDetector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) {
-  PyObject *resultobj = 0;
-  ISimulation *arg1 = (ISimulation *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  IDetector *result = 0 ;
-  
-  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ISimulation, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ISimulation_getDetector" "', argument " "1"" of type '" "ISimulation const *""'"); 
-  }
-  arg1 = reinterpret_cast< ISimulation * >(argp1);
-  result = (IDetector *)((ISimulation const *)arg1)->getDetector();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IDetector, 0 |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_ISimulation_getDetector(PyObject *self, PyObject *args) {
-  Py_ssize_t argc;
-  PyObject *argv[2] = {
-    0
-  };
-  
-  if (!(argc = SWIG_Python_UnpackTuple(args, "ISimulation_getDetector", 0, 1, argv))) SWIG_fail;
-  --argc;
-  if (argc == 1) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_ISimulation, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      return _wrap_ISimulation_getDetector__SWIG_0(self, argc, argv);
-    }
-  }
-  if (argc == 1) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_ISimulation, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      return _wrap_ISimulation_getDetector__SWIG_1(self, argc, argv);
-    }
-  }
-  
-fail:
-  SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'ISimulation_getDetector'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    ISimulation::getDetector()\n"
-    "    ISimulation::getDetector() const\n");
-  return 0;
-}
-
-
 SWIGINTERN PyObject *_wrap_ISimulation_detector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) {
   PyObject *resultobj = 0;
   ISimulation *arg1 = (ISimulation *) 0 ;
@@ -44730,12 +44652,6 @@ static PyMethodDef SwigMethods[] = {
 		"const Beam& ISimulation::beam() const\n"
 		"\n"
 		""},
-	 { "ISimulation_getDetector", _wrap_ISimulation_getDetector, METH_VARARGS, "\n"
-		"ISimulation_getDetector(ISimulation self) -> IDetector\n"
-		"ISimulation_getDetector(ISimulation self) -> IDetector const *\n"
-		"const IDetector* ISimulation::getDetector() const\n"
-		"\n"
-		""},
 	 { "ISimulation_detector", _wrap_ISimulation_detector, METH_VARARGS, "\n"
 		"ISimulation_detector(ISimulation self) -> IDetector\n"
 		"ISimulation_detector(ISimulation self) -> IDetector const &\n"
-- 
GitLab


From 68350d558c0003da8771203932ab398862058977 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 14:22:54 +0200
Subject: [PATCH 3/4] rm ISimulation::setDetectorResolution

---
 Core/Export/SimulationToPython.cpp            |   2 +-
 Core/Simulation/ISimulation.cpp               |   5 -
 Core/Simulation/ISimulation.h                 |   2 -
 Core/Simulation/StandardSimulations.cpp       |   2 +-
 .../scatter2d/DetectorResolutionFunction.py   |   5 +-
 auto/Wrap/doxygenCore.i                       |   3 -
 auto/Wrap/libBornAgainCore.py                 |   8 -
 auto/Wrap/libBornAgainCore_wrap.cpp           | 208 +++++++-----------
 8 files changed, 87 insertions(+), 148 deletions(-)

diff --git a/Core/Export/SimulationToPython.cpp b/Core/Export/SimulationToPython.cpp
index 72deff96ea7..f1ca9dcd12b 100644
--- a/Core/Export/SimulationToPython.cpp
+++ b/Core/Export/SimulationToPython.cpp
@@ -208,7 +208,7 @@ std::string defineDetectorResolutionFunction(const ISimulation* simulation)
         if (auto* convfunc = dynamic_cast<const ConvolutionDetectorResolution*>(resfunc)) {
             if (auto* resfunc = dynamic_cast<const ResolutionFunction2DGaussian*>(
                     convfunc->getResolutionFunction2D())) {
-                result << indent() << "simulation.setDetectorResolutionFunction(";
+                result << indent() << "simulation.detector().setResolutionFunction(";
                 result << "ba.ResolutionFunction2DGaussian(";
                 result << printFunc(detector)(resfunc->getSigmaX()) << ", ";
                 result << printFunc(detector)(resfunc->getSigmaY()) << "))\n";
diff --git a/Core/Simulation/ISimulation.cpp b/Core/Simulation/ISimulation.cpp
index 4f02a1d565f..170b885354a 100644
--- a/Core/Simulation/ISimulation.cpp
+++ b/Core/Simulation/ISimulation.cpp
@@ -174,11 +174,6 @@ void ISimulation::setTerminalProgressMonitor()
     });
 }
 
-void ISimulation::setDetectorResolutionFunction(const IResolutionFunction2D& resolution_function)
-{
-    detector().setResolutionFunction(resolution_function);
-}
-
 void ISimulation::prepareSimulation()
 {
     m_sample_provider.updateSample();
diff --git a/Core/Simulation/ISimulation.h b/Core/Simulation/ISimulation.h
index 7a4232853c8..66e3d3d64ae 100644
--- a/Core/Simulation/ISimulation.h
+++ b/Core/Simulation/ISimulation.h
@@ -61,8 +61,6 @@ public:
     IDetector& detector() { return m_instrument.detector(); }
     const IDetector& detector() const { return m_instrument.detector(); }
 
-    void setDetectorResolutionFunction(const IResolutionFunction2D& resolution_function);
-
     void setSample(const MultiLayer& sample);
     const MultiLayer* sample() const;
 
diff --git a/Core/Simulation/StandardSimulations.cpp b/Core/Simulation/StandardSimulations.cpp
index d6b44ba2d2e..a25677f75a0 100644
--- a/Core/Simulation/StandardSimulations.cpp
+++ b/Core/Simulation/StandardSimulations.cpp
@@ -158,7 +158,7 @@ GISASSimulation* StandardSimulations::MiniGISASDetectorResolution()
 {
     GISASSimulation* result = MiniGISAS();
     ResolutionFunction2DGaussian resfunc(0.0025, 0.0025);
-    result->setDetectorResolutionFunction(resfunc);
+    result->detector().setResolutionFunction(resfunc);
     return result;
 }
 
diff --git a/Examples/scatter2d/DetectorResolutionFunction.py b/Examples/scatter2d/DetectorResolutionFunction.py
index a212e22c2be..894b5143fd8 100755
--- a/Examples/scatter2d/DetectorResolutionFunction.py
+++ b/Examples/scatter2d/DetectorResolutionFunction.py
@@ -43,10 +43,9 @@ def get_sample():
 def get_simulation(sample):
     beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0))
     detector = ba.SphericalDetector(100, 2*deg, 1*deg, 1*deg)
-    simulation = ba.GISASSimulation(beam, sample, detector)
-    simulation.setDetectorResolutionFunction(
+    detector.setResolutionFunction(
         ba.ResolutionFunction2DGaussian(0.02*deg, 0.02*deg))
-    return simulation
+    return ba.GISASSimulation(beam, sample, detector)
 
 
 if __name__ == '__main__':
diff --git a/auto/Wrap/doxygenCore.i b/auto/Wrap/doxygenCore.i
index 52bd8ef3588..53973c2d342 100644
--- a/auto/Wrap/doxygenCore.i
+++ b/auto/Wrap/doxygenCore.i
@@ -1025,9 +1025,6 @@ Run a simulation in a MPI environment.
 %feature("docstring")  ISimulation::detector "const IDetector& ISimulation::detector() const
 ";
 
-%feature("docstring")  ISimulation::setDetectorResolutionFunction "void ISimulation::setDetectorResolutionFunction(const IResolutionFunction2D &resolution_function)
-";
-
 %feature("docstring")  ISimulation::setSample "void ISimulation::setSample(const MultiLayer &sample)
 
 The MultiLayer object will not be owned by the  ISimulation object. 
diff --git a/auto/Wrap/libBornAgainCore.py b/auto/Wrap/libBornAgainCore.py
index e2fc2b252c4..840b498dcbb 100644
--- a/auto/Wrap/libBornAgainCore.py
+++ b/auto/Wrap/libBornAgainCore.py
@@ -3543,14 +3543,6 @@ class ISimulation(libBornAgainBase.ICloneable, libBornAgainParam.INode):
         """
         return _libBornAgainCore.ISimulation_detector(self, *args)
 
-    def setDetectorResolutionFunction(self, resolution_function):
-        r"""
-        setDetectorResolutionFunction(ISimulation self, IResolutionFunction2D const & resolution_function)
-        void ISimulation::setDetectorResolutionFunction(const IResolutionFunction2D &resolution_function)
-
-        """
-        return _libBornAgainCore.ISimulation_setDetectorResolutionFunction(self, resolution_function)
-
     def setSample(self, sample):
         r"""
         setSample(ISimulation self, MultiLayer const & sample)
diff --git a/auto/Wrap/libBornAgainCore_wrap.cpp b/auto/Wrap/libBornAgainCore_wrap.cpp
index cc426f44313..0f598d034f2 100644
--- a/auto/Wrap/libBornAgainCore_wrap.cpp
+++ b/auto/Wrap/libBornAgainCore_wrap.cpp
@@ -3125,90 +3125,89 @@ namespace Swig {
 #define SWIGTYPE_p_INodeVisitor swig_types[25]
 #define SWIGTYPE_p_IParametricComponent swig_types[26]
 #define SWIGTYPE_p_IRangedDistribution swig_types[27]
-#define SWIGTYPE_p_IResolutionFunction2D swig_types[28]
-#define SWIGTYPE_p_ISampleNode swig_types[29]
-#define SWIGTYPE_p_IShape2D swig_types[30]
-#define SWIGTYPE_p_ISimulation swig_types[31]
-#define SWIGTYPE_p_ISimulation2D swig_types[32]
-#define SWIGTYPE_p_ISpecularScan swig_types[33]
-#define SWIGTYPE_p_IVarianceFunction swig_types[34]
-#define SWIGTYPE_p_Instrument swig_types[35]
-#define SWIGTYPE_p_IntensityFunctionLog swig_types[36]
-#define SWIGTYPE_p_IntensityFunctionSqrt swig_types[37]
-#define SWIGTYPE_p_IterationInfo swig_types[38]
-#define SWIGTYPE_p_MultiLayer swig_types[39]
-#define SWIGTYPE_p_OffSpecularSimulation swig_types[40]
-#define SWIGTYPE_p_OutputDataT_double_t swig_types[41]
-#define SWIGTYPE_p_ParameterDistribution swig_types[42]
-#define SWIGTYPE_p_ParameterPool swig_types[43]
-#define SWIGTYPE_p_PoissonNoiseBackground swig_types[44]
-#define SWIGTYPE_p_ProgressHandler__Callback_t swig_types[45]
-#define SWIGTYPE_p_PyBuilderCallback swig_types[46]
-#define SWIGTYPE_p_PyObserverCallback swig_types[47]
-#define SWIGTYPE_p_QSpecScan swig_types[48]
-#define SWIGTYPE_p_RealLimits swig_types[49]
-#define SWIGTYPE_p_ScanResolution swig_types[50]
-#define SWIGTYPE_p_SimulationOptions swig_types[51]
-#define SWIGTYPE_p_SimulationResult swig_types[52]
-#define SWIGTYPE_p_SpecularSimulation swig_types[53]
-#define SWIGTYPE_p_VarianceConstantFunction swig_types[54]
-#define SWIGTYPE_p_VarianceSimFunction swig_types[55]
-#define SWIGTYPE_p_allocator_type swig_types[56]
-#define SWIGTYPE_p_char swig_types[57]
-#define SWIGTYPE_p_difference_type swig_types[58]
-#define SWIGTYPE_p_first_type swig_types[59]
-#define SWIGTYPE_p_int swig_types[60]
-#define SWIGTYPE_p_key_type swig_types[61]
-#define SWIGTYPE_p_long_long swig_types[62]
-#define SWIGTYPE_p_mapped_type swig_types[63]
-#define SWIGTYPE_p_mumufit__MinimizerResult swig_types[64]
-#define SWIGTYPE_p_mumufit__Parameters swig_types[65]
-#define SWIGTYPE_p_p_PyObject swig_types[66]
-#define SWIGTYPE_p_second_type swig_types[67]
-#define SWIGTYPE_p_short swig_types[68]
-#define SWIGTYPE_p_signed_char swig_types[69]
-#define SWIGTYPE_p_size_type swig_types[70]
-#define SWIGTYPE_p_std__allocatorT_AxisInfo_t swig_types[71]
-#define SWIGTYPE_p_std__allocatorT_BasicVector3DT_double_t_t swig_types[72]
-#define SWIGTYPE_p_std__allocatorT_BasicVector3DT_std__complexT_double_t_t_t swig_types[73]
-#define SWIGTYPE_p_std__allocatorT_INode_const_p_t swig_types[74]
-#define SWIGTYPE_p_std__allocatorT_INode_p_t swig_types[75]
-#define SWIGTYPE_p_std__allocatorT_double_t swig_types[76]
-#define SWIGTYPE_p_std__allocatorT_int_t swig_types[77]
-#define SWIGTYPE_p_std__allocatorT_std__complexT_double_t_t swig_types[78]
-#define SWIGTYPE_p_std__allocatorT_std__pairT_double_double_t_t swig_types[79]
-#define SWIGTYPE_p_std__allocatorT_std__pairT_std__string_const_double_t_t swig_types[80]
-#define SWIGTYPE_p_std__allocatorT_std__string_t swig_types[81]
-#define SWIGTYPE_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t swig_types[82]
-#define SWIGTYPE_p_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t swig_types[83]
-#define SWIGTYPE_p_std__allocatorT_unsigned_long_t swig_types[84]
-#define SWIGTYPE_p_std__complexT_double_t swig_types[85]
-#define SWIGTYPE_p_std__invalid_argument swig_types[86]
-#define SWIGTYPE_p_std__lessT_std__string_t swig_types[87]
-#define SWIGTYPE_p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t swig_types[88]
-#define SWIGTYPE_p_std__pairT_double_double_t swig_types[89]
-#define SWIGTYPE_p_std__shared_ptrT_ISampleBuilder_t swig_types[90]
-#define SWIGTYPE_p_std__vectorT_AxisInfo_std__allocatorT_AxisInfo_t_t swig_types[91]
-#define SWIGTYPE_p_std__vectorT_BasicVector3DT_double_t_std__allocatorT_BasicVector3DT_double_t_t_t swig_types[92]
-#define SWIGTYPE_p_std__vectorT_BasicVector3DT_std__complexT_double_t_t_std__allocatorT_BasicVector3DT_std__complexT_double_t_t_t_t swig_types[93]
-#define SWIGTYPE_p_std__vectorT_INode_const_p_std__allocatorT_INode_const_p_t_t swig_types[94]
-#define SWIGTYPE_p_std__vectorT_INode_p_std__allocatorT_INode_p_t_t swig_types[95]
-#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[96]
-#define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[97]
-#define SWIGTYPE_p_std__vectorT_std__complexT_double_t_std__allocatorT_std__complexT_double_t_t_t swig_types[98]
-#define SWIGTYPE_p_std__vectorT_std__pairT_double_double_t_std__allocatorT_std__pairT_double_double_t_t_t swig_types[99]
-#define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[100]
-#define SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t swig_types[101]
-#define SWIGTYPE_p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t swig_types[102]
-#define SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t swig_types[103]
-#define SWIGTYPE_p_swig__SwigPyIterator swig_types[104]
-#define SWIGTYPE_p_unsigned_char swig_types[105]
-#define SWIGTYPE_p_unsigned_int swig_types[106]
-#define SWIGTYPE_p_unsigned_long_long swig_types[107]
-#define SWIGTYPE_p_unsigned_short swig_types[108]
-#define SWIGTYPE_p_value_type swig_types[109]
-static swig_type_info *swig_types[111];
-static swig_module_info swig_module = {swig_types, 110, 0, 0, 0, 0};
+#define SWIGTYPE_p_ISampleNode swig_types[28]
+#define SWIGTYPE_p_IShape2D swig_types[29]
+#define SWIGTYPE_p_ISimulation swig_types[30]
+#define SWIGTYPE_p_ISimulation2D swig_types[31]
+#define SWIGTYPE_p_ISpecularScan swig_types[32]
+#define SWIGTYPE_p_IVarianceFunction swig_types[33]
+#define SWIGTYPE_p_Instrument swig_types[34]
+#define SWIGTYPE_p_IntensityFunctionLog swig_types[35]
+#define SWIGTYPE_p_IntensityFunctionSqrt swig_types[36]
+#define SWIGTYPE_p_IterationInfo swig_types[37]
+#define SWIGTYPE_p_MultiLayer swig_types[38]
+#define SWIGTYPE_p_OffSpecularSimulation swig_types[39]
+#define SWIGTYPE_p_OutputDataT_double_t swig_types[40]
+#define SWIGTYPE_p_ParameterDistribution swig_types[41]
+#define SWIGTYPE_p_ParameterPool swig_types[42]
+#define SWIGTYPE_p_PoissonNoiseBackground swig_types[43]
+#define SWIGTYPE_p_ProgressHandler__Callback_t swig_types[44]
+#define SWIGTYPE_p_PyBuilderCallback swig_types[45]
+#define SWIGTYPE_p_PyObserverCallback swig_types[46]
+#define SWIGTYPE_p_QSpecScan swig_types[47]
+#define SWIGTYPE_p_RealLimits swig_types[48]
+#define SWIGTYPE_p_ScanResolution swig_types[49]
+#define SWIGTYPE_p_SimulationOptions swig_types[50]
+#define SWIGTYPE_p_SimulationResult swig_types[51]
+#define SWIGTYPE_p_SpecularSimulation swig_types[52]
+#define SWIGTYPE_p_VarianceConstantFunction swig_types[53]
+#define SWIGTYPE_p_VarianceSimFunction swig_types[54]
+#define SWIGTYPE_p_allocator_type swig_types[55]
+#define SWIGTYPE_p_char swig_types[56]
+#define SWIGTYPE_p_difference_type swig_types[57]
+#define SWIGTYPE_p_first_type swig_types[58]
+#define SWIGTYPE_p_int swig_types[59]
+#define SWIGTYPE_p_key_type swig_types[60]
+#define SWIGTYPE_p_long_long swig_types[61]
+#define SWIGTYPE_p_mapped_type swig_types[62]
+#define SWIGTYPE_p_mumufit__MinimizerResult swig_types[63]
+#define SWIGTYPE_p_mumufit__Parameters swig_types[64]
+#define SWIGTYPE_p_p_PyObject swig_types[65]
+#define SWIGTYPE_p_second_type swig_types[66]
+#define SWIGTYPE_p_short swig_types[67]
+#define SWIGTYPE_p_signed_char swig_types[68]
+#define SWIGTYPE_p_size_type swig_types[69]
+#define SWIGTYPE_p_std__allocatorT_AxisInfo_t swig_types[70]
+#define SWIGTYPE_p_std__allocatorT_BasicVector3DT_double_t_t swig_types[71]
+#define SWIGTYPE_p_std__allocatorT_BasicVector3DT_std__complexT_double_t_t_t swig_types[72]
+#define SWIGTYPE_p_std__allocatorT_INode_const_p_t swig_types[73]
+#define SWIGTYPE_p_std__allocatorT_INode_p_t swig_types[74]
+#define SWIGTYPE_p_std__allocatorT_double_t swig_types[75]
+#define SWIGTYPE_p_std__allocatorT_int_t swig_types[76]
+#define SWIGTYPE_p_std__allocatorT_std__complexT_double_t_t swig_types[77]
+#define SWIGTYPE_p_std__allocatorT_std__pairT_double_double_t_t swig_types[78]
+#define SWIGTYPE_p_std__allocatorT_std__pairT_std__string_const_double_t_t swig_types[79]
+#define SWIGTYPE_p_std__allocatorT_std__string_t swig_types[80]
+#define SWIGTYPE_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t swig_types[81]
+#define SWIGTYPE_p_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t swig_types[82]
+#define SWIGTYPE_p_std__allocatorT_unsigned_long_t swig_types[83]
+#define SWIGTYPE_p_std__complexT_double_t swig_types[84]
+#define SWIGTYPE_p_std__invalid_argument swig_types[85]
+#define SWIGTYPE_p_std__lessT_std__string_t swig_types[86]
+#define SWIGTYPE_p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t swig_types[87]
+#define SWIGTYPE_p_std__pairT_double_double_t swig_types[88]
+#define SWIGTYPE_p_std__shared_ptrT_ISampleBuilder_t swig_types[89]
+#define SWIGTYPE_p_std__vectorT_AxisInfo_std__allocatorT_AxisInfo_t_t swig_types[90]
+#define SWIGTYPE_p_std__vectorT_BasicVector3DT_double_t_std__allocatorT_BasicVector3DT_double_t_t_t swig_types[91]
+#define SWIGTYPE_p_std__vectorT_BasicVector3DT_std__complexT_double_t_t_std__allocatorT_BasicVector3DT_std__complexT_double_t_t_t_t swig_types[92]
+#define SWIGTYPE_p_std__vectorT_INode_const_p_std__allocatorT_INode_const_p_t_t swig_types[93]
+#define SWIGTYPE_p_std__vectorT_INode_p_std__allocatorT_INode_p_t_t swig_types[94]
+#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[95]
+#define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[96]
+#define SWIGTYPE_p_std__vectorT_std__complexT_double_t_std__allocatorT_std__complexT_double_t_t_t swig_types[97]
+#define SWIGTYPE_p_std__vectorT_std__pairT_double_double_t_std__allocatorT_std__pairT_double_double_t_t_t swig_types[98]
+#define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[99]
+#define SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t swig_types[100]
+#define SWIGTYPE_p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t swig_types[101]
+#define SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t swig_types[102]
+#define SWIGTYPE_p_swig__SwigPyIterator swig_types[103]
+#define SWIGTYPE_p_unsigned_char swig_types[104]
+#define SWIGTYPE_p_unsigned_int swig_types[105]
+#define SWIGTYPE_p_unsigned_long_long swig_types[106]
+#define SWIGTYPE_p_unsigned_short swig_types[107]
+#define SWIGTYPE_p_value_type swig_types[108]
+static swig_type_info *swig_types[110];
+static swig_module_info swig_module = {swig_types, 109, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -39098,38 +39097,6 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_ISimulation_setDetectorResolutionFunction(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  ISimulation *arg1 = (ISimulation *) 0 ;
-  IResolutionFunction2D *arg2 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  PyObject *swig_obj[2] ;
-  
-  if (!SWIG_Python_UnpackTuple(args, "ISimulation_setDetectorResolutionFunction", 2, 2, swig_obj)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ISimulation, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ISimulation_setDetectorResolutionFunction" "', argument " "1"" of type '" "ISimulation *""'"); 
-  }
-  arg1 = reinterpret_cast< ISimulation * >(argp1);
-  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_IResolutionFunction2D,  0  | 0);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ISimulation_setDetectorResolutionFunction" "', argument " "2"" of type '" "IResolutionFunction2D const &""'"); 
-  }
-  if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ISimulation_setDetectorResolutionFunction" "', argument " "2"" of type '" "IResolutionFunction2D const &""'"); 
-  }
-  arg2 = reinterpret_cast< IResolutionFunction2D * >(argp2);
-  (arg1)->setDetectorResolutionFunction((IResolutionFunction2D const &)*arg2);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
 SWIGINTERN PyObject *_wrap_ISimulation_setSample(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   ISimulation *arg1 = (ISimulation *) 0 ;
@@ -44658,11 +44625,6 @@ static PyMethodDef SwigMethods[] = {
 		"const IDetector& ISimulation::detector() const\n"
 		"\n"
 		""},
-	 { "ISimulation_setDetectorResolutionFunction", _wrap_ISimulation_setDetectorResolutionFunction, METH_VARARGS, "\n"
-		"ISimulation_setDetectorResolutionFunction(ISimulation self, IResolutionFunction2D const & resolution_function)\n"
-		"void ISimulation::setDetectorResolutionFunction(const IResolutionFunction2D &resolution_function)\n"
-		"\n"
-		""},
 	 { "ISimulation_setSample", _wrap_ISimulation_setSample, METH_VARARGS, "\n"
 		"ISimulation_setSample(ISimulation self, MultiLayer const & sample)\n"
 		"void ISimulation::setSample(const MultiLayer &sample)\n"
@@ -45612,7 +45574,6 @@ static swig_type_info _swigt__p_INode = {"_p_INode", "INode *|std::vector< INode
 static swig_type_info _swigt__p_INodeVisitor = {"_p_INodeVisitor", "INodeVisitor *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_IParametricComponent = {"_p_IParametricComponent", "IParametricComponent *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_IRangedDistribution = {"_p_IRangedDistribution", "IRangedDistribution *", 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_ISimulation = {"_p_ISimulation", "ISimulation *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_ISimulation2D = {"_p_ISimulation2D", "ISimulation2D *", 0, 0, (void*)0, 0};
@@ -45722,7 +45683,6 @@ static swig_type_info *swig_type_initial[] = {
   &_swigt__p_INodeVisitor,
   &_swigt__p_IParametricComponent,
   &_swigt__p_IRangedDistribution,
-  &_swigt__p_IResolutionFunction2D,
   &_swigt__p_ISampleNode,
   &_swigt__p_IShape2D,
   &_swigt__p_ISimulation,
@@ -45836,7 +45796,6 @@ static swig_cast_info _swigc__p_INode[] = {  {&_swigt__p_INode, 0, 0, 0},  {&_sw
 static swig_cast_info _swigc__p_INodeVisitor[] = {  {&_swigt__p_INodeVisitor, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_IParametricComponent[] = {  {&_swigt__p_IFormFactor, _p_IFormFactorTo_p_IParametricComponent, 0, 0},  {&_swigt__p_SpecularSimulation, _p_SpecularSimulationTo_p_IParametricComponent, 0, 0},  {&_swigt__p_DepthProbeSimulation, _p_DepthProbeSimulationTo_p_IParametricComponent, 0, 0},  {&_swigt__p_OffSpecularSimulation, _p_OffSpecularSimulationTo_p_IParametricComponent, 0, 0},  {&_swigt__p_GISASSimulation, _p_GISASSimulationTo_p_IParametricComponent, 0, 0},  {&_swigt__p_ISimulation, _p_ISimulationTo_p_IParametricComponent, 0, 0},  {&_swigt__p_IParametricComponent, 0, 0, 0},  {&_swigt__p_PoissonNoiseBackground, _p_PoissonNoiseBackgroundTo_p_IParametricComponent, 0, 0},  {&_swigt__p_ConstantBackground, _p_ConstantBackgroundTo_p_IParametricComponent, 0, 0},  {&_swigt__p_IBackground, _p_IBackgroundTo_p_IParametricComponent, 0, 0},  {&_swigt__p_IBornFF, _p_IBornFFTo_p_IParametricComponent, 0, 0},  {&_swigt__p_ISampleNode, _p_ISampleNodeTo_p_IParametricComponent, 0, 0},  {&_swigt__p_ParameterDistribution, _p_ParameterDistributionTo_p_IParametricComponent, 0, 0},  {&_swigt__p_ISimulation2D, _p_ISimulation2DTo_p_IParametricComponent, 0, 0},  {&_swigt__p_INode, _p_INodeTo_p_IParametricComponent, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_IRangedDistribution[] = {  {&_swigt__p_IRangedDistribution, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_IResolutionFunction2D[] = {  {&_swigt__p_IResolutionFunction2D, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_IShape2D[] = {  {&_swigt__p_IShape2D, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_ISimulation[] = {  {&_swigt__p_ISimulation2D, _p_ISimulation2DTo_p_ISimulation, 0, 0},  {&_swigt__p_ISimulation, 0, 0, 0},  {&_swigt__p_GISASSimulation, _p_GISASSimulationTo_p_ISimulation, 0, 0},  {&_swigt__p_OffSpecularSimulation, _p_OffSpecularSimulationTo_p_ISimulation, 0, 0},  {&_swigt__p_DepthProbeSimulation, _p_DepthProbeSimulationTo_p_ISimulation, 0, 0},  {&_swigt__p_SpecularSimulation, _p_SpecularSimulationTo_p_ISimulation, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_ISimulation2D[] = {  {&_swigt__p_ISimulation2D, 0, 0, 0},  {&_swigt__p_GISASSimulation, _p_GISASSimulationTo_p_ISimulation2D, 0, 0},  {&_swigt__p_OffSpecularSimulation, _p_OffSpecularSimulationTo_p_ISimulation2D, 0, 0},{0, 0, 0, 0}};
@@ -45946,7 +45905,6 @@ static swig_cast_info *swig_cast_initial[] = {
   _swigc__p_INodeVisitor,
   _swigc__p_IParametricComponent,
   _swigc__p_IRangedDistribution,
-  _swigc__p_IResolutionFunction2D,
   _swigc__p_ISampleNode,
   _swigc__p_IShape2D,
   _swigc__p_ISimulation,
-- 
GitLab


From cffe2231bb13fa844b7bc3a7c16d1a1bf6b01645 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 14:50:47 +0200
Subject: [PATCH 4/4] clang-format

---
 Device/Beam/Beam.cpp                           | 5 +++--
 GUI/coregui/Models/DomainSimulationBuilder.cpp | 2 --
 GUI/coregui/mainwindow/projectmanager.cpp      | 7 +++----
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/Device/Beam/Beam.cpp b/Device/Beam/Beam.cpp
index 2c31a4718f5..a567460e5c7 100644
--- a/Device/Beam/Beam.cpp
+++ b/Device/Beam/Beam.cpp
@@ -31,8 +31,9 @@ Beam::Beam(double intensity, double wavelength, const Direction& direction)
     setName("Beam");
     registerParameter("Intensity", &m_intensity).setNonnegative();
     registerParameter("Wavelength", &m_wavelength).setUnit("nm").setNonnegative();
-    registerParameter("InclinationAngle", &m_alpha).setUnit("rad").setLimited(
-        -INCLINATION_LIMIT, INCLINATION_LIMIT);
+    registerParameter("InclinationAngle", &m_alpha)
+        .setUnit("rad")
+        .setLimited(-INCLINATION_LIMIT, INCLINATION_LIMIT);
     registerParameter("AzimuthalAngle", &m_phi).setUnit("rad").setLimited(-M_PI_2, M_PI_2);
     registerVector("BlochVector", &m_bloch_vector, "");
 }
diff --git a/GUI/coregui/Models/DomainSimulationBuilder.cpp b/GUI/coregui/Models/DomainSimulationBuilder.cpp
index 6295efb7e29..4bc118c70b1 100644
--- a/GUI/coregui/Models/DomainSimulationBuilder.cpp
+++ b/GUI/coregui/Models/DomainSimulationBuilder.cpp
@@ -33,7 +33,6 @@
 #include "GUI/coregui/Models/TransformToDomain.h"
 #include "GUI/coregui/utils/GUIHelpers.h"
 
-
 namespace {
 
 void addBackgroundToSimulation(const InstrumentItem& instrumentItem, ISimulation& simulation)
@@ -134,7 +133,6 @@ createDepthProbeSimulation(std::unique_ptr<MultiLayer> P_multilayer,
 
 } // namespace
 
-
 std::unique_ptr<ISimulation>
 DomainSimulationBuilder::createSimulation(const MultiLayerItem* sampleItem,
                                           const InstrumentItem* instrumentItem,
diff --git a/GUI/coregui/mainwindow/projectmanager.cpp b/GUI/coregui/mainwindow/projectmanager.cpp
index 35f0858a5bc..152fc581292 100644
--- a/GUI/coregui/mainwindow/projectmanager.cpp
+++ b/GUI/coregui/mainwindow/projectmanager.cpp
@@ -322,10 +322,9 @@ void ProjectManager::openProject(QString fileName)
     createNewProject();
 
     if (fileName.isEmpty()) {
-        fileName =
-            QFileDialog::getOpenFileName(m_mainWindow, "Open project file", workingDirectory(),
-                                         "BornAgain project Files (*.pro)",
-                                         nullptr, QFileDialog::DontUseNativeDialog);
+        fileName = QFileDialog::getOpenFileName(
+            m_mainWindow, "Open project file", workingDirectory(),
+            "BornAgain project Files (*.pro)", nullptr, QFileDialog::DontUseNativeDialog);
         if (fileName.isEmpty())
             return;
     }
-- 
GitLab