From 6aeb4bcc91c920129c3182443ed44d9a8eb990f3 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Mon, 7 Dec 2020 15:22:28 +0100
Subject: [PATCH] rm removeMask

---
 Core/Simulation/ISimulation2D.cpp             |  4 --
 Core/Simulation/ISimulation2D.h               |  3 -
 Device/Detector/DetectorMask.cpp              |  6 --
 Device/Detector/DetectorMask.h                |  3 -
 Device/Detector/IDetector2D.cpp               |  5 --
 Device/Detector/IDetector2D.h                 |  3 -
 .../Python/fit52_Advanced/fit_with_masks.py   |  9 ---
 .../Core/Detector/DetectorMaskTest.cpp        |  7 ---
 auto/Wrap/doxygenCore.i                       |  5 --
 auto/Wrap/doxygenDevice.i                     | 10 ----
 auto/Wrap/libBornAgainCore.py                 | 10 ----
 auto/Wrap/libBornAgainCore_wrap.cpp           | 29 ----------
 auto/Wrap/libBornAgainDevice.py               | 20 -------
 auto/Wrap/libBornAgainDevice_wrap.cpp         | 58 -------------------
 14 files changed, 172 deletions(-)

diff --git a/Core/Simulation/ISimulation2D.cpp b/Core/Simulation/ISimulation2D.cpp
index e116ff5123d..edc6840a1c0 100644
--- a/Core/Simulation/ISimulation2D.cpp
+++ b/Core/Simulation/ISimulation2D.cpp
@@ -28,10 +28,6 @@ void ISimulation2D::prepareSimulation() {
     m_detector_context = instrument().detector2D().createContext();
 }
 
-void ISimulation2D::removeMasks() {
-    instrument().detector2D().removeMasks();
-}
-
 void ISimulation2D::addMask(const IShape2D& shape, bool mask_value) {
     instrument().detector2D().addMask(shape, mask_value);
 }
diff --git a/Core/Simulation/ISimulation2D.h b/Core/Simulation/ISimulation2D.h
index a410a786f6c..dabfbec1d79 100644
--- a/Core/Simulation/ISimulation2D.h
+++ b/Core/Simulation/ISimulation2D.h
@@ -46,9 +46,6 @@ public:
     //! Sets the detector (axes can be overwritten later)
     void setDetector(const IDetector2D& detector);
 
-    //! removes all masks from the detector
-    void removeMasks();
-
     //! Adds mask of given shape to the stack of detector masks. The mask value 'true' means
     //! that the channel will be excluded from the simulation. The mask which is added last
     //! has priority.
diff --git a/Device/Detector/DetectorMask.cpp b/Device/Detector/DetectorMask.cpp
index 61a56b618b6..2735302d507 100644
--- a/Device/Detector/DetectorMask.cpp
+++ b/Device/Detector/DetectorMask.cpp
@@ -82,12 +82,6 @@ Histogram2D* DetectorMask::createHistogram() const {
     return dynamic_cast<Histogram2D*>(IHistogram::createHistogram(data));
 }
 
-void DetectorMask::removeMasks() {
-    m_shapes.clear();
-    m_mask_of_shape.clear();
-    m_mask_data.clear();
-}
-
 size_t DetectorMask::numberOfMasks() const {
     return m_shapes.size();
 }
diff --git a/Device/Detector/DetectorMask.h b/Device/Detector/DetectorMask.h
index 58743f70213..cf2b69468ae 100644
--- a/Device/Detector/DetectorMask.h
+++ b/Device/Detector/DetectorMask.h
@@ -48,9 +48,6 @@ public:
 
     Histogram2D* createHistogram() const;
 
-    //! remove all masks and return object to initial state
-    void removeMasks();
-
     //! returns true if has masks
     bool hasMasks() const { return !m_shapes.empty(); }
 
diff --git a/Device/Detector/IDetector2D.cpp b/Device/Detector/IDetector2D.cpp
index d56939358b5..5da7895fbfc 100644
--- a/Device/Detector/IDetector2D.cpp
+++ b/Device/Detector/IDetector2D.cpp
@@ -64,10 +64,6 @@ std::unique_ptr<DetectorContext> IDetector2D::createContext() const {
     return std::make_unique<DetectorContext>(this);
 }
 
