From a0ba9ded17f8abdd4f5b0ece467a582e07c22562 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Fri, 11 Dec 2020 09:05:37 +0100
Subject: [PATCH] rm unused fct from Beam

---
 Device/Beam/Beam.cpp                    |  7 -----
 Device/Beam/Beam.h                      |  2 --
 Tests/UnitTests/Core/Other/BeamTest.cpp | 22 ---------------
 auto/Wrap/doxygenDevice.i               |  5 ----
 auto/Wrap/libBornAgainDevice.py         | 10 -------
 auto/Wrap/libBornAgainDevice_wrap.cpp   | 36 -------------------------
 6 files changed, 82 deletions(-)

diff --git a/Device/Beam/Beam.cpp b/Device/Beam/Beam.cpp
index 95016fab4c8..96d8acfb6ac 100644
--- a/Device/Beam/Beam.cpp
+++ b/Device/Beam/Beam.cpp
@@ -100,13 +100,6 @@ void Beam::setFootprintFactor(const IFootprintFactor& shape_factor) {
     registerChild(m_shape_factor.get());
 }
 
-void Beam::setWidthRatio(double width_ratio) {
-    if (!m_shape_factor)
-        throw std::runtime_error("Error in Beam::setWidthRatio: footprint factor is nullptr. "
-                                 "Probably, you have forgotten to initialize it.");
-    m_shape_factor->setWidthRatio(width_ratio);
-}
-
 void Beam::setPolarization(const kvector_t bloch_vector) {
     if (bloch_vector.mag() > 1.0) {
         throw std::runtime_error(
diff --git a/Device/Beam/Beam.h b/Device/Beam/Beam.h
index 2911d5d9ca8..0e0ad7d822f 100644
--- a/Device/Beam/Beam.h
+++ b/Device/Beam/Beam.h
@@ -61,8 +61,6 @@ public:
     void setIntensity(double intensity) { m_intensity = intensity; }
     //! Sets footprint factor to the beam.
     void setFootprintFactor(const IFootprintFactor& shape_factor);
-    //! Sets beam to sample width ratio in footprint factor.
-    void setWidthRatio(double width_ratio);
     //! Sets the polarization density matrix according to the given Bloch vector
     void setPolarization(const kvector_t bloch_vector);
 
diff --git a/Tests/UnitTests/Core/Other/BeamTest.cpp b/Tests/UnitTests/Core/Other/BeamTest.cpp
index 28cdc25668e..2a162ddbc16 100644
--- a/Tests/UnitTests/Core/Other/BeamTest.cpp
+++ b/Tests/UnitTests/Core/Other/BeamTest.cpp
@@ -55,25 +55,3 @@ TEST_F(BeamTest, BeamPolarization) {
     EXPECT_NEAR(-0.2, bloch_vector.y(), 1e-8);
     EXPECT_NEAR(0.4, bloch_vector.z(), 1e-8);
 }
-
-TEST_F(BeamTest, FootprintBehaviour) {
-    Beam beam = Beam::horizontalBeam();
-    EXPECT_EQ(nullptr, beam.footprintFactor());
-    EXPECT_THROW(beam.setWidthRatio(1.0), std::runtime_error);
-
-    FootprintSquare square_ff(0.0);
-    beam.setFootprintFactor(square_ff);
-    beam.setWidthRatio(1.0);
-    EXPECT_EQ(1.0, beam.footprintFactor()->widthRatio());
-
-    Beam beam4 = beam;
-    FootprintGauss gaussian_ff(1.0);
-    beam4.setFootprintFactor(gaussian_ff);
-
-    const double r0 = beam.footprintFactor()->widthRatio();
-    const double r4 = beam4.footprintFactor()->widthRatio();
-    EXPECT_EQ(r0, r4);
-
-    EXPECT_EQ(beam.footprintFactor()->parent(), static_cast<INode*>(&beam));
-    EXPECT_EQ(beam4.footprintFactor()->parent(), static_cast<INode*>(&beam4));
-}
diff --git a/auto/Wrap/doxygenDevice.i b/auto/Wrap/doxygenDevice.i
index 2f7c01ec186..f3ec7cd2d79 100644
--- a/auto/Wrap/doxygenDevice.i
+++ b/auto/Wrap/doxygenDevice.i
@@ -99,11 +99,6 @@ Sets the beam intensity in neutrons/sec.
 Sets footprint factor to the beam. 
 ";
 
-%feature("docstring")  Beam::setWidthRatio "void Beam::setWidthRatio(double width_ratio)
-
-Sets beam to sample width ratio in footprint factor. 
-";
-
 %feature("docstring")  Beam::setPolarization "void Beam::setPolarization(const kvector_t bloch_vector)
 
 Sets the polarization density matrix according to the given Bloch vector. 
diff --git a/auto/Wrap/libBornAgainDevice.py b/auto/Wrap/libBornAgainDevice.py
index e0a6d3ebcae..14a2b676c8e 100644
--- a/auto/Wrap/libBornAgainDevice.py
+++ b/auto/Wrap/libBornAgainDevice.py
@@ -2820,16 +2820,6 @@ class Beam(libBornAgainParam.INode):
         """
         return _libBornAgainDevice.Beam_setFootprintFactor(self, shape_factor)
 
-    def setWidthRatio(self, width_ratio):
-        r"""
-        setWidthRatio(Beam self, double width_ratio)
-        void Beam::setWidthRatio(double width_ratio)
-
-        Sets beam to sample width ratio in footprint factor. 
-
-        """
-        return _libBornAgainDevice.Beam_setWidthRatio(self, width_ratio)
-
     def setPolarization(self, bloch_vector):
         r"""
         setPolarization(Beam self, kvector_t bloch_vector)
diff --git a/auto/Wrap/libBornAgainDevice_wrap.cpp b/auto/Wrap/libBornAgainDevice_wrap.cpp
index fd5e221a304..2bc78057009 100644
--- a/auto/Wrap/libBornAgainDevice_wrap.cpp
+++ b/auto/Wrap/libBornAgainDevice_wrap.cpp
@@ -31411,35 +31411,6 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_Beam_setWidthRatio(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Beam *arg1 = (Beam *) 0 ;
-  double arg2 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  double val2 ;
-  int ecode2 = 0 ;
-  PyObject *swig_obj[2] ;
-  
-  if (!SWIG_Python_UnpackTuple(args, "Beam_setWidthRatio", 2, 2, swig_obj)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Beam, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Beam_setWidthRatio" "', argument " "1"" of type '" "Beam *""'"); 
-  }
-  arg1 = reinterpret_cast< Beam * >(argp1);
-  ecode2 = SWIG_AsVal_double(swig_obj[1], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Beam_setWidthRatio" "', argument " "2"" of type '" "double""'");
-  } 
-  arg2 = static_cast< double >(val2);
-  (arg1)->setWidthRatio(arg2);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
 SWIGINTERN PyObject *_wrap_Beam_setPolarization(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Beam *arg1 = (Beam *) 0 ;
@@ -44825,13 +44796,6 @@ static PyMethodDef SwigMethods[] = {
 		"Sets footprint factor to the beam. \n"
 		"\n"
 		""},
-	 { "Beam_setWidthRatio", _wrap_Beam_setWidthRatio, METH_VARARGS, "\n"
-		"Beam_setWidthRatio(Beam self, double width_ratio)\n"
-		"void Beam::setWidthRatio(double width_ratio)\n"
-		"\n"
-		"Sets beam to sample width ratio in footprint factor. \n"
-		"\n"
-		""},
 	 { "Beam_setPolarization", _wrap_Beam_setPolarization, METH_VARARGS, "\n"
 		"Beam_setPolarization(Beam self, kvector_t bloch_vector)\n"
 		"void Beam::setPolarization(const kvector_t bloch_vector)\n"
-- 
GitLab