diff --git a/Vates/VatesAPI/inc/MantidVatesAPI/ViewFrustum.h b/Vates/VatesAPI/inc/MantidVatesAPI/ViewFrustum.h index b145c50bf3c772d099a09541aec4a0cdfc716281..24cf149df1932e3e4e4916374db2d586fc132b82 100644 --- a/Vates/VatesAPI/inc/MantidVatesAPI/ViewFrustum.h +++ b/Vates/VatesAPI/inc/MantidVatesAPI/ViewFrustum.h @@ -35,13 +35,7 @@ class DLLExport FrustumPlane std::vector<T> getPlaneCoefficients() { - std::vector<T> coefficients; - coefficients.push_back(m_paramA); - coefficients.push_back(m_paramB); - coefficients.push_back(m_paramC); - coefficients.push_back(m_paramD); - - return coefficients; + return {m_paramA, m_paramB, m_paramC, m_paramD}; } private: @@ -100,27 +94,16 @@ class DLLExport ViewFrustum { const size_t dim = 3; - std::vector<T> aVec; - aVec.push_back(plane1.A()); - aVec.push_back(plane2.A()); - aVec.push_back(plane3.A()); + std::vector<T> aVec{plane1.A(), plane2.A(), plane3.A()}; - std::vector<T> bVec; - bVec.push_back(plane1.B()); - bVec.push_back(plane2.B()); - bVec.push_back(plane3.B()); + std::vector<T> bVec{plane1.B(), plane2.B(), plane3.B()}; - std::vector<T> cVec; - cVec.push_back(plane1.C()); - cVec.push_back(plane2.C()); - cVec.push_back(plane3.C()); + std::vector<T> cVec{plane1.C(), plane2.C(), plane3.C()}; // The input is Ax+By+Cz+D=0 but we need the form Ax+By+Cz=D - std::vector<T> dVec; const T factor = -1; - dVec.push_back(factor*plane1.D()); - dVec.push_back(factor*plane2.D()); - dVec.push_back(factor*plane3.D()); + std::vector<T> dVec{factor * plane1.D(), factor * plane2.D(), + factor * plane3.D()}; // Get the different matrix permutations Mantid::Kernel::Matrix<T> abcMatrix(dim, dim); @@ -143,10 +126,8 @@ class DLLExport ViewFrustum T adcDet = adcMatrix.determinant(); T abdDet = abdMatrix.determinant(); - std::vector<T> intersection; - intersection.push_back(dbcDet/abcDet); - intersection.push_back(adcDet/abcDet); - intersection.push_back(abdDet/abcDet); + std::vector<T> intersection{dbcDet / abcDet, adcDet / abcDet, + abdDet / abcDet}; return intersection; } diff --git a/Vates/VatesAPI/src/MDHWLoadingPresenter.cpp b/Vates/VatesAPI/src/MDHWLoadingPresenter.cpp index 1e8bfbdd904c7fa5350b083f7fb851a8eb7b0f89..3299e811fa95f351f0a61823506bfbe87af5babf 100644 --- a/Vates/VatesAPI/src/MDHWLoadingPresenter.cpp +++ b/Vates/VatesAPI/src/MDHWLoadingPresenter.cpp @@ -62,8 +62,8 @@ void MDHWLoadingPresenter::transposeWs(Mantid::API::IMDHistoWorkspace_sptr &inHi nonIntegratedDims.push_back(i); } } - std::vector<int> orderedDims; - orderedDims = nonIntegratedDims; + + std::vector<int> orderedDims = nonIntegratedDims; orderedDims.insert(orderedDims.end(), integratedDims.begin(), integratedDims.end()); diff --git a/Vates/VatesAPI/src/SaveMDWorkspaceToVTKImpl.cpp b/Vates/VatesAPI/src/SaveMDWorkspaceToVTKImpl.cpp index e4b1aa143a09c744b46ea04d0c4c7d1286f42ac4..e78b699220937da26cd91a66358d83f26ebb25da 100644 --- a/Vates/VatesAPI/src/SaveMDWorkspaceToVTKImpl.cpp +++ b/Vates/VatesAPI/src/SaveMDWorkspaceToVTKImpl.cpp @@ -195,17 +195,16 @@ SaveMDWorkspaceToVTKImpl::translateStringToVisualNormalization( } void SaveMDWorkspaceToVTKImpl::setupMembers() { - m_normalizations.insert( - std::make_pair("AutoSelect", VisualNormalization::AutoSelect)); - m_normalizations.insert( - std::make_pair("NoNormalization", VisualNormalization::NoNormalization)); - m_normalizations.insert(std::make_pair( - "NumEventsNormalization", VisualNormalization::NumEventsNormalization)); - m_normalizations.insert(std::make_pair( - "VolumeNormalization", VisualNormalization::VolumeNormalization)); - - m_thresholds.push_back("IgnoreZerosThresholdRange"); - m_thresholds.push_back("NoThresholdRange"); + m_normalizations.emplace("AutoSelect", VisualNormalization::AutoSelect); + m_normalizations.emplace("NoNormalization", + VisualNormalization::NoNormalization); + m_normalizations.emplace("NumEventsNormalization", + VisualNormalization::NumEventsNormalization); + m_normalizations.emplace("VolumeNormalization", + VisualNormalization::VolumeNormalization); + + m_thresholds.emplace_back("IgnoreZerosThresholdRange"); + m_thresholds.emplace_back("NoThresholdRange"); } std::vector<std::string> diff --git a/Vates/VatesAPI/src/vtkDataSetToNonOrthogonalDataSet.cpp b/Vates/VatesAPI/src/vtkDataSetToNonOrthogonalDataSet.cpp index 06c7d32442df635b074127fcf1b22516783da64b..e8b3ad69f423ed119639526f87e3e37dd896d0ce 100644 --- a/Vates/VatesAPI/src/vtkDataSetToNonOrthogonalDataSet.cpp +++ b/Vates/VatesAPI/src/vtkDataSetToNonOrthogonalDataSet.cpp @@ -286,11 +286,7 @@ void vtkDataSetToNonOrthogonalDataSet::createSkewInformation( m_skewMat *= scaleMat; // Setup basis normalisation array - // Intel and MSBuild can't handle this - // m_basisNorm = {ol.astar(), ol.bstar(), ol.cstar()}; - m_basisNorm.push_back(ol.astar()); - m_basisNorm.push_back(ol.bstar()); - m_basisNorm.push_back(ol.cstar()); + m_basisNorm = {ol.astar(), ol.bstar(), ol.cstar()}; // Expand matrix to 4 dimensions if necessary if (4 == m_numDims) { diff --git a/Vates/VatesAPI/src/vtkDataSetToPeaksFilteredDataSet.cpp b/Vates/VatesAPI/src/vtkDataSetToPeaksFilteredDataSet.cpp index 4218501a95f1e0bbb47f5688781700c4dbc36fb6..ee772a91430c275d51ba8fc814c2f04e6c4c06d6 100644 --- a/Vates/VatesAPI/src/vtkDataSetToPeaksFilteredDataSet.cpp +++ b/Vates/VatesAPI/src/vtkDataSetToPeaksFilteredDataSet.cpp @@ -256,13 +256,14 @@ GCC_DIAG_OFF(strict-aliasing) switch(coordinateSystem) { case(Mantid::Kernel::SpecialCoordinateSystem::HKL): - peaksInfo.push_back(std::pair<Mantid::Kernel::V3D, double>(peak->getHKL(), radius*m_radiusFactor)); + peaksInfo.emplace_back(peak->getHKL(), radius * m_radiusFactor); break; case(Mantid::Kernel::SpecialCoordinateSystem::QLab): - peaksInfo.push_back(std::pair<Mantid::Kernel::V3D, double>(peak->getQLabFrame(), radius*m_radiusFactor)); + peaksInfo.emplace_back(peak->getQLabFrame(), radius * m_radiusFactor); break; case(Mantid::Kernel::SpecialCoordinateSystem::QSample): - peaksInfo.push_back(std::pair<Mantid::Kernel::V3D, double>(peak->getQSampleFrame(), radius*m_radiusFactor)); + peaksInfo.emplace_back(peak->getQSampleFrame(), + radius * m_radiusFactor); break; default: throw std::invalid_argument("The special coordinate systems don't match."); diff --git a/Vates/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h b/Vates/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h index f5d5ffbfd792251bd138345cb62e656fdc065724..4daa34208e207622ee165738d455c324b8022b52 100644 --- a/Vates/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h +++ b/Vates/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h @@ -84,33 +84,10 @@ private: } // Create the coordinate transformation information - std::vector<Mantid::coord_t> affMatVals; - affMatVals.push_back(1); - affMatVals.push_back(0); - affMatVals.push_back(0); - affMatVals.push_back(0); - affMatVals.push_back(0); - affMatVals.push_back(0); - affMatVals.push_back(0); - affMatVals.push_back(1); - affMatVals.push_back(0); - affMatVals.push_back(0); - affMatVals.push_back(0); - affMatVals.push_back(0); - affMatVals.push_back(0); - affMatVals.push_back(1); - affMatVals.push_back(0); - affMatVals.push_back(0); - affMatVals.push_back(1); - affMatVals.push_back(0); - affMatVals.push_back(0); - affMatVals.push_back(0); - affMatVals.push_back(0); - affMatVals.push_back(0); - affMatVals.push_back(0); - affMatVals.push_back(0); - affMatVals.push_back(1); - + std::vector<Mantid::coord_t> affMatVals{1, 0, 0, 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 1, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 1}; + CoordTransformAffine affMat(4, 4); affMat.setMatrix(Matrix<Mantid::coord_t>(affMatVals)); if (!forgetAffmat) @@ -128,15 +105,7 @@ private: } else { - wMat.push_back(1); - wMat.push_back(1); - wMat.push_back(0); - wMat.push_back(1); - wMat.push_back(-1); - wMat.push_back(0); - wMat.push_back(0); - wMat.push_back(0); - wMat.push_back(1); + wMat = {1, 1, 0, 1, -1, 0, 0, 0, 1}; } if (!forgetWmat) diff --git a/Vates/VatesAPI/test/vtkDataSetToPeaksFilteredDataSetTest.h b/Vates/VatesAPI/test/vtkDataSetToPeaksFilteredDataSetTest.h index aa765535bf3691ca3e75ddcd8fe99746cfd7695a..1488cb1fb87c3507f18b3158931c29b80aa23e9a 100644 --- a/Vates/VatesAPI/test/vtkDataSetToPeaksFilteredDataSetTest.h +++ b/Vates/VatesAPI/test/vtkDataSetToPeaksFilteredDataSetTest.h @@ -67,7 +67,8 @@ private: vtkSmartPointer<vtkUnstructuredGrid> makeSplatterSourceGrid() { FakeProgressAction progressUpdate; MDEventWorkspace3Lean::sptr ws = MDEventsTestHelper::makeMDEW<3>(10, -10.0, 10.0, 1); - vtkSplatterPlotFactory factory(ThresholdRange_scptr(new UserDefinedThresholdRange(0, 1)), "signal"); + vtkSplatterPlotFactory factory( + boost::make_shared<UserDefinedThresholdRange>(0, 1), "signal"); factory.initialize(ws); vtkSmartPointer<vtkDataSet> product; TS_ASSERT_THROWS_NOTHING(product = factory.create(progressUpdate)); @@ -211,22 +212,23 @@ public: // The actual radius is multiplied by the radius factor. double peakRadius = 5; Mantid::Kernel::SpecialCoordinateSystem coordinateSystem = Mantid::Kernel::SpecialCoordinateSystem::QSample; - Mantid::Geometry::PeakShape_sptr shape(new Mantid::DataObjects::PeakShapeSpherical(peakRadius, coordinateSystem, "test", 1)); + auto shape = boost::make_shared<Mantid::DataObjects::PeakShapeSpherical>( + peakRadius, coordinateSystem, "test", 1); boost::shared_ptr<MockPeakFilter> peak = boost::make_shared<MockPeakFilter>(); peak->setPeakShape(shape); - std::vector<std::pair<boost::shared_ptr<MockPeakFilter>, Mantid::Kernel::V3D>> fakeSinglePeakPeakWorkspaces; - fakeSinglePeakPeakWorkspaces.push_back(std::pair<boost::shared_ptr<MockPeakFilter>, Mantid::Kernel::V3D>(peak, coordinate)); + std::vector< + std::pair<boost::shared_ptr<MockPeakFilter>, Mantid::Kernel::V3D>> + fakeSinglePeakPeakWorkspaces{{peak, coordinate}}; - std::vector<PeaksFilterDataContainer> peakData; PeaksFilterDataContainer data1; data1.position = coordinate; data1.radius = peakRadius; data1.radiusFactor = peaksFilter.getRadiusFactor(); - peakData.push_back(data1); + std::vector<PeaksFilterDataContainer> peakData{data1}; - // Act + // Act do_test_execute(peaksFilter, fakeSinglePeakPeakWorkspaces, coordinateSystem); // Assert @@ -242,18 +244,14 @@ public: Mantid::Kernel::V3D coordinate(0,0,0); double peakRadiusMax = 7; - std::vector<double> radii; - radii.push_back(peakRadiusMax); - radii.push_back(6); - radii.push_back(5); + std::vector<double> radii{peakRadiusMax, 6, 5}; - std::vector<Mantid::Kernel::V3D> directions; - directions.push_back(Mantid::Kernel::V3D(0.0,1.0,0.0)); - directions.push_back(Mantid::Kernel::V3D(1.0,0.0,0.0)); - directions.push_back(Mantid::Kernel::V3D(0.0,0.0,1.0)); + std::vector<Mantid::Kernel::V3D> directions{ + {0., 1., 0.}, {1., 0., 0.}, {0., 0., 1.}}; Mantid::Kernel::SpecialCoordinateSystem coordinateSystem = Mantid::Kernel::SpecialCoordinateSystem::QSample; - Mantid::Geometry::PeakShape_sptr shape(new Mantid::DataObjects::PeakShapeEllipsoid(directions, radii, radii, radii , coordinateSystem, "test", 1)); + auto shape = boost::make_shared<Mantid::DataObjects::PeakShapeEllipsoid>( + directions, radii, radii, radii, coordinateSystem, "test", 1); boost::shared_ptr<MockPeakFilter> peak = boost::make_shared<MockPeakFilter>(); peak->setPeakShape(shape); @@ -286,7 +284,7 @@ public: Mantid::Kernel::SpecialCoordinateSystem coordinateSystem = Mantid::Kernel::SpecialCoordinateSystem::QSample; double radius = peaksFilter.getRadiusNoShape(); - Mantid::Geometry::PeakShape_sptr shape(new Mantid::DataObjects::NoShape()); + auto shape = boost::make_shared<Mantid::DataObjects::NoShape>(); boost::shared_ptr<MockPeakFilter> peak = boost::make_shared<MockPeakFilter>(); peak->setPeakShape(shape); @@ -318,7 +316,8 @@ public: Mantid::Kernel::V3D coordinate(0,0,0); double peakRadius = 5; Mantid::Kernel::SpecialCoordinateSystem coordinateSystem = Mantid::Kernel::SpecialCoordinateSystem::QSample; - Mantid::Geometry::PeakShape_sptr shape(new Mantid::DataObjects::PeakShapeSpherical(peakRadius, coordinateSystem, "test", 1)); + auto shape = boost::make_shared<Mantid::DataObjects::PeakShapeSpherical>( + peakRadius, coordinateSystem, "test", 1); boost::shared_ptr<MockPeakFilter> peak = boost::make_shared<MockPeakFilter>(); peak->setPeakShape(shape); @@ -326,12 +325,12 @@ public: // Peak 2 Mantid::Kernel::V3D coordinate2(12,0,0); double peakRadius2 = 5; - Mantid::Geometry::PeakShape_sptr shape2(new Mantid::DataObjects::PeakShapeSpherical(peakRadius2, coordinateSystem, "test", 1)); + auto shape2 = boost::make_shared<Mantid::DataObjects::PeakShapeSpherical>( + peakRadius2, coordinateSystem, "test", 1); boost::shared_ptr<MockPeakFilter> peak2 = boost::make_shared<MockPeakFilter>(); peak2->setPeakShape(shape2); - std::vector<PeaksFilterDataContainer> peakData; PeaksFilterDataContainer data1; data1.position = coordinate; data1.radius =peakRadius; @@ -341,12 +340,11 @@ public: data2.radius = peakRadius2; data2.radiusFactor = peaksFilter.getRadiusFactor(); - peakData.push_back(data1); - peakData.push_back(data2); + std::vector<PeaksFilterDataContainer> peakData{data1, data2}; - std::vector<std::pair<boost::shared_ptr<MockPeakFilter>, Mantid::Kernel::V3D>> fakeSinglePeakPeakWorkspaces; - fakeSinglePeakPeakWorkspaces.push_back(std::pair<boost::shared_ptr<MockPeakFilter>, Mantid::Kernel::V3D>(peak, coordinate)); - fakeSinglePeakPeakWorkspaces.push_back(std::pair<boost::shared_ptr<MockPeakFilter>, Mantid::Kernel::V3D>(peak2, coordinate2)); + std::vector< + std::pair<boost::shared_ptr<MockPeakFilter>, Mantid::Kernel::V3D>> + fakeSinglePeakPeakWorkspaces{{peak, coordinate}, {peak2, coordinate2}}; // Act do_test_execute(peaksFilter, fakeSinglePeakPeakWorkspaces, coordinateSystem); diff --git a/Vates/VatesSimpleGui/QtWidgets/src/ModeControlWidget.cpp b/Vates/VatesSimpleGui/QtWidgets/src/ModeControlWidget.cpp index fb3a1631a6b388fd60192c02406f3ebca06bc880..d1020877720aedde0a1865644d750bddccab61e3 100644 --- a/Vates/VatesSimpleGui/QtWidgets/src/ModeControlWidget.cpp +++ b/Vates/VatesSimpleGui/QtWidgets/src/ModeControlWidget.cpp @@ -32,10 +32,14 @@ ModeControlWidget::ModeControlWidget(QWidget *parent) : QWidget(parent) // Add the mapping from string to the view enum MantidQt::API::MdConstants mdConstants; - mapFromStringToView.insert(std::pair<QString, ModeControlWidget::Views>(mdConstants.getStandardView(), ModeControlWidget::STANDARD)); - mapFromStringToView.insert(std::pair<QString, ModeControlWidget::Views>(mdConstants.getThreeSliceView(), ModeControlWidget::THREESLICE)); - mapFromStringToView.insert(std::pair<QString, ModeControlWidget::Views>(mdConstants.getMultiSliceView(), ModeControlWidget::MULTISLICE)); - mapFromStringToView.insert(std::pair<QString, ModeControlWidget::Views>(mdConstants.getSplatterPlotView(), ModeControlWidget::SPLATTERPLOT)); + mapFromStringToView.emplace(mdConstants.getStandardView(), + ModeControlWidget::STANDARD); + mapFromStringToView.emplace(mdConstants.getThreeSliceView(), + ModeControlWidget::THREESLICE); + mapFromStringToView.emplace(mdConstants.getMultiSliceView(), + ModeControlWidget::MULTISLICE); + mapFromStringToView.emplace(mdConstants.getSplatterPlotView(), + ModeControlWidget::SPLATTERPLOT); } ModeControlWidget::~ModeControlWidget() diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/BackgroundRgbProvider.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/BackgroundRgbProvider.cpp index 0c6592839150fff8e1f36d59a0af952596179614..5d87dd61bb3f15d2e5ed12f0b7d741a12c1e8b2c 100644 --- a/Vates/VatesSimpleGui/ViewWidgets/src/BackgroundRgbProvider.cpp +++ b/Vates/VatesSimpleGui/ViewWidgets/src/BackgroundRgbProvider.cpp @@ -53,7 +53,6 @@ namespace Mantid std::vector<double> BackgroundRgbProvider::getRgbFromSetting(bool useCurrentBackgroundColor) { // Set the mantid default here - std::vector<double> background; QColor userBackground; if (useCurrentBackgroundColor) @@ -101,11 +100,8 @@ namespace Mantid bVal = defaultBackgroundColor.blue(); } - background.push_back(static_cast<double>(rVal)); - background.push_back(static_cast<double>(gVal)); - background.push_back(static_cast<double>(bVal)); - - return background; + return {static_cast<double>(rVal), static_cast<double>(gVal), + static_cast<double>(bVal)}; } void BackgroundRgbProvider::update() diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp index 561b0d42f7d8ee9cfabe88fa9c24242129448b2f..aeea83cec4260a0e603f5786120dd33286df9051 100644 --- a/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp +++ b/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp @@ -618,26 +618,22 @@ void MdViewerWidget::removeAllRebinning(ModeControlWidget::Views view) { pqServer *server = pqActiveObjects::instance().activeServer(); pqServerManagerModel *smModel = pqApplicationCore::instance()->getServerManagerModel(); - QList<pqPipelineSource *> sources = + const QList<pqPipelineSource *> sources = smModel->findItems<pqPipelineSource *>(server); // We need to record all true sources, The filters will be removed in the // removeRebinning step // Hence the iterator will not point to a valid object anymore. QList<pqPipelineSource *> sourcesToAlter; - - for (QList<pqPipelineSource *>::Iterator source = sources.begin(); - source != sources.end(); ++source) { - const QString srcProxyName = (*source)->getProxy()->GetXMLGroup(); - + foreach (pqPipelineSource *source, sources) { + const QString srcProxyName = source->getProxy()->GetXMLGroup(); if (srcProxyName == QString("sources")) { - sourcesToAlter.push_back(*source); + sourcesToAlter.push_back(source); } } - for (QList<pqPipelineSource *>::Iterator source = sourcesToAlter.begin(); - source != sourcesToAlter.end(); ++source) { - removeRebinning(*source, false, view); + foreach (pqPipelineSource *source, sourcesToAlter) { + removeRebinning(source, false, view); } } diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/RebinnedSourcesManager.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/RebinnedSourcesManager.cpp index 279be2c805d00339b47dec84c94a283b577a8f09..7336f92bd132c827b219bbd888561aa213029c23 100644 --- a/Vates/VatesSimpleGui/ViewWidgets/src/RebinnedSourcesManager.cpp +++ b/Vates/VatesSimpleGui/ViewWidgets/src/RebinnedSourcesManager.cpp @@ -396,11 +396,13 @@ namespace Mantid inputWorkspace = m_rebinnedWorkspaceAndSourceToOriginalWorkspace[createKeyPairForSource(source)]; outputWorkspace = m_tempPrefix + inputWorkspace + algorithmType + m_tempPostfix; // Keep track of the old rebinned workspace and source - m_newRebinnedWorkspacePairBuffer.insert(std::pair<std::string, std::pair<std::string, pqPipelineSource*>>(workspaceName, std::pair<std::string, pqPipelineSource*>(outputWorkspace, source))); + m_newRebinnedWorkspacePairBuffer.emplace( + workspaceName, std::make_pair(outputWorkspace, source)); } } // Record the workspaces - m_newWorkspacePairBuffer.insert(std::pair<std::string, std::pair<std::string, pqPipelineSource*>>(inputWorkspace, std::pair<std::string, pqPipelineSource*>(outputWorkspace, source))); + m_newWorkspacePairBuffer.emplace( + inputWorkspace, std::make_pair(outputWorkspace, source)); m_inputSource= source; }