From d0db4f9dcecdaa2856f1f8da159ce8f7da059766 Mon Sep 17 00:00:00 2001
From: Anton Piccardo-Selg <anton.piccardo-selg@tessella.com>
Date: Wed, 14 Oct 2015 12:56:05 +0100
Subject: [PATCH] Refs #13872 Phase out string-based constructor in more algs

---
 Framework/DataObjects/test/MDEventInserterTest.h          | 7 ++++---
 Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h | 4 +++-
 Framework/SINQ/src/SliceMDHisto.cpp                       | 2 +-
 Framework/SINQ/test/InvertMDDimTest.h                     | 8 +++++---
 Framework/SINQ/test/MDHistoToWorkspace2DTest.h            | 8 +++++---
 Framework/SINQ/test/ProjectMDTest.h                       | 7 ++++---
 Framework/SINQ/test/SliceMDHistoTest.h                    | 8 +++++---
 MantidQt/API/test/PlotAxisTest.h                          | 6 ++++--
 Vates/VatesAPI/src/MDEWLoadingPresenter.cpp               | 2 +-
 Vates/VatesAPI/src/MDHWLoadingPresenter.cpp               | 2 +-
 Vates/VatesAPI/src/SQWLoadingPresenter.cpp                | 2 +-
 11 files changed, 34 insertions(+), 22 deletions(-)

diff --git a/Framework/DataObjects/test/MDEventInserterTest.h b/Framework/DataObjects/test/MDEventInserterTest.h
index 3285149b0e1..2fc05b5ecaa 100644
--- a/Framework/DataObjects/test/MDEventInserterTest.h
+++ b/Framework/DataObjects/test/MDEventInserterTest.h
@@ -28,13 +28,14 @@ private:
   /// specified event type.
   IMDEventWorkspace_sptr createInputWorkspace(const std::string &eventType) {
     using Mantid::Geometry::MDHistoDimension;
-
+    Mantid::Geometry::GeneralFrame frame(
+        Mantid::Geometry::GeneralFrame::GeneralFrameDistance, "m");
     IMDEventWorkspace_sptr ws = MDEventFactory::CreateMDWorkspace(2, eventType);
     coord_t min(-10.0f), max(10.0f);
     ws->addDimension(
-        boost::make_shared<MDHistoDimension>("A", "A", "m", min, max, 1));
+        boost::make_shared<MDHistoDimension>("A", "A", frame, min, max, 1));
     ws->addDimension(
-        boost::make_shared<MDHistoDimension>("B", "B", "m", min, max, 1));
+        boost::make_shared<MDHistoDimension>("B", "B", frame, min, max, 1));
     ws->initialize();
     // Split to level 1
     ws->splitBox();
diff --git a/Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h b/Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h
index 5791b8fc0b7..3879e17d05a 100644
--- a/Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h
+++ b/Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h
@@ -244,9 +244,11 @@ public:
   }
 
   void test_skip_masked_detectors() {
+    Mantid::Geometry::GeneralFrame frame(
+        Mantid::Geometry::GeneralFrame::GeneralFrameDistance, "m");
     WritableHistoWorkspace *ws =
         new WritableHistoWorkspace(MDHistoDimension_sptr(
-            new MDHistoDimension("x", "x", "m", 0.0, 10, 100)));
+            new MDHistoDimension("x", "x", frame, 0.0, 10, 100)));
 
     ws->setMaskValueAt(0, true);  // Mask the first bin
     ws->setMaskValueAt(1, true);  // Mask the second bin
diff --git a/Framework/SINQ/src/SliceMDHisto.cpp b/Framework/SINQ/src/SliceMDHisto.cpp
index 60e4bb154c9..b415a4afd50 100644
--- a/Framework/SINQ/src/SliceMDHisto.cpp
+++ b/Framework/SINQ/src/SliceMDHisto.cpp
@@ -75,7 +75,7 @@ void SliceMDHisto::exec() {
   for (unsigned int k = 0; k < m_rank; ++k) {
     boost::shared_ptr<const IMDDimension> arDim = inWS->getDimension(k);
     dimensions.push_back(MDHistoDimension_sptr(new MDHistoDimension(
-        arDim->getName(), arDim->getName(), arDim->getUnits(),
+      arDim->getName(), arDim->getName(), arDim->getMDFrame(),
         arDim->getX(start[k]), arDim->getX(end[k]), end[k] - start[k])));
   }
   MDHistoWorkspace_sptr outWS(new MDHistoWorkspace(dimensions));
diff --git a/Framework/SINQ/test/InvertMDDimTest.h b/Framework/SINQ/test/InvertMDDimTest.h
index 860eb191a97..ff52f734473 100644
--- a/Framework/SINQ/test/InvertMDDimTest.h
+++ b/Framework/SINQ/test/InvertMDDimTest.h
@@ -110,17 +110,19 @@ public:
 private:
   MDHistoWorkspace_sptr makeTestMD() {
     IMDDimension_sptr dim;
+    Mantid::Geometry::GeneralFrame frame(
+        Mantid::Geometry::GeneralFrame::GeneralFrameDistance, "mm");
     std::vector<IMDDimension_sptr> dimensions;
     dim = MDHistoDimension_sptr(new MDHistoDimension(
-        std::string("x"), std::string("ID0"), std::string("mm"), coord_t(-5),
+        std::string("x"), std::string("ID0"), frame, coord_t(-5),
         coord_t(5), size_t(10)));
     dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim));
     dim = MDHistoDimension_sptr(new MDHistoDimension(
-        std::string("y"), std::string("ID1"), std::string("mm"), coord_t(-6),
+        std::string("y"), std::string("ID1"), frame, coord_t(-6),
         coord_t(6), size_t(12)));
     dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim));
     dim = MDHistoDimension_sptr(new MDHistoDimension(
-        std::string("z"), std::string("ID2"), std::string("mm"), coord_t(-10),
+        std::string("z"), std::string("ID2"), frame, coord_t(-10),
         coord_t(10), size_t(20)));
     dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim));
 
