From a7d1ae57a7eb71e781c7336f4096e18b13a0db84 Mon Sep 17 00:00:00 2001 From: Roman Tolchenov <roman.tolchenov@stfc.ac.uk> Date: Mon, 1 Dec 2014 15:11:50 +0000 Subject: [PATCH] Re #10123. Renamed column type names. --- .../test/CheckWorkspacesMatchTest.h | 10 ++-- .../DataHandling/src/LoadNexusProcessed.cpp | 12 ++-- .../test/LoadNexusProcessedTest.h | 23 +++++--- .../test/SaveNexusProcessedTest.h | 55 +++++++++--------- .../Framework/DataObjects/src/TableColumn.cpp | 17 +----- .../DataObjects/test/TableWorkspaceTest.h | 6 +- .../src/PreprocessDetectorsToMD.cpp | 6 +- .../api/src/Exports/ITableWorkspace.cpp | 2 +- .../src/WorkspaceCreationHelper.cpp | 6 +- Test/AutoTestData/SavedTableWorkspace.nxs | Bin 20136 -> 20640 bytes 10 files changed, 67 insertions(+), 70 deletions(-) diff --git a/Code/Mantid/Framework/Algorithms/test/CheckWorkspacesMatchTest.h b/Code/Mantid/Framework/Algorithms/test/CheckWorkspacesMatchTest.h index 38c14708fdb..7bb087b2266 100644 --- a/Code/Mantid/Framework/Algorithms/test/CheckWorkspacesMatchTest.h +++ b/Code/Mantid/Framework/Algorithms/test/CheckWorkspacesMatchTest.h @@ -900,9 +900,9 @@ private: auto table = WorkspaceFactory::Instance().createTable(); // One column of each type table->addColumn("int","int"); - table->addColumn("int32_t","int32"); + table->addColumn("uint","uint"); table->addColumn("long64","int64"); - table->addColumn("size_t","uint"); + table->addColumn("ulong64","uint64"); table->addColumn("float","float"); table->addColumn("double","double"); table->addColumn("bool","bool"); @@ -911,13 +911,13 @@ private: // A few rows TableRow row1 = table->appendRow(); - row1 << -1 << static_cast<int32_t>(0) << static_cast<int64_t>(1) << static_cast<size_t>(10) + row1 << -1 << static_cast<uint32_t>(0) << static_cast<int64_t>(1) << static_cast<uint64_t>(10) << 5.5f << -9.9 << true << "Hello" << Mantid::Kernel::V3D(); TableRow row2 = table->appendRow(); - row2 << 1 << static_cast<int32_t>(-2) << static_cast<int64_t>(-2) << static_cast<size_t>(100) + row2 << 1 << static_cast<uint32_t>(2) << static_cast<int64_t>(-2) << static_cast<uint64_t>(100) << 0.0f << 101.0 << false << "World" << Mantid::Kernel::V3D(-1,3,4); TableRow row3 = table->appendRow(); - row3 << 6 << static_cast<int32_t>(3) << static_cast<int64_t>(0) << static_cast<size_t>(0) + row3 << 6 << static_cast<uint32_t>(3) << static_cast<int64_t>(0) << static_cast<uint64_t>(0) << -99.0f << 0.0 << false << "!" << Mantid::Kernel::V3D(1,6,10); return table; diff --git a/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp b/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp index f17fd53b360..172b02d2b82 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp @@ -827,14 +827,18 @@ int64_t index_start = indices[wi]; { loadNumericColumn<int>( nx_tw, dataSetName, workspace, "int" ); } + else if (info.type == NX_UINT32) + { + loadNumericColumn<uint32_t>( nx_tw, dataSetName, workspace, "uint" ); + } else if (info.type == NX_INT64) { loadNumericColumn<int64_t>( nx_tw, dataSetName, workspace, "long64" ); } - //else if (info.type == NX_UINT64) - //{ - // loadNumericColumn<size_t>( nx_tw, dataSetName, workspace, "ulong64" ); - //} + else if (info.type == NX_UINT64) + { + loadNumericColumn<int64_t>( nx_tw, dataSetName, workspace, "ulong64" ); + } else if (info.type == NX_FLOAT32) { loadNumericColumn<float>( nx_tw, dataSetName, workspace, "float" ); diff --git a/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h b/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h index 77a74008ad0..86d9261bcfb 100644 --- a/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h +++ b/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h @@ -547,7 +547,7 @@ public: TS_ASSERT( alg.execute()); TableWorkspace_const_sptr ws = AnalysisDataService::Instance().retrieveWS<TableWorkspace>(wsName); - TS_ASSERT_EQUALS( ws->columnCount(), 8); + TS_ASSERT_EQUALS( ws->columnCount(), 10); TS_ASSERT_EQUALS( ws->rowCount(), 4); try @@ -581,6 +581,13 @@ public: TS_ASSERT_EQUALS( column[2], 2); TS_ASSERT_EQUALS( column[3], 4); } + { + ConstColumnVector<uint32_t> column = ws->getVector("UInteger"); + TS_ASSERT_EQUALS( column[0], 35); + TS_ASSERT_EQUALS( column[1], 33); + TS_ASSERT_EQUALS( column[2], 32); + TS_ASSERT_EQUALS( column[3], 34); + } { ConstColumnVector<int64_t> column = ws->getVector("Integer64"); TS_ASSERT_EQUALS( column[0], 15); @@ -595,13 +602,13 @@ public: TS_ASSERT_DELTA( column[2], 0.2, 0.000001 ); TS_ASSERT_DELTA( column[3], 0.4, 0.000001 ); } - //{ - // ConstColumnVector<size_t> column = ws->getVector("Size"); - // TS_ASSERT_EQUALS( column[0], 25); - // TS_ASSERT_EQUALS( column[1], 23); - // TS_ASSERT_EQUALS( column[2], 22); - // TS_ASSERT_EQUALS( column[3], 24); - //} + { + ConstColumnVector<uint64_t> column = ws->getVector("Size"); + TS_ASSERT_EQUALS( column[0], 25); + TS_ASSERT_EQUALS( column[1], 23); + TS_ASSERT_EQUALS( column[2], 22); + TS_ASSERT_EQUALS( column[3], 24); + } { ConstColumnVector<Boolean> column = ws->getVector("Bool"); TS_ASSERT( column[0] ); diff --git a/Code/Mantid/Framework/DataHandling/test/SaveNexusProcessedTest.h b/Code/Mantid/Framework/DataHandling/test/SaveNexusProcessedTest.h index 5424c5e887a..1d6ca9fafd1 100644 --- a/Code/Mantid/Framework/DataHandling/test/SaveNexusProcessedTest.h +++ b/Code/Mantid/Framework/DataHandling/test/SaveNexusProcessedTest.h @@ -405,7 +405,6 @@ public: { Poco::File(output_filename).remove(); } - const int nEntries = 3; const int nHist = 1; const int nBins = 1; @@ -583,14 +582,13 @@ public: data[1] = 10.2f; data[2] = 10.3f; } - table->addColumn("int", "UInt32Column"); - //table->addColumn("uint", "UInt32Column"); - //{ - // auto& data = table->getColVector<uint32_t>("UInt32Column"); - // data[0] = 15; - // data[1] = 12; - // data[2] = 13; - //} + table->addColumn("uint", "UInt32Column"); + { + auto& data = table->getColVector<uint32_t>("UInt32Column"); + data[0] = 15; + data[1] = 12; + data[2] = 13; + } table->addColumn("long64", "Int64Column"); { auto& data = table->getColVector<int64_t>("Int64Column"); @@ -598,14 +596,13 @@ public: data[1] = 22; data[2] = 23; } - table->addColumn("int", "SizeColumn"); - //table->addColumn("ulong64", "SizeColumn"); - //{ - // auto& data = table->getColVector<uint64_t>("SizeColumn"); - // data[0] = 35; - // data[1] = 32; - // data[2] = 33; - //} + table->addColumn("ulong64", "SizeColumn"); + { + auto& data = table->getColVector<uint64_t>("SizeColumn"); + data[0] = 35; + data[1] = 32; + data[2] = 33; + } table->addColumn("bool", "BoolColumn"); { auto& data = table->getColVector<Boolean>("BoolColumn"); @@ -661,12 +658,12 @@ public: doTestColumnData( "FloatColumn", savedNexus, expectedData ); } - //{ - // savedNexus.openData("column_4"); - // doTestColumnInfo( savedNexus, NX_UINT32, "", "UInt32Column" ); - // uint32_t expectedData[] = { 15, 12, 13 }; - // doTestColumnData( "UInt32Column", savedNexus, expectedData ); - //} + { + savedNexus.openData("column_4"); + doTestColumnInfo( savedNexus, NX_UINT32, "", "UInt32Column" ); + uint32_t expectedData[] = { 15, 12, 13 }; + doTestColumnData( "UInt32Column", savedNexus, expectedData ); + } { savedNexus.openData("column_5"); @@ -675,12 +672,12 @@ public: doTestColumnData( "Int64Column", savedNexus, expectedData ); } - //{ - // savedNexus.openData("column_6"); - // doTestColumnInfo( savedNexus, NX_UINT64, "", "SizeColumn" ); - // uint64_t expectedData[] = { 35, 32, 33 }; - // doTestColumnData( "SizeColumn", savedNexus, expectedData ); - //} + { + savedNexus.openData("column_6"); + doTestColumnInfo( savedNexus, NX_UINT64, "", "SizeColumn" ); + uint64_t expectedData[] = { 35, 32, 33 }; + doTestColumnData( "SizeColumn", savedNexus, expectedData ); + } { savedNexus.openData("column_7"); diff --git a/Code/Mantid/Framework/DataObjects/src/TableColumn.cpp b/Code/Mantid/Framework/DataObjects/src/TableColumn.cpp index 45fcc998acf..284d893888b 100644 --- a/Code/Mantid/Framework/DataObjects/src/TableColumn.cpp +++ b/Code/Mantid/Framework/DataObjects/src/TableColumn.cpp @@ -7,26 +7,15 @@ namespace Mantid namespace DataObjects { -//DECLARE_TABLECOLUMN(int32_t,int) -//DECLARE_TABLECOLUMN(uint32_t,uint) -//DECLARE_TABLECOLUMN(int64_t,long64) -//DECLARE_TABLECOLUMN(uint64_t,ulong64) -//DECLARE_TABLECOLUMN(float,float) -//DECLARE_TABLECOLUMN(double,double) -//DECLARE_TABLECOLUMN(API::Boolean,bool) -//DECLARE_TABLECOLUMN(std::string,str) -//DECLARE_TABLECOLUMN(Mantid::Kernel::V3D,V3D) - DECLARE_TABLECOLUMN(int,int) -DECLARE_TABLECOLUMN(int32_t,int32_t) -DECLARE_TABLECOLUMN(size_t,size_t) +DECLARE_TABLECOLUMN(uint32_t,uint) +DECLARE_TABLECOLUMN(int64_t,long64) +DECLARE_TABLECOLUMN(uint64_t,ulong64) DECLARE_TABLECOLUMN(float,float) DECLARE_TABLECOLUMN(double,double) DECLARE_TABLECOLUMN(API::Boolean,bool) DECLARE_TABLECOLUMN(std::string,str) DECLARE_TABLECOLUMN(Mantid::Kernel::V3D,V3D) -DECLARE_TABLECOLUMN(int64_t,long64) - } // namespace DataObjects } // namespace Mantid diff --git a/Code/Mantid/Framework/DataObjects/test/TableWorkspaceTest.h b/Code/Mantid/Framework/DataObjects/test/TableWorkspaceTest.h index 04b77d62579..cc934cddd2a 100644 --- a/Code/Mantid/Framework/DataObjects/test/TableWorkspaceTest.h +++ b/Code/Mantid/Framework/DataObjects/test/TableWorkspaceTest.h @@ -353,12 +353,12 @@ public: { TableWorkspace tw(3); - tw.addColumn("size_t","SizeT"); + tw.addColumn("ulong64","SizeT"); tw.addColumn("double","Double"); tw.addColumn("str","String"); - std::vector<size_t> &SizeTData = tw.getColVector<size_t>("SizeT"); + auto &SizeTData = tw.getColVector<uint64_t>("SizeT"); TS_ASSERT_THROWS(tw.getColVector<int>("Double"),std::runtime_error); std::vector<double> &DoublData = tw.getColVector<double>("Double"); std::vector<std::string> &StrData = tw.getColVector<std::string>("String"); @@ -374,7 +374,7 @@ public: StrData[1] = "2"; StrData[2] = "3"; - auto SizeTDataI = tw.getColVector<size_t>(0); + auto SizeTDataI = tw.getColVector<uint64_t>(0); TS_ASSERT_THROWS(tw.getColVector<int>(1),std::runtime_error); auto DoublDataI = tw.getColVector<double>(1); auto StrDataI = tw.getColVector<std::string>(2); diff --git a/Code/Mantid/Framework/MDAlgorithms/src/PreprocessDetectorsToMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/PreprocessDetectorsToMD.cpp index 2c69dccbbfc..5eecac35395 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/PreprocessDetectorsToMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/PreprocessDetectorsToMD.cpp @@ -109,11 +109,11 @@ namespace Mantid if(!targWS->addColumn("double","TwoTheta"))throw(std::runtime_error("Can not add column TwoTheta")); if(!targWS->addColumn("double","Azimuthal"))throw(std::runtime_error("Can not add column Azimuthal")); // the detector ID; - if(!targWS->addColumn("int32_t","DetectorID"))throw(std::runtime_error("Can not add column DetectorID")); + if(!targWS->addColumn("int","DetectorID"))throw(std::runtime_error("Can not add column DetectorID")); // stores spectra index which corresponds to a valid detector index; - if(!targWS->addColumn("size_t","detIDMap"))throw(std::runtime_error("Can not add column detIDMap")); + if(!targWS->addColumn("ulong64","detIDMap"))throw(std::runtime_error("Can not add column detIDMap")); // stores detector index which corresponds to the workspace index; - if(!targWS->addColumn("size_t","spec2detMap"))throw(std::runtime_error("Can not add column spec2detMap")); + if(!targWS->addColumn("ulong64","spec2detMap"))throw(std::runtime_error("Can not add column spec2detMap")); m_getIsMasked = this->getProperty("GetMaskState"); if(m_getIsMasked) // as bool is presented in vectors as a class, we are using int instead of bool diff --git a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp index 30b9fda8294..2d84276064e 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp @@ -33,7 +33,7 @@ namespace /// Boost macro for "looping" over builtin types #define BUILTIN_TYPES \ BOOST_PP_TUPLE_TO_LIST( \ - 6, (double, std::string, int, int64_t, float, size_t) \ + 7, (double, std::string, int, uint32_t, int64_t, float, uint64_t) \ ) #define USER_TYPES \ BOOST_PP_TUPLE_TO_LIST( \ diff --git a/Code/Mantid/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp b/Code/Mantid/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp index aa4b2597f84..3653b5674e6 100644 --- a/Code/Mantid/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp +++ b/Code/Mantid/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp @@ -1232,13 +1232,13 @@ namespace WorkspaceCreationHelper if (!targWS->addColumn("double", "Azimuthal")) throw(std::runtime_error("Can not add column Azimuthal")); // the detector ID; - if (!targWS->addColumn("int32_t", "DetectorID")) + if (!targWS->addColumn("int", "DetectorID")) throw(std::runtime_error("Can not add column DetectorID")); // stores spectra index which corresponds to a valid detector index; - if (!targWS->addColumn("size_t", "detIDMap")) + if (!targWS->addColumn("ulong64", "detIDMap")) throw(std::runtime_error("Can not add column detIDMap")); // stores detector index which corresponds to the workspace index; - if (!targWS->addColumn("size_t", "spec2detMap")) + if (!targWS->addColumn("ulong64", "spec2detMap")) throw(std::runtime_error("Can not add column spec2detMap")); // will see about that diff --git a/Test/AutoTestData/SavedTableWorkspace.nxs b/Test/AutoTestData/SavedTable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