Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re #11263. Adding generated algorithm template
- Loading branch information
1 parent
f6fbaea
commit 670c282
Showing
4 changed files
with
175 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/Segfault.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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:: | ||
|