diff --git a/Framework/Crystal/src/PredictPeaks.cpp b/Framework/Crystal/src/PredictPeaks.cpp index 8b81c6035d6732ebbcf9453c3398b5a67daaf27a..2c48afe19ef2c9403d0be45073e0b502989ace58 100644 --- a/Framework/Crystal/src/PredictPeaks.cpp +++ b/Framework/Crystal/src/PredictPeaks.cpp @@ -423,7 +423,7 @@ void PredictPeaks::calculateQAndAddToOutput(const V3D &hkl, V3D q = orientedUB * hkl * (2.0 * M_PI * m_qConventionFactor); // Create the peak using the Q in the lab framewith all its info: - Peak p(m_inst, q, boost::optional<double>()); + Peak p(m_inst, q); /* The constructor calls setQLabFrame, which already calls findDetector, which is expensive. It's not necessary to call it again, instead it's enough to diff --git a/Framework/Crystal/test/IndexSXPeaksTest.h b/Framework/Crystal/test/IndexSXPeaksTest.h index f32d635ed316c80200b4cb91c2be10e1f823de70..1ec63d9afb71f5716b309a0166cd29347f9c4dd3 100644 --- a/Framework/Crystal/test/IndexSXPeaksTest.h +++ b/Framework/Crystal/test/IndexSXPeaksTest.h @@ -119,9 +119,9 @@ public: for (int i = 0; i < m_masterPeaks->getNumberPeaks(); i++) { IPeak &peak = m_masterPeaks->getPeak(i); Mantid::Kernel::V3D v(1, 0, 0); - peak.setQSampleFrame(v, boost::optional<double>()); // Overwrite all Q - // samples to be - // co-linear. + peak.setQSampleFrame(v); // Overwrite all Q + // samples to be + // co-linear. } TS_ASSERT_THROWS(doTest(6, "1, 2, 3, 4, 5, 6", 14.131, 19.247, 8.606, 90.0, diff --git a/Framework/DataObjects/inc/MantidDataObjects/Peak.h b/Framework/DataObjects/inc/MantidDataObjects/Peak.h index 997fbeee2ff8158d0351b0ca16035b87d55e4008..cdd6b417fc7c8b37f301d6ca3679af65cd89eb8a 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/Peak.h +++ b/Framework/DataObjects/inc/MantidDataObjects/Peak.h @@ -26,13 +26,13 @@ public: friend class PeakColumn; Peak(); - Peak(Geometry::Instrument_const_sptr m_inst, Mantid::Kernel::V3D QLabFrame, - boost::optional<double> detectorDistance = boost::optional<double>()); + Peak(const Geometry::Instrument_const_sptr &m_inst, + const Mantid::Kernel::V3D &QLabFrame, + boost::optional<double> detectorDistance = boost::none); Peak(const Geometry::Instrument_const_sptr &m_inst, const Mantid::Kernel::V3D &QSampleFrame, const Mantid::Kernel::Matrix<double> &goniometer, - const boost::optional<double> &detectorDistance = - boost::optional<double>()); + boost::optional<double> detectorDistance = boost::none); Peak(Geometry::Instrument_const_sptr m_inst, int m_detectorID, double m_Wavelength); Peak(Geometry::Instrument_const_sptr m_inst, int m_detectorID, @@ -45,8 +45,8 @@ public: /// Copy constructor Peak(const Peak &other); - Peak(Peak &&) = default; - Peak &operator=(Peak &&) = default; + Peak(Peak &&) noexcept; + Peak &operator=(Peak &&) noexcept; // Construct a peak from a reference to the interface @@ -87,12 +87,12 @@ public: Mantid::Kernel::V3D getDetectorPosition() const override; Mantid::Kernel::V3D getDetectorPositionNoCheck() const override; - void setQSampleFrame(const Mantid::Kernel::V3D &QSampleFrame, - const boost::optional<double> &detectorDistance = - boost::optional<double>()) override; - void setQLabFrame(const Mantid::Kernel::V3D &QLabFrame, - const boost::optional<double> &detectorDistance = - boost::optional<double>()) override; + void setQSampleFrame( + const Mantid::Kernel::V3D &QSampleFrame, + boost::optional<double> detectorDistance = boost::none) override; + void + setQLabFrame(const Mantid::Kernel::V3D &QLabFrame, + boost::optional<double> detectorDistance = boost::none) override; void setWavelength(double wavelength) override; double getWavelength() const override; diff --git a/Framework/DataObjects/inc/MantidDataObjects/PeaksWorkspace.h b/Framework/DataObjects/inc/MantidDataObjects/PeaksWorkspace.h index 7700635f781c02db7ed12d3fdcb87901c5f4af1d..6e29fddcdfea1f0a7e6c8e60d8af0d0e58f42b27 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/PeaksWorkspace.h +++ b/Framework/DataObjects/inc/MantidDataObjects/PeaksWorkspace.h @@ -106,9 +106,9 @@ public: Peak &getPeak(int peakNum) override; const Peak &getPeak(int peakNum) const override; - Geometry::IPeak *createPeak(Kernel::V3D QLabFrame, - boost::optional<double> detectorDistance = - boost::optional<double>()) const override; + Geometry::IPeak *createPeak( + Kernel::V3D QLabFrame, + boost::optional<double> detectorDistance = boost::none) const override; std::vector<std::pair<std::string, std::string>> peakInfo(Kernel::V3D qFrame, bool labCoords) const override; diff --git a/Framework/DataObjects/src/Peak.cpp b/Framework/DataObjects/src/Peak.cpp index 170285bef5e0ead4814289e5ef132b42cf449fde..e0527820882dc59d1857719bec5f5935d3b0c848 100644 --- a/Framework/DataObjects/src/Peak.cpp +++ b/Framework/DataObjects/src/Peak.cpp @@ -45,7 +45,7 @@ Peak::Peak() */ Peak::Peak(const Geometry::Instrument_const_sptr &m_inst, const Mantid::Kernel::V3D &QLabFrame, - const boost::optional<double> &detectorDistance) + boost::optional<double> detectorDistance) : m_H(0), m_K(0), m_L(0), m_intensity(0), m_sigmaIntensity(0), m_binCount(0), m_GoniometerMatrix(3, 3, true), m_InverseGoniometerMatrix(3, 3, true), m_runNumber(0), m_monitorCount(0), @@ -72,7 +72,7 @@ Peak::Peak(const Geometry::Instrument_const_sptr &m_inst, Peak::Peak(const Geometry::Instrument_const_sptr &m_inst, const Mantid::Kernel::V3D &QSampleFrame, const Mantid::Kernel::Matrix<double> &goniometer, - const boost::optional<double> &detectorDistance) + boost::optional<double> detectorDistance) : m_H(0), m_K(0), m_L(0), m_intensity(0), m_sigmaIntensity(0), m_binCount(0), m_GoniometerMatrix(goniometer), m_InverseGoniometerMatrix(goniometer), m_runNumber(0), m_monitorCount(0), @@ -231,6 +231,9 @@ Peak::Peak(const Geometry::IPeak &ipeak) } } +Peak::Peak(Peak &&) noexcept = default; +Peak &Peak::operator=(Peak &&) noexcept = default; + //---------------------------------------------------------------------------------------------- /** Set the incident wavelength of the neutron. Calculates the energy from this. * Assumes elastic scattering. @@ -495,7 +498,7 @@ Mantid::Kernel::V3D Peak::getQSampleFrame() const { * Used to give a valid TOF. You do NOT need to explicitly set this. */ void Peak::setQSampleFrame(const Mantid::Kernel::V3D &QSampleFrame, - const boost::optional<double> &detectorDistance) { + boost::optional<double> detectorDistance) { V3D Qlab = m_GoniometerMatrix * QSampleFrame; this->setQLabFrame(Qlab, detectorDistance); } @@ -517,7 +520,7 @@ void Peak::setQSampleFrame(const Mantid::Kernel::V3D &QSampleFrame, * ray trace to find the intersecing detector. */ void Peak::setQLabFrame(const Mantid::Kernel::V3D &QLabFrame, - const boost::optional<double> &detectorDistance) { + boost::optional<double> detectorDistance) { // Clear out the detector = we can't know them m_detectorID = -1; m_det = IDetector_sptr(); @@ -922,7 +925,7 @@ void Peak::setPeakShape(Mantid::Geometry::PeakShape *shape) { * @param shape : Desired shape */ void Peak::setPeakShape(Mantid::Geometry::PeakShape_const_sptr shape) { - this->m_peakShape = shape; + this->m_peakShape = std::move(shape); } /** diff --git a/Framework/Geometry/inc/MantidGeometry/Crystal/IPeak.h b/Framework/Geometry/inc/MantidGeometry/Crystal/IPeak.h index 67b1ea9da79047895eabda98da92494021dc5faa..7703dd2dc0ff166c4eb6aef6178380f304480a9d 100644 --- a/Framework/Geometry/inc/MantidGeometry/Crystal/IPeak.h +++ b/Framework/Geometry/inc/MantidGeometry/Crystal/IPeak.h @@ -50,12 +50,10 @@ public: virtual Mantid::Kernel::V3D getQSampleFrame() const = 0; virtual bool findDetector() = 0; - virtual void - setQSampleFrame(const Mantid::Kernel::V3D &QSampleFrame, - const boost::optional<double> &detectorDistance) = 0; - virtual void - setQLabFrame(const Mantid::Kernel::V3D &QLabFrame, - const boost::optional<double> &detectorDistance) = 0; + virtual void setQSampleFrame(const Mantid::Kernel::V3D &QSampleFrame, + boost::optional<double> detectorDistance) = 0; + virtual void setQLabFrame(const Mantid::Kernel::V3D &QLabFrame, + boost::optional<double> detectorDistance) = 0; virtual void setWavelength(double wavelength) = 0; virtual double getWavelength() const = 0; diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IPeak.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IPeak.cpp index 59514e9f2ef4d2274ff5d267dab12cc2e44168c1..04969a4679322f4e2ccfa033c6f73d46823a61af 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/IPeak.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/IPeak.cpp @@ -18,7 +18,7 @@ Mantid::Geometry::PeakShape_sptr getPeakShape(IPeak &peak) { } void setQLabFrame1(IPeak &peak, Mantid::Kernel::V3D qLabFrame) { // Set the q lab frame. No explicit detector distance. - return peak.setQLabFrame(qLabFrame, boost::optional<double>()); + return peak.setQLabFrame(qLabFrame, boost::none); } void setQLabFrame2(IPeak &peak, Mantid::Kernel::V3D qLabFrame, double distance) { @@ -28,7 +28,7 @@ void setQLabFrame2(IPeak &peak, Mantid::Kernel::V3D qLabFrame, void setQSampleFrame1(IPeak &peak, Mantid::Kernel::V3D qSampleFrame) { // Set the qsample frame. No explicit detector distance. - return peak.setQSampleFrame(qSampleFrame, boost::optional<double>()); + return peak.setQSampleFrame(qSampleFrame, boost::none); } void setQSampleFrame2(IPeak &peak, Mantid::Kernel::V3D qSampleFrame, diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IPeaksWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IPeaksWorkspace.cpp index b2d3589110da7671e479a87b05f4899e1ac40fec..76d09bebf7baa6df1903cbfdb431e64762cc2a60 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/IPeaksWorkspace.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/IPeaksWorkspace.cpp @@ -26,8 +26,7 @@ IPeak *createPeakHKL(IPeaksWorkspace &self, const object &data) { /// Create a peak via it's QLab value from a list or numpy array IPeak *createPeakQLab(IPeaksWorkspace &self, const object &data) { return self.createPeak( - Mantid::PythonInterface::Converters::PyObjectToV3D(data)(), - boost::optional<double>()); + Mantid::PythonInterface::Converters::PyObjectToV3D(data)(), boost::none); } /// Create a peak via it's QLab value from a list or numpy array