Skip to content

Commit

Permalink
Re #11263. Adding generated algorithm template
Browse files Browse the repository at this point in the history
  • Loading branch information
peterfpeterson committed Mar 4, 2015
1 parent f6fbaea commit 670c282
Show file tree
Hide file tree
Showing 4 changed files with 175 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Code/Mantid/Framework/Algorithms/CMakeLists.txt
Expand Up @@ -52,7 +52,7 @@ set ( SRC_FILES
src/ConvertToMatrixWorkspace.cpp
src/ConvertToPointData.cpp
src/ConvertUnits.cpp
src/CopyDetectorMapping.cpp
src/CopyDetectorMapping.cpp
src/CopyInstrumentParameters.cpp
src/CopyLogs.cpp
src/CopySample.cpp
Expand Down Expand Up @@ -176,6 +176,7 @@ set ( SRC_FILES
src/Q1DWeighted.cpp
src/Qhelper.cpp
src/Qxy.cpp
src/RRFMuon.cpp
src/RadiusSum.cpp
src/RayTracerTester.cpp
src/ReadGroupsFromFile.cpp
Expand All @@ -192,7 +193,7 @@ set ( SRC_FILES
src/ReflectometryReductionOneAuto.cpp
src/ReflectometryWorkflowBase.cpp
src/Regroup.cpp
src/RemoveBackground.cpp
src/RemoveBackground.cpp
src/RemoveBins.cpp
src/RemoveExpDecay.cpp
src/RemoveLowResTOF.cpp
Expand All @@ -205,12 +206,12 @@ set ( SRC_FILES
src/ResetNegatives.cpp
src/ResizeRectangularDetector.cpp
src/RingProfile.cpp
src/RRFMuon.cpp
src/SANSDirectBeamScaling.cpp
src/SassenaFFT.cpp
src/SaveGSASInstrumentFile.cpp
src/Scale.cpp
src/ScaleX.cpp
src/Segfault.cpp
src/SetInstrumentParameter.cpp
src/SetUncertainties.cpp
src/ShiftLogTime.cpp
Expand Down Expand Up @@ -238,7 +239,7 @@ set ( SRC_FILES
src/SumRowColumn.cpp
src/SumSpectra.cpp
src/TOFSANSResolution.cpp
src/TOFSANSResolutionByPixel.cpp
src/TOFSANSResolutionByPixel.cpp
src/Transpose.cpp
src/UnGroupWorkspace.cpp
src/UnaryOperation.cpp
Expand Down Expand Up @@ -307,7 +308,7 @@ set ( INC_FILES
inc/MantidAlgorithms/ConvertToMatrixWorkspace.h
inc/MantidAlgorithms/ConvertToPointData.h
inc/MantidAlgorithms/ConvertUnits.h
inc/MantidAlgorithms/CopyDetectorMapping.h
inc/MantidAlgorithms/CopyDetectorMapping.h
inc/MantidAlgorithms/CopyInstrumentParameters.h
inc/MantidAlgorithms/CopyLogs.h
inc/MantidAlgorithms/CopySample.h
Expand Down Expand Up @@ -432,6 +433,7 @@ set ( INC_FILES
inc/MantidAlgorithms/Q1DWeighted.h
inc/MantidAlgorithms/Qhelper.h
inc/MantidAlgorithms/Qxy.h
inc/MantidAlgorithms/RRFMuon.h
inc/MantidAlgorithms/RadiusSum.h
inc/MantidAlgorithms/RayTracerTester.h
inc/MantidAlgorithms/ReadGroupsFromFile.h
Expand All @@ -448,7 +450,7 @@ set ( INC_FILES
inc/MantidAlgorithms/ReflectometryReductionOneAuto.h
inc/MantidAlgorithms/ReflectometryWorkflowBase.h
inc/MantidAlgorithms/Regroup.h
inc/MantidAlgorithms/RemoveBackground.h
inc/MantidAlgorithms/RemoveBackground.h
inc/MantidAlgorithms/RemoveBins.h
inc/MantidAlgorithms/RemoveExpDecay.h
inc/MantidAlgorithms/RemoveLowResTOF.h
Expand All @@ -461,12 +463,12 @@ set ( INC_FILES
inc/MantidAlgorithms/ResetNegatives.h
inc/MantidAlgorithms/ResizeRectangularDetector.h
inc/MantidAlgorithms/RingProfile.h
inc/MantidAlgorithms/RRFMuon.h
inc/MantidAlgorithms/SANSDirectBeamScaling.h
inc/MantidAlgorithms/SassenaFFT.h
inc/MantidAlgorithms/SaveGSASInstrumentFile.h
inc/MantidAlgorithms/Scale.h
inc/MantidAlgorithms/ScaleX.h
inc/MantidAlgorithms/Segfault.h
inc/MantidAlgorithms/SetInstrumentParameter.h
inc/MantidAlgorithms/SetUncertainties.h
inc/MantidAlgorithms/ShiftLogTime.h
Expand Down Expand Up @@ -494,7 +496,7 @@ set ( INC_FILES
inc/MantidAlgorithms/SumRowColumn.h
inc/MantidAlgorithms/SumSpectra.h
inc/MantidAlgorithms/TOFSANSResolution.h
inc/MantidAlgorithms/TOFSANSResolutionByPixel.h
inc/MantidAlgorithms/TOFSANSResolutionByPixel.h
inc/MantidAlgorithms/Transpose.h
inc/MantidAlgorithms/UnGroupWorkspace.h
inc/MantidAlgorithms/UnaryOperation.h
Expand Down
56 changes: 56 additions & 0 deletions Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/Segfault.h
@@ -0,0 +1,56 @@
#ifndef MANTID_ALGORITHMS_SEGFAULT_H_
#define MANTID_ALGORITHMS_SEGFAULT_H_

#include "MantidKernel/System.h"
#include "MantidAPI/Algorithm.h"

namespace Mantid
{
namespace Algorithms
{

/** Segfault : TODO: DESCRIPTION
Copyright © 2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source
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 Segfault : public API::Algorithm
{
public:
Segfault();
virtual ~Segfault();

virtual const std::string name() const;
virtual int version() const;
virtual const std::string category() const;
virtual const std::string summary() const;

private:
void init();
void exec();


};


} // namespace Algorithms
} // namespace Mantid

#endif /* MANTID_ALGORITHMS_SEGFAULT_H_ */
65 changes: 65 additions & 0 deletions Code/Mantid/Framework/Algorithms/src/Segfault.cpp
@@ -0,0 +1,65 @@
#include "MantidAlgorithms/Segfault.h"

namespace Mantid
{
namespace Algorithms
{

using Mantid::Kernel::Direction;
using Mantid::API::WorkspaceProperty;

// Register the algorithm into the AlgorithmFactory
DECLARE_ALGORITHM(Segfault)



//----------------------------------------------------------------------------------------------
/** Constructor
*/
Segfault::Segfault()
{
}

//----------------------------------------------------------------------------------------------
/** Destructor
*/
Segfault::~Segfault()
{
}


//----------------------------------------------------------------------------------------------

/// Algorithms name for identification. @see Algorithm::name
const std::string Segfault::name() const { return "Segfault"; }

/// Algorithm's version for identification. @see Algorithm::version
int Segfault::version() const { return 1;};

/// Algorithm's category for identification. @see Algorithm::category
const std::string Segfault::category() const { return TODO: FILL IN A CATEGORY;}

/// Algorithm's summary for use in the GUI and help. @see Algorithm::summary
const std::string Segfault::summary() const { return TODO: FILL IN A SUMMARY;};

//----------------------------------------------------------------------------------------------
/** Initialize the algorithm's properties.
*/
void Segfault::init()
{
declareProperty(new WorkspaceProperty<>("InputWorkspace","",Direction::Input), "An input workspace.");
declareProperty(new WorkspaceProperty<>("OutputWorkspace","",Direction::Output), "An output workspace.");
}

//----------------------------------------------------------------------------------------------
/** Execute the algorithm.
*/
void Segfault::exec()
{
// TODO Auto-generated execute stub
}



} // namespace Algorithms
} // namespace Mantid
44 changes: 44 additions & 0 deletions Code/Mantid/docs/source/algorithms/Segfault-v1.rst
@@ -0,0 +1,44 @@

.. algorithm::

.. summary::

.. alias::

.. properties::

Description
-----------

TODO: Enter a full rst-markup description of your algorithm here.


Usage
-----
.. Try not to use files in your examples,
but if you cannot avoid it then the (small) files must be added to
autotestdata\UsageData and the following tag unindented
.. include:: ../usagedata-note.txt
**Example - Segfault**

.. testcode:: SegfaultExample

# Create a host workspace
ws = CreateWorkspace(DataX=range(0,3), DataY=(0,2))
or
ws = CreateSampleWorkspace()

wsOut = Segfault()

# Print the result
print "The output workspace has %i spectra" % wsOut.getNumberHistograms()

Output:

.. testoutput:: SegfaultExample

The output workspace has ?? spectra

.. categories::

0 comments on commit 670c282

Please sign in to comment.