From 3b9362b7e82d3223a0280a19b9a01e1ef9e945d6 Mon Sep 17 00:00:00 2001 From: Karl Palmen <karl.palmen@stfc.ac.uk> Date: Wed, 28 Mar 2018 17:44:41 +0100 Subject: [PATCH] Rename LoadShape to LoadSampleShape re #12828 Signed-off-by: Karl Palmen <karl.palmen@stfc.ac.uk> --- Framework/DataHandling/CMakeLists.txt | 6 +- .../{LoadShape.h => LoadSampleShape.h} | 2 +- .../{LoadShape.cpp => LoadSampleShape.cpp} | 22 +++---- ...{LoadShapeTest.h => LoadSampleShapeTest.h} | 66 +++++++++---------- ...oadShape-v1.rst => LoadSampleShape-v1.rst} | 0 5 files changed, 48 insertions(+), 48 deletions(-) rename Framework/DataHandling/inc/MantidDataHandling/{LoadShape.h => LoadSampleShape.h} (97%) rename Framework/DataHandling/src/{LoadShape.cpp => LoadSampleShape.cpp} (90%) rename Framework/DataHandling/test/{LoadShapeTest.h => LoadSampleShapeTest.h} (75%) rename docs/source/algorithms/{LoadShape-v1.rst => LoadSampleShape-v1.rst} (100%) diff --git a/Framework/DataHandling/CMakeLists.txt b/Framework/DataHandling/CMakeLists.txt index 3fe52ab3fc7..97b0854c2c3 100644 --- a/Framework/DataHandling/CMakeLists.txt +++ b/Framework/DataHandling/CMakeLists.txt @@ -97,7 +97,7 @@ set ( SRC_FILES src/LoadRawBin0.cpp src/LoadRawHelper.cpp src/LoadRawSpectrum0.cpp - src/LoadShape.cpp + src/LoadSampleShape.cpp src/LoadSESANS.cpp src/LoadSINQFocus.cpp src/LoadSNSspec.cpp @@ -273,8 +273,8 @@ set ( INC_FILES inc/MantidDataHandling/LoadRawBin0.h inc/MantidDataHandling/LoadRawHelper.h inc/MantidDataHandling/LoadRawSpectrum0.h + inc/MantidDataHandling/LoadSampleShape.h inc/MantidDataHandling/LoadSESANS.h - inc/MantidDataHandling/LoadShape.h inc/MantidDataHandling/LoadSINQFocus.h inc/MantidDataHandling/LoadSNSspec.h inc/MantidDataHandling/LoadSPE.h @@ -445,8 +445,8 @@ set ( TEST_FILES LoadRawBin0Test.h LoadRawSaveNxsLoadNxsTest.h LoadRawSpectrum0Test.h + LoadSampleShapeTest.h LoadSESANSTest.h - LoadShapeTest.h LoadSINQFocusTest.h LoadSNSspecTest.h LoadSPETest.h diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadShape.h b/Framework/DataHandling/inc/MantidDataHandling/LoadSampleShape.h similarity index 97% rename from Framework/DataHandling/inc/MantidDataHandling/LoadShape.h rename to Framework/DataHandling/inc/MantidDataHandling/LoadSampleShape.h index 86009b266eb..0a63dee393f 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadShape.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadSampleShape.h @@ -39,7 +39,7 @@ File change history is stored at: <https://github.com/mantidproject/mantid>. Code Documentation is available at: <http://doxygen.mantidproject.org> */ -class DLLExport LoadShape : public API::IFileLoader<Kernel::FileDescriptor> { +class DLLExport LoadSampleShape : public API::IFileLoader<Kernel::FileDescriptor> { public: /// Algorithm's name for identification overriding a virtual method const std::string name() const override { return "LoadShape"; }; diff --git a/Framework/DataHandling/src/LoadShape.cpp b/Framework/DataHandling/src/LoadSampleShape.cpp similarity index 90% rename from Framework/DataHandling/src/LoadShape.cpp rename to Framework/DataHandling/src/LoadSampleShape.cpp index ea7844bd7dd..17ba159010b 100644 --- a/Framework/DataHandling/src/LoadShape.cpp +++ b/Framework/DataHandling/src/LoadSampleShape.cpp @@ -1,4 +1,4 @@ -#include "MantidDataHandling/LoadShape.h" +#include "MantidDataHandling/LoadSampleShape.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/FileProperty.h" @@ -19,13 +19,13 @@ namespace Mantid { namespace DataHandling { // Register the algorithm into the algorithm factory -DECLARE_ALGORITHM(LoadShape) +DECLARE_ALGORITHM(LoadSampleShape) using namespace Kernel; using namespace API; using namespace Geometry; -void LoadShape::init() { +void LoadSampleShape::init() { auto wsValidator = boost::make_shared<CompositeValidator>(); wsValidator->add<API::InstrumentValidator>(); @@ -55,7 +55,7 @@ void LoadShape::init() { * @returns An integer specifying the confidence level. 0 indicates it will not * be used */ -int LoadShape::confidence(Kernel::FileDescriptor &descriptor) const { +int LoadSampleShape::confidence(Kernel::FileDescriptor &descriptor) const { const std::string &filePath = descriptor.filename(); const size_t filenameLength = filePath.size(); @@ -67,7 +67,7 @@ int LoadShape::confidence(Kernel::FileDescriptor &descriptor) const { return confidence; } -void LoadShape::exec() { +void LoadSampleShape::exec() { MatrixWorkspace_const_sptr inputWS = getProperty("InputWorkspace"); MatrixWorkspace_sptr outputWS = getProperty("OutputWorkspace"); @@ -101,7 +101,7 @@ void LoadShape::exec() { } std::unique_ptr<Geometry::MeshObject> -LoadShape::readSTLSolid(std::ifstream &file, std::string &name) { +LoadSampleShape::readSTLSolid(std::ifstream &file, std::string &name) { // Read Solid name // We expect line after trimming to be "solid "+name. std::string line; @@ -118,7 +118,7 @@ LoadShape::readSTLSolid(std::ifstream &file, std::string &name) { return nullptr; } -std::unique_ptr<MeshObject> LoadShape::readSTLMeshObject(std::ifstream &file) { +std::unique_ptr<MeshObject> LoadSampleShape::readSTLMeshObject(std::ifstream &file) { std::vector<uint16_t> triangleIndices; std::vector<V3D> vertices; V3D t1, t2, t3; @@ -140,7 +140,7 @@ std::unique_ptr<MeshObject> LoadShape::readSTLMeshObject(std::ifstream &file) { } /* Reads triangle for STL file and returns true if triangle is found */ -bool LoadShape::readSTLTriangle(std::ifstream &file, V3D &v1, V3D &v2, +bool LoadSampleShape::readSTLTriangle(std::ifstream &file, V3D &v1, V3D &v2, V3D &v3) { if (readSTLLine(file, "facet") && readSTLLine(file, "outer loop")) { @@ -156,7 +156,7 @@ bool LoadShape::readSTLTriangle(std::ifstream &file, V3D &v1, V3D &v2, } /* Reads vertex from STL file and returns true if vertex is found */ -bool LoadShape::readSTLVertex(std::ifstream &file, V3D &vertex) { +bool LoadSampleShape::readSTLVertex(std::ifstream &file, V3D &vertex) { std::string line; if (getline(file, line)) { boost::trim(line); @@ -175,7 +175,7 @@ bool LoadShape::readSTLVertex(std::ifstream &file, V3D &vertex) { } // Read, check and ignore line in STL file. Return true if line is read -bool LoadShape::readSTLLine(std::ifstream &file, std::string const &type) { +bool LoadSampleShape::readSTLLine(std::ifstream &file, std::string const &type) { std::string line; if (getline(file, line)) { boost::trim(line); @@ -196,7 +196,7 @@ bool LoadShape::readSTLLine(std::ifstream &file, std::string const &type) { } // Adds vertex to list if distinct and returns index to vertex added or equal -uint16_t LoadShape::addSTLVertex(V3D &vertex, std::vector<V3D> &vertices) { +uint16_t LoadSampleShape::addSTLVertex(V3D &vertex, std::vector<V3D> &vertices) { for (uint16_t i = 0; i < vertices.size(); ++i) { if (areEqualVertices(vertex, vertices[i])) { return i; diff --git a/Framework/DataHandling/test/LoadShapeTest.h b/Framework/DataHandling/test/LoadSampleShapeTest.h similarity index 75% rename from Framework/DataHandling/test/LoadShapeTest.h rename to Framework/DataHandling/test/LoadSampleShapeTest.h index 662b91c42f0..99a8b54ed9f 100644 --- a/Framework/DataHandling/test/LoadShapeTest.h +++ b/Framework/DataHandling/test/LoadSampleShapeTest.h @@ -4,7 +4,7 @@ #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/Sample.h" -#include "MantidDataHandling/LoadShape.h" +#include "MantidDataHandling/LoadSampleShape.h" #include "MantidDataHandling/LoadInstrument.h" #include "MantidGeometry/Objects/MeshObject.h" #include "MantidKernel/OptionalBool.h" @@ -17,10 +17,10 @@ using namespace Mantid::API; using namespace Mantid::DataHandling; using namespace Mantid::Geometry; -class LoadShapeTest : public CxxTest::TestSuite { +class LoadSampleShapeTest : public CxxTest::TestSuite { public: - static LoadShapeTest *createSuite() { return new LoadShapeTest(); } - static void destroySuite(LoadShapeTest *suite) { delete suite; } + static LoadSampleShapeTest *createSuite() { return new LoadSampleShapeTest(); } + static void destroySuite(LoadSampleShapeTest *suite) { delete suite; } void testName() { TS_ASSERT_EQUALS(loadShape.name(), "LoadShape"); } @@ -36,32 +36,32 @@ public: } void testConfidence() { - LoadShape testLoadShape; - testLoadShape.initialize(); - testLoadShape.setPropertyValue("Filename", "cube.stl"); - std::string path = testLoadShape.getPropertyValue("Filename"); + LoadSampleShape testLoadSampleShape; + testLoadSampleShape.initialize(); + testLoadSampleShape.setPropertyValue("Filename", "cube.stl"); + std::string path = testLoadSampleShape.getPropertyValue("Filename"); auto *descriptor = new Kernel::FileDescriptor(path); - TS_ASSERT_EQUALS(90, testLoadShape.confidence(*descriptor)); + TS_ASSERT_EQUALS(90, testLoadSampleShape.confidence(*descriptor)); delete descriptor; } void testExec_2WS() { - LoadShape testLoadShape; - testLoadShape.initialize(); - testLoadShape.setPropertyValue("Filename", "cube.stl"); - prepareWorkspaces(testLoadShape, "InputWS", "OutputWS"); - TS_ASSERT_THROWS_NOTHING(testLoadShape.execute()); - TS_ASSERT(testLoadShape.isExecuted()); + LoadSampleShape testLoadSampleShape; + testLoadSampleShape.initialize(); + testLoadSampleShape.setPropertyValue("Filename", "cube.stl"); + prepareWorkspaces(testLoadSampleShape, "InputWS", "OutputWS"); + TS_ASSERT_THROWS_NOTHING(testLoadSampleShape.execute()); + TS_ASSERT(testLoadSampleShape.isExecuted()); clearWorkspaces("InputWS", "OutputWS"); } void testExec_1WS() { - LoadShape testLoadShape; - testLoadShape.initialize(); - testLoadShape.setPropertyValue("Filename", "cube.stl"); - prepareWorkspaces(testLoadShape, "InputWS", "InputWS"); - TS_ASSERT_THROWS_NOTHING(testLoadShape.execute()); - TS_ASSERT(testLoadShape.isExecuted()); + LoadSampleShape testLoadSampleShape; + testLoadSampleShape.initialize(); + testLoadSampleShape.setPropertyValue("Filename", "cube.stl"); + prepareWorkspaces(testLoadSampleShape, "InputWS", "InputWS"); + TS_ASSERT_THROWS_NOTHING(testLoadSampleShape.execute()); + TS_ASSERT(testLoadSampleShape.isExecuted()); clearWorkspaces("InputWS", "InputWS"); } @@ -104,7 +104,7 @@ public: private: // Create workspaces and add them to algorithm properties - void prepareWorkspaces(LoadShape &alg, const std::string &inputWS, + void prepareWorkspaces(LoadSampleShape &alg, const std::string &inputWS, const std::string &outputWS) { auto inWs = WorkspaceCreationHelper::create2DWorkspaceWithFullInstrument(10, 4); @@ -126,12 +126,12 @@ private: const MeshObject *loadMeshObject(const std::string &inputWS, const std::string &outputWS, const std::string filename) { - LoadShape testLoadShape; - testLoadShape.initialize(); - testLoadShape.setPropertyValue("Filename", filename); - prepareWorkspaces(testLoadShape, inputWS, outputWS); - TS_ASSERT_THROWS_NOTHING(testLoadShape.execute()); - TS_ASSERT(testLoadShape.isExecuted()); + LoadSampleShape testLoadSampleShape; + testLoadSampleShape.initialize(); + testLoadSampleShape.setPropertyValue("Filename", filename); + prepareWorkspaces(testLoadSampleShape, inputWS, outputWS); + TS_ASSERT_THROWS_NOTHING(testLoadSampleShape.execute()); + TS_ASSERT(testLoadSampleShape.isExecuted()); return getMeshObject(outputWS); } @@ -159,7 +159,7 @@ private: } } - LoadShape loadShape; + LoadSampleShape loadShape; }; class LoadShapeTestPerformance : public CxxTest::TestSuite { @@ -173,7 +173,7 @@ public: } } - void testLoadShapePerformance() { + void testLoadSampleShapePerformance() { for (auto alg : loadAlgPtrs) { TS_ASSERT_THROWS_NOTHING(alg->execute()); } @@ -189,13 +189,13 @@ public: } private: - std::vector<LoadShape *> loadAlgPtrs; + std::vector<LoadSampleShape *> loadAlgPtrs; const int numberOfIterations = 5; const std::string inWsName = "InWS"; const std::string outWsName = "OutWS"; - LoadShape *setupAlg() { - LoadShape *loadAlg = new LoadShape(); + LoadSampleShape *setupAlg() { + LoadSampleShape *loadAlg = new LoadSampleShape(); loadAlg->initialize(); loadAlg->setPropertyValue("Filename", "tube.stl"); diff --git a/docs/source/algorithms/LoadShape-v1.rst b/docs/source/algorithms/LoadSampleShape-v1.rst similarity index 100% rename from docs/source/algorithms/LoadShape-v1.rst rename to docs/source/algorithms/LoadSampleShape-v1.rst -- GitLab