diff --git a/Framework/SINQ/test/MDHistoToWorkspace2DTest.h b/Framework/SINQ/test/MDHistoToWorkspace2DTest.h
index cdd08b0122c..03bc6664002 100644
--- a/Framework/SINQ/test/MDHistoToWorkspace2DTest.h
+++ b/Framework/SINQ/test/MDHistoToWorkspace2DTest.h
@@ -74,17 +74,19 @@ public:
 private:
   MDHistoWorkspace_sptr makeTestMD() {
     IMDDimension_sptr dim;
+    Mantid::Geometry::GeneralFrame frame(
+        Mantid::Geometry::GeneralFrame::GeneralFrameDistance, "mm");
     std::vector<IMDDimension_sptr> dimensions;
     dim = MDHistoDimension_sptr(new MDHistoDimension(
-        std::string("x"), std::string("ID0"), std::string("mm"), coord_t(-50),
+        std::string("x"), std::string("ID0"), frame, coord_t(-50),
         coord_t(50), size_t(100)));
     dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim));
     dim = MDHistoDimension_sptr(new MDHistoDimension(
-        std::string("y"), std::string("ID1"), std::string("mm"), coord_t(-60),
+        std::string("y"), std::string("ID1"), frame, coord_t(-60),
         coord_t(60), size_t(120)));
     dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim));
     dim = MDHistoDimension_sptr(new MDHistoDimension(
-        std::string("z"), std::string("ID2"), std::string("mm"), coord_t(-100),
+        std::string("z"), std::string("ID2"), frame, coord_t(-100),
         coord_t(100), size_t(200)));
     dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim));
 
diff --git a/Framework/SINQ/test/ProjectMDTest.h b/Framework/SINQ/test/ProjectMDTest.h
index 5f34e3acb3b..47c4343bba7 100644
--- a/Framework/SINQ/test/ProjectMDTest.h
+++ b/Framework/SINQ/test/ProjectMDTest.h
@@ -228,17 +228,18 @@ public:
 private:
   MDHistoWorkspace_sptr makeTestMD() {
     IMDDimension_sptr dim;
+    Mantid::Geometry::GeneralFrame frame(Mantid::Geometry::GeneralFrame::GeneralFrameDistance, "mm");
     std::vector<IMDDimension_sptr> dimensions;
     dim = MDHistoDimension_sptr(new MDHistoDimension(
-        std::string("x"), std::string("ID0"), std::string("mm"), coord_t(-5),
+        std::string("x"), std::string("ID0"), frame, coord_t(-5),
         coord_t(5), size_t(10)));
     dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim));
     dim = MDHistoDimension_sptr(new MDHistoDimension(
-        std::string("y"), std::string("ID1"), std::string("mm"), coord_t(-6),
+        std::string("y"), std::string("ID1"), frame, coord_t(-6),
         coord_t(6), size_t(12)));
     dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim));
     dim = MDHistoDimension_sptr(new MDHistoDimension(
-        std::string("z"), std::string("ID2"), std::string("mm"), coord_t(-10),
+        std::string("z"), std::string("ID2"), frame, coord_t(-10),
         coord_t(10), size_t(20)));
     dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim));
 
