-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs #8534. Files for new MuonCalculateAsymmetry algorithm.
- Loading branch information
1 parent
f250883
commit fa0a29a
Showing
4 changed files
with
189 additions
and
0 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
...Mantid/Framework/WorkflowAlgorithms/inc/MantidWorkflowAlgorithms/MuonCalculateAsymmetry.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_WORKFLOWALGORITHMS_MUONCALCULATEASYMMETRY_H_ | ||
#define MANTID_WORKFLOWALGORITHMS_MUONCALCULATEASYMMETRY_H_ | ||
|
||
#include "MantidKernel/System.h" | ||
#include "MantidAPI/Algorithm.h" | ||
|
||
namespace Mantid | ||
{ | ||
namespace WorkflowAlgorithms | ||
{ | ||
|
||
/** MuonCalculateAsymmetry : 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 MuonCalculateAsymmetry : public API::Algorithm | ||
{ | ||
public: | ||
MuonCalculateAsymmetry(); | ||
virtual ~MuonCalculateAsymmetry(); | ||
|
||
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 WorkflowAlgorithms | ||
} // namespace Mantid | ||
|
||
#endif /* MANTID_WORKFLOWALGORITHMS_MUONCALCULATEASYMMETRY_H_ */ |
70 changes: 70 additions & 0 deletions
70
Code/Mantid/Framework/WorkflowAlgorithms/src/MuonCalculateAsymmetry.cpp
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,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 "MantidWorkflowAlgorithms/MuonCalculateAsymmetry.h" | ||
|
||
namespace Mantid | ||
{ | ||
namespace WorkflowAlgorithms | ||
{ | ||
|
||
// Register the algorithm into the AlgorithmFactory | ||
DECLARE_ALGORITHM(MuonCalculateAsymmetry) | ||
|
||
|
||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Constructor | ||
*/ | ||
MuonCalculateAsymmetry::MuonCalculateAsymmetry() | ||
{ | ||
} | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Destructor | ||
*/ | ||
MuonCalculateAsymmetry::~MuonCalculateAsymmetry() | ||
{ | ||
} | ||
|
||
|
||
//---------------------------------------------------------------------------------------------- | ||
/// Algorithm's name for identification. @see Algorithm::name | ||
const std::string MuonCalculateAsymmetry::name() const { return "MuonCalculateAsymmetry";}; | ||
|
||
/// Algorithm's version for identification. @see Algorithm::version | ||
int MuonCalculateAsymmetry::version() const { return 1;}; | ||
|
||
/// Algorithm's category for identification. @see Algorithm::category | ||
const std::string MuonCalculateAsymmetry::category() const { return TODO: FILL IN A CATEGORY;} | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
/// Sets documentation strings for this algorithm | ||
void MuonCalculateAsymmetry::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 MuonCalculateAsymmetry::init() | ||
{ | ||
declareProperty(new WorkspaceProperty<>("InputWorkspace","",Direction::Input), "An input workspace."); | ||
declareProperty(new WorkspaceProperty<>("OutputWorkspace","",Direction::Output), "An output workspace."); | ||
} | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Execute the algorithm. | ||
*/ | ||
void MuonCalculateAsymmetry::exec() | ||
{ | ||
// TODO Auto-generated execute stub | ||
} | ||
|
||
|
||
|
||
} // namespace WorkflowAlgorithms | ||
} // namespace Mantid |
60 changes: 60 additions & 0 deletions
60
Code/Mantid/Framework/WorkflowAlgorithms/test/MuonCalculateAsymmetryTest.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,60 @@ | ||
#ifndef MANTID_WORKFLOWALGORITHMS_MUONCALCULATEASYMMETRYTEST_H_ | ||
#define MANTID_WORKFLOWALGORITHMS_MUONCALCULATEASYMMETRYTEST_H_ | ||
|
||
#include <cxxtest/TestSuite.h> | ||
|
||
#include "MantidWorkflowAlgorithms/MuonCalculateAsymmetry.h" | ||
|
||
using Mantid::WorkflowAlgorithms::MuonCalculateAsymmetry; | ||
|
||
class MuonCalculateAsymmetryTest : 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 MuonCalculateAsymmetryTest *createSuite() { return new MuonCalculateAsymmetryTest(); } | ||
static void destroySuite( MuonCalculateAsymmetryTest *suite ) { delete suite; } | ||
|
||
|
||
void test_Init() | ||
{ | ||
MuonCalculateAsymmetry alg; | ||
TS_ASSERT_THROWS_NOTHING( alg.initialize() ) | ||
TS_ASSERT( alg.isInitialized() ) | ||
} | ||
|
||
void test_exec() | ||
{ | ||
// Name of the output workspace. | ||
std::string outWSName("MuonCalculateAsymmetryTest_OutputWS"); | ||
|
||
MuonCalculateAsymmetry 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_WORKFLOWALGORITHMS_MUONCALCULATEASYMMETRYTEST_H_ */ |