From 01bb800139e0803b1570060639e075b200bd51ef Mon Sep 17 00:00:00 2001 From: Harry Jeffery <henry.jeffery@stfc.ac.uk> Date: Wed, 30 Jul 2014 17:01:34 +0100 Subject: [PATCH] Add ClearInstrumentParameters algorithm stub. Refs #10020 --- .../Framework/Algorithms/CMakeLists.txt | 2 + .../ClearInstrumentParameters.h | 62 ++++++++++++++++++ .../src/ClearInstrumentParameters.cpp | 65 +++++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ClearInstrumentParameters.h create mode 100644 Code/Mantid/Framework/Algorithms/src/ClearInstrumentParameters.cpp diff --git a/Code/Mantid/Framework/Algorithms/CMakeLists.txt b/Code/Mantid/Framework/Algorithms/CMakeLists.txt index 131135ff25e..9e6ad98faad 100644 --- a/Code/Mantid/Framework/Algorithms/CMakeLists.txt +++ b/Code/Mantid/Framework/Algorithms/CMakeLists.txt @@ -30,6 +30,7 @@ set ( SRC_FILES src/ChangePulsetime.cpp src/CheckWorkspacesMatch.cpp src/ChopData.cpp + src/ClearInstrumentParameters.cpp src/ClearMaskFlag.cpp src/CloneWorkspace.cpp src/CommutativeBinaryOperation.cpp @@ -269,6 +270,7 @@ set ( INC_FILES inc/MantidAlgorithms/ChangePulsetime.h inc/MantidAlgorithms/CheckWorkspacesMatch.h inc/MantidAlgorithms/ChopData.h + inc/MantidAlgorithms/ClearInstrumentParameters.h inc/MantidAlgorithms/ClearMaskFlag.h inc/MantidAlgorithms/CloneWorkspace.h inc/MantidAlgorithms/CommutativeBinaryOperation.h diff --git a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ClearInstrumentParameters.h b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ClearInstrumentParameters.h new file mode 100644 index 00000000000..958522ede2b --- /dev/null +++ b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ClearInstrumentParameters.h @@ -0,0 +1,62 @@ +#ifndef MANTID_ALGORITHMS_CLEARINSTRUMENTPARAMETERS_H_ +#define MANTID_ALGORITHMS_CLEARINSTRUMENTPARAMETERS_H_ + +#include "MantidKernel/System.h" +#include "MantidAPI/Algorithm.h" + +namespace Mantid +{ + +namespace Algorithms +{ + + /** ClearInstrumentParameters : Clear out an instrument's parameters. + + @author Harry Jeffery, ISIS, RAL + @date 30/7/2014 + + Copyright © 2014 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 ClearInstrumentParameters : public API::Algorithm + { + public: + ClearInstrumentParameters(); + virtual ~ClearInstrumentParameters(); + + virtual const std::string name() const; + ///Summary of algorithms purpose + virtual const std::string summary() const {return "Clears all the parameters of a workspace's instrument.";} + + virtual int version() const; + virtual const std::string category() const; + + private: + + void init(); + void exec(); + + }; + + +} // namespace Algorithms +} // namespace Mantid + +#endif /* MANTID_ALGORITHMS_CLEARINSTRUMENTPARAMETERS_H_ */ diff --git a/Code/Mantid/Framework/Algorithms/src/ClearInstrumentParameters.cpp b/Code/Mantid/Framework/Algorithms/src/ClearInstrumentParameters.cpp new file mode 100644 index 00000000000..d8e05317d3d --- /dev/null +++ b/Code/Mantid/Framework/Algorithms/src/ClearInstrumentParameters.cpp @@ -0,0 +1,65 @@ +#include "MantidAlgorithms/ClearInstrumentParameters.h" +#include "MantidAPI/FileProperty.h" +#include "MantidAPI/WorkspaceValidators.h" +#include "MantidGeometry/IComponent.h" +#include "MantidGeometry/Instrument.h" +#include "MantidGeometry/Instrument/ParameterMap.h" + +namespace Mantid +{ +namespace Algorithms +{ + + // Register the algorithm into the AlgorithmFactory + DECLARE_ALGORITHM(ClearInstrumentParameters) + + using namespace Kernel; + using namespace API; + using namespace Geometry; + + //---------------------------------------------------------------------------------------------- + /** Constructor + */ + ClearInstrumentParameters::ClearInstrumentParameters() + { + } + + //---------------------------------------------------------------------------------------------- + /** Destructor + */ + ClearInstrumentParameters::~ClearInstrumentParameters() + { + } + + //---------------------------------------------------------------------------------------------- + /// Algorithm's name for identification. @see Algorithm::name + const std::string ClearInstrumentParameters::name() const { return "ClearInstrumentParameters";}; + + /// Algorithm's version for identification. @see Algorithm::version + int ClearInstrumentParameters::version() const { return 1;}; + + /// Algorithm's category for identification. @see Algorithm::category + const std::string ClearInstrumentParameters::category() const { return "DataHandling\\Instrument";} + + //---------------------------------------------------------------------------------------------- + + //---------------------------------------------------------------------------------------------- + /** Initialize the algorithm's properties. + */ + void ClearInstrumentParameters::init() + { + declareProperty(new WorkspaceProperty<>("Workspace","",Direction::InOut,boost::make_shared<InstrumentValidator>()), + "Workspace whose instrument parameters are to be cleared."); + + declareProperty("LocationParameters", true, "Clear the location parameters used to calibrate the instrument.", Direction::Input); + } + + //---------------------------------------------------------------------------------------------- + /** Execute the algorithm. + */ + void ClearInstrumentParameters::exec() + { + } + +} // namespace Algorithms +} // namespace Mantid -- GitLab