From cec3f0dac08cc9a93b8548527deccbb593676e28 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Tue, 20 Dec 2022 10:18:07 +0100
Subject: [PATCH] merge exec_spanZ into spanZ

---
 Examples/scatter2d/CustomFormFactor.py        |   2 +-
 Sample/HardParticle/IFormFactorPolyhedron.cpp |   2 +-
 Sample/HardParticle/IFormFactorPolyhedron.h   |   4 +-
 Sample/HardParticle/Sphere.cpp                |  20 +-
 Sample/HardParticle/Sphere.h                  |   3 +-
 Sample/Particle/IFormFactor.cpp               |   5 -
 Sample/Particle/IFormFactor.h                 |   4 +-
 auto/Wrap/libBornAgainSample.py               |  12 +-
 auto/Wrap/libBornAgainSample_wrap.cpp         | 199 ++++++++++--------
 auto/Wrap/libBornAgainSample_wrap.h           |   5 +-
 10 files changed, 135 insertions(+), 121 deletions(-)

diff --git a/Examples/scatter2d/CustomFormFactor.py b/Examples/scatter2d/CustomFormFactor.py
index f6a371251de..f67ad32efb7 100755
--- a/Examples/scatter2d/CustomFormFactor.py
+++ b/Examples/scatter2d/CustomFormFactor.py
@@ -44,7 +44,7 @@ class CustomFormFactor(ba.IFormFactor):
                sinc(qzhH)*(sinc(0.5*qyhL)*(sinc(qxhL)-0.5*sinc(0.5*qxhL))+\
                sinc(0.5*qxhL)*sinc(qyhL))
 
-    def exec_spanZ(self, rotation):
+    def spanZ(self, rotation):
         return ba.Span(0, self.H)
 
 
diff --git a/Sample/HardParticle/IFormFactorPolyhedron.cpp b/Sample/HardParticle/IFormFactorPolyhedron.cpp
index 809a42eb2e7..e2641fe7ff4 100644
--- a/Sample/HardParticle/IFormFactorPolyhedron.cpp
+++ b/Sample/HardParticle/IFormFactorPolyhedron.cpp
@@ -49,7 +49,7 @@ double IFormFactorPolyhedron::radialExtension() const
     return pimpl->radius();
 }
 
-Span IFormFactorPolyhedron::exec_spanZ(const IRotation* rotation) const
+Span IFormFactorPolyhedron::spanZ(const IRotation* rotation) const
 {
     ASSERT(m_validated);
     return PolyhedralUtil::spanZ(pimpl->vertices(), rotation);
diff --git a/Sample/HardParticle/IFormFactorPolyhedron.h b/Sample/HardParticle/IFormFactorPolyhedron.h
index f968d576b42..086e295cadb 100644
--- a/Sample/HardParticle/IFormFactorPolyhedron.h
+++ b/Sample/HardParticle/IFormFactorPolyhedron.h
@@ -36,15 +36,13 @@ public:
     double radialExtension() const override;
 
     complex_t formfactor(C3 q) const override;
+    Span spanZ(const IRotation* rotation) const override;
 
 protected:
     void setPolyhedron(const ff::Topology& topology, double z_bottom,
                        const std::vector<R3>& vertices) const;
 
     mutable std::unique_ptr<ff::IBody> pimpl;
-
-private:
-    Span exec_spanZ(const IRotation* rotation) const override;
 };
 
 #endif // BORNAGAIN_SAMPLE_HARDPARTICLE_IFORMFACTORPOLYHEDRON_H
diff --git a/Sample/HardParticle/Sphere.cpp b/Sample/HardParticle/Sphere.cpp
index 13fdac1bf07..0b20aea8fae 100644
--- a/Sample/HardParticle/Sphere.cpp
+++ b/Sample/HardParticle/Sphere.cpp
@@ -33,7 +33,16 @@ Sphere::Sphere(double radius, bool position_at_center)
 {
 }
 
-Span Sphere::exec_spanZ(const IRotation* rotation) const
+complex_t Sphere::formfactor(C3 q) const
+{
+    ASSERT(m_validated);
+    complex_t result = SampleUtils::someff::ffSphere(q, m_radius);
+    if (!m_position_at_center)
+        result *= exp_I(q.z() * m_radius);
+    return result;
+}
+
+Span Sphere::spanZ(const IRotation* rotation) const
 {
     if (m_position_at_center)
         return {-m_radius, +m_radius};
@@ -44,15 +53,6 @@ Span Sphere::exec_spanZ(const IRotation* rotation) const
     return {new_centre.z() - m_radius, new_centre.z() + m_radius};
 }
 
-complex_t Sphere::formfactor(C3 q) const
-{
-    ASSERT(m_validated);
-    complex_t result = SampleUtils::someff::ffSphere(q, m_radius);
-    if (!m_position_at_center)
-        result *= exp_I(q.z() * m_radius);
-    return result;
-}
-
 std::string Sphere::validate() const
 {
     if (m_radius <= 0)
diff --git a/Sample/HardParticle/Sphere.h b/Sample/HardParticle/Sphere.h
index dd76ee45479..76fd92d1bb2 100644
--- a/Sample/HardParticle/Sphere.h
+++ b/Sample/HardParticle/Sphere.h
@@ -34,6 +34,7 @@ public:
     double radialExtension() const override { return m_radius; }
 
     complex_t formfactor(C3 q) const override;
+    Span spanZ(const IRotation* rotation) const override;
 
     std::string validate() const override;
 
@@ -41,8 +42,6 @@ protected:
     bool canSliceAnalytically(const IRotation*) const override { return true; }
 
 private:
-    Span exec_spanZ(const IRotation* rotation) const override;
-
     const double& m_radius;
     bool m_position_at_center;
 };
diff --git a/Sample/Particle/IFormFactor.cpp b/Sample/Particle/IFormFactor.cpp
index 41526cbcee4..df14b62f5f9 100644
--- a/Sample/Particle/IFormFactor.cpp
+++ b/Sample/Particle/IFormFactor.cpp
@@ -37,11 +37,6 @@ double IFormFactor::volume() const
 }
 
 Span IFormFactor::spanZ(const IRotation* rotation) const
-{
-    return exec_spanZ(rotation);
-}
-
-Span IFormFactor::exec_spanZ(const IRotation* rotation) const
 {
     if (!m_shape3D)
         throw std::runtime_error("Bug: Form factor has no m_shape3D, cannot compute top z");
diff --git a/Sample/Particle/IFormFactor.h b/Sample/Particle/IFormFactor.h
index d9a36016adf..faf68de5d1b 100644
--- a/Sample/Particle/IFormFactor.h
+++ b/Sample/Particle/IFormFactor.h
@@ -47,7 +47,7 @@ public:
     //! form factor's shape. This is used for SSCA calculations
     virtual double radialExtension() const = 0;
 
-    Span spanZ(const IRotation* rotation) const;
+    virtual Span spanZ(const IRotation* rotation) const;
 
     //! Creates the Python constructor of this class (or derived classes)
     std::string pythonConstructor() const;
@@ -66,8 +66,6 @@ public:
     virtual complex_t formfactor(C3 q) const = 0;
 
 protected:
-    virtual Span exec_spanZ(const IRotation* rotation) const;
-
     //! IShape3D object, used to retrieve vertices (which may be approximate in the case
     //! of round shapes). For soft particles, this will be a hard mean shape.
     mutable std::unique_ptr<IShape3D> m_shape3D;
diff --git a/auto/Wrap/libBornAgainSample.py b/auto/Wrap/libBornAgainSample.py
index 3c3e8a66c8e..a0e6fd48d56 100644
--- a/auto/Wrap/libBornAgainSample.py
+++ b/auto/Wrap/libBornAgainSample.py
@@ -2690,10 +2690,6 @@ class IFormFactor(ISampleNode):
     def formfactor(self, q):
         r"""formfactor(IFormFactor self, C3 q) -> complex_t"""
         return _libBornAgainSample.IFormFactor_formfactor(self, q)
-
-    def exec_spanZ(self, rotation):
-        r"""exec_spanZ(IFormFactor self, IRotation rotation) -> Span"""
-        return _libBornAgainSample.IFormFactor_exec_spanZ(self, rotation)
     def __disown__(self):
         self.this.disown()
         _libBornAgainSample.disown_IFormFactor(self)
@@ -4705,6 +4701,10 @@ class IFormFactorPolyhedron(IFormFactor):
         r"""formfactor(IFormFactorPolyhedron self, C3 q) -> complex_t"""
         return _libBornAgainSample.IFormFactorPolyhedron_formfactor(self, q)
 
+    def spanZ(self, rotation):
+        r"""spanZ(IFormFactorPolyhedron self, IRotation rotation) -> Span"""
+        return _libBornAgainSample.IFormFactorPolyhedron_spanZ(self, rotation)
+
 # Register IFormFactorPolyhedron in _libBornAgainSample:
 _libBornAgainSample.IFormFactorPolyhedron_swigregister(IFormFactorPolyhedron)
 class IFormFactorPrism(IFormFactorPolyhedron):
@@ -5625,6 +5625,10 @@ class Sphere(IFormFactor):
         r"""formfactor(Sphere self, C3 q) -> complex_t"""
         return _libBornAgainSample.Sphere_formfactor(self, q)
 
+    def spanZ(self, rotation):
+        r"""spanZ(Sphere self, IRotation rotation) -> Span"""
+        return _libBornAgainSample.Sphere_spanZ(self, rotation)
+
     def validate(self):
         r"""validate(Sphere self) -> std::string"""
         return _libBornAgainSample.Sphere_validate(self)
diff --git a/auto/Wrap/libBornAgainSample_wrap.cpp b/auto/Wrap/libBornAgainSample_wrap.cpp
index 0d85bd57482..0734552a083 100644
--- a/auto/Wrap/libBornAgainSample_wrap.cpp
+++ b/auto/Wrap/libBornAgainSample_wrap.cpp
@@ -8027,105 +8027,103 @@ double SwigDirector_IFormFactor::radialExtension() const {
 }
 
 
-bool SwigDirector_IFormFactor::canSliceAnalytically(IRotation const *rot) const {
-  bool c_result = SwigValueInit< bool >() ;
+Span SwigDirector_IFormFactor::spanZ(IRotation const *rotation) const {
+  void *swig_argp ;
+  int swig_res = 0 ;
   
+  Span c_result;
   swig::SwigVar_PyObject obj0;
-  obj0 = SWIG_NewPointerObj(SWIG_as_voidptr(rot), SWIGTYPE_p_IRotation,  0 );
+  obj0 = SWIG_NewPointerObj(SWIG_as_voidptr(rotation), SWIGTYPE_p_IRotation,  0 );
   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 = 9;
-  const char *const swig_method_name = "canSliceAnalytically";
+  const char *const swig_method_name = "spanZ";
   PyObject *method = swig_get_method(swig_method_index, swig_method_name);
   swig::SwigVar_PyObject result = PyObject_CallFunctionObjArgs(method ,(PyObject *)obj0, NULL);
 #else
-  swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar("canSliceAnalytically");
+  swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar("spanZ");
   swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name ,(PyObject *)obj0, NULL);
 #endif
   if (!result) {
     PyObject *error = PyErr_Occurred();
     if (error) {
-      Swig::DirectorMethodException::raise("Error detected when calling 'IFormFactor.canSliceAnalytically'");
+      Swig::DirectorMethodException::raise("Error detected when calling 'IFormFactor.spanZ'");
     }
   }
-  bool swig_val;
-  int swig_res = SWIG_AsVal_bool(result, &swig_val);
+  swig_res = SWIG_ConvertPtr(result,&swig_argp,SWIGTYPE_p_Span,  0  | 0);
   if (!SWIG_IsOK(swig_res)) {
-    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(swig_res)), "in output value of type '""bool""'");
+    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(swig_res)), "in output value of type '""Span""'");
   }
-  c_result = static_cast< bool >(swig_val);
-  return (bool) c_result;
+  c_result = *(reinterpret_cast< Span * >(swig_argp));
+  if (SWIG_IsNewObj(swig_res)) delete reinterpret_cast< Span * >(swig_argp);
+  return (Span) c_result;
 }
 
 
-complex_t SwigDirector_IFormFactor::formfactor(C3 q) const {
-  complex_t c_result;
+bool SwigDirector_IFormFactor::canSliceAnalytically(IRotation const *rot) const {
+  bool c_result = SwigValueInit< bool >() ;
+  
   swig::SwigVar_PyObject obj0;
-  obj0 = SWIG_NewPointerObj((new C3(SWIG_STD_MOVE(q))), SWIGTYPE_p_Vec3T_std__complexT_double_t_t, SWIG_POINTER_OWN |  0 );
+  obj0 = SWIG_NewPointerObj(SWIG_as_voidptr(rot), SWIGTYPE_p_IRotation,  0 );
   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 = 10;
-  const char *const swig_method_name = "formfactor";
+  const char *const swig_method_name = "canSliceAnalytically";
   PyObject *method = swig_get_method(swig_method_index, swig_method_name);
   swig::SwigVar_PyObject result = PyObject_CallFunctionObjArgs(method ,(PyObject *)obj0, NULL);
 #else
-  swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar("formfactor");
+  swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar("canSliceAnalytically");
   swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name ,(PyObject *)obj0, NULL);
 #endif
   if (!result) {
     PyObject *error = PyErr_Occurred();
     if (error) {
-      Swig::DirectorMethodException::raise("Error detected when calling 'IFormFactor.formfactor'");
+      Swig::DirectorMethodException::raise("Error detected when calling 'IFormFactor.canSliceAnalytically'");
     }
   }
-  std::complex<double> swig_val;
-  int swig_res = SWIG_AsVal_std_complex_Sl_double_Sg_(result, &swig_val);
+  bool swig_val;
+  int swig_res = SWIG_AsVal_bool(result, &swig_val);
   if (!SWIG_IsOK(swig_res)) {
-    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(swig_res)), "in output value of type '""complex_t""'");
+    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(swig_res)), "in output value of type '""bool""'");
   }
-  c_result = static_cast< complex_t >(swig_val);
-  return (complex_t) c_result;
+  c_result = static_cast< bool >(swig_val);
+  return (bool) c_result;
 }
 
 
-Span SwigDirector_IFormFactor::exec_spanZ(IRotation const *rotation) const {
-  void *swig_argp ;
-  int swig_res = 0 ;
-  
-  Span c_result;
+complex_t SwigDirector_IFormFactor::formfactor(C3 q) const {
+  complex_t c_result;
   swig::SwigVar_PyObject obj0;
-  obj0 = SWIG_NewPointerObj(SWIG_as_voidptr(rotation), SWIGTYPE_p_IRotation,  0 );
-  swig_set_inner("exec_spanZ", true);
+  obj0 = SWIG_NewPointerObj((new C3(SWIG_STD_MOVE(q))), SWIGTYPE_p_Vec3T_std__complexT_double_t_t, SWIG_POINTER_OWN |  0 );
   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 = 11;
-  const char *const swig_method_name = "exec_spanZ";
+  const char *const swig_method_name = "formfactor";
   PyObject *method = swig_get_method(swig_method_index, swig_method_name);
   swig::SwigVar_PyObject result = PyObject_CallFunctionObjArgs(method ,(PyObject *)obj0, NULL);
 #else
-  swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar("exec_spanZ");
+  swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar("formfactor");
   swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name ,(PyObject *)obj0, NULL);
 #endif
-  swig_set_inner("exec_spanZ", false);
   if (!result) {
     PyObject *error = PyErr_Occurred();
     if (error) {
-      Swig::DirectorMethodException::raise("Error detected when calling 'IFormFactor.exec_spanZ'");
+      Swig::DirectorMethodException::raise("Error detected when calling 'IFormFactor.formfactor'");
     }
   }
-  swig_res = SWIG_ConvertPtr(result,&swig_argp,SWIGTYPE_p_Span,  0  | 0);
+  std::complex<double> swig_val;
+  int swig_res = SWIG_AsVal_std_complex_Sl_double_Sg_(result, &swig_val);
   if (!SWIG_IsOK(swig_res)) {
-    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(swig_res)), "in output value of type '""Span""'");
+    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(swig_res)), "in output value of type '""complex_t""'");
   }
-  c_result = *(reinterpret_cast< Span * >(swig_argp));
-  if (SWIG_IsNewObj(swig_res)) delete reinterpret_cast< Span * >(swig_argp);
-  return (Span) c_result;
+  c_result = static_cast< complex_t >(swig_val);
+  return (complex_t) c_result;
 }
 
 
@@ -34092,6 +34090,8 @@ SWIGINTERN PyObject *_wrap_IFormFactor_spanZ(PyObject *self, PyObject *args) {
   void *argp2 = 0 ;
   int res2 = 0 ;
   PyObject *swig_obj[2] ;
+  Swig::Director *director = 0;
+  bool upcall = false;
   Span result;
   
   if (!SWIG_Python_UnpackTuple(args, "IFormFactor_spanZ", 2, 2, swig_obj)) SWIG_fail;
@@ -34105,7 +34105,17 @@ SWIGINTERN PyObject *_wrap_IFormFactor_spanZ(PyObject *self, PyObject *args) {
     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IFormFactor_spanZ" "', argument " "2"" of type '" "IRotation const *""'"); 
   }
   arg2 = reinterpret_cast< IRotation * >(argp2);
-  result = ((IFormFactor const *)arg1)->spanZ((IRotation const *)arg2);
+  director = SWIG_DIRECTOR_CAST(arg1);
+  upcall = (director && (director->swig_get_self()==swig_obj[0]));
+  try {
+    if (upcall) {
+      result = ((IFormFactor const *)arg1)->IFormFactor::spanZ((IRotation const *)arg2);
+    } else {
+      result = ((IFormFactor const *)arg1)->spanZ((IRotation const *)arg2);
+    }
+  } catch (Swig::DirectorException&) {
+    SWIG_fail;
+  }
   resultobj = SWIG_NewPointerObj((new Span(result)), SWIGTYPE_p_Span, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
@@ -34332,54 +34342,6 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_IFormFactor_exec_spanZ(PyObject *self, PyObject *args) {
-  PyObject *resultobj = 0;
-  IFormFactor *arg1 = (IFormFactor *) 0 ;
-  IRotation *arg2 = (IRotation *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  PyObject *swig_obj[2] ;
-  Swig::Director *director = 0;
-  bool upcall = false;
-  SwigDirector_IFormFactor *darg = 0;
-  Span result;
-  
-  if (!SWIG_Python_UnpackTuple(args, "IFormFactor_exec_spanZ", 2, 2, swig_obj)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_IFormFactor, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IFormFactor_exec_spanZ" "', argument " "1"" of type '" "IFormFactor const *""'"); 
-  }
-  arg1 = reinterpret_cast< IFormFactor * >(argp1);
-  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_IRotation, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IFormFactor_exec_spanZ" "', argument " "2"" of type '" "IRotation const *""'"); 
-  }
-  arg2 = reinterpret_cast< IRotation * >(argp2);
-  director = SWIG_DIRECTOR_CAST(arg1);
-  if (!director || !(director->swig_get_inner("exec_spanZ"))) {
-    SWIG_SetErrorMsg(PyExc_RuntimeError,"accessing protected member exec_spanZ");
-    SWIG_fail;
-  }
-  upcall = (director && (director->swig_get_self()==swig_obj[0]));
-  try {
-    darg = dynamic_cast<SwigDirector_IFormFactor *>(arg1);
-    if (upcall) {
-      result = ((SwigDirector_IFormFactor const *)darg)->exec_spanZSwigPublic((IRotation const *)arg2);
-    } else {
-      result = ((SwigDirector_IFormFactor const *)darg)->exec_spanZ((IRotation const *)arg2);
-    }
-  } catch (Swig::DirectorException&) {
-    SWIG_fail;
-  }
-  resultobj = SWIG_NewPointerObj((new Span(result)), SWIGTYPE_p_Span, SWIG_POINTER_OWN |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
 SWIGINTERN PyObject *_wrap_disown_IFormFactor(PyObject *self, PyObject *args) {
   PyObject *resultobj = 0;
   IFormFactor *arg1 = (IFormFactor *) 0 ;
@@ -48017,6 +47979,36 @@ fail:
 }
 
 
+SWIGINTERN PyObject *_wrap_IFormFactorPolyhedron_spanZ(PyObject *self, PyObject *args) {
+  PyObject *resultobj = 0;
+  IFormFactorPolyhedron *arg1 = (IFormFactorPolyhedron *) 0 ;
+  IRotation *arg2 = (IRotation *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject *swig_obj[2] ;
+  Span result;
+  
+  if (!SWIG_Python_UnpackTuple(args, "IFormFactorPolyhedron_spanZ", 2, 2, swig_obj)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_IFormFactorPolyhedron, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IFormFactorPolyhedron_spanZ" "', argument " "1"" of type '" "IFormFactorPolyhedron const *""'"); 
+  }
+  arg1 = reinterpret_cast< IFormFactorPolyhedron * >(argp1);
+  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_IRotation, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IFormFactorPolyhedron_spanZ" "', argument " "2"" of type '" "IRotation const *""'"); 
+  }
+  arg2 = reinterpret_cast< IRotation * >(argp2);
+  result = ((IFormFactorPolyhedron const *)arg1)->spanZ((IRotation const *)arg2);
+  resultobj = SWIG_NewPointerObj((new Span(result)), SWIGTYPE_p_Span, SWIG_POINTER_OWN |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *IFormFactorPolyhedron_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
   if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL;
@@ -54136,6 +54128,36 @@ fail:
 }
 
 
+SWIGINTERN PyObject *_wrap_Sphere_spanZ(PyObject *self, PyObject *args) {
+  PyObject *resultobj = 0;
+  Sphere *arg1 = (Sphere *) 0 ;
+  IRotation *arg2 = (IRotation *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject *swig_obj[2] ;
+  Span result;
+  
+  if (!SWIG_Python_UnpackTuple(args, "Sphere_spanZ", 2, 2, swig_obj)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Sphere, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Sphere_spanZ" "', argument " "1"" of type '" "Sphere const *""'"); 
+  }
+  arg1 = reinterpret_cast< Sphere * >(argp1);
+  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_IRotation, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Sphere_spanZ" "', argument " "2"" of type '" "IRotation const *""'"); 
+  }
+  arg2 = reinterpret_cast< IRotation * >(argp2);
+  result = ((Sphere const *)arg1)->spanZ((IRotation const *)arg2);
+  resultobj = SWIG_NewPointerObj((new Span(result)), SWIGTYPE_p_Span, SWIG_POINTER_OWN |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_Sphere_validate(PyObject *self, PyObject *args) {
   PyObject *resultobj = 0;
   Sphere *arg1 = (Sphere *) 0 ;
@@ -61149,7 +61171,6 @@ static PyMethodDef SwigMethods[] = {
 	 { "IFormFactor_thePolFF", _wrap_IFormFactor_thePolFF, METH_VARARGS, "IFormFactor_thePolFF(IFormFactor self, WavevectorInfo const & wavevectors) -> SpinMatrix"},
 	 { "IFormFactor_formfactor_pol", _wrap_IFormFactor_formfactor_pol, METH_VARARGS, "IFormFactor_formfactor_pol(IFormFactor self, C3 q) -> SpinMatrix"},
 	 { "IFormFactor_formfactor", _wrap_IFormFactor_formfactor, METH_VARARGS, "IFormFactor_formfactor(IFormFactor self, C3 q) -> complex_t"},
-	 { "IFormFactor_exec_spanZ", _wrap_IFormFactor_exec_spanZ, METH_VARARGS, "IFormFactor_exec_spanZ(IFormFactor self, IRotation rotation) -> Span"},
 	 { "disown_IFormFactor", _wrap_disown_IFormFactor, METH_O, NULL},
 	 { "IFormFactor_swigregister", IFormFactor_swigregister, METH_O, NULL},
 	 { "IFormFactor_swiginit", IFormFactor_swiginit, METH_VARARGS, NULL},
@@ -61718,6 +61739,7 @@ static PyMethodDef SwigMethods[] = {
 	 { "IFormFactorPolyhedron_volume", _wrap_IFormFactorPolyhedron_volume, METH_O, "IFormFactorPolyhedron_volume(IFormFactorPolyhedron self) -> double"},
 	 { "IFormFactorPolyhedron_radialExtension", _wrap_IFormFactorPolyhedron_radialExtension, METH_O, "IFormFactorPolyhedron_radialExtension(IFormFactorPolyhedron self) -> double"},
 	 { "IFormFactorPolyhedron_formfactor", _wrap_IFormFactorPolyhedron_formfactor, METH_VARARGS, "IFormFactorPolyhedron_formfactor(IFormFactorPolyhedron self, C3 q) -> complex_t"},
+	 { "IFormFactorPolyhedron_spanZ", _wrap_IFormFactorPolyhedron_spanZ, METH_VARARGS, "IFormFactorPolyhedron_spanZ(IFormFactorPolyhedron self, IRotation rotation) -> Span"},
 	 { "IFormFactorPolyhedron_swigregister", IFormFactorPolyhedron_swigregister, METH_O, NULL},
 	 { "delete_IFormFactorPrism", _wrap_delete_IFormFactorPrism, METH_O, "delete_IFormFactorPrism(IFormFactorPrism self)"},
 	 { "IFormFactorPrism_height", _wrap_IFormFactorPrism_height, METH_O, "IFormFactorPrism_height(IFormFactorPrism self) -> double"},
@@ -62002,6 +62024,7 @@ static PyMethodDef SwigMethods[] = {
 	 { "Sphere_radius", _wrap_Sphere_radius, METH_O, "Sphere_radius(Sphere self) -> double"},
 	 { "Sphere_radialExtension", _wrap_Sphere_radialExtension, METH_O, "Sphere_radialExtension(Sphere self) -> double"},
 	 { "Sphere_formfactor", _wrap_Sphere_formfactor, METH_VARARGS, "Sphere_formfactor(Sphere self, C3 q) -> complex_t"},
+	 { "Sphere_spanZ", _wrap_Sphere_spanZ, METH_VARARGS, "Sphere_spanZ(Sphere self, IRotation rotation) -> Span"},
 	 { "Sphere_validate", _wrap_Sphere_validate, METH_O, "Sphere_validate(Sphere self) -> std::string"},
 	 { "delete_Sphere", _wrap_delete_Sphere, METH_O, "delete_Sphere(Sphere self)"},
 	 { "Sphere_swigregister", Sphere_swigregister, METH_O, NULL},
diff --git a/auto/Wrap/libBornAgainSample_wrap.h b/auto/Wrap/libBornAgainSample_wrap.h
index e58e9412d20..89d5931aa41 100644
--- a/auto/Wrap/libBornAgainSample_wrap.h
+++ b/auto/Wrap/libBornAgainSample_wrap.h
@@ -77,12 +77,9 @@ public:
     virtual Material const *material() const;
     virtual double volume() const;
     virtual double radialExtension() const;
+    virtual Span spanZ(IRotation const *rotation) const;
     virtual bool canSliceAnalytically(IRotation const *rot) const;
     virtual complex_t formfactor(C3 q) const;
-    virtual Span exec_spanZ(IRotation const *rotation) const;
-    virtual Span exec_spanZSwigPublic(IRotation const *rotation) const {
-      return IFormFactor::exec_spanZ(rotation);
-    }
 
 /* Internal director utilities */
 public:
-- 
GitLab