From 40e2eea3068a879fc9ccd99edc1c1b24293a32b9 Mon Sep 17 00:00:00 2001 From: Vickie Lynch <lynchve@ornl.gov> Date: Tue, 2 May 2017 08:40:54 -0400 Subject: [PATCH] Refs #19461 clang-format --- Framework/API/inc/MantidAPI/DetectorInfo.h | 20 +++++------ Framework/API/src/DetectorInfo.cpp | 15 ++++---- .../inc/MantidMDAlgorithms/FindPeaksMD.h | 14 ++------ Framework/MDAlgorithms/src/FindPeaksMD.cpp | 34 ++++++++----------- 4 files changed, 35 insertions(+), 48 deletions(-) diff --git a/Framework/API/inc/MantidAPI/DetectorInfo.h b/Framework/API/inc/MantidAPI/DetectorInfo.h index aa5be47e828..84abb1f89c5 100644 --- a/Framework/API/inc/MantidAPI/DetectorInfo.h +++ b/Framework/API/inc/MantidAPI/DetectorInfo.h @@ -74,7 +74,7 @@ public: DetectorInfo(Beamline::DetectorInfo &detectorInfo, boost::shared_ptr<const Geometry::Instrument> instrument, Geometry::ParameterMap *pmap, - boost::shared_ptr<const std::unordered_map<detid_t, size_t> > + boost::shared_ptr<const std::unordered_map<detid_t, size_t>> detIdToIndexMap); DetectorInfo &operator=(const DetectorInfo &rhs); @@ -135,7 +135,7 @@ public: void merge(const DetectorInfo &other); - boost::shared_ptr<const std::unordered_map<detid_t, size_t> > + boost::shared_ptr<const std::unordered_map<detid_t, size_t>> detIdToIndexMap() const; friend class SpectrumInfo; @@ -167,13 +167,13 @@ private: Geometry::ParameterMap *m_pmap; boost::shared_ptr<const Geometry::Instrument> m_instrument; std::vector<detid_t> m_detectorIDs; - boost::shared_ptr<const std::unordered_map<detid_t, size_t> > m_detIDToIndex; + boost::shared_ptr<const std::unordered_map<detid_t, size_t>> m_detIDToIndex; // The following variables are mutable, since they are initialized (cached) // only on demand, by const getters. mutable boost::shared_ptr<const Geometry::IComponent> m_source; mutable boost::shared_ptr<const Geometry::IComponent> m_sample; - mutable bool m_sourceGood{ false }; - mutable bool m_sampleGood{ false }; + mutable bool m_sourceGood{false}; + mutable bool m_sampleGood{false}; mutable Kernel::V3D m_sourcePos; mutable Kernel::V3D m_samplePos; mutable double m_L1; @@ -181,16 +181,16 @@ private: mutable std::once_flag m_sampleCached; mutable std::once_flag m_L1Cached; - mutable std::vector<boost::shared_ptr<const Geometry::IDetector> > - m_lastDetector; + mutable std::vector<boost::shared_ptr<const Geometry::IDetector>> + m_lastDetector; mutable std::vector< - std::pair<const Geometry::IComponent *, std::vector<size_t> > > - m_lastAssemblyDetectorIndices; + std::pair<const Geometry::IComponent *, std::vector<size_t>>> + m_lastAssemblyDetectorIndices; mutable std::vector<size_t> m_lastIndex; }; /// Helper Non-member to make the ID->index mappings for detector IDs -MANTID_API_DLL boost::shared_ptr<const std::unordered_map<detid_t, size_t> > +MANTID_API_DLL boost::shared_ptr<const std::unordered_map<detid_t, size_t>> makeDetIdToIndexMap(const std::vector<detid_t> &detIds); } // namespace API diff --git a/Framework/API/src/DetectorInfo.cpp b/Framework/API/src/DetectorInfo.cpp index cd1809fa468..6f6c08cfdb9 100644 --- a/Framework/API/src/DetectorInfo.cpp +++ b/Framework/API/src/DetectorInfo.cpp @@ -17,12 +17,11 @@ namespace API { * @param detIds : Detector IDs to build the indexes for * @return shared_ptr to const map of detector ID -> detector index. */ -boost::shared_ptr<const std::unordered_map<detid_t, size_t> > +boost::shared_ptr<const std::unordered_map<detid_t, size_t>> makeDetIdToIndexMap(const std::vector<detid_t> &detIds) { const size_t nDetIds = detIds.size(); - auto detIdToIndex = - boost::make_shared<std::unordered_map<detid_t, size_t> >(); + auto detIdToIndex = boost::make_shared<std::unordered_map<detid_t, size_t>>(); detIdToIndex->reserve(nDetIds); for (size_t i = 0; i < nDetIds; ++i) { (*detIdToIndex)[detIds[i]] = i; @@ -68,7 +67,7 @@ DetectorInfo::DetectorInfo( Beamline::DetectorInfo &detectorInfo, boost::shared_ptr<const Geometry::Instrument> instrument, Geometry::ParameterMap *pmap, - boost::shared_ptr<const std::unordered_map<detid_t, size_t> > + boost::shared_ptr<const std::unordered_map<detid_t, size_t>> detIdToIndexMap) : m_detectorInfo(detectorInfo), m_pmap(pmap), m_instrument(instrument), m_detIDToIndex(detIdToIndexMap), m_lastDetector(PARALLEL_GET_MAX_THREADS), @@ -463,7 +462,7 @@ size_t DetectorInfo::scanCount(const size_t index) const { std::pair<Kernel::DateAndTime, Kernel::DateAndTime> DetectorInfo::scanInterval(const std::pair<size_t, size_t> &index) const { const auto &interval = m_detectorInfo.scanInterval(index); - return { interval.first, interval.second }; + return {interval.first, interval.second}; } /** Set the scan interval of the detector with given detector index. @@ -476,8 +475,8 @@ DetectorInfo::scanInterval(const std::pair<size_t, size_t> &index) const { void DetectorInfo::setScanInterval( const size_t index, const std::pair<Kernel::DateAndTime, Kernel::DateAndTime> &interval) { - m_detectorInfo.setScanInterval(index, { interval.first.totalNanoseconds(), - interval.second.totalNanoseconds() }); + m_detectorInfo.setScanInterval(index, {interval.first.totalNanoseconds(), + interval.second.totalNanoseconds()}); } /** Merges the contents of other into this. @@ -578,7 +577,7 @@ void DetectorInfo::doCacheSample() const { void DetectorInfo::cacheL1() const { m_L1 = m_source->getDistance(*m_sample); } -boost::shared_ptr<const std::unordered_map<detid_t, size_t> > +boost::shared_ptr<const std::unordered_map<detid_t, size_t>> DetectorInfo::detIdToIndexMap() const { return m_detIDToIndex; } diff --git a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FindPeaksMD.h b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FindPeaksMD.h index ab77c93591d..622ee99a2a6 100644 --- a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FindPeaksMD.h +++ b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FindPeaksMD.h @@ -24,9 +24,7 @@ class DLLExport FindPeaksMD : public API::Algorithm { public: FindPeaksMD(); /// Algorithm's name for identification - const std::string name() const override { - return "FindPeaksMD"; - }; + const std::string name() const override { return "FindPeaksMD"; }; /// Summary of algorithms purpose const std::string summary() const override { return "Find peaks in reciprocal space in a MDEventWorkspace or a " @@ -34,9 +32,7 @@ public: } /// Algorithm's version for identification - int version() const override { - return 1; - }; + int version() const override { return 1; }; /// Algorithm's category for identification const std::string category() const override { return "Optimization\\PeakFinding;MDAlgorithms\\Peaks"; @@ -91,11 +87,7 @@ private: Mantid::API::Progress *prog; /** Enum describing which type of dimensions in the MDEventWorkspace */ - enum eDimensionType { - HKL, - QLAB, - QSAMPLE - }; + enum eDimensionType { HKL, QLAB, QSAMPLE }; /// Instrument Mantid::Geometry::Instrument_const_sptr inst; diff --git a/Framework/MDAlgorithms/src/FindPeaksMD.cpp b/Framework/MDAlgorithms/src/FindPeaksMD.cpp index 6b461b868da..cf179c1acfe 100644 --- a/Framework/MDAlgorithms/src/FindPeaksMD.cpp +++ b/Framework/MDAlgorithms/src/FindPeaksMD.cpp @@ -117,23 +117,23 @@ FindPeaksMD::FindPeaksMD() /** Initialize the algorithm's properties. */ void FindPeaksMD::init() { - declareProperty(make_unique<WorkspaceProperty<IMDWorkspace> >( + declareProperty(make_unique<WorkspaceProperty<IMDWorkspace>>( "InputWorkspace", "", Direction::Input), "An input MDEventWorkspace or MDHistoWorkspace with at least " "3 dimensions."); declareProperty( - make_unique<PropertyWithValue<double> >("PeakDistanceThreshold", 0.1, - Direction::Input), + make_unique<PropertyWithValue<double>>("PeakDistanceThreshold", 0.1, + Direction::Input), "Threshold distance for rejecting peaks that are found to be too close " "from each other.\n" "This should be some multiple of the radius of a peak. Default: 0.1."); - declareProperty(make_unique<PropertyWithValue<int64_t> >("MaxPeaks", 500, - Direction::Input), + declareProperty(make_unique<PropertyWithValue<int64_t>>("MaxPeaks", 500, + Direction::Input), "Maximum number of peaks to find. Default: 500."); - declareProperty(make_unique<PropertyWithValue<double> >( + declareProperty(make_unique<PropertyWithValue<double>>( "DensityThresholdFactor", 10.0, Direction::Input), "The overall signal density of the workspace will be " "multiplied by this factor \n" @@ -141,7 +141,7 @@ void FindPeaksMD::init() { "considered to be peaks. See the help.\n" "Default: 10.0"); - declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace> >( + declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace>>( "OutputWorkspace", "", Direction::Output), "An output PeaksWorkspace with the peaks' found positions."); @@ -150,7 +150,7 @@ void FindPeaksMD::init() { "if it exists. \n" "If unchecked, the output workspace is replaced (Default)."); - auto nonNegativeInt = boost::make_shared<BoundedValidator<int> >(); + auto nonNegativeInt = boost::make_shared<BoundedValidator<int>>(); nonNegativeInt->setLower(0); declareProperty("EdgePixels", 0, nonNegativeInt, "Remove peaks that are at pixels this close to edge. "); @@ -184,8 +184,7 @@ void FindPeaksMD::readExperimentInfo(const ExperimentInfo_sptr &ei, Mantid::Kernel::Matrix<double>(3, 3, true); // Default IDENTITY matrix try { m_goniometer = ei->mutableRun().getGoniometerMatrix(); - } - catch (std::exception &e) { + } catch (std::exception &e) { g_log.warning() << "Error finding goniometer matrix. It will not be set in " "the peaks found.\n"; g_log.warning() << e.what() << '\n'; @@ -208,8 +207,7 @@ void FindPeaksMD::addPeak(const V3D &Q, const double binCount) { } if (p->getDetectorID() != -1) peakWS->addPeak(*p); - } - catch (std::exception &e) { + } catch (std::exception &e) { g_log.notice() << "Error creating peak at " << Q << " because of '" << e.what() << "'. Peak will be skipped.\n"; } @@ -236,8 +234,7 @@ FindPeaksMD::createPeak(const Mantid::Kernel::V3D &Q, const double binCount) { try { // Look for a detector p->findDetector(); - } - catch (...) { /* Ignore errors in ray-tracer */ + } catch (...) { /* Ignore errors in ray-tracer */ } p->setBinCount(binCount); @@ -432,8 +429,7 @@ void FindPeaksMD::findPeaks(typename MDEventWorkspace<MDE, nd>::sptr ws) { g_log.information() << "Add new peak with Q-center = " << Q[0] << ", " << Q[1] << ", " << Q[2] << "\n"; } - } - catch (std::exception &e) { + } catch (std::exception &e) { g_log.notice() << "Error creating peak at " << Q << " because of '" << e.what() << "'. Peak will be skipped.\n"; } @@ -452,8 +448,8 @@ void FindPeaksMD::findPeaks(typename MDEventWorkspace<MDE, nd>::sptr ws) { * * @param ws :: MDHistoWorkspace */ -void -FindPeaksMD::findPeaksHisto(Mantid::DataObjects::MDHistoWorkspace_sptr ws) { +void FindPeaksMD::findPeaksHisto( + Mantid::DataObjects::MDHistoWorkspace_sptr ws) { size_t nd = ws->getNumDims(); if (nd < 3) throw std::invalid_argument("Workspace must have at least 3 dimensions."); @@ -623,7 +619,7 @@ void FindPeaksMD::exec() { delete prog; // Do a sort by bank name and then descending bin count (intensity) - std::vector<std::pair<std::string, bool> > criteria; + std::vector<std::pair<std::string, bool>> criteria; criteria.push_back(std::pair<std::string, bool>("RunNumber", true)); criteria.push_back(std::pair<std::string, bool>("BankName", true)); criteria.push_back(std::pair<std::string, bool>("bincount", false)); -- GitLab