-void IDetector2D::removeMasks() {
-    m_detector_mask.removeMasks();
-}
-
 void IDetector2D::addMask(const IShape2D& shape, bool mask_value) {
     m_detector_mask.addMask(shape, mask_value);
     m_detector_mask.initMaskData(*this);
@@ -76,7 +72,6 @@ void IDetector2D::addMask(const IShape2D& shape, bool mask_value) {
 void IDetector2D::maskAll() {
     if (dimension() != 2)
         return;
-    m_detector_mask.removeMasks();
     addMask(InfinitePlane(), true);
 }
 
diff --git a/Device/Detector/IDetector2D.h b/Device/Detector/IDetector2D.h
index 8bdfc087c62..b6863a731de 100644
--- a/Device/Detector/IDetector2D.h
+++ b/Device/Detector/IDetector2D.h
@@ -39,9 +39,6 @@ public:
     void setDetectorParameters(size_t n_x, double x_min, double x_max, size_t n_y, double y_min,
                                double y_max);
 
-    //! Removes all masks from the detector
-    void removeMasks();
-
     const DetectorMask* detectorMask() const override;
 
     //! Adds mask of given shape to the stack of detector masks. The mask value 'true' means
diff --git a/Examples/Python/fit52_Advanced/fit_with_masks.py b/Examples/Python/fit52_Advanced/fit_with_masks.py
index 21ddfa0975a..6c00d5a7a62 100644
--- a/Examples/Python/fit52_Advanced/fit_with_masks.py
+++ b/Examples/Python/fit52_Advanced/fit_with_masks.py
@@ -107,15 +107,6 @@ def add_mask_to_simulation(simulation):
     simulation.addMask(ba.Rectangle(0.75*deg, 0.95*deg, 0.85*deg, 1.05*deg),
                        False)
 
-    # other mask's shapes are possible too
-    # simulation.removeMasks()
-    # # rotated ellipse:
-    # simulation.addMask(ba.Ellipse(0.11*deg, 1.25*deg,
-    #                    1.0*deg, 0.5*deg, 45.0*deg), True)
-    # simulation.addMask(Line(-1.0*deg, 0.0*deg, 1.0*deg, 2.0*deg), True)
-    # simulation.addMask(ba.HorizontalLine(1.0*deg), False)
-    # simulation.addMask(ba.VerticalLine(0.0*deg), False)
-
 
 def run_fitting():
     """
diff --git a/Tests/UnitTests/Core/Detector/DetectorMaskTest.cpp b/Tests/UnitTests/Core/Detector/DetectorMaskTest.cpp
index 9579a08d3c0..289064bea75 100644
--- a/Tests/UnitTests/Core/Detector/DetectorMaskTest.cpp
+++ b/Tests/UnitTests/Core/Detector/DetectorMaskTest.cpp
@@ -79,13 +79,6 @@ TEST_F(DetectorMaskTest, AddMask) {
             EXPECT_FALSE(detectorMask.isMasked(index));
         }
     }
-
-    // clearing all masks
-    detectorMask.removeMasks();
-    detectorMask.initMaskData(detector);
-    for (size_t index = 0; index < detectorMask.getMaskData()->getAllocatedSize(); ++index) {
-        EXPECT_FALSE(detectorMask.isMasked(index));
-    }
 }
 
 TEST_F(DetectorMaskTest, AssignmentOperator) {
diff --git a/auto/Wrap/doxygenCore.i b/auto/Wrap/doxygenCore.i
index 832016732b4..08dfa1d6735 100644
--- a/auto/Wrap/doxygenCore.i
+++ b/auto/Wrap/doxygenCore.i
@@ -1072,11 +1072,6 @@ upper edge of last alpha-bin
 Sets the detector (axes can be overwritten later) 
 ";
 
-%feature("docstring")  ISimulation2D::removeMasks "void ISimulation2D::removeMasks()
-
-removes all masks from the detector 
-";
-
 %feature("docstring")  ISimulation2D::addMask "void ISimulation2D::addMask(const IShape2D &shape, bool mask_value=true)
 
 Adds mask of given shape to the stack of detector masks. The mask value 'true' means that the channel will be excluded from the simulation. The mask which is added last has priority.
diff --git a/auto/Wrap/doxygenDevice.i b/auto/Wrap/doxygenDevice.i
index 2b2b6f02973..97c1f99b2c1 100644
--- a/auto/Wrap/doxygenDevice.i
+++ b/auto/Wrap/doxygenDevice.i
@@ -394,11 +394,6 @@ Init the map of masks for the given detector plane.
 %feature("docstring")  DetectorMask::createHistogram "Histogram2D * DetectorMask::createHistogram() const
 ";
 
-%feature("docstring")  DetectorMask::removeMasks "void DetectorMask::removeMasks()
-
-remove all masks and return object to initial state 
-";
-
 %feature("docstring")  DetectorMask::hasMasks "bool DetectorMask::hasMasks() const
 
 returns true if has masks 
@@ -1037,11 +1032,6 @@ C++ includes: IDetector2D.h
 Sets detector parameters using angle ranges. 
 ";
 
-%feature("docstring")  IDetector2D::removeMasks "void IDetector2D::removeMasks()
-
-Removes all masks from the detector. 
-";
-
 %feature("docstring")  IDetector2D::detectorMask "const DetectorMask * IDetector2D::detectorMask() const override
 
 Returns detector masks container. 
diff --git a/auto/Wrap/libBornAgainCore.py b/auto/Wrap/libBornAgainCore.py
index cadae334850..dd65788bd76 100644
--- a/auto/Wrap/libBornAgainCore.py
+++ b/auto/Wrap/libBornAgainCore.py
@@ -3873,16 +3873,6 @@ class ISimulation2D(ISimulation):
         """
         return _libBornAgainCore.ISimulation2D_setDetector(self, detector)
 
-    def removeMasks(self):
-        r"""
-        removeMasks(ISimulation2D self)
-        void ISimulation2D::removeMasks()
-
-        removes all masks from the detector 
-
-        """
-        return _libBornAgainCore.ISimulation2D_removeMasks(self)
-
     def addMask(self, shape, mask_value=True):
         r"""
         addMask(ISimulation2D self, IShape2D const & shape, bool mask_value=True)
diff --git a/auto/Wrap/libBornAgainCore_wrap.cpp b/auto/Wrap/libBornAgainCore_wrap.cpp
index cc2f2b4d9a6..bc76649c261 100644
--- a/auto/Wrap/libBornAgainCore_wrap.cpp
+++ b/auto/Wrap/libBornAgainCore_wrap.cpp
@@ -40429,28 +40429,6 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_ISimulation2D_removeMasks(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  ISimulation2D *arg1 = (ISimulation2D *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject *swig_obj[1] ;
-  
-  if (!args) SWIG_fail;
-  swig_obj[0] = args;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ISimulation2D, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ISimulation2D_removeMasks" "', argument " "1"" of type '" "ISimulation2D *""'"); 
-  }
-  arg1 = reinterpret_cast< ISimulation2D * >(argp1);
-  (arg1)->removeMasks();
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
 SWIGINTERN PyObject *_wrap_ISimulation2D_addMask__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) {
   PyObject *resultobj = 0;
   ISimulation2D *arg1 = (ISimulation2D *) 0 ;
@@ -43847,13 +43825,6 @@ static PyMethodDef SwigMethods[] = {
 		"Sets the detector (axes can be overwritten later) \n"
 		"\n"
 		""},
-	 { "ISimulation2D_removeMasks", _wrap_ISimulation2D_removeMasks, METH_O, "\n"
-		"ISimulation2D_removeMasks(ISimulation2D self)\n"
-		"void ISimulation2D::removeMasks()\n"
-		"\n"
-		"removes all masks from the detector \n"
-		"\n"
-		""},
 	 { "ISimulation2D_addMask", _wrap_ISimulation2D_addMask, METH_VARARGS, "\n"
 		"ISimulation2D_addMask(ISimulation2D self, IShape2D const & shape, bool mask_value=True)\n"
 		"void ISimulation2D::addMask(const IShape2D &shape, bool mask_value=true)\n"
diff --git a/auto/Wrap/libBornAgainDevice.py b/auto/Wrap/libBornAgainDevice.py
index bc51d8965cc..7adb138871b 100644
--- a/auto/Wrap/libBornAgainDevice.py
+++ b/auto/Wrap/libBornAgainDevice.py
@@ -4426,16 +4426,6 @@ class DetectorMask(object):
         """
         return _libBornAgainDevice.DetectorMask_createHistogram(self)
 
-    def removeMasks(self):
-        r"""
-        removeMasks(DetectorMask self)
-        void DetectorMask::removeMasks()
-
-        remove all masks and return object to initial state 
-
-        """
-        return _libBornAgainDevice.DetectorMask_removeMasks(self)
-
     def hasMasks(self):
         r"""
         hasMasks(DetectorMask self) -> bool
@@ -4727,16 +4717,6 @@ class IDetector2D(IDetector):
         """
         return _libBornAgainDevice.IDetector2D_setDetectorParameters(self, n_x, x_min, x_max, n_y, y_min, y_max)
 
-    def removeMasks(self):
-        r"""
-        removeMasks(IDetector2D self)
-        void IDetector2D::removeMasks()
-
-        Removes all masks from the detector. 
-
-        """
-        return _libBornAgainDevice.IDetector2D_removeMasks(self)
-
     def detectorMask(self):
         r"""
         detectorMask(IDetector2D self) -> DetectorMask
diff --git a/auto/Wrap/libBornAgainDevice_wrap.cpp b/auto/Wrap/libBornAgainDevice_wrap.cpp
index 6ca5d66de5f..3ef05c727d5 100644
--- a/auto/Wrap/libBornAgainDevice_wrap.cpp
+++ b/auto/Wrap/libBornAgainDevice_wrap.cpp
@@ -37656,28 +37656,6 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_DetectorMask_removeMasks(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  DetectorMask *arg1 = (DetectorMask *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject *swig_obj[1] ;
-  
-  if (!args) SWIG_fail;
-  swig_obj[0] = args;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DetectorMask, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DetectorMask_removeMasks" "', argument " "1"" of type '" "DetectorMask *""'"); 
-  }
-  arg1 = reinterpret_cast< DetectorMask * >(argp1);
-  (arg1)->removeMasks();
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
 SWIGINTERN PyObject *_wrap_DetectorMask_hasMasks(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   DetectorMask *arg1 = (DetectorMask *) 0 ;
@@ -38657,28 +38635,6 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_IDetector2D_removeMasks(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  IDetector2D *arg1 = (IDetector2D *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject *swig_obj[1] ;
-  
-  if (!args) SWIG_fail;
-  swig_obj[0] = args;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_IDetector2D, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IDetector2D_removeMasks" "', argument " "1"" of type '" "IDetector2D *""'"); 
-  }
-  arg1 = reinterpret_cast< IDetector2D * >(argp1);
-  (arg1)->removeMasks();
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
 SWIGINTERN PyObject *_wrap_IDetector2D_detectorMask(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   IDetector2D *arg1 = (IDetector2D *) 0 ;
@@ -47431,13 +47387,6 @@ static PyMethodDef SwigMethods[] = {
 		"Histogram2D * DetectorMask::createHistogram() const\n"
 		"\n"
 		""},
-	 { "DetectorMask_removeMasks", _wrap_DetectorMask_removeMasks, METH_O, "\n"
-		"DetectorMask_removeMasks(DetectorMask self)\n"
-		"void DetectorMask::removeMasks()\n"
-		"\n"
-		"remove all masks and return object to initial state \n"
-		"\n"
-		""},
 	 { "DetectorMask_hasMasks", _wrap_DetectorMask_hasMasks, METH_O, "\n"
 		"DetectorMask_hasMasks(DetectorMask self) -> bool\n"
 		"bool DetectorMask::hasMasks() const\n"
@@ -47621,13 +47570,6 @@ static PyMethodDef SwigMethods[] = {
 		"Sets detector parameters using angle ranges. \n"
 		"\n"
 		""},
-	 { "IDetector2D_removeMasks", _wrap_IDetector2D_removeMasks, METH_O, "\n"
-		"IDetector2D_removeMasks(IDetector2D self)\n"
-		"void IDetector2D::removeMasks()\n"
-		"\n"
-		"Removes all masks from the detector. \n"
-		"\n"
-		""},
 	 { "IDetector2D_detectorMask", _wrap_IDetector2D_detectorMask, METH_O, "\n"
 		"IDetector2D_detectorMask(IDetector2D self) -> DetectorMask\n"
 		"const DetectorMask * IDetector2D::detectorMask() const override\n"
-- 
GitLab