From a4c5c9c4aa90a9b4cbae457ba86bf865a5eead05 Mon Sep 17 00:00:00 2001
From: Matt King <matthew.king@stfc.ac.uk>
Date: Fri, 9 Oct 2015 15:17:33 +0100
Subject: [PATCH] Added progress report to ConvertToReflectometryQ

Refs #13508
---
 .../src/ConvertToReflectometryQ.cpp            | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp b/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp
index 1431b38ae0e..fe2dfbcc3e2 100644
--- a/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp
+++ b/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp
@@ -353,40 +353,54 @@ void ConvertToReflectometryQ::exec() {
 
   TableWorkspace_sptr vertexes =
       boost::make_shared<Mantid::DataObjects::TableWorkspace>();
-
+  Progress transSelectionProg(this, 0.0, 0.1, 2);
   if (outputAsMDWorkspace) {
+    transSelectionProg.report("Choosing Transformation");
     if (transMethod == centerTransform()) {
       auto outputMDWS = transform->executeMD(inputWs, bc);
+      Progress transPerformProg(this, 0.1, 0.7, 5);
+      transPerformProg.report("Performed transformation");
       // Copy ExperimentInfo (instrument, run, sample) to the output WS
       ExperimentInfo_sptr ei(inputWs->cloneExperimentInfo());
       outputMDWS->addExperimentInfo(ei);
       outputWS = outputMDWS;
     } else if (transMethod == normPolyTransform()) {
+      Progress transPerformProg(this, 0.1, 0.7, 5);
       const bool dumpVertexes = this->getProperty("DumpVertexes");
       auto vertexesTable = vertexes;
       // perform the normalised polygon transformation
+      transPerformProg.report("Performing Transformation");
       auto normPolyTrans = transform->executeNormPoly(
           inputWs, vertexesTable, dumpVertexes, outputDimensions);
       // copy any experiment info from input workspace
       normPolyTrans->copyExperimentInfoFrom(inputWs.get());
       // produce MDHistoWorkspace from normPolyTrans workspace.
+      Progress outputToMDProg(this, 0.7, 0.75, 10);
       auto outputMDWS = transform->executeMDNormPoly(normPolyTrans);
       ExperimentInfo_sptr ei(normPolyTrans->cloneExperimentInfo());
       outputMDWS->addExperimentInfo(ei);
       outputWS = outputMDWS;
+      outputToMDProg.report("Successfully output to MD");
     } else {
       throw std::runtime_error("Unknown rebinning method: " + transMethod);
     }
   } else if (transMethod == normPolyTransform()) {
+    transSelectionProg.report("Choosing Transformation");
+    Progress transPerformProg(this, 0.1, 0.7, 5);
     const bool dumpVertexes = this->getProperty("DumpVertexes");
     auto vertexesTable = vertexes;
     // perform the normalised polygon transformation
+    transPerformProg.report("Performing Transformation");
     auto output2DWS = transform->executeNormPoly(
         inputWs, vertexesTable, dumpVertexes, outputDimensions);
     // copy any experiment info from input workspace
     output2DWS->copyExperimentInfoFrom(inputWs.get());
     outputWS = output2DWS;
+    transPerformProg.report("Transformation Complete");
   } else if (transMethod == centerTransform()) {
+    transSelectionProg.report("Choosing Transformation");
+    Progress transPerformProg(this, 0.1, 0.7, 5);
+    transPerformProg.report("Performing Transformation");
     auto output2DWS = transform->execute(inputWs);
     output2DWS->copyExperimentInfoFrom(inputWs.get());
     outputWS = output2DWS;
@@ -397,6 +411,8 @@ void ConvertToReflectometryQ::exec() {
   // Execute the transform and bind to the output.
   setProperty("OutputWorkspace", outputWS);
   setProperty("OutputVertexes", vertexes);
+  Progress setPropertyProg(this, 0.8, 1.0, 2);
+  setPropertyProg.report("Success");
 }
 
 } // namespace Mantid
-- 
GitLab