From 3b3a0b93a75d11a570e7e986ad4cf8b454eb1d6b Mon Sep 17 00:00:00 2001 From: Alex Buts <Alex.Buts@stfc.ac.uk> Date: Wed, 3 Oct 2012 16:52:57 +0100 Subject: [PATCH] refs #5871 this should fix it + minor modifications to logManager&Run to avoid "hiden funtcion" warnings. --- .../API/inc/MantidAPI/ITableWorkspace.h | 26 +++++++++++++++-- .../Framework/API/inc/MantidAPI/LogManager.h | 5 ++++ Code/Mantid/Framework/API/inc/MantidAPI/Run.h | 2 +- Code/Mantid/Framework/API/src/LogManager.cpp | 1 + Code/Mantid/Framework/API/src/Run.cpp | 16 +++++----- .../Algorithms/src/FilterByLogValue.cpp | 8 ++--- .../DataObjects/test/TableWorkspaceTest.h | 10 +++++++ .../MDAlgorithms/src/ConvertToMD.cpp | 6 ++-- .../src/PreprocessDetectorsToMD.cpp | 29 ++++++++----------- .../test/PreprocessDetectorsToMDTest.h | 24 +++++++-------- .../Framework/MDEvents/src/ConvToMDBase.cpp | 3 +- .../Framework/MDEvents/src/MDTransfModQ.cpp | 2 +- .../Framework/MDEvents/src/MDTransfQ3D.cpp | 2 +- .../MDEvents/src/UnitsConversionHelper.cpp | 4 +-- .../src/WorkspaceCreationHelper.cpp | 19 ++++++------ 15 files changed, 96 insertions(+), 61 deletions(-) diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/ITableWorkspace.h b/Code/Mantid/Framework/API/inc/MantidAPI/ITableWorkspace.h index 57e2bf32a9b..9cfe1cf973d 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/ITableWorkspace.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/ITableWorkspace.h @@ -8,7 +8,7 @@ #include "MantidAPI/Workspace.h" #include "MantidAPI/Column.h" #include "MantidKernel/V3D.h" -#include "MantidKernel/PropertyManager.h" +#include "MantidAPI/LogManager.h" #include <boost/shared_ptr.hpp> #include <boost/lexical_cast.hpp> @@ -125,11 +125,25 @@ public: // ===================================================================================== -class ITableWorkspace_DllExport ITableWorkspace: public API::Workspace, virtual public Kernel::PropertyManager +class ITableWorkspace_DllExport ITableWorkspace: public API::Workspace { public: + ///Constructor + ITableWorkspace():m_LogManager(new API::LogManager) + {} /// Virtual destructor. virtual ~ITableWorkspace(){} + /// Copy constructor + ITableWorkspace(const ITableWorkspace &other) + { + m_LogManager = boost::make_shared<API::LogManager>(*other.m_LogManager); + } + /// Operator = + ITableWorkspace & operator=(const ITableWorkspace &rhs) + { + if(&rhs != this)m_LogManager = boost::make_shared<API::LogManager>(*rhs.m_LogManager); + return *this; + } /// Return the workspace typeID virtual const std::string id() const{return "ITableWorkspace";} @@ -152,6 +166,10 @@ public: } return ok; } + /**Get access to shared pointer containing workspace porperties */ + API::LogManager_sptr logs(){return m_LogManager;} + /**Get constant access to shared pointer containing workspace porperties */ + API::LogManager_const_sptr getLogs()const{return m_LogManager;} /// Removes a column. virtual void removeColumn( const std::string& name) = 0; @@ -346,9 +364,13 @@ protected: c->remove(index); } + API::LogManager_sptr m_LogManager; + private: /// Logger static Kernel::Logger& g_log; + // Non-copyable, non-assignable + }; diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/LogManager.h b/Code/Mantid/Framework/API/inc/MantidAPI/LogManager.h index acf44c860a3..0704d670541 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/LogManager.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/LogManager.h @@ -162,6 +162,11 @@ namespace Mantid /// Cache for the retrieved single values mutable SingleValueCache m_singleValueCache; }; + ///shared pointer to the logManager base class + typedef boost::shared_ptr<LogManager> LogManager_sptr; + ///shared pointer to the logManager base class (const version) + typedef boost::shared_ptr<const LogManager> LogManager_const_sptr; + /** * Add a property of a specified type (Simply creates a Kernel::Property of that type diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/Run.h b/Code/Mantid/Framework/API/inc/MantidAPI/Run.h index 5af65e64df5..aab4704ada7 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/Run.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/Run.h @@ -61,7 +61,7 @@ namespace Mantid /// Filter the logs by time void filterByTime(const Kernel::DateAndTime start, const Kernel::DateAndTime stop); /// Split the logs based on the given intervals - void splitByTime(Kernel::TimeSplitterType& splitter, std::vector< Run * > outputs) const; + void splitByTime(Kernel::TimeSplitterType& splitter, std::vector< LogManager * > outputs) const; /// Return an approximate memory size for the object in bytes size_t getMemorySize() const; diff --git a/Code/Mantid/Framework/API/src/LogManager.cpp b/Code/Mantid/Framework/API/src/LogManager.cpp index a6ad0db14cc..a5637a3a78b 100644 --- a/Code/Mantid/Framework/API/src/LogManager.cpp +++ b/Code/Mantid/Framework/API/src/LogManager.cpp @@ -426,6 +426,7 @@ Kernel::Logger& LogManager::g_log = Kernel::Logger::get("LogManager"); INSTANTIATE(double); INSTANTIATE(int); + INSTANTIATE(uint32_t); INSTANTIATE(std::string); INSTANTIATE(bool); /// @endcond diff --git a/Code/Mantid/Framework/API/src/Run.cpp b/Code/Mantid/Framework/API/src/Run.cpp index 4ecdcfb9176..9c95c177618 100644 --- a/Code/Mantid/Framework/API/src/Run.cpp +++ b/Code/Mantid/Framework/API/src/Run.cpp @@ -136,21 +136,23 @@ Kernel::Logger& Run::g_log = Kernel::Logger::get("Run"); * @param splitter :: TimeSplitterType with the intervals and destinations. * @param outputs :: Vector of output runs. */ - void Run::splitByTime(TimeSplitterType& splitter, std::vector< Run * > outputs) const + void Run::splitByTime(TimeSplitterType& splitter, std::vector< LogManager * > outputs) const { - size_t n = outputs.size(); - std::vector<LogManager *> outputsBase(outputs.begin(),outputs.end()); - LogManager::splitByTime(splitter,outputsBase); + + //std::vector<LogManager *> outputsBase(outputs.begin(),outputs.end()); + LogManager::splitByTime(splitter,outputs); + size_t n = outputs.size(); //Re-integrate proton charge of all outputs for (size_t i=0; i<n; i++) { - if (outputsBase[i]) + if (outputs[i]) { - outputs[i] = dynamic_cast<Run *>(outputsBase[i]); - outputs[i]->integrateProtonCharge(); + auto run = dynamic_cast<Run *>(outputs[i]); + if(run)run->integrateProtonCharge(); } } + } diff --git a/Code/Mantid/Framework/Algorithms/src/FilterByLogValue.cpp b/Code/Mantid/Framework/Algorithms/src/FilterByLogValue.cpp index 8e950051cf7..afb4a8e3394 100644 --- a/Code/Mantid/Framework/Algorithms/src/FilterByLogValue.cpp +++ b/Code/Mantid/Framework/Algorithms/src/FilterByLogValue.cpp @@ -251,12 +251,12 @@ void FilterByLogValue::exec() PARALLEL_CHECK_INTERUPT_REGION //To split/filter the runs, first you make a vector with just the one output run - std::vector< Run *> output_runs; - Run * output_run = new Run(inputWS->mutableRun()); + std::vector< LogManager *> output_runs; + LogManager * output_run = new Run(inputWS->mutableRun()); output_runs.push_back( output_run ); inputWS->run().splitByTime(splitter, output_runs); // Set the output back in the input - inputWS->mutableRun() = *output_runs[0]; + inputWS->mutableRun() = *(static_cast<Run*>(output_runs[0])); inputWS->mutableRun().integrateProtonCharge(); //Cast the outputWS to the matrixOutputWS and save it @@ -296,7 +296,7 @@ void FilterByLogValue::exec() outputWS->doneAddingEventLists(); //To split/filter the runs, first you make a vector with just the one output run - std::vector< Run *> output_runs; + std::vector< LogManager *> output_runs; output_runs.push_back( &outputWS->mutableRun() ); inputWS->run().splitByTime(splitter, output_runs); diff --git a/Code/Mantid/Framework/DataObjects/test/TableWorkspaceTest.h b/Code/Mantid/Framework/DataObjects/test/TableWorkspaceTest.h index 4acabec8f69..b4b8ac513d9 100644 --- a/Code/Mantid/Framework/DataObjects/test/TableWorkspaceTest.h +++ b/Code/Mantid/Framework/DataObjects/test/TableWorkspaceTest.h @@ -404,6 +404,16 @@ public: } } + void testAddProperty() + { + TableWorkspace tw(3); + TS_ASSERT_THROWS_NOTHING(tw.logs()->addProperty("SomeInt",int(10))); + TS_ASSERT_EQUALS(10,tw.getLogs()->getPropertyValueAsType<int>("SomeInt")); + + TS_ASSERT_THROWS_NOTHING(tw.logs()->addProperty<double>("SomeDouble",100)); + TS_ASSERT_DELTA(100,tw.getLogs()->getPropertyValueAsType<double>("SomeDouble"),1.e-7); + } + }; diff --git a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMD.cpp index a62dde0e79d..22547f3ce18 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMD.cpp @@ -401,7 +401,7 @@ DataObjects::TableWorkspace_const_sptr ConvertToMD::preprocessDetectorsPositions { // let's take at least some precaution to ensure that instrument have not changed std::string currentWSInstrumentName = InWS2D->getInstrument()->getName(); - std::string oldInstrName = std::string(TargTableWS->getProperty("InstrumentName")); + std::string oldInstrName = TargTableWS->getLogs()->getPropertyValueAsType<std::string>("InstrumentName"); if(oldInstrName==currentWSInstrumentName) return TargTableWS; } @@ -447,7 +447,7 @@ DataObjects::TableWorkspace_const_sptr ConvertToMD::preprocessDetectorsPositions // in direct or indirect mode input ws has to have input energy if(Emode==CnvrtToMD::Direct||Emode==CnvrtToMD::Indir) { - double m_Ei = TargTableWS->getProperty("Ei"); + double m_Ei = TargTableWS->getLogs()->getPropertyValueAsType<double>("Ei"); if(isNaN(m_Ei)) { // Direct mode needs Ei @@ -458,7 +458,7 @@ DataObjects::TableWorkspace_const_sptr ConvertToMD::preprocessDetectorsPositions if(!eFixed) throw(std::invalid_argument("Input neutron's energy has to be defined in inelastic mode ")); - uint32_t NDetectors = TargTableWS->getProperty("ActualDetectorsNum"); + uint32_t NDetectors = TargTableWS->getLogs()->getPropertyValueAsType<uint32_t>("ActualDetectorsNum"); for(uint32_t i=0;i<NDetectors;i++) if(isNaN(*(eFixed+i)))throw(std::invalid_argument("Undefined eFixed energy for detector N: "+boost::lexical_cast<std::string>(i))); } diff --git a/Code/Mantid/Framework/MDAlgorithms/src/PreprocessDetectorsToMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/PreprocessDetectorsToMD.cpp index 09e583cc6a8..b66ac11ec74 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/PreprocessDetectorsToMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/PreprocessDetectorsToMD.cpp @@ -117,14 +117,8 @@ namespace Mantid // sin^2(Theta) // std::vector<double> SinThetaSq; - targWS->declareProperty(new Kernel::PropertyWithValue<std::string>("InstrumentName",""),"The name which should unique identify current instrument"); - targWS->declareProperty(new Kernel::PropertyWithValue<double>("L1",0),"L1 is the source to sample distance"); - targWS->declareProperty(new Kernel::PropertyWithValue<double>("Ei",EMPTY_DBL()),"Incident energy for Direct or Analysis energy for indirect instrument"); - targWS->declareProperty(new Kernel::PropertyWithValue<uint32_t>("ActualDetectorsNum",0),"The actual number of detectors receivinv signal"); - targWS->declareProperty(new Kernel::PropertyWithValue<bool>("FakeDetectors",false),"If the detectors were actually processed from real instrument or generated for some fake one "); - double Efi = getEi(inputWS); - targWS->setProperty<double>("Ei",Efi); + targWS->logs()->addProperty<double>("Ei",Efi,true); return targWS; } @@ -150,7 +144,7 @@ namespace Mantid try { double L1 = source->getDistance(*sample); - targWS->setProperty<double>("L1",L1); + targWS->logs()->addProperty<double>("L1",L1,true); g_log.debug() << "Source-sample distance: " << L1 << std::endl; } catch (Kernel::Exception::NotFoundError &) @@ -159,8 +153,8 @@ namespace Mantid } // Instrument name std::string InstrName=instrument->getName(); - targWS->setProperty<std::string>("InstrumentName",InstrName); - targWS->setProperty<bool>("FakeDetectors",false); + targWS->logs()->addProperty<std::string>("InstrumentName",InstrName,true); // "The name which should unique identify current instrument"); + targWS->logs()->addProperty<bool>("FakeDetectors",false,true); // get access to the workspace memory auto &sp2detMap = targWS->getColVector<size_t>("spec2detMap"); @@ -172,7 +166,7 @@ namespace Mantid auto &detDir = targWS->getColVector<Kernel::V3D>("DetDirections"); // Efixed; do we need one and does one exist? - double Efi = targWS->getProperty("Ei"); + double Efi = targWS->getLogs()->getPropertyValueAsType<double>("Ei"); float *pEfixedArray(NULL); const Geometry::ParameterMap& pmap = inputWS->constInstrumentParameters(); if (m_getEFixed) @@ -238,7 +232,7 @@ namespace Mantid { try { - Geometry::Parameter_sptr par = pmap.getRecursive(spDet.get(),"Efixed"); + Geometry::Parameter_sptr par = pmap.getRecursive(spDet.get(),"eFixed"); if (par) Efi = par->value<double>(); } catch(std::runtime_error&) @@ -251,7 +245,7 @@ namespace Mantid if(i%div==0) theProgress.report(i,"Preprocessing detectors"); } - targWS->setProperty<uint32_t>("ActualDetectorsNum",liveDetectorsCount); + targWS->logs()->addProperty<uint32_t>("ActualDetectorsNum",liveDetectorsCount,true); theProgress.report(); g_log.information()<<"finished preprocessing detectors locations, found: "<<liveDetectorsCount<<" detectors out of: "<<nHist<<" Histohrams\n"; @@ -262,10 +256,11 @@ namespace Mantid { UNUSED_ARG(inputWS); // set sample-detector postion equal to 1; - targWS->setProperty<double>("L1",1.); + targWS->logs()->addProperty<double>("L1",1.,true); // - targWS->setProperty<std::string>("InstrumentName","FakeInstrument"); - targWS->setProperty<bool>("FakeDetectors",true); + targWS->logs()->addProperty<std::string>("InstrumentName","FakeInstrument",true); + targWS->logs()->addProperty<bool>("FakeDetectors",true,true); + // get access to the workspace memory @@ -280,7 +275,7 @@ namespace Mantid //// progress messave appearence size_t nHist = targWS->rowCount(); - targWS->setProperty<uint32_t>("ActualDetectorsNum",uint32_t(nHist)); + targWS->logs()->addProperty<uint32_t>("ActualDetectorsNum",uint32_t(nHist),true); double polar(0); // Loop over the spectra diff --git a/Code/Mantid/Framework/MDAlgorithms/test/PreprocessDetectorsToMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/PreprocessDetectorsToMDTest.h index c737f6611c1..8e66a7d78f7 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/PreprocessDetectorsToMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/PreprocessDetectorsToMDTest.h @@ -71,10 +71,10 @@ void testPreprocessDetectors() uint32_t nDet(0); std::string InstrName; bool fakeDetectrors(false); - TS_ASSERT_THROWS_NOTHING(nDet = tws->getProperty("ActualDetectorsNum")); - TS_ASSERT_THROWS_NOTHING(L1 = tws->getProperty("L1")); - TS_ASSERT_THROWS_NOTHING(InstrName =std::string(tws->getProperty("InstrumentName"))); - TS_ASSERT_THROWS_NOTHING(fakeDetectrors=tws->getProperty("FakeDetectors")); + TS_ASSERT_THROWS_NOTHING(nDet = tws->getLogs()->getPropertyValueAsType<uint32_t>("ActualDetectorsNum")); + TS_ASSERT_THROWS_NOTHING(L1 = tws->getLogs()->getPropertyValueAsType<double>("L1")); + TS_ASSERT_THROWS_NOTHING(InstrName =tws->getLogs()->getPropertyValueAsType<std::string>("InstrumentName")); + TS_ASSERT_THROWS_NOTHING(fakeDetectrors=tws->getLogs()->getPropertyValueAsType<bool>("FakeDetectors")); TS_ASSERT_DELTA(10,L1,1.e-11); TS_ASSERT_EQUALS(4,nDet); @@ -115,10 +115,10 @@ void testFakeDetectors() uint32_t nDet(0); std::string InstrName; bool fakeDetectrors(false); - TS_ASSERT_THROWS_NOTHING(nDet = tws->getProperty("ActualDetectorsNum")); - TS_ASSERT_THROWS_NOTHING(L1 = tws->getProperty("L1")); - TS_ASSERT_THROWS_NOTHING(InstrName =std::string(tws->getProperty("InstrumentName"))); - TS_ASSERT_THROWS_NOTHING(fakeDetectrors=tws->getProperty("FakeDetectors")); + TS_ASSERT_THROWS_NOTHING(nDet = tws->getLogs()->getPropertyValueAsType<uint32_t>("ActualDetectorsNum")); + TS_ASSERT_THROWS_NOTHING(L1 = tws->getLogs()->getPropertyValueAsType<double>("L1")); + TS_ASSERT_THROWS_NOTHING(InstrName =tws->getLogs()->getPropertyValueAsType<std::string>("InstrumentName")); + TS_ASSERT_THROWS_NOTHING(fakeDetectrors=tws->getLogs()->getPropertyValueAsType<bool>("FakeDetectors")); TS_ASSERT_DELTA(1,L1,1.e-11); TS_ASSERT_EQUALS(4,nDet); @@ -145,10 +145,10 @@ void testTheAlg() uint32_t nDet(0); std::string InstrName; bool fakeDetectrors(false); - TS_ASSERT_THROWS_NOTHING(nDet = tws->getProperty("ActualDetectorsNum")); - TS_ASSERT_THROWS_NOTHING(L1 = tws->getProperty("L1")); - TS_ASSERT_THROWS_NOTHING(InstrName =std::string(tws->getProperty("InstrumentName"))); - TS_ASSERT_THROWS_NOTHING(fakeDetectrors=tws->getProperty("FakeDetectors")); + TS_ASSERT_THROWS_NOTHING(nDet = tws->getLogs()->getPropertyValueAsType<uint32_t>("ActualDetectorsNum")); + TS_ASSERT_THROWS_NOTHING(L1 = tws->getLogs()->getPropertyValueAsType<double>("L1")); + TS_ASSERT_THROWS_NOTHING(InstrName =tws->getLogs()->getPropertyValueAsType<std::string>("InstrumentName")); + TS_ASSERT_THROWS_NOTHING(fakeDetectrors=tws->getLogs()->getPropertyValueAsType<bool>("FakeDetectors")); TS_ASSERT_DELTA(10,L1,1.e-11); TS_ASSERT_EQUALS(4,nDet); diff --git a/Code/Mantid/Framework/MDEvents/src/ConvToMDBase.cpp b/Code/Mantid/Framework/MDEvents/src/ConvToMDBase.cpp index a9d8618c595..2f5d9fe7c4f 100644 --- a/Code/Mantid/Framework/MDEvents/src/ConvToMDBase.cpp +++ b/Code/Mantid/Framework/MDEvents/src/ConvToMDBase.cpp @@ -24,7 +24,8 @@ namespace Mantid // check if detector information has been precalculated: if(!WSD.m_PreprDetTable)throw(std::runtime_error("Detector information has to be precalculated before ConvToMDBase::initialize is deployed")); - m_NSpectra = WSD.m_PreprDetTable->getProperty("ActualDetectorsNum"); + // number of valid spectra is equal to actual number of valid detectors in spectra-det map + m_NSpectra = WSD.m_PreprDetTable->getLogs()->getPropertyValueAsType<uint32_t>("ActualDetectorsNum"); m_detIDMap = WSD.m_PreprDetTable->getColVector<size_t>("detIDMap"); m_detID = WSD.m_PreprDetTable->getColVector<int32_t>("DetectorID"); diff --git a/Code/Mantid/Framework/MDEvents/src/MDTransfModQ.cpp b/Code/Mantid/Framework/MDEvents/src/MDTransfModQ.cpp index 941771a0361..926677279ce 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDTransfModQ.cpp +++ b/Code/Mantid/Framework/MDEvents/src/MDTransfModQ.cpp @@ -198,7 +198,7 @@ namespace Mantid if(m_Emode == CnvrtToMD::Direct||m_Emode == CnvrtToMD::Indir) { // energy needed in inelastic case - m_Ei = ConvParams.m_PreprDetTable->getProperty("Ei"); + m_Ei = ConvParams.m_PreprDetTable->getLogs()->getPropertyValueAsType<double>("Ei"); // the wave vector of incident neutrons; m_Ki=sqrt(m_Ei/PhysicalConstants::E_mev_toNeutronWavenumberSq); diff --git a/Code/Mantid/Framework/MDEvents/src/MDTransfQ3D.cpp b/Code/Mantid/Framework/MDEvents/src/MDTransfQ3D.cpp index de3dc18374c..902fd9a8d4c 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDTransfQ3D.cpp +++ b/Code/Mantid/Framework/MDEvents/src/MDTransfQ3D.cpp @@ -149,7 +149,7 @@ namespace Mantid if(m_Emode == CnvrtToMD::Direct||m_Emode == CnvrtToMD::Indir) { // energy needed in inelastic case - m_Ei = ConvParams.m_PreprDetTable->getProperty("Ei"); + m_Ei = ConvParams.m_PreprDetTable->getLogs()->getPropertyValueAsType<double>("Ei"); // the wave vector of incident neutrons; m_Ki=sqrt(m_Ei/PhysicalConstants::E_mev_toNeutronWavenumberSq); diff --git a/Code/Mantid/Framework/MDEvents/src/UnitsConversionHelper.cpp b/Code/Mantid/Framework/MDEvents/src/UnitsConversionHelper.cpp index 8b7ad71bc2e..c8291dc9600 100644 --- a/Code/Mantid/Framework/MDEvents/src/UnitsConversionHelper.cpp +++ b/Code/Mantid/Framework/MDEvents/src/UnitsConversionHelper.cpp @@ -90,12 +90,12 @@ void UnitsConversionHelper::initialize(const MDWSDescription &targetWSDescr, con m_pTwoThetas = &(targetWSDescr.m_PreprDetTable->getColVector<double>("TwoTheta")); m_pL2s = &(targetWSDescr.m_PreprDetTable->getColVector<double>("L2")); - m_L1 = targetWSDescr.m_PreprDetTable->getProperty("L1"); + m_L1 = targetWSDescr.m_PreprDetTable->getLogs()->getPropertyValueAsType<double>("L1"); m_Emode = (int)targetWSDescr.getEMode(); // get efix - m_Efix = targetWSDescr.m_PreprDetTable->getProperty("Ei"); + m_Efix = targetWSDescr.m_PreprDetTable->getLogs()->getPropertyValueAsType<double>("Ei"); m_pEfixedArray=NULL; if(m_Emode==(int)CnvrtToMD::Indir) m_pEfixedArray = targetWSDescr.m_PreprDetTable->getColDataArray<float>("eFixed"); } diff --git a/Code/Mantid/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp b/Code/Mantid/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp index 149c3666fa1..f8d81b416f4 100644 --- a/Code/Mantid/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp +++ b/Code/Mantid/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp @@ -1113,11 +1113,9 @@ namespace WorkspaceCreationHelper // sin^2(Theta) // std::vector<double> SinThetaSq; - targWS->declareProperty(new Kernel::PropertyWithValue<std::string>("InstrumentName",""),"The name which should unique identify current instrument"); - targWS->declareProperty(new Kernel::PropertyWithValue<double>("L1",0),"L1 is the source to sample distance"); - targWS->declareProperty(new Kernel::PropertyWithValue<double>("Ei",EMPTY_DBL()),"Incident energy for Direct or Analysis energy for indirect instrument"); - targWS->declareProperty(new Kernel::PropertyWithValue<uint32_t>("ActualDetectorsNum",0),"The actual number of detectors receivinv signal"); - targWS->declareProperty(new Kernel::PropertyWithValue<bool>("FakeDetectors",false),"If the detectors were actually processed from real instrument or generated for some fake one "); + + + //,"If the detectors were actually processed from real instrument or generated for some fake one "); return targWS; } @@ -1139,7 +1137,7 @@ namespace WorkspaceCreationHelper try { double L1 = source->getDistance(*sample); - targWS->setProperty<double>("L1",L1); + targWS->logs()->addProperty<double>("L1",L1,true); } catch (Kernel::Exception::NotFoundError &) { @@ -1147,8 +1145,9 @@ namespace WorkspaceCreationHelper } // Instrument name std::string InstrName=instrument->getName(); - targWS->setProperty<std::string>("InstrumentName",InstrName); - targWS->setProperty<bool>("FakeDetectors",false); + targWS->logs()->addProperty<std::string>("InstrumentName",InstrName,true); + targWS->logs()->addProperty<bool>("FakeDetectors",false,true); + targWS->logs()->addProperty<double>("Ei",Ei,true); //"Incident energy for Direct or Analysis energy for indirect instrument"); // get access to the workspace memory auto &sp2detMap = targWS->getColVector<size_t>("spec2detMap"); @@ -1159,7 +1158,7 @@ namespace WorkspaceCreationHelper auto &Azimuthal = targWS->getColVector<double>("Azimuthal"); auto &detDir = targWS->getColVector<Kernel::V3D>("DetDirections"); - targWS->setProperty<double>("Ei",Ei); + //// progress messave appearence size_t nHist = targWS->rowCount(); @@ -1215,7 +1214,7 @@ namespace WorkspaceCreationHelper } - targWS->setProperty<uint32_t>("ActualDetectorsNum",liveDetectorsCount); + targWS->logs()->addProperty<uint32_t>("ActualDetectorsNum",liveDetectorsCount,true); //,"The actual number of detectors receivinv signal"); } -- GitLab