diff --git a/Core/Instrument/IntensityDataFunctions.cpp b/Core/Instrument/IntensityDataFunctions.cpp index c26fede419aaa702caf7dc512349e2772c208489..ba786aeba4ff95d737e63296d8539d55f2813594 100644 --- a/Core/Instrument/IntensityDataFunctions.cpp +++ b/Core/Instrument/IntensityDataFunctions.cpp @@ -47,14 +47,14 @@ double IntensityDataFunctions::getRelativeDifference( *std::unique_ptr<OutputData<double>>(ref.getData().meanValues()) ); } -OutputData<double>* IntensityDataFunctions::createRelativeDifferenceData( +std::unique_ptr<OutputData<double> > IntensityDataFunctions::createRelativeDifferenceData( const OutputData<double>& data, const OutputData<double>& reference) { if(!data.hasSameDimensions(reference)) throw Exceptions::RuntimeErrorException( "IntensityDataFunctions::createRelativeDifferenceData() -> " "Error. Different dimensions of data and reference."); - OutputData<double>* result = reference.clone(); + std::unique_ptr<OutputData<double> > result(reference.clone()); for(size_t i=0; i<result->getAllocatedSize(); ++i) (*result)[i] = Numeric::get_relative_difference(data[i], reference[i]); return result; diff --git a/Core/Instrument/IntensityDataFunctions.h b/Core/Instrument/IntensityDataFunctions.h index 0967ea14c343f8203725c4710c57b5b4524802c0..b5285d91fe6e415d051785463fdcb19668931f34 100644 --- a/Core/Instrument/IntensityDataFunctions.h +++ b/Core/Instrument/IntensityDataFunctions.h @@ -32,10 +32,11 @@ BA_CORE_API_ double getRelativeDifference( BA_CORE_API_ double getRelativeDifference(const IHistogram& dat, const IHistogram& ref); -BA_CORE_API_ OutputData<double>* createRelativeDifferenceData( +#ifndef SWIG + +BA_CORE_API_ std::unique_ptr<OutputData<double>> createRelativeDifferenceData( const OutputData<double>& data, const OutputData<double>& reference); -#ifndef SWIG //! Returns a pointer to new object with input data rotated by //! n*90 deg counterclockwise (n > 0) or clockwise (n < 0) //! Axes are swapped if the data is effectively rotated by 90 or 270 degrees diff --git a/GUI/coregui/Views/FitWidgets/FitComparisonWidget.cpp b/GUI/coregui/Views/FitWidgets/FitComparisonWidget.cpp index 5ce867028ca7bc3ab4df904011db08120867650f..d4630946f41bc300ca9bfe3b215155ac75b7e263 100644 --- a/GUI/coregui/Views/FitWidgets/FitComparisonWidget.cpp +++ b/GUI/coregui/Views/FitWidgets/FitComparisonWidget.cpp @@ -175,7 +175,7 @@ void FitComparisonWidget::calculateRelativeDifference() Q_ASSERT(diffItem()); diffItem()->setOutputData(IntensityDataFunctions::createRelativeDifferenceData( - *simulatedDataItem()->getOutputData(), *realDataItem()->getOutputData())); + *simulatedDataItem()->getOutputData(), *realDataItem()->getOutputData()).release()); diffItem()->xAxisItem()->setItemValue(BasicAxisItem::P_TITLE, simulatedDataItem()->getXaxisTitle()); diffItem()->yAxisItem()->setItemValue(BasicAxisItem::P_TITLE, simulatedDataItem()->getYaxisTitle()); diff --git a/auto/Wrap/libBornAgainCore.py b/auto/Wrap/libBornAgainCore.py index e2f07e2d8c1f14ae7eda3108c8d6d71c88b72547..91e6f3a415340205bad81530abe07f4d2ba8cb77 100644 --- a/auto/Wrap/libBornAgainCore.py +++ b/auto/Wrap/libBornAgainCore.py @@ -20268,15 +20268,6 @@ def getRelativeDifference(*args): """ return _libBornAgainCore.getRelativeDifference(*args) -def createRelativeDifferenceData(data, reference): - """ - createRelativeDifferenceData(IntensityData data, IntensityData reference) -> IntensityData - - OutputData< double > * IntensityDataFunctions::createRelativeDifferenceData(const OutputData< double > &data, const OutputData< double > &reference) - - """ - return _libBornAgainCore.createRelativeDifferenceData(data, reference) - def applyDetectorResolution(origin, resolution_function): """ applyDetectorResolution(IntensityData origin, IResolutionFunction2D resolution_function) -> IntensityData diff --git a/auto/Wrap/libBornAgainCore_wrap.cpp b/auto/Wrap/libBornAgainCore_wrap.cpp index 1c986e3b1fc63ddd637bfc215029762c8150da48..da93a4e4f13655b2ea1222dd43bca99e05708a9b 100644 --- a/auto/Wrap/libBornAgainCore_wrap.cpp +++ b/auto/Wrap/libBornAgainCore_wrap.cpp @@ -88631,43 +88631,6 @@ fail: } -SWIGINTERN PyObject *_wrap_createRelativeDifferenceData(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - OutputData< double > *arg1 = 0 ; - OutputData< double > *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - OutputData< double > *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:createRelativeDifferenceData",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_OutputDataT_double_t, 0 | 0); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "createRelativeDifferenceData" "', argument " "1"" of type '" "OutputData< double > const &""'"); - } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "createRelativeDifferenceData" "', argument " "1"" of type '" "OutputData< double > const &""'"); - } - arg1 = reinterpret_cast< OutputData< double > * >(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_OutputDataT_double_t, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "createRelativeDifferenceData" "', argument " "2"" of type '" "OutputData< double > const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "createRelativeDifferenceData" "', argument " "2"" of type '" "OutputData< double > const &""'"); - } - arg2 = reinterpret_cast< OutputData< double > * >(argp2); - result = (OutputData< double > *)IntensityDataFunctions::createRelativeDifferenceData((OutputData< double > const &)*arg1,(OutputData< double > const &)*arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OutputDataT_double_t, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - SWIGINTERN PyObject *_wrap_applyDetectorResolution(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; OutputData< double > *arg1 = 0 ; @@ -123260,12 +123223,6 @@ static PyMethodDef SwigMethods[] = { "double IntensityDataFunctions::getRelativeDifference(const IHistogram &dat, const IHistogram &ref)\n" "\n" ""}, - { (char *)"createRelativeDifferenceData", _wrap_createRelativeDifferenceData, METH_VARARGS, (char *)"\n" - "createRelativeDifferenceData(IntensityData data, IntensityData reference) -> IntensityData\n" - "\n" - "OutputData< double > * IntensityDataFunctions::createRelativeDifferenceData(const OutputData< double > &data, const OutputData< double > &reference)\n" - "\n" - ""}, { (char *)"applyDetectorResolution", _wrap_applyDetectorResolution, METH_VARARGS, (char *)"\n" "applyDetectorResolution(IntensityData origin, IResolutionFunction2D resolution_function) -> IntensityData\n" "\n"