From a42ce447efebea7084262611993a5046de13fbdb Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Tue, 24 Aug 2021 15:47:06 +0200
Subject: [PATCH] mv onChange to INode

---
 Param/Base/IParametric.h              |   6 -
 Param/Node/INode.h                    |   6 +
 Wrap/Swig/libBornAgainSample.i        |   6 -
 auto/Wrap/doxygenParam.i              |  10 +-
 auto/Wrap/libBornAgainParam.py        |  20 +--
 auto/Wrap/libBornAgainParam_wrap.cpp  | 157 ++++++++----------
 auto/Wrap/libBornAgainParam_wrap.h    |  24 +--
 auto/Wrap/libBornAgainSample.py       |   4 -
 auto/Wrap/libBornAgainSample_wrap.cpp | 223 ++++++++++----------------
 auto/Wrap/libBornAgainSample_wrap.h   |   9 +-
 10 files changed, 174 insertions(+), 291 deletions(-)

diff --git a/Param/Base/IParametric.h b/Param/Base/IParametric.h
index 732dd884684..0397da1e501 100644
--- a/Param/Base/IParametric.h
+++ b/Param/Base/IParametric.h
@@ -32,12 +32,6 @@ public:
 
     const std::string& getName() const { return m_name; }
 
-    //! Action to be taken in inherited class when a value has changed. Formerly this was also
-    //! called when a change via registered parameter took place. This is now obsolete, but the
-    //! onChange() call is still relevant for calculations when a value is changed by different
-    //! means (e.g. after initialization).
-    virtual void onChange() {}
-
 protected:
     void setName(const std::string& name) { m_name = name; }
 
diff --git a/Param/Node/INode.h b/Param/Node/INode.h
index 3ed01c92838..cd201892505 100644
--- a/Param/Node/INode.h
+++ b/Param/Node/INode.h
@@ -72,6 +72,12 @@ public:
     //! Returns display name, composed from the name of node and it's copy number.
     std::string displayName() const;
 
+    //! Action to be taken in inherited class when a value has changed. Formerly this was also
+    //! called when a change via registered parameter took place. This is now obsolete, but the
+    //! onChange() call is still relevant for calculations when a value is changed by different
+    //! means (e.g. after initialization).
+    virtual void onChange() {}
+
 private:
     const INode* m_parent{nullptr};
     // const std::string m_className;
diff --git a/Wrap/Swig/libBornAgainSample.i b/Wrap/Swig/libBornAgainSample.i
index 9d59fe3b832..d5701441b19 100644
--- a/Wrap/Swig/libBornAgainSample.i
+++ b/Wrap/Swig/libBornAgainSample.i
@@ -229,9 +229,3 @@
     BasicVector3D<double> __neg__() const {
         return - *($self); }
 };
-
-%extend ISampleBuilder {
-    virtual void onChange() {
-        return ($self)->IParametric::onChange();
-    }
-};
diff --git a/auto/Wrap/doxygenParam.i b/auto/Wrap/doxygenParam.i
index df5686ca4bf..82da602737b 100644
--- a/auto/Wrap/doxygenParam.i
+++ b/auto/Wrap/doxygenParam.i
@@ -487,6 +487,11 @@ Returns copyNumber of child, which takes into account existence of children with
 Returns display name, composed from the name of node and it's copy number. 
 ";
 
+%feature("docstring")  INode::onChange "virtual void INode::onChange()
+
+Action to be taken in inherited class when a value has changed. Formerly this was also called when a change via registered parameter took place. This is now obsolete, but the  onChange() call is still relevant for calculations when a value is changed by different means (e.g. after initialization). 
+";
+
 
 // File: classINodeVisitor.xml
 %feature("docstring") INodeVisitor "
@@ -889,11 +894,6 @@ C++ includes: IParametric.h
 %feature("docstring")  IParametric::getName "const std::string& IParametric::getName() const
 ";
 
-%feature("docstring")  IParametric::onChange "virtual void IParametric::onChange()
-
-Action to be taken in inherited class when a value has changed. Formerly this was also called when a change via registered parameter took place. This is now obsolete, but the  onChange() call is still relevant for calculations when a value is changed by different means (e.g. after initialization). 
-";
-
 
 // File: classIRangedDistribution.xml
 %feature("docstring") IRangedDistribution "
diff --git a/auto/Wrap/libBornAgainParam.py b/auto/Wrap/libBornAgainParam.py
index a5a42d62ea3..775a365fe5b 100644
--- a/auto/Wrap/libBornAgainParam.py
+++ b/auto/Wrap/libBornAgainParam.py
@@ -2046,16 +2046,6 @@ class IParametric(object):
 
         """
         return _libBornAgainParam.IParametric_getName(self)
-
-    def onChange(self):
-        r"""
-        onChange(IParametric self)
-        virtual void IParametric::onChange()
-
-        Action to be taken in inherited class when a value has changed. Formerly this was also called when a change via registered parameter took place. This is now obsolete, but the  onChange() call is still relevant for calculations when a value is changed by different means (e.g. after initialization). 
-
-        """
-        return _libBornAgainParam.IParametric_onChange(self)
     def __disown__(self):
         self.this.disown()
         _libBornAgainParam.disown_IParametric(self)
@@ -2242,6 +2232,16 @@ class INode(IParametric):
 
         """
         return _libBornAgainParam.INode_displayName(self)
+
+    def onChange(self):
+        r"""
+        onChange(INode self)
+        virtual void INode::onChange()
+
+        Action to be taken in inherited class when a value has changed. Formerly this was also called when a change via registered parameter took place. This is now obsolete, but the  onChange() call is still relevant for calculations when a value is changed by different means (e.g. after initialization). 
+
+        """
+        return _libBornAgainParam.INode_onChange(self)
     def __disown__(self):
         self.this.disown()
         _libBornAgainParam.disown_INode(self)
diff --git a/auto/Wrap/libBornAgainParam_wrap.cpp b/auto/Wrap/libBornAgainParam_wrap.cpp
index 47e4a01c8c2..e0bd76eae2d 100644
--- a/auto/Wrap/libBornAgainParam_wrap.cpp
+++ b/auto/Wrap/libBornAgainParam_wrap.cpp
@@ -7114,29 +7114,6 @@ SwigDirector_IParametric::SwigDirector_IParametric(PyObject *self, std::string c
 SwigDirector_IParametric::~SwigDirector_IParametric() {
 }
 
-void SwigDirector_IParametric::onChange() {
-  if (!swig_get_self()) {
-    Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call IParametric.__init__.");
-  }
-#if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 0;
-  const char *const swig_method_name = "onChange";
-  PyObject *method = swig_get_method(swig_method_index, swig_method_name);
-  swig::SwigVar_PyObject args = PyTuple_New(0);
-  swig::SwigVar_PyObject result = PyObject_Call(method, (PyObject *) args, NULL);
-#else
-  swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar("onChange");
-  swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);
-#endif
-  if (!result) {
-    PyObject *error = PyErr_Occurred();
-    if (error) {
-      Swig::DirectorMethodException::raise("Error detected when calling 'IParametric.onChange'");
-    }
-  }
-}
-
-
 SwigDirector_INode::SwigDirector_INode(PyObject *self): INode(), Swig::Director(self) {
   SWIG_DIRECTOR_RGTR((INode *)this, this); 
 }
@@ -7154,29 +7131,6 @@ SwigDirector_INode::SwigDirector_INode(PyObject *self, NodeMeta const &meta, std
 SwigDirector_INode::~SwigDirector_INode() {
 }
 
-void SwigDirector_INode::onChange() {
-  if (!swig_get_self()) {
-    Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call INode.__init__.");
-  }
-#if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 0;
-  const char *const swig_method_name = "onChange";
-  PyObject *method = swig_get_method(swig_method_index, swig_method_name);
-  swig::SwigVar_PyObject args = PyTuple_New(0);
-  swig::SwigVar_PyObject result = PyObject_Call(method, (PyObject *) args, NULL);
-#else
-  swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar("onChange");
-  swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);
-#endif
-  if (!result) {
-    PyObject *error = PyErr_Occurred();
-    if (error) {
-      Swig::DirectorMethodException::raise("Error detected when calling 'INode.onChange'");
-    }
-  }
-}
-
-
 void SwigDirector_INode::accept(INodeVisitor *visitor) const {
   swig::SwigVar_PyObject obj0;
   obj0 = SWIG_NewPointerObj(SWIG_as_voidptr(visitor), SWIGTYPE_p_INodeVisitor,  0 );
@@ -7184,7 +7138,7 @@ void SwigDirector_INode::accept(INodeVisitor *visitor) const {
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call INode.__init__.");
   }
 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 1;
+  const size_t swig_method_index = 0;
   const char *const swig_method_name = "accept";
   PyObject *method = swig_get_method(swig_method_index, swig_method_name);
   swig::SwigVar_PyObject result = PyObject_CallFunctionObjArgs(method ,(PyObject *)obj0, NULL);
@@ -7207,7 +7161,7 @@ std::vector< INode const *, std::allocator< INode const * > > SwigDirector_INode
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call INode.__init__.");
   }
 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 2;
+  const size_t swig_method_index = 1;
   const char *const swig_method_name = "getChildren";
   PyObject *method = swig_get_method(swig_method_index, swig_method_name);
   swig::SwigVar_PyObject args = PyTuple_New(0);
@@ -7240,7 +7194,7 @@ void SwigDirector_INode::setParent(INode const *newParent) {
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call INode.__init__.");
   }
 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 3;
+  const size_t swig_method_index = 2;
   const char *const swig_method_name = "setParent";
   PyObject *method = swig_get_method(swig_method_index, swig_method_name);
   swig::SwigVar_PyObject result = PyObject_CallFunctionObjArgs(method ,(PyObject *)obj0, NULL);
@@ -7257,6 +7211,29 @@ void SwigDirector_INode::setParent(INode const *newParent) {
 }
 
 
+void SwigDirector_INode::onChange() {
+  if (!swig_get_self()) {
+    Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call INode.__init__.");
+  }
+#if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
+  const size_t swig_method_index = 3;
+  const char *const swig_method_name = "onChange";
+  PyObject *method = swig_get_method(swig_method_index, swig_method_name);
+  swig::SwigVar_PyObject args = PyTuple_New(0);
+  swig::SwigVar_PyObject result = PyObject_Call(method, (PyObject *) args, NULL);
+#else
+  swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar("onChange");
+  swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);
+#endif
+  if (!result) {
+    PyObject *error = PyErr_Occurred();
+    if (error) {
+      Swig::DirectorMethodException::raise("Error detected when calling 'INode.onChange'");
+    }
+  }
+}
+
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -27978,40 +27955,6 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_IParametric_onChange(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  IParametric *arg1 = (IParametric *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject *swig_obj[1] ;
-  Swig::Director *director = 0;
-  bool upcall = false;
-  
-  if (!args) SWIG_fail;
-  swig_obj[0] = args;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_IParametric, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IParametric_onChange" "', argument " "1"" of type '" "IParametric *""'"); 
-  }
-  arg1 = reinterpret_cast< IParametric * >(argp1);
-  director = SWIG_DIRECTOR_CAST(arg1);
-  upcall = (director && (director->swig_get_self()==swig_obj[0]));
-  try {
-    if (upcall) {
-      (arg1)->IParametric::onChange();
-    } else {
-      (arg1)->onChange();
-    }
-  } catch (Swig::DirectorException&) {
-    SWIG_fail;
-  }
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
 SWIGINTERN PyObject *_wrap_disown_IParametric(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   IParametric *arg1 = (IParametric *) 0 ;
@@ -29140,6 +29083,40 @@ fail:
 }
 
 
+SWIGINTERN PyObject *_wrap_INode_onChange(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  INode *arg1 = (INode *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject *swig_obj[1] ;
+  Swig::Director *director = 0;
+  bool upcall = false;
+  
+  if (!args) SWIG_fail;
+  swig_obj[0] = args;
+  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_INode, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "INode_onChange" "', argument " "1"" of type '" "INode *""'"); 
+  }
+  arg1 = reinterpret_cast< INode * >(argp1);
+  director = SWIG_DIRECTOR_CAST(arg1);
+  upcall = (director && (director->swig_get_self()==swig_obj[0]));
+  try {
+    if (upcall) {
+      (arg1)->INode::onChange();
+    } else {
+      (arg1)->onChange();
+    }
+  } catch (Swig::DirectorException&) {
+    SWIG_fail;
+  }
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_disown_INode(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   INode *arg1 = (INode *) 0 ;
@@ -42683,13 +42660,6 @@ static PyMethodDef SwigMethods[] = {
 		"const std::string& IParametric::getName() const\n"
 		"\n"
 		""},
-	 { "IParametric_onChange", _wrap_IParametric_onChange, METH_O, "\n"
-		"IParametric_onChange(IParametric self)\n"
-		"virtual void IParametric::onChange()\n"
-		"\n"
-		"Action to be taken in inherited class when a value has changed. Formerly this was also called when a change via registered parameter took place. This is now obsolete, but the  onChange() call is still relevant for calculations when a value is changed by different means (e.g. after initialization). \n"
-		"\n"
-		""},
 	 { "disown_IParametric", _wrap_disown_IParametric, METH_O, NULL},
 	 { "IParametric_swigregister", IParametric_swigregister, METH_O, NULL},
 	 { "IParametric_swiginit", IParametric_swiginit, METH_VARARGS, NULL},
@@ -42802,6 +42772,13 @@ static PyMethodDef SwigMethods[] = {
 		"Returns display name, composed from the name of node and it's copy number. \n"
 		"\n"
 		""},
+	 { "INode_onChange", _wrap_INode_onChange, METH_O, "\n"
+		"INode_onChange(INode self)\n"
+		"virtual void INode::onChange()\n"
+		"\n"
+		"Action to be taken in inherited class when a value has changed. Formerly this was also called when a change via registered parameter took place. This is now obsolete, but the  onChange() call is still relevant for calculations when a value is changed by different means (e.g. after initialization). \n"
+		"\n"
+		""},
 	 { "disown_INode", _wrap_disown_INode, METH_O, NULL},
 	 { "INode_swigregister", INode_swigregister, METH_O, NULL},
 	 { "INode_swiginit", INode_swiginit, METH_VARARGS, NULL},
diff --git a/auto/Wrap/libBornAgainParam_wrap.h b/auto/Wrap/libBornAgainParam_wrap.h
index 605e093f012..a3ac2f72ae8 100644
--- a/auto/Wrap/libBornAgainParam_wrap.h
+++ b/auto/Wrap/libBornAgainParam_wrap.h
@@ -20,7 +20,6 @@ class SwigDirector_IParametric : public IParametric, public Swig::Director {
 public:
     SwigDirector_IParametric(PyObject *self, std::string const &name = "");
     virtual ~SwigDirector_IParametric();
-    virtual void onChange();
 
 /* Internal director utilities */
 public:
@@ -33,27 +32,6 @@ public:
     }
 private:
     mutable std::map<std::string, bool> swig_inner;
-
-#if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-/* VTable implementation */
-    PyObject *swig_get_method(size_t method_index, const char *method_name) const {
-      PyObject *method = vtable[method_index];
-      if (!method) {
-        swig::SwigVar_PyObject name = SWIG_Python_str_FromChar(method_name);
-        method = PyObject_GetAttr(swig_get_self(), name);
-        if (!method) {
-          std::string msg = "Method in class IParametric doesn't exist, undefined ";
-          msg += method_name;
-          Swig::DirectorMethodException::raise(msg.c_str());
-        }
-        vtable[method_index] = method;
-      }
-      return method;
-    }
-private:
-    mutable swig::SwigVar_PyObject vtable[1];
-#endif
-
 };
 
 
@@ -63,10 +41,10 @@ public:
     SwigDirector_INode(PyObject *self);
     SwigDirector_INode(PyObject *self, NodeMeta const &meta, std::vector< double, std::allocator< double > > const &PValues);
     virtual ~SwigDirector_INode();
-    virtual void onChange();
     virtual void accept(INodeVisitor *visitor) const;
     virtual std::vector< INode const *, std::allocator< INode const * > > getChildren() const;
     virtual void setParent(INode const *newParent);
+    virtual void onChange();
 
 /* Internal director utilities */
 public:
diff --git a/auto/Wrap/libBornAgainSample.py b/auto/Wrap/libBornAgainSample.py
index e973f4b0bf5..a8f5b104a7f 100644
--- a/auto/Wrap/libBornAgainSample.py
+++ b/auto/Wrap/libBornAgainSample.py
@@ -11279,10 +11279,6 @@ class ISampleBuilder(libBornAgainParam.IParametric):
 
         """
         return _libBornAgainSample.ISampleBuilder_size(self)
-
-    def onChange(self):
-        r"""onChange(ISampleBuilder self)"""
-        return _libBornAgainSample.ISampleBuilder_onChange(self)
     def __disown__(self):
         self.this.disown()
         _libBornAgainSample.disown_ISampleBuilder(self)
diff --git a/auto/Wrap/libBornAgainSample_wrap.cpp b/auto/Wrap/libBornAgainSample_wrap.cpp
index fe6085053ae..fb1795076be 100644
--- a/auto/Wrap/libBornAgainSample_wrap.cpp
+++ b/auto/Wrap/libBornAgainSample_wrap.cpp
@@ -7439,9 +7439,6 @@ SWIGINTERNINLINE PyObject*
   return PyInt_FromSize_t((size_t) value);
 }
 
-SWIGINTERN void ISampleBuilder_onChange(ISampleBuilder *self){
-        return (self)->IParametric::onChange();
-    }
 
 
 /* ---------------------------------------------------
@@ -7525,29 +7522,6 @@ void SwigDirector_ISampleNode::transferToCPP() {
 }
 
 
-void SwigDirector_ISampleNode::onChange() {
-  if (!swig_get_self()) {
-    Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call ISampleNode.__init__.");
-  }
-#if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 2;
-  const char *const swig_method_name = "onChange";
-  PyObject *method = swig_get_method(swig_method_index, swig_method_name);
-  swig::SwigVar_PyObject args = PyTuple_New(0);
-  swig::SwigVar_PyObject result = PyObject_Call(method, (PyObject *) args, NULL);
-#else
-  swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar("onChange");
-  swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);
-#endif
-  if (!result) {
-    PyObject *error = PyErr_Occurred();
-    if (error) {
-      Swig::DirectorMethodException::raise("Error detected when calling 'ISampleNode.onChange'");
-    }
-  }
-}
-
-
 void SwigDirector_ISampleNode::accept(INodeVisitor *visitor) const {
   swig::SwigVar_PyObject obj0;
   obj0 = SWIG_NewPointerObj(SWIG_as_voidptr(visitor), SWIGTYPE_p_INodeVisitor,  0 );
@@ -7555,7 +7529,7 @@ void SwigDirector_ISampleNode::accept(INodeVisitor *visitor) const {
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call ISampleNode.__init__.");
   }
 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 3;
+  const size_t swig_method_index = 2;
   const char *const swig_method_name = "accept";
   PyObject *method = swig_get_method(swig_method_index, swig_method_name);
   swig::SwigVar_PyObject result = PyObject_CallFunctionObjArgs(method ,(PyObject *)obj0, NULL);
@@ -7578,7 +7552,7 @@ std::vector< INode const *, std::allocator< INode const * > > SwigDirector_ISamp
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call ISampleNode.__init__.");
   }
 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 4;
+  const size_t swig_method_index = 3;
   const char *const swig_method_name = "getChildren";
   PyObject *method = swig_get_method(swig_method_index, swig_method_name);
   swig::SwigVar_PyObject args = PyTuple_New(0);
@@ -7611,7 +7585,7 @@ void SwigDirector_ISampleNode::setParent(INode const *newParent) {
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call ISampleNode.__init__.");
   }
 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 5;
+  const size_t swig_method_index = 4;
   const char *const swig_method_name = "setParent";
   PyObject *method = swig_get_method(swig_method_index, swig_method_name);
   swig::SwigVar_PyObject result = PyObject_CallFunctionObjArgs(method ,(PyObject *)obj0, NULL);
@@ -7628,6 +7602,29 @@ void SwigDirector_ISampleNode::setParent(INode const *newParent) {
 }
 
 
+void SwigDirector_ISampleNode::onChange() {
+  if (!swig_get_self()) {
+    Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call ISampleNode.__init__.");
+  }
+#if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
+  const size_t swig_method_index = 5;
+  const char *const swig_method_name = "onChange";
+  PyObject *method = swig_get_method(swig_method_index, swig_method_name);
+  swig::SwigVar_PyObject args = PyTuple_New(0);
+  swig::SwigVar_PyObject result = PyObject_Call(method, (PyObject *) args, NULL);
+#else
+  swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar("onChange");
+  swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);
+#endif
+  if (!result) {
+    PyObject *error = PyErr_Occurred();
+    if (error) {
+      Swig::DirectorMethodException::raise("Error detected when calling 'ISampleNode.onChange'");
+    }
+  }
+}
+
+
 Material const *SwigDirector_ISampleNode::material() const {
   Material *c_result = 0 ;
   void *swig_argp ;
@@ -7738,29 +7735,6 @@ void SwigDirector_IFormFactor::transferToCPP() {
 }
 
 
-void SwigDirector_IFormFactor::onChange() {
-  if (!swig_get_self()) {
-    Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call IFormFactor.__init__.");
-  }
-#if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 2;
-  const char *const swig_method_name = "onChange";
-  PyObject *method = swig_get_method(swig_method_index, swig_method_name);
-  swig::SwigVar_PyObject args = PyTuple_New(0);
-  swig::SwigVar_PyObject result = PyObject_Call(method, (PyObject *) args, NULL);
-#else
-  swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar("onChange");
-  swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);
-#endif
-  if (!result) {
-    PyObject *error = PyErr_Occurred();
-    if (error) {
-      Swig::DirectorMethodException::raise("Error detected when calling 'IFormFactor.onChange'");
-    }
-  }
-}
-
-
 void SwigDirector_IFormFactor::accept(INodeVisitor *visitor) const {
   swig::SwigVar_PyObject obj0;
   obj0 = SWIG_NewPointerObj(SWIG_as_voidptr(visitor), SWIGTYPE_p_INodeVisitor,  0 );
@@ -7768,7 +7742,7 @@ void SwigDirector_IFormFactor::accept(INodeVisitor *visitor) const {
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call IFormFactor.__init__.");
   }
 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 3;
+  const size_t swig_method_index = 2;
   const char *const swig_method_name = "accept";
   PyObject *method = swig_get_method(swig_method_index, swig_method_name);
   swig::SwigVar_PyObject result = PyObject_CallFunctionObjArgs(method ,(PyObject *)obj0, NULL);
@@ -7791,7 +7765,7 @@ std::vector< INode const *, std::allocator< INode const * > > SwigDirector_IForm
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call IFormFactor.__init__.");
   }
 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 4;
+  const size_t swig_method_index = 3;
   const char *const swig_method_name = "getChildren";
   PyObject *method = swig_get_method(swig_method_index, swig_method_name);
   swig::SwigVar_PyObject args = PyTuple_New(0);
@@ -7824,7 +7798,7 @@ void SwigDirector_IFormFactor::setParent(INode const *newParent) {
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call IFormFactor.__init__.");
   }
 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 5;
+  const size_t swig_method_index = 4;
   const char *const swig_method_name = "setParent";
   PyObject *method = swig_get_method(swig_method_index, swig_method_name);
   swig::SwigVar_PyObject result = PyObject_CallFunctionObjArgs(method ,(PyObject *)obj0, NULL);
@@ -7841,6 +7815,29 @@ void SwigDirector_IFormFactor::setParent(INode const *newParent) {
 }
 
 
+void SwigDirector_IFormFactor::onChange() {
+  if (!swig_get_self()) {
+    Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call IFormFactor.__init__.");
+  }
+#if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
+  const size_t swig_method_index = 5;
+  const char *const swig_method_name = "onChange";
+  PyObject *method = swig_get_method(swig_method_index, swig_method_name);
+  swig::SwigVar_PyObject args = PyTuple_New(0);
+  swig::SwigVar_PyObject result = PyObject_Call(method, (PyObject *) args, NULL);
+#else
+  swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar("onChange");
+  swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);
+#endif
+  if (!result) {
+    PyObject *error = PyErr_Occurred();
+    if (error) {
+      Swig::DirectorMethodException::raise("Error detected when calling 'IFormFactor.onChange'");
+    }
+  }
+}
+
+
 Material const *SwigDirector_IFormFactor::material() const {
   Material *c_result = 0 ;
   void *swig_argp ;
@@ -8214,29 +8211,6 @@ void SwigDirector_IBornFF::transferToCPP() {
 }
 
 
-void SwigDirector_IBornFF::onChange() {
-  if (!swig_get_self()) {
-    Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call IBornFF.__init__.");
-  }
-#if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 2;
-  const char *const swig_method_name = "onChange";
-  PyObject *method = swig_get_method(swig_method_index, swig_method_name);
-  swig::SwigVar_PyObject args = PyTuple_New(0);
-  swig::SwigVar_PyObject result = PyObject_Call(method, (PyObject *) args, NULL);
-#else
-  swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar("onChange");
-  swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);
-#endif
-  if (!result) {
-    PyObject *error = PyErr_Occurred();
-    if (error) {
-      Swig::DirectorMethodException::raise("Error detected when calling 'IBornFF.onChange'");
-    }
-  }
-}
-
-
 void SwigDirector_IBornFF::accept(INodeVisitor *visitor) const {
   swig::SwigVar_PyObject obj0;
   obj0 = SWIG_NewPointerObj(SWIG_as_voidptr(visitor), SWIGTYPE_p_INodeVisitor,  0 );
@@ -8244,7 +8218,7 @@ void SwigDirector_IBornFF::accept(INodeVisitor *visitor) const {
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call IBornFF.__init__.");
   }
 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 3;
+  const size_t swig_method_index = 2;
   const char *const swig_method_name = "accept";
   PyObject *method = swig_get_method(swig_method_index, swig_method_name);
   swig::SwigVar_PyObject result = PyObject_CallFunctionObjArgs(method ,(PyObject *)obj0, NULL);
@@ -8267,7 +8241,7 @@ std::vector< INode const *, std::allocator< INode const * > > SwigDirector_IBorn
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call IBornFF.__init__.");
   }
 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 4;
+  const size_t swig_method_index = 3;
   const char *const swig_method_name = "getChildren";
   PyObject *method = swig_get_method(swig_method_index, swig_method_name);
   swig::SwigVar_PyObject args = PyTuple_New(0);
@@ -8300,7 +8274,7 @@ void SwigDirector_IBornFF::setParent(INode const *newParent) {
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call IBornFF.__init__.");
   }
 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 5;
+  const size_t swig_method_index = 4;
   const char *const swig_method_name = "setParent";
   PyObject *method = swig_get_method(swig_method_index, swig_method_name);
   swig::SwigVar_PyObject result = PyObject_CallFunctionObjArgs(method ,(PyObject *)obj0, NULL);
@@ -8317,6 +8291,29 @@ void SwigDirector_IBornFF::setParent(INode const *newParent) {
 }
 
 
+void SwigDirector_IBornFF::onChange() {
+  if (!swig_get_self()) {
+    Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call IBornFF.__init__.");
+  }
+#if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
+  const size_t swig_method_index = 5;
+  const char *const swig_method_name = "onChange";
+  PyObject *method = swig_get_method(swig_method_index, swig_method_name);
+  swig::SwigVar_PyObject args = PyTuple_New(0);
+  swig::SwigVar_PyObject result = PyObject_Call(method, (PyObject *) args, NULL);
+#else
+  swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar("onChange");
+  swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);
+#endif
+  if (!result) {
+    PyObject *error = PyErr_Occurred();
+    if (error) {
+      Swig::DirectorMethodException::raise("Error detected when calling 'IBornFF.onChange'");
+    }
+  }
+}
+
+
 Material const *SwigDirector_IBornFF::material() const {
   Material *c_result = 0 ;
   void *swig_argp ;
@@ -8657,29 +8654,6 @@ SwigDirector_ISampleBuilder::SwigDirector_ISampleBuilder(PyObject *self): ISampl
 SwigDirector_ISampleBuilder::~SwigDirector_ISampleBuilder() {
 }
 
-void SwigDirector_ISampleBuilder::onChange() {
-  if (!swig_get_self()) {
-    Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call ISampleBuilder.__init__.");
-  }
-#if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 0;
-  const char *const swig_method_name = "onChange";
-  PyObject *method = swig_get_method(swig_method_index, swig_method_name);
-  swig::SwigVar_PyObject args = PyTuple_New(0);
-  swig::SwigVar_PyObject result = PyObject_Call(method, (PyObject *) args, NULL);
-#else
-  swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar("onChange");
-  swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);
-#endif
-  if (!result) {
-    PyObject *error = PyErr_Occurred();
-    if (error) {
-      Swig::DirectorMethodException::raise("Error detected when calling 'ISampleBuilder.onChange'");
-    }
-  }
-}
-
-
 MultiLayer *SwigDirector_ISampleBuilder::buildSample() const {
   MultiLayer *c_result = 0 ;
   void *swig_argp ;
@@ -8690,7 +8664,7 @@ MultiLayer *SwigDirector_ISampleBuilder::buildSample() const {
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call ISampleBuilder.__init__.");
   }
 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 1;
+  const size_t swig_method_index = 0;
   const char *const swig_method_name = "buildSample";
   PyObject *method = swig_get_method(swig_method_index, swig_method_name);
   swig::SwigVar_PyObject args = PyTuple_New(0);
@@ -8727,7 +8701,7 @@ MultiLayer *SwigDirector_ISampleBuilder::createSampleByIndex(size_t arg0) {
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call ISampleBuilder.__init__.");
   }
 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 2;
+  const size_t swig_method_index = 1;
   const char *const swig_method_name = "createSampleByIndex";
   PyObject *method = swig_get_method(swig_method_index, swig_method_name);
   swig::SwigVar_PyObject result = PyObject_CallFunctionObjArgs(method ,(PyObject *)obj0, NULL);
@@ -8758,7 +8732,7 @@ size_t SwigDirector_ISampleBuilder::size() {
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call ISampleBuilder.__init__.");
   }
 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
-  const size_t swig_method_index = 3;
+  const size_t swig_method_index = 2;
   const char *const swig_method_name = "size";
   PyObject *method = swig_get_method(swig_method_index, swig_method_name);
   swig::SwigVar_PyObject args = PyTuple_New(0);
@@ -66727,40 +66701,6 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_ISampleBuilder_onChange(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  ISampleBuilder *arg1 = (ISampleBuilder *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  std::shared_ptr< ISampleBuilder > tempshared1 ;
-  std::shared_ptr< ISampleBuilder > *smartarg1 = 0 ;
-  PyObject *swig_obj[1] ;
-  
-  if (!args) SWIG_fail;
-  swig_obj[0] = args;
-  {
-    int newmem = 0;
-    res1 = SWIG_ConvertPtrAndOwn(swig_obj[0], &argp1, SWIGTYPE_p_std__shared_ptrT_ISampleBuilder_t, 0 |  0 , &newmem);
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ISampleBuilder_onChange" "', argument " "1"" of type '" "ISampleBuilder *""'");
-    }
-    if (newmem & SWIG_CAST_NEW_MEMORY) {
-      tempshared1 = *reinterpret_cast< std::shared_ptr<  ISampleBuilder > * >(argp1);
-      delete reinterpret_cast< std::shared_ptr<  ISampleBuilder > * >(argp1);
-      arg1 = const_cast< ISampleBuilder * >(tempshared1.get());
-    } else {
-      smartarg1 = reinterpret_cast< std::shared_ptr<  ISampleBuilder > * >(argp1);
-      arg1 = const_cast< ISampleBuilder * >((smartarg1 ? smartarg1->get() : 0));
-    }
-  }
-  ISampleBuilder_onChange(arg1);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
 SWIGINTERN PyObject *_wrap_disown_ISampleBuilder(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   ISampleBuilder *arg1 = (ISampleBuilder *) 0 ;
@@ -72694,7 +72634,6 @@ static PyMethodDef SwigMethods[] = {
 		"virtual size_t ISampleBuilder::size()\n"
 		"\n"
 		""},
-	 { "ISampleBuilder_onChange", _wrap_ISampleBuilder_onChange, METH_O, "ISampleBuilder_onChange(ISampleBuilder self)"},
 	 { "disown_ISampleBuilder", _wrap_disown_ISampleBuilder, METH_O, NULL},
 	 { "ISampleBuilder_swigregister", ISampleBuilder_swigregister, METH_O, NULL},
 	 { "ISampleBuilder_swiginit", ISampleBuilder_swiginit, METH_VARARGS, NULL},
diff --git a/auto/Wrap/libBornAgainSample_wrap.h b/auto/Wrap/libBornAgainSample_wrap.h
index ca027c5f6b6..0a51b8d4c18 100644
--- a/auto/Wrap/libBornAgainSample_wrap.h
+++ b/auto/Wrap/libBornAgainSample_wrap.h
@@ -23,10 +23,10 @@ public:
     virtual ~SwigDirector_ISampleNode();
     virtual ISampleNode *clone() const;
     virtual void transferToCPP();
-    virtual void onChange();
     virtual void accept(INodeVisitor *visitor) const;
     virtual std::vector< INode const *, std::allocator< INode const * > > getChildren() const;
     virtual void setParent(INode const *newParent);
+    virtual void onChange();
     virtual Material const *material() const;
 
 /* Internal director utilities */
@@ -72,10 +72,10 @@ public:
     virtual ~SwigDirector_IFormFactor();
     virtual IFormFactor *clone() const;
     virtual void transferToCPP();
-    virtual void onChange();
     virtual void accept(INodeVisitor *visitor) const;
     virtual std::vector< INode const *, std::allocator< INode const * > > getChildren() const;
     virtual void setParent(INode const *newParent);
+    virtual void onChange();
     virtual Material const *material() const;
     virtual void setAmbientMaterial(Material const &arg0);
     virtual complex_t theFF(WavevectorInfo const &wavevectors) const;
@@ -135,10 +135,10 @@ public:
     virtual ~SwigDirector_IBornFF();
     virtual IBornFF *clone() const;
     virtual void transferToCPP();
-    virtual void onChange();
     virtual void accept(INodeVisitor *visitor) const;
     virtual std::vector< INode const *, std::allocator< INode const * > > getChildren() const;
     virtual void setParent(INode const *newParent);
+    virtual void onChange();
     virtual Material const *material() const;
     virtual void setAmbientMaterial(Material const &arg0);
     virtual complex_t theFF(WavevectorInfo const &wavevectors) const;
@@ -196,7 +196,6 @@ class SwigDirector_ISampleBuilder : public ISampleBuilder, public Swig::Director
 public:
     SwigDirector_ISampleBuilder(PyObject *self);
     virtual ~SwigDirector_ISampleBuilder();
-    virtual void onChange();
     virtual MultiLayer *buildSample() const;
     virtual MultiLayer *createSampleByIndex(size_t arg0);
     virtual size_t size();
@@ -230,7 +229,7 @@ private:
       return method;
     }
 private:
-    mutable swig::SwigVar_PyObject vtable[4];
+    mutable swig::SwigVar_PyObject vtable[3];
 #endif
 
 };
-- 
GitLab