From 6613938bf19cbedc49eaee5c48a44ad9bcdc23a8 Mon Sep 17 00:00:00 2001 From: Gesner Passos <gesner.passos@stfc.ac.uk> Date: Mon, 19 Aug 2013 14:16:15 +0100 Subject: [PATCH] Creation of the RingProfile algorithm just execution of class_maker re #7776 --- .../Framework/Algorithms/CMakeLists.txt | 9 ++- .../inc/MantidAlgorithms/RingProfile.h | 56 +++++++++++++++ .../Framework/Algorithms/src/RingProfile.cpp | 70 +++++++++++++++++++ .../Algorithms/test/RingProfileTest.h | 60 ++++++++++++++++ 4 files changed, 192 insertions(+), 3 deletions(-) create mode 100644 Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/RingProfile.h create mode 100644 Code/Mantid/Framework/Algorithms/src/RingProfile.cpp create mode 100644 Code/Mantid/Framework/Algorithms/test/RingProfileTest.h diff --git a/Code/Mantid/Framework/Algorithms/CMakeLists.txt b/Code/Mantid/Framework/Algorithms/CMakeLists.txt index 80d27474c52..43652d2527e 100644 --- a/Code/Mantid/Framework/Algorithms/CMakeLists.txt +++ b/Code/Mantid/Framework/Algorithms/CMakeLists.txt @@ -180,6 +180,7 @@ set ( SRC_FILES src/ResampleX.cpp src/ResetNegatives.cpp src/ResizeRectangularDetector.cpp + src/RingProfile.cpp src/SANSDirectBeamScaling.cpp src/SassenaFFT.cpp src/Scale.cpp @@ -189,7 +190,7 @@ set ( SRC_FILES src/SignalOverError.cpp src/SmoothData.cpp src/SmoothNeighbours.cpp - src/SofQCommon.cpp + src/SofQCommon.cpp src/SofQW.cpp src/SofQW2.cpp src/SofQW3.cpp @@ -402,6 +403,7 @@ set ( INC_FILES inc/MantidAlgorithms/ResampleX.h inc/MantidAlgorithms/ResetNegatives.h inc/MantidAlgorithms/ResizeRectangularDetector.h + inc/MantidAlgorithms/RingProfile.h inc/MantidAlgorithms/SANSDirectBeamScaling.h inc/MantidAlgorithms/SassenaFFT.h inc/MantidAlgorithms/Scale.h @@ -411,7 +413,7 @@ set ( INC_FILES inc/MantidAlgorithms/SignalOverError.h inc/MantidAlgorithms/SmoothData.h inc/MantidAlgorithms/SmoothNeighbours.h - inc/MantidAlgorithms/SofQCommon.h + inc/MantidAlgorithms/SofQCommon.h inc/MantidAlgorithms/SofQW.h inc/MantidAlgorithms/SofQW2.h inc/MantidAlgorithms/SofQW3.h @@ -490,8 +492,8 @@ set ( TEST_FILES ConjoinWorkspacesTest.h ConvertAxisByFormulaTest.h ConvertFromDistributionTest.h - ConvertSpectrumAxisTest.h ConvertSpectrumAxis2Test.h + ConvertSpectrumAxisTest.h ConvertTableToMatrixWorkspaceTest.h ConvertToDistributionTest.h ConvertToEventWorkspaceTest.h @@ -617,6 +619,7 @@ set ( TEST_FILES ResampleXTest.h ResetNegativesTest.h ResizeRectangularDetectorTest.h + RingProfileTest.h SassenaFFTTest.h ScaleTest.h ScaleXTest.h diff --git a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/RingProfile.h b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/RingProfile.h new file mode 100644 index 00000000000..27a894c03ba --- /dev/null +++ b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/RingProfile.h @@ -0,0 +1,56 @@ +#ifndef MANTID_ALGORITHMS_RINGPROFILE_H_ +#define MANTID_ALGORITHMS_RINGPROFILE_H_ + +#include "MantidKernel/System.h" +#include "MantidAPI/Algorithm.h" + +namespace Mantid +{ +namespace Algorithms +{ + + /** RingProfile : TODO: DESCRIPTION + + Copyright © 2013 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + File change history is stored at: <https://github.com/mantidproject/mantid> + Code Documentation is available at: <http://doxygen.mantidproject.org> + */ + class DLLExport RingProfile : public API::Algorithm + { + public: + RingProfile(); + virtual ~RingProfile(); + + virtual const std::string name() const; + virtual int version() const; + virtual const std::string category() const; + + private: + virtual void initDocs(); + void init(); + void exec(); + + + }; + + +} // namespace Algorithms +} // namespace Mantid + +#endif /* MANTID_ALGORITHMS_RINGPROFILE_H_ */ \ No newline at end of file diff --git a/Code/Mantid/Framework/Algorithms/src/RingProfile.cpp b/Code/Mantid/Framework/Algorithms/src/RingProfile.cpp new file mode 100644 index 00000000000..c4c2be4f880 --- /dev/null +++ b/Code/Mantid/Framework/Algorithms/src/RingProfile.cpp @@ -0,0 +1,70 @@ +/*WIKI* +TODO: Enter a full wiki-markup description of your algorithm here. You can then use the Build/wiki_maker.py script to generate your full wiki page. +*WIKI*/ + +#include "MantidAlgorithms/RingProfile.h" + +namespace Mantid +{ +namespace Algorithms +{ + + // Register the algorithm into the AlgorithmFactory + DECLARE_ALGORITHM(RingProfile) + + + + //---------------------------------------------------------------------------------------------- + /** Constructor + */ + RingProfile::RingProfile() + { + } + + //---------------------------------------------------------------------------------------------- + /** Destructor + */ + RingProfile::~RingProfile() + { + } + + + //---------------------------------------------------------------------------------------------- + /// Algorithm's name for identification. @see Algorithm::name + const std::string RingProfile::name() const { return "RingProfile";}; + + /// Algorithm's version for identification. @see Algorithm::version + int RingProfile::version() const { return 1;}; + + /// Algorithm's category for identification. @see Algorithm::category + const std::string RingProfile::category() const { return TODO: FILL IN A CATEGORY;} + + //---------------------------------------------------------------------------------------------- + /// Sets documentation strings for this algorithm + void RingProfile::initDocs() + { + this->setWikiSummary("TODO: Enter a quick description of your algorithm."); + this->setOptionalMessage("TODO: Enter a quick description of your algorithm."); + } + + //---------------------------------------------------------------------------------------------- + /** Initialize the algorithm's properties. + */ + void RingProfile::init() + { + declareProperty(new WorkspaceProperty<>("InputWorkspace","",Direction::Input), "An input workspace."); + declareProperty(new WorkspaceProperty<>("OutputWorkspace","",Direction::Output), "An output workspace."); + } + + //---------------------------------------------------------------------------------------------- + /** Execute the algorithm. + */ + void RingProfile::exec() + { + // TODO Auto-generated execute stub + } + + + +} // namespace Algorithms +} // namespace Mantid \ No newline at end of file diff --git a/Code/Mantid/Framework/Algorithms/test/RingProfileTest.h b/Code/Mantid/Framework/Algorithms/test/RingProfileTest.h new file mode 100644 index 00000000000..358b3d747e8 --- /dev/null +++ b/Code/Mantid/Framework/Algorithms/test/RingProfileTest.h @@ -0,0 +1,60 @@ +#ifndef MANTID_ALGORITHMS_RINGPROFILETEST_H_ +#define MANTID_ALGORITHMS_RINGPROFILETEST_H_ + +#include <cxxtest/TestSuite.h> + +#include "MantidAlgorithms/RingProfile.h" + +using Mantid::Algorithms::RingProfile; + +class RingProfileTest : public CxxTest::TestSuite +{ +public: + // This pair of boilerplate methods prevent the suite being created statically + // This means the constructor isn't called when running other tests + static RingProfileTest *createSuite() { return new RingProfileTest(); } + static void destroySuite( RingProfileTest *suite ) { delete suite; } + + + void test_Init() + { + RingProfile alg; + TS_ASSERT_THROWS_NOTHING( alg.initialize() ) + TS_ASSERT( alg.isInitialized() ) + } + + void test_exec() + { + // Name of the output workspace. + std::string outWSName("RingProfileTest_OutputWS"); + + RingProfile alg; + TS_ASSERT_THROWS_NOTHING( alg.initialize() ) + TS_ASSERT( alg.isInitialized() ) + TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("REPLACE_PROPERTY_NAME_HERE!!!!", "value") ); + TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", outWSName) ); + TS_ASSERT_THROWS_NOTHING( alg.execute(); ); + TS_ASSERT( alg.isExecuted() ); + + // Retrieve the workspace from data service. TODO: Change to your desired type + Workspace_sptr ws; + TS_ASSERT_THROWS_NOTHING( ws = AnalysisDataService::Instance().retrieveWS<Workspace>(outWSName) ); + TS_ASSERT(ws); + if (!ws) return; + + // TODO: Check the results + + // Remove workspace from the data service. + AnalysisDataService::Instance().remove(outWSName); + } + + void test_Something() + { + TSM_ASSERT( "You forgot to write a test!", 0); + } + + +}; + + +#endif /* MANTID_ALGORITHMS_RINGPROFILETEST_H_ */ \ No newline at end of file -- GitLab