From 234f57737d4fa6610938a8b73c514cb96b01ccac Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 18 May 2022 14:10:03 +0200 Subject: [PATCH] rm unused Powerfield<T>::setAxisSizes --- Device/Data/Powerfield.h | 15 ------- Tests/Unit/Device/PowerfieldIteratorTest.cpp | 20 ++++----- auto/Wrap/doxygenDevice.i | 5 --- auto/Wrap/libBornAgainDevice.py | 10 ----- auto/Wrap/libBornAgainDevice_wrap.cpp | 44 -------------------- 5 files changed, 7 insertions(+), 87 deletions(-) diff --git a/Device/Data/Powerfield.h b/Device/Data/Powerfield.h index 0f9119179e7..89b6934cca0 100644 --- a/Device/Data/Powerfield.h +++ b/Device/Data/Powerfield.h @@ -181,9 +181,6 @@ public: //! Sets content of output data to specific value void setAllTo(const T& value); - //! Adds 'rank' axes with indicated sizes - void setAxisSizes(size_t rank, int* n_dims); - //! Sets new values to raw data vector void setRawDataVector(const std::vector<T>& data_vector); @@ -392,18 +389,6 @@ void Powerfield<T>::setAllTo(const T& value) m_ll_data->setAll(value); } -template <class T> -void Powerfield<T>::setAxisSizes(size_t rank, int* n_dims) -{ - clear(); - std::string basename("axis"); - for (size_t i = 0; i < rank; ++i) { - std::ostringstream name; - name << basename << i; - addAxis(name.str(), n_dims[i], 0.0, (double)(n_dims[i] - 1)); - } -} - template <class T> const Powerfield<T>& Powerfield<T>::operator+=(const Powerfield<T>& other) { diff --git a/Tests/Unit/Device/PowerfieldIteratorTest.cpp b/Tests/Unit/Device/PowerfieldIteratorTest.cpp index 02e81f62e47..95e86f62c55 100644 --- a/Tests/Unit/Device/PowerfieldIteratorTest.cpp +++ b/Tests/Unit/Device/PowerfieldIteratorTest.cpp @@ -13,25 +13,19 @@ PowerfieldIteratorTest::PowerfieldIteratorTest() auto* dims = new int[2]; dims[0] = 3; dims[1] = 5; - _data.setAxisSizes(2, dims); - double value = 0.0; - Powerfield<double>::iterator it = _data.begin(); - while (it != _data.end()) { - *it = value; - value += 1.0; - ++it; - } - delete[] dims; + _data.addAxis("x", 3, 0, 1); + _data.addAxis("y", 5, 0, 1); + _data.setRawDataVector({ 1., 2., 3., 4., 5. , 11., 12., 13., 14., 15., 21., 22., 23., 24., 25.}); } TEST_F(PowerfieldIteratorTest, Iterate) { Powerfield<double>::iterator it = _data.begin(); - EXPECT_EQ(0.0, *it); + EXPECT_EQ(1.0, *it); for (size_t i = 0; i < 14; ++i) { ++it; } - EXPECT_DOUBLE_EQ(14.0, *it); + EXPECT_DOUBLE_EQ(25.0, *it); ++it; EXPECT_EQ(it, _data.end()); ++it; @@ -41,11 +35,11 @@ TEST_F(PowerfieldIteratorTest, Iterate) TEST_F(PowerfieldIteratorTest, ConstIterate) { Powerfield<double>::const_iterator it = _data.begin(); - EXPECT_EQ(0.0, *it); + EXPECT_EQ(1.0, *it); for (size_t i = 0; i < 14; ++i) { ++it; } - EXPECT_DOUBLE_EQ(14.0, *it); + EXPECT_DOUBLE_EQ(25.0, *it); ++it; EXPECT_EQ(it, _data.end()); ++it; diff --git a/auto/Wrap/doxygenDevice.i b/auto/Wrap/doxygenDevice.i index 04946cca641..7d97b7bfa39 100644 --- a/auto/Wrap/doxygenDevice.i +++ b/auto/Wrap/doxygenDevice.i @@ -2096,11 +2096,6 @@ Sets object into initial state (no dimensions, data) Sets content of output data to specific value. "; -%feature("docstring") Powerfield::setAxisSizes "void Powerfield< T >::setAxisSizes(size_t rank, int *n_dims) - -Adds 'rank' axes with indicated sizes. -"; - %feature("docstring") Powerfield::setRawDataVector "void Powerfield< T >::setRawDataVector(const std::vector< T > &data_vector) Sets new values to raw data vector. diff --git a/auto/Wrap/libBornAgainDevice.py b/auto/Wrap/libBornAgainDevice.py index e16fc1e8e8b..c1a2ac2d4f9 100644 --- a/auto/Wrap/libBornAgainDevice.py +++ b/auto/Wrap/libBornAgainDevice.py @@ -2366,16 +2366,6 @@ class IntensityData(IField): """ return _libBornAgainDevice.IntensityData_setAllTo(self, value) - def setAxisSizes(self, rank, n_dims): - r""" - setAxisSizes(IntensityData self, size_t rank, int * n_dims) - void Powerfield< T >::setAxisSizes(size_t rank, int *n_dims) - - Adds 'rank' axes with indicated sizes. - - """ - return _libBornAgainDevice.IntensityData_setAxisSizes(self, rank, n_dims) - def setRawDataVector(self, data_vector): r""" setRawDataVector(IntensityData self, vdouble1d_t data_vector) diff --git a/auto/Wrap/libBornAgainDevice_wrap.cpp b/auto/Wrap/libBornAgainDevice_wrap.cpp index 36eecc4f090..c4dcdccff9a 100644 --- a/auto/Wrap/libBornAgainDevice_wrap.cpp +++ b/auto/Wrap/libBornAgainDevice_wrap.cpp @@ -28258,43 +28258,6 @@ fail: } -SWIGINTERN PyObject *_wrap_IntensityData_setAxisSizes(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Powerfield< double > *arg1 = (Powerfield< double > *) 0 ; - size_t arg2 ; - int *arg3 = (int *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "IntensityData_setAxisSizes", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PowerfieldT_double_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntensityData_setAxisSizes" "', argument " "1"" of type '" "Powerfield< double > *""'"); - } - arg1 = reinterpret_cast< Powerfield< double > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntensityData_setAxisSizes" "', argument " "2"" of type '" "size_t""'"); - } - arg2 = static_cast< size_t >(val2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IntensityData_setAxisSizes" "', argument " "3"" of type '" "int *""'"); - } - arg3 = reinterpret_cast< int * >(argp3); - (arg1)->setAxisSizes(arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - SWIGINTERN PyObject *_wrap_IntensityData_setRawDataVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; Powerfield< double > *arg1 = (Powerfield< double > *) 0 ; @@ -42961,13 +42924,6 @@ static PyMethodDef SwigMethods[] = { "Sets content of output data to specific value. \n" "\n" ""}, - { "IntensityData_setAxisSizes", _wrap_IntensityData_setAxisSizes, METH_VARARGS, "\n" - "IntensityData_setAxisSizes(IntensityData self, size_t rank, int * n_dims)\n" - "void Powerfield< T >::setAxisSizes(size_t rank, int *n_dims)\n" - "\n" - "Adds 'rank' axes with indicated sizes. \n" - "\n" - ""}, { "IntensityData_setRawDataVector", _wrap_IntensityData_setRawDataVector, METH_VARARGS, "\n" "IntensityData_setRawDataVector(IntensityData self, vdouble1d_t data_vector)\n" "void Powerfield< T >::setRawDataVector(const std::vector< T > &data_vector)\n" -- GitLab