From af5858bae2a2d19f7aa539d60862564bddbcb53d Mon Sep 17 00:00:00 2001
From: Walter Van Herck <w.van.herck@fz-juelich.de>
Date: Mon, 8 Jul 2019 11:12:37 +0200
Subject: [PATCH] Remove obsolete Layer::cloneInvertB and Layer::shallowClone

---
 Core/Multilayer/Layer.cpp           | 19 +++----------------
 Core/Multilayer/Layer.h             |  6 +-----
 auto/Wrap/libBornAgainCore.py       | 10 ----------
 auto/Wrap/libBornAgainCore_wrap.cpp | 28 ----------------------------
 4 files changed, 4 insertions(+), 59 deletions(-)

diff --git a/Core/Multilayer/Layer.cpp b/Core/Multilayer/Layer.cpp
index 53b64c3230c..7995829c75c 100644
--- a/Core/Multilayer/Layer.cpp
+++ b/Core/Multilayer/Layer.cpp
@@ -38,20 +38,15 @@ Layer::~Layer()
 
 Layer* Layer::clone() const
 {
-    Layer* p_result = shallowClone();
+    Layer* p_result = new Layer(m_material, m_thickness);
+    p_result->setName(getName());
+    p_result->m_B_field = m_B_field;
     p_result->m_n_slices = m_n_slices;
     for (auto p_layout : layouts())
         p_result->addLayout(*p_layout);
     return p_result;
 }
 
-Layer* Layer::cloneInvertB() const
-{
-    Layer* p_result = shallowClone();
-    p_result->m_B_field = -m_B_field;
-    return p_result;
-}
-
 //! Sets layer thickness in nanometers.
 void Layer::setThickness(double thickness)
 {
@@ -112,14 +107,6 @@ Eigen::Matrix2cd Layer::polarizedReducedPotential(kvector_t k, double n_ref) con
     return MaterialUtils::PolarizedReducedPotential(n, b_field, k, n_ref);
 }
 
-Layer* Layer::shallowClone() const
-{
-    Layer* p_result = new Layer(m_material, m_thickness);
-    p_result->setName(getName());
-    p_result->m_B_field = m_B_field;
-    return p_result;
-}
-
 kvector_t Layer::bField() const
 {
     return m_B_field;
diff --git a/Core/Multilayer/Layer.h b/Core/Multilayer/Layer.h
index 11ccf0c2644..0659093f6dd 100644
--- a/Core/Multilayer/Layer.h
+++ b/Core/Multilayer/Layer.h
@@ -37,10 +37,9 @@ public:
     };
     Layer(Material material, double thickness = 0);
 
-    ~Layer();
+    ~Layer() override;
 
     Layer* clone() const override final;
-    Layer* cloneInvertB() const;
 
     void accept(INodeVisitor* visitor) const override final { visitor->visit(this); }
 
@@ -71,9 +70,6 @@ public:
 #endif
 
 private:
-    //! Clone the layer without its layouts
-    Layer* shallowClone() const;
-
     //! Return the magnetic B-field in this layer
     kvector_t bField() const;
 
diff --git a/auto/Wrap/libBornAgainCore.py b/auto/Wrap/libBornAgainCore.py
index 4a25d36179f..7271e6b9fda 100644
--- a/auto/Wrap/libBornAgainCore.py
+++ b/auto/Wrap/libBornAgainCore.py
@@ -24371,16 +24371,6 @@ class Layer(ISample):
         return _libBornAgainCore.Layer_clone(self)
 
 
-    def cloneInvertB(self):
-        """
-        cloneInvertB(Layer self) -> Layer
-
-        Layer * Layer::cloneInvertB() const
-
-        """
-        return _libBornAgainCore.Layer_cloneInvertB(self)
-
-
     def accept(self, visitor):
         """
         accept(Layer self, INodeVisitor visitor)
diff --git a/auto/Wrap/libBornAgainCore_wrap.cpp b/auto/Wrap/libBornAgainCore_wrap.cpp
index 10c0f842fd4..7b4e029a918 100644
--- a/auto/Wrap/libBornAgainCore_wrap.cpp
+++ b/auto/Wrap/libBornAgainCore_wrap.cpp
@@ -104101,28 +104101,6 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_Layer_cloneInvertB(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Layer *arg1 = (Layer *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  Layer *result = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:Layer_cloneInvertB",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Layer, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_cloneInvertB" "', argument " "1"" of type '" "Layer const *""'"); 
-  }
-  arg1 = reinterpret_cast< Layer * >(argp1);
-  result = (Layer *)((Layer const *)arg1)->cloneInvertB();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Layer, 0 |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
 SWIGINTERN PyObject *_wrap_Layer_accept(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Layer *arg1 = (Layer *) 0 ;
@@ -136571,12 +136549,6 @@ static PyMethodDef SwigMethods[] = {
 		"Returns a clone of this  ISample object. \n"
 		"\n"
 		""},
-	 { (char *)"Layer_cloneInvertB", _wrap_Layer_cloneInvertB, METH_VARARGS, (char *)"\n"
-		"Layer_cloneInvertB(Layer self) -> Layer\n"
-		"\n"
-		"Layer * Layer::cloneInvertB() const\n"
-		"\n"
-		""},
 	 { (char *)"Layer_accept", _wrap_Layer_accept, METH_VARARGS, (char *)"\n"
 		"Layer_accept(Layer self, INodeVisitor visitor)\n"
 		"\n"
-- 
GitLab