diff --git a/Framework/SINQ/test/SliceMDHistoTest.h b/Framework/SINQ/test/SliceMDHistoTest.h
index 140ef301df7..00cf3d72d1e 100644
--- a/Framework/SINQ/test/SliceMDHistoTest.h
+++ b/Framework/SINQ/test/SliceMDHistoTest.h
@@ -90,16 +90,18 @@ private:
   MDHistoWorkspace_sptr makeTestMD() {
     IMDDimension_sptr dim;
     std::vector<IMDDimension_sptr> dimensions;
+    Mantid::Geometry::GeneralFrame frame(
+        Mantid::Geometry::GeneralFrame::GeneralFrameDistance, "mm");
     dim = MDHistoDimension_sptr(new MDHistoDimension(
-        std::string("x"), std::string("ID0"), std::string("mm"), coord_t(-50),
+        std::string("x"), std::string("ID0"), frame, coord_t(-50),
         coord_t(50), size_t(100)));
     dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim));
     dim = MDHistoDimension_sptr(new MDHistoDimension(
-        std::string("y"), std::string("ID1"), std::string("mm"), coord_t(-60),
+        std::string("y"), std::string("ID1"), frame, coord_t(-60),
         coord_t(60), size_t(120)));
     dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim));
     dim = MDHistoDimension_sptr(new MDHistoDimension(
-        std::string("z"), std::string("ID2"), std::string("mm"), coord_t(-100),
+        std::string("z"), std::string("ID2"), frame, coord_t(-100),
         coord_t(100), size_t(200)));
     dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim));
 
diff --git a/MantidQt/API/test/PlotAxisTest.h b/MantidQt/API/test/PlotAxisTest.h
index 8816dce04c0..302f9be5c15 100644
--- a/MantidQt/API/test/PlotAxisTest.h
+++ b/MantidQt/API/test/PlotAxisTest.h
@@ -138,8 +138,10 @@ public:
     using MantidQt::API::PlotAxis;
     using Mantid::Geometry::MDHistoDimension;
     using Mantid::Kernel::UnitLabel;
-
-      MDHistoDimension dim("tof", "dimx", UnitLabel("us",L"\u03bcs","\\mu s"), 0.0f, 1.0f, 10);
+    Mantid::Geometry::GeneralFrame frame(
+        Mantid::Geometry::GeneralFrame::GeneralFrameTOF,
+        UnitLabel("us", L"\u03bcs", "\\mu s"));
+    MDHistoDimension dim("tof", "dimx", frame, 0.0f, 1.0f, 10);
     QString expected = QString::fromWCharArray(L"tof (\u03bcs)");
     TS_ASSERT_EQUALS(expected, PlotAxis(dim).title());
   }
diff --git a/Vates/VatesAPI/src/MDEWLoadingPresenter.cpp b/Vates/VatesAPI/src/MDEWLoadingPresenter.cpp
index ef6d00898db..e551f06583c 100644
--- a/Vates/VatesAPI/src/MDEWLoadingPresenter.cpp
+++ b/Vates/VatesAPI/src/MDEWLoadingPresenter.cpp
@@ -65,7 +65,7 @@ namespace Mantid
         }
         //std::cout << "dim " << d << min << " to " <<  max << std::endl;
         axisLabels.push_back(makeAxisTitle(inDim));
-        MDHistoDimension_sptr dim(new MDHistoDimension(inDim->getName(), inDim->getName(), inDim->getUnits(), min, max, inDim->getNBins()));
+        MDHistoDimension_sptr dim(new MDHistoDimension(inDim->getName(), inDim->getName(), inDim->getMDFrame(), min, max, inDim->getNBins()));
         dimensions.push_back(dim);
       }
 
diff --git a/Vates/VatesAPI/src/MDHWLoadingPresenter.cpp b/Vates/VatesAPI/src/MDHWLoadingPresenter.cpp
index 305cdf43e8c..9db9b9dd4be 100644
--- a/Vates/VatesAPI/src/MDHWLoadingPresenter.cpp
+++ b/Vates/VatesAPI/src/MDHWLoadingPresenter.cpp
@@ -125,7 +125,7 @@ void MDHWLoadingPresenter::extractMetadata(
     axisLabels.push_back(makeAxisTitle(inDim));
     MDHistoDimension_sptr dim(
         new MDHistoDimension(inDim->getName(), inDim->getName(),
-                             inDim->getUnits(), min, max, inDim->getNBins()));
+                             inDim->getMDFrame(), min, max, inDim->getNBins()));
     dimensions.push_back(dim);
   }
 
diff --git a/Vates/VatesAPI/src/SQWLoadingPresenter.cpp b/Vates/VatesAPI/src/SQWLoadingPresenter.cpp
index 537d14a4481..7e51bd61e9f 100644
--- a/Vates/VatesAPI/src/SQWLoadingPresenter.cpp
+++ b/Vates/VatesAPI/src/SQWLoadingPresenter.cpp
@@ -110,7 +110,7 @@ namespace Mantid
         IMDDimension_const_sptr inDim = eventWs->getDimension(d);
         axisLabels.push_back(makeAxisTitle(inDim));
         //Copy the dimension, but set the ID and name to be the same. This is an assumption in bintohistoworkspace.
-        MDHistoDimension_sptr dim(new MDHistoDimension(inDim->getName(), inDim->getName(), inDim->getUnits(), inDim->getMinimum(), inDim->getMaximum(), size_t(10)));
+        MDHistoDimension_sptr dim(new MDHistoDimension(inDim->getName(), inDim->getName(), inDim->getMDFrame(), inDim->getMinimum(), inDim->getMaximum(), size_t(10)));
         dimensions.push_back(dim);
       }
 
-- 
GitLab