From 6f914191707698e0c71f6e4bbf35e544a0e3e2b0 Mon Sep 17 00:00:00 2001
From: Joachim Wuttke <j.wuttke@fz-juelich.de>
Date: Tue, 7 Nov 2023 18:10:12 +0100
Subject: [PATCH] rm Bin.h from Swig

---
 Base/Axis/Bin.h                     |   3 +
 Wrap/Swig/libBornAgainBase.i        |   2 -
 auto/Wrap/libBornAgainBase.py       |  73 +----
 auto/Wrap/libBornAgainBase_wrap.cpp | 477 ++--------------------------
 4 files changed, 35 insertions(+), 520 deletions(-)

diff --git a/Base/Axis/Bin.h b/Base/Axis/Bin.h
index b8db8bcbad7..210a77c0686 100644
--- a/Base/Axis/Bin.h
+++ b/Base/Axis/Bin.h
@@ -12,6 +12,9 @@
 //
 //  ************************************************************************************************
 
+#ifdef SWIG
+#error no need to expose this header to Swig
+#endif // SWIG
 #ifndef BORNAGAIN_BASE_AXIS_BIN_H
 #define BORNAGAIN_BASE_AXIS_BIN_H
 
diff --git a/Wrap/Swig/libBornAgainBase.i b/Wrap/Swig/libBornAgainBase.i
index d0f3842e9fc..f707b2687ad 100644
--- a/Wrap/Swig/libBornAgainBase.i
+++ b/Wrap/Swig/libBornAgainBase.i
@@ -18,7 +18,6 @@
 
 %{
 #include <heinz/Complex.h>
-#include "Base/Axis/Bin.h"
 #include "Base/Axis/Frame.h"
 #include "Base/Axis/Scale.h"
 #include "Base/Axis/MakeScale.h"
@@ -42,7 +41,6 @@
 %include "heinz/Vectors3D.h"
 %include "Base/Vector/RotMatrix.h"
 
-%include "Base/Axis/Bin.h"
 %include "Base/Axis/Scale.h"
 %include "Base/Axis/MakeScale.h"
 %include "Base/Axis/Frame.h"
diff --git a/auto/Wrap/libBornAgainBase.py b/auto/Wrap/libBornAgainBase.py
index 2f2b56df36b..834297e5e6a 100644
--- a/auto/Wrap/libBornAgainBase.py
+++ b/auto/Wrap/libBornAgainBase.py
@@ -1788,66 +1788,6 @@ def sin2Theta(a):
 def angle(a, b):
     r"""angle(R3 a, R3 b) -> double"""
     return _libBornAgainBase.angle(a, b)
-class Bin1D(object):
-    r"""Proxy of C++ Bin1D class."""
-
-    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
-
-    def __init__(self, *args, **kwargs):
-        raise AttributeError("No constructor defined")
-    __repr__ = _swig_repr
-
-    @staticmethod
-    def FromTo(lower, upper):
-        r"""FromTo(double lower, double upper) -> Bin1D"""
-        return _libBornAgainBase.Bin1D_FromTo(lower, upper)
-
-    @staticmethod
-    def At(*args):
-        r"""
-        At(double center) -> Bin1D
-        At(double center, double halfwidth) -> Bin1D
-        """
-        return _libBornAgainBase.Bin1D_At(*args)
-
-    def __eq__(self, arg2):
-        r"""__eq__(Bin1D self, Bin1D arg2) -> bool"""
-        return _libBornAgainBase.Bin1D___eq__(self, arg2)
-
-    def lowerBound(self):
-        r"""lowerBound(Bin1D self) -> double"""
-        return _libBornAgainBase.Bin1D_lowerBound(self)
-
-    def upperBound(self):
-        r"""upperBound(Bin1D self) -> double"""
-        return _libBornAgainBase.Bin1D_upperBound(self)
-
-    def center(self):
-        r"""center(Bin1D self) -> double"""
-        return _libBornAgainBase.Bin1D_center(self)
-
-    def binSize(self):
-        r"""binSize(Bin1D self) -> double"""
-        return _libBornAgainBase.Bin1D_binSize(self)
-
-    def clipped_or_nil(self, lower, upper):
-        r"""clipped_or_nil(Bin1D self, double lower, double upper) -> std::optional< Bin1D >"""
-        return _libBornAgainBase.Bin1D_clipped_or_nil(self, lower, upper)
-    __swig_destroy__ = _libBornAgainBase.delete_Bin1D
-
-# Register Bin1D in _libBornAgainBase:
-_libBornAgainBase.Bin1D_swigregister(Bin1D)
-nanometer = cvar.nanometer
-angstrom = cvar.angstrom
-micrometer = cvar.micrometer
-millimeter = cvar.millimeter
-nm = cvar.nm
-nm2 = cvar.nm2
-rad = cvar.rad
-deg = cvar.deg
-tesla = cvar.tesla
-gauss = cvar.gauss
-
 class Scale(object):
     r"""Proxy of C++ Scale class."""
 
@@ -1898,7 +1838,7 @@ class Scale(object):
         return _libBornAgainBase.Scale_center(self)
 
     def bin(self, i):
-        r"""bin(Scale self, size_t i) -> Bin1D"""
+        r"""bin(Scale self, size_t i) -> Bin1D const &"""
         return _libBornAgainBase.Scale_bin(self, i)
 
     def binCenter(self, i):
@@ -1955,6 +1895,17 @@ class Scale(object):
 
 # Register Scale in _libBornAgainBase:
 _libBornAgainBase.Scale_swigregister(Scale)
+nanometer = cvar.nanometer
+angstrom = cvar.angstrom
+micrometer = cvar.micrometer
+millimeter = cvar.millimeter
+nm = cvar.nm
+nm2 = cvar.nm2
+rad = cvar.rad
+deg = cvar.deg
+tesla = cvar.tesla
+gauss = cvar.gauss
+
 
 def GenericScale(name, limits):
     r"""GenericScale(std::string name, vdouble1d_t limits) -> Scale"""
diff --git a/auto/Wrap/libBornAgainBase_wrap.cpp b/auto/Wrap/libBornAgainBase_wrap.cpp
index 45a993c3815..042b9af2dfd 100644
--- a/auto/Wrap/libBornAgainBase_wrap.cpp
+++ b/auto/Wrap/libBornAgainBase_wrap.cpp
@@ -3425,26 +3425,25 @@ namespace Swig {
 #define SWIGTYPE_p_std__invalid_argument swig_types[36]
 #define SWIGTYPE_p_std__lessT_std__string_t swig_types[37]
 #define SWIGTYPE_p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t swig_types[38]
-#define SWIGTYPE_p_std__optionalT_Bin1D_t swig_types[39]
-#define SWIGTYPE_p_std__pairT_double_double_t swig_types[40]
-#define SWIGTYPE_p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t swig_types[41]
-#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[42]
-#define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[43]
-#define SWIGTYPE_p_std__vectorT_std__complexT_double_t_std__allocatorT_std__complexT_double_t_t_t swig_types[44]
-#define SWIGTYPE_p_std__vectorT_std__pairT_double_double_t_std__allocatorT_std__pairT_double_double_t_t_t swig_types[45]
-#define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[46]
-#define SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t swig_types[47]
-#define SWIGTYPE_p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t swig_types[48]
-#define SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t swig_types[49]
-#define SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t swig_types[50]
-#define SWIGTYPE_p_swig__SwigPyIterator swig_types[51]
-#define SWIGTYPE_p_unsigned_char swig_types[52]
-#define SWIGTYPE_p_unsigned_int swig_types[53]
-#define SWIGTYPE_p_unsigned_long_long swig_types[54]
-#define SWIGTYPE_p_unsigned_short swig_types[55]
-#define SWIGTYPE_p_value_type swig_types[56]
-static swig_type_info *swig_types[58];
-static swig_module_info swig_module = {swig_types, 57, 0, 0, 0, 0};
+#define SWIGTYPE_p_std__pairT_double_double_t swig_types[39]
+#define SWIGTYPE_p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t swig_types[40]
+#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[41]
+#define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[42]
+#define SWIGTYPE_p_std__vectorT_std__complexT_double_t_std__allocatorT_std__complexT_double_t_t_t swig_types[43]
+#define SWIGTYPE_p_std__vectorT_std__pairT_double_double_t_std__allocatorT_std__pairT_double_double_t_t_t swig_types[44]
+#define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[45]
+#define SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t swig_types[46]
+#define SWIGTYPE_p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t swig_types[47]
+#define SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t swig_types[48]
+#define SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t swig_types[49]
+#define SWIGTYPE_p_swig__SwigPyIterator swig_types[50]
+#define SWIGTYPE_p_unsigned_char swig_types[51]
+#define SWIGTYPE_p_unsigned_int swig_types[52]
+#define SWIGTYPE_p_unsigned_long_long swig_types[53]
+#define SWIGTYPE_p_unsigned_short swig_types[54]
+#define SWIGTYPE_p_value_type swig_types[55]
+static swig_type_info *swig_types[57];
+static swig_module_info swig_module = {swig_types, 56, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -6985,7 +6984,6 @@ SWIGINTERN std::vector< std::pair< double,double > >::iterator std_vector_Sl_std
 SWIGINTERN void std_vector_Sl_std_pair_Sl_double_Sc_double_Sg__Sg__insert__SWIG_1(std::vector< std::pair< double,double > > *self,std::vector< std::pair< double,double > >::iterator pos,std::vector< std::pair< double,double > >::size_type n,std::vector< std::pair< double,double > >::value_type const &x){ self->insert(pos, n, x); }
 
 #include <heinz/Complex.h>
-#include "Base/Axis/Bin.h"
 #include "Base/Axis/Frame.h"
 #include "Base/Axis/Scale.h"
 #include "Base/Axis/MakeScale.h"
@@ -25361,424 +25359,6 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_Bin1D_FromTo(PyObject *self, PyObject *args) {
-  PyObject *resultobj = 0;
-  double arg1 ;
-  double arg2 ;
-  double val1 ;
-  int ecode1 = 0 ;
-  double val2 ;
-  int ecode2 = 0 ;
-  PyObject *swig_obj[2] ;
-  SwigValueWrapper< Bin1D > result;
-  
-  if (!SWIG_Python_UnpackTuple(args, "Bin1D_FromTo", 2, 2, swig_obj)) SWIG_fail;
-  ecode1 = SWIG_AsVal_double(swig_obj[0], &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Bin1D_FromTo" "', argument " "1"" of type '" "double""'");
-  } 
-  arg1 = static_cast< double >(val1);
-  ecode2 = SWIG_AsVal_double(swig_obj[1], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Bin1D_FromTo" "', argument " "2"" of type '" "double""'");
-  } 
-  arg2 = static_cast< double >(val2);
-  {
-    try {
-      result = Bin1D::FromTo(arg1,arg2);
-    } catch (const std::exception& ex) {
-      // message shown in the Python interpreter
-      const std::string msg {
-        "BornAgain C++ Exception: " + std::string(ex.what())
-      };
-      SWIG_exception(SWIG_RuntimeError, msg.c_str());
-    }
-  }
-  resultobj = SWIG_NewPointerObj((new Bin1D(result)), SWIGTYPE_p_Bin1D, SWIG_POINTER_OWN |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Bin1D_At__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) {
-  PyObject *resultobj = 0;
-  double arg1 ;
-  double val1 ;
-  int ecode1 = 0 ;
-  SwigValueWrapper< Bin1D > result;
-  
-  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
-  ecode1 = SWIG_AsVal_double(swig_obj[0], &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Bin1D_At" "', argument " "1"" of type '" "double""'");
-  } 
-  arg1 = static_cast< double >(val1);
-  {
-    try {
-      result = Bin1D::At(arg1);
-    } catch (const std::exception& ex) {
-      // message shown in the Python interpreter
-      const std::string msg {
-        "BornAgain C++ Exception: " + std::string(ex.what())
-      };
-      SWIG_exception(SWIG_RuntimeError, msg.c_str());
-    }
-  }
-  resultobj = SWIG_NewPointerObj((new Bin1D(result)), SWIGTYPE_p_Bin1D, SWIG_POINTER_OWN |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Bin1D_At__SWIG_1(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) {
-  PyObject *resultobj = 0;
-  double arg1 ;
-  double arg2 ;
-  double val1 ;
-  int ecode1 = 0 ;
-  double val2 ;
-  int ecode2 = 0 ;
-  SwigValueWrapper< Bin1D > result;
-  
-  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
-  ecode1 = SWIG_AsVal_double(swig_obj[0], &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Bin1D_At" "', argument " "1"" of type '" "double""'");
-  } 
-  arg1 = static_cast< double >(val1);
-  ecode2 = SWIG_AsVal_double(swig_obj[1], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Bin1D_At" "', argument " "2"" of type '" "double""'");
-  } 
-  arg2 = static_cast< double >(val2);
-  {
-    try {
-      result = Bin1D::At(arg1,arg2);
-    } catch (const std::exception& ex) {
-      // message shown in the Python interpreter
-      const std::string msg {
-        "BornAgain C++ Exception: " + std::string(ex.what())
-      };
-      SWIG_exception(SWIG_RuntimeError, msg.c_str());
-    }
-  }
-  resultobj = SWIG_NewPointerObj((new Bin1D(result)), SWIGTYPE_p_Bin1D, SWIG_POINTER_OWN |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Bin1D_At(PyObject *self, PyObject *args) {
-  Py_ssize_t argc;
-  PyObject *argv[3] = {
-    0
-  };
-  
-  if (!(argc = SWIG_Python_UnpackTuple(args, "Bin1D_At", 0, 2, argv))) SWIG_fail;
-  --argc;
-  if (argc == 1) {
-    int _v = 0;
-    {
-      int res = SWIG_AsVal_double(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      return _wrap_Bin1D_At__SWIG_0(self, argc, argv);
-    }
-  }
-  if (argc == 2) {
-    int _v = 0;
-    {
-      int res = SWIG_AsVal_double(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      {
-        int res = SWIG_AsVal_double(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        return _wrap_Bin1D_At__SWIG_1(self, argc, argv);
-      }
-    }
-  }
-  
-fail:
-  SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'Bin1D_At'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    Bin1D::At(double)\n"
-    "    Bin1D::At(double,double)\n");
-  return 0;
-}
-
-
-SWIGINTERN PyObject *_wrap_Bin1D___eq__(PyObject *self, PyObject *args) {
-  PyObject *resultobj = 0;
-  Bin1D *arg1 = (Bin1D *) 0 ;
-  Bin1D *arg2 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  PyObject *swig_obj[2] ;
-  bool result;
-  
-  if (!SWIG_Python_UnpackTuple(args, "Bin1D___eq__", 2, 2, swig_obj)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Bin1D, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Bin1D___eq__" "', argument " "1"" of type '" "Bin1D const *""'"); 
-  }
-  arg1 = reinterpret_cast< Bin1D * >(argp1);
-  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_Bin1D,  0  | 0);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Bin1D___eq__" "', argument " "2"" of type '" "Bin1D const &""'"); 
-  }
-  if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Bin1D___eq__" "', argument " "2"" of type '" "Bin1D const &""'"); 
-  }
-  arg2 = reinterpret_cast< Bin1D * >(argp2);
-  {
-    try {
-      result = (bool)((Bin1D const *)arg1)->operator ==((Bin1D const &)*arg2);
-    } catch (const std::exception& ex) {
-      // message shown in the Python interpreter
-      const std::string msg {
-        "BornAgain C++ Exception: " + std::string(ex.what())
-      };
-      SWIG_exception(SWIG_RuntimeError, msg.c_str());
-    }
-  }
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  PyErr_Clear();
-  Py_INCREF(Py_NotImplemented);
-  return Py_NotImplemented;
-}
-
-
-SWIGINTERN PyObject *_wrap_Bin1D_lowerBound(PyObject *self, PyObject *args) {
-  PyObject *resultobj = 0;
-  Bin1D *arg1 = (Bin1D *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject *swig_obj[1] ;
-  double result;
-  
-  if (!args) SWIG_fail;
-  swig_obj[0] = args;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Bin1D, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Bin1D_lowerBound" "', argument " "1"" of type '" "Bin1D const *""'"); 
-  }
-  arg1 = reinterpret_cast< Bin1D * >(argp1);
-  {
-    try {
-      result = (double)((Bin1D const *)arg1)->lowerBound();
-    } catch (const std::exception& ex) {
-      // message shown in the Python interpreter
-      const std::string msg {
-        "BornAgain C++ Exception: " + std::string(ex.what())
-      };
-      SWIG_exception(SWIG_RuntimeError, msg.c_str());
-    }
-  }
-  resultobj = SWIG_From_double(static_cast< double >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Bin1D_upperBound(PyObject *self, PyObject *args) {
-  PyObject *resultobj = 0;
-  Bin1D *arg1 = (Bin1D *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject *swig_obj[1] ;
-  double result;
-  
-  if (!args) SWIG_fail;
-  swig_obj[0] = args;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Bin1D, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Bin1D_upperBound" "', argument " "1"" of type '" "Bin1D const *""'"); 
-  }
-  arg1 = reinterpret_cast< Bin1D * >(argp1);
-  {
-    try {
-      result = (double)((Bin1D const *)arg1)->upperBound();
-    } catch (const std::exception& ex) {
-      // message shown in the Python interpreter
-      const std::string msg {
-        "BornAgain C++ Exception: " + std::string(ex.what())
-      };
-      SWIG_exception(SWIG_RuntimeError, msg.c_str());
-    }
-  }
-  resultobj = SWIG_From_double(static_cast< double >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Bin1D_center(PyObject *self, PyObject *args) {
-  PyObject *resultobj = 0;
-  Bin1D *arg1 = (Bin1D *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject *swig_obj[1] ;
-  double result;
-  
-  if (!args) SWIG_fail;
-  swig_obj[0] = args;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Bin1D, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Bin1D_center" "', argument " "1"" of type '" "Bin1D const *""'"); 
-  }
-  arg1 = reinterpret_cast< Bin1D * >(argp1);
-  {
-    try {
-      result = (double)((Bin1D const *)arg1)->center();
-    } catch (const std::exception& ex) {
-      // message shown in the Python interpreter
-      const std::string msg {
-        "BornAgain C++ Exception: " + std::string(ex.what())
-      };
-      SWIG_exception(SWIG_RuntimeError, msg.c_str());
-    }
-  }
-  resultobj = SWIG_From_double(static_cast< double >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Bin1D_binSize(PyObject *self, PyObject *args) {
-  PyObject *resultobj = 0;
-  Bin1D *arg1 = (Bin1D *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject *swig_obj[1] ;
-  double result;
-  
-  if (!args) SWIG_fail;
-  swig_obj[0] = args;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Bin1D, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Bin1D_binSize" "', argument " "1"" of type '" "Bin1D const *""'"); 
-  }
-  arg1 = reinterpret_cast< Bin1D * >(argp1);
-  {
-    try {
-      result = (double)((Bin1D const *)arg1)->binSize();
-    } catch (const std::exception& ex) {
-      // message shown in the Python interpreter
-      const std::string msg {
-        "BornAgain C++ Exception: " + std::string(ex.what())
-      };
-      SWIG_exception(SWIG_RuntimeError, msg.c_str());
-    }
-  }
-  resultobj = SWIG_From_double(static_cast< double >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Bin1D_clipped_or_nil(PyObject *self, PyObject *args) {
-  PyObject *resultobj = 0;
-  Bin1D *arg1 = (Bin1D *) 0 ;
-  double arg2 ;
-  double arg3 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  double val2 ;
-  int ecode2 = 0 ;
-  double val3 ;
-  int ecode3 = 0 ;
-  PyObject *swig_obj[3] ;
-  SwigValueWrapper< std::optional< Bin1D > > result;
-  
-  if (!SWIG_Python_UnpackTuple(args, "Bin1D_clipped_or_nil", 3, 3, swig_obj)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Bin1D, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Bin1D_clipped_or_nil" "', argument " "1"" of type '" "Bin1D const *""'"); 
-  }
-  arg1 = reinterpret_cast< Bin1D * >(argp1);
-  ecode2 = SWIG_AsVal_double(swig_obj[1], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Bin1D_clipped_or_nil" "', argument " "2"" of type '" "double""'");
-  } 
-  arg2 = static_cast< double >(val2);
-  ecode3 = SWIG_AsVal_double(swig_obj[2], &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Bin1D_clipped_or_nil" "', argument " "3"" of type '" "double""'");
-  } 
-  arg3 = static_cast< double >(val3);
-  {
-    try {
-      result = ((Bin1D const *)arg1)->clipped_or_nil(arg2,arg3);
-    } catch (const std::exception& ex) {
-      // message shown in the Python interpreter
-      const std::string msg {
-        "BornAgain C++ Exception: " + std::string(ex.what())
-      };
-      SWIG_exception(SWIG_RuntimeError, msg.c_str());
-    }
-  }
-  resultobj = SWIG_NewPointerObj((new std::optional< Bin1D >(result)), SWIGTYPE_p_std__optionalT_Bin1D_t, SWIG_POINTER_OWN |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_delete_Bin1D(PyObject *self, PyObject *args) {
-  PyObject *resultobj = 0;
-  Bin1D *arg1 = (Bin1D *) 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_Bin1D, SWIG_POINTER_DISOWN |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Bin1D" "', argument " "1"" of type '" "Bin1D *""'"); 
-  }
-  arg1 = reinterpret_cast< Bin1D * >(argp1);
-  {
-    try {
-      delete arg1;
-    } catch (const std::exception& ex) {
-      // message shown in the Python interpreter
-      const std::string msg {
-        "BornAgain C++ Exception: " + std::string(ex.what())
-      };
-      SWIG_exception(SWIG_RuntimeError, msg.c_str());
-    }
-  }
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *Bin1D_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *obj;
-  if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_Bin1D, SWIG_NewClientData(obj));
-  return SWIG_Py_Void();
-}
-
 SWIGINTERN PyObject *_wrap_new_Scale__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) {
   PyObject *resultobj = 0;
   Coordinate *arg1 = 0 ;
@@ -30390,19 +29970,6 @@ static PyMethodDef SwigMethods[] = {
 	 { "cosTheta", _wrap_cosTheta, METH_O, "cosTheta(R3 a) -> double"},
 	 { "sin2Theta", _wrap_sin2Theta, METH_O, "sin2Theta(R3 a) -> double"},
 	 { "angle", _wrap_angle, METH_VARARGS, "angle(R3 a, R3 b) -> double"},
-	 { "Bin1D_FromTo", _wrap_Bin1D_FromTo, METH_VARARGS, "Bin1D_FromTo(double lower, double upper) -> Bin1D"},
-	 { "Bin1D_At", _wrap_Bin1D_At, METH_VARARGS, "\n"
-		"Bin1D_At(double center) -> Bin1D\n"
-		"Bin1D_At(double center, double halfwidth) -> Bin1D\n"
-		""},
-	 { "Bin1D___eq__", _wrap_Bin1D___eq__, METH_VARARGS, "Bin1D___eq__(Bin1D self, Bin1D arg2) -> bool"},
-	 { "Bin1D_lowerBound", _wrap_Bin1D_lowerBound, METH_O, "Bin1D_lowerBound(Bin1D self) -> double"},
-	 { "Bin1D_upperBound", _wrap_Bin1D_upperBound, METH_O, "Bin1D_upperBound(Bin1D self) -> double"},
-	 { "Bin1D_center", _wrap_Bin1D_center, METH_O, "Bin1D_center(Bin1D self) -> double"},
-	 { "Bin1D_binSize", _wrap_Bin1D_binSize, METH_O, "Bin1D_binSize(Bin1D self) -> double"},
-	 { "Bin1D_clipped_or_nil", _wrap_Bin1D_clipped_or_nil, METH_VARARGS, "Bin1D_clipped_or_nil(Bin1D self, double lower, double upper) -> std::optional< Bin1D >"},
-	 { "delete_Bin1D", _wrap_delete_Bin1D, METH_O, "delete_Bin1D(Bin1D self)"},
-	 { "Bin1D_swigregister", Bin1D_swigregister, METH_O, NULL},
 	 { "new_Scale", _wrap_new_Scale, METH_VARARGS, "\n"
 		"Scale(Coordinate const & coord, std::vector< Bin1D,std::allocator< Bin1D > > bins)\n"
 		"new_Scale(Scale other) -> Scale\n"
@@ -30416,7 +29983,7 @@ static PyMethodDef SwigMethods[] = {
 	 { "Scale_rangeComprises", _wrap_Scale_rangeComprises, METH_VARARGS, "Scale_rangeComprises(Scale self, double value) -> bool"},
 	 { "Scale_span", _wrap_Scale_span, METH_O, "Scale_span(Scale self) -> double"},
 	 { "Scale_center", _wrap_Scale_center, METH_O, "Scale_center(Scale self) -> double"},
-	 { "Scale_bin", _wrap_Scale_bin, METH_VARARGS, "Scale_bin(Scale self, size_t i) -> Bin1D"},
+	 { "Scale_bin", _wrap_Scale_bin, METH_VARARGS, "Scale_bin(Scale self, size_t i) -> Bin1D const &"},
 	 { "Scale_binCenter", _wrap_Scale_binCenter, METH_VARARGS, "Scale_binCenter(Scale self, size_t i) -> double"},
 	 { "Scale_bins", _wrap_Scale_bins, METH_O, "Scale_bins(Scale self) -> std::vector< Bin1D,std::allocator< Bin1D > > const &"},
 	 { "Scale_binCenters", _wrap_Scale_binCenters, METH_O, "Scale_binCenters(Scale self) -> vdouble1d_t"},
@@ -30565,7 +30132,6 @@ static swig_type_info _swigt__p_std__functionT_double_fdoubleF_t = {"_p_std__fun
 static swig_type_info _swigt__p_std__invalid_argument = {"_p_std__invalid_argument", "std::invalid_argument *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_std__lessT_std__string_t = {"_p_std__lessT_std__string_t", "std::less< std::string > *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t = {"_p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t", "std::map< std::string,double,std::less< std::string >,std::allocator< std::pair< std::string const,double > > > *|std::map< std::string,double > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__optionalT_Bin1D_t = {"_p_std__optionalT_Bin1D_t", "std::optional< Bin1D > *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_std__pairT_double_double_t = {"_p_std__pairT_double_double_t", "std::pair< double,double > *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t = {"_p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t", "std::vector< Bin1D,std::allocator< Bin1D > > *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_std__vectorT_double_std__allocatorT_double_t_t = {"_p_std__vectorT_double_std__allocatorT_double_t_t", "std::vector< double,std::allocator< double > > *|std::vector< double > *", 0, 0, (void*)0, 0};
@@ -30624,7 +30190,6 @@ static swig_type_info *swig_type_initial[] = {
   &_swigt__p_std__invalid_argument,
   &_swigt__p_std__lessT_std__string_t,
   &_swigt__p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t,
-  &_swigt__p_std__optionalT_Bin1D_t,
   &_swigt__p_std__pairT_double_double_t,
   &_swigt__p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t,
   &_swigt__p_std__vectorT_double_std__allocatorT_double_t_t,
@@ -30683,7 +30248,6 @@ static swig_cast_info _swigc__p_std__functionT_double_fdoubleF_t[] = {  {&_swigt
 static swig_cast_info _swigc__p_std__invalid_argument[] = {  {&_swigt__p_std__invalid_argument, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_std__lessT_std__string_t[] = {  {&_swigt__p_std__lessT_std__string_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t[] = {  {&_swigt__p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__optionalT_Bin1D_t[] = {  {&_swigt__p_std__optionalT_Bin1D_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_std__pairT_double_double_t[] = {  {&_swigt__p_std__pairT_double_double_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t[] = {  {&_swigt__p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_std__vectorT_double_std__allocatorT_double_t_t[] = {  {&_swigt__p_std__vectorT_double_std__allocatorT_double_t_t, 0, 0, 0},{0, 0, 0, 0}};
@@ -30742,7 +30306,6 @@ static swig_cast_info *swig_cast_initial[] = {
   _swigc__p_std__invalid_argument,
   _swigc__p_std__lessT_std__string_t,
   _swigc__p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t,
-  _swigc__p_std__optionalT_Bin1D_t,
   _swigc__p_std__pairT_double_double_t,
   _swigc__p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t,
   _swigc__p_std__vectorT_double_std__allocatorT_double_t_t,
-- 
GitLab