Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #11056. Setup for new AddPeaksHKL algorithm
- Loading branch information
1 parent
1f5c833
commit 0d10ba2
Showing
12 changed files
with
266 additions
and
16 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
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/Crystal/inc/MantidCrystal/AddPeakHKL.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_CRYSTAL_ADDPEAKHKL_H_ | ||
#define MANTID_CRYSTAL_ADDPEAKHKL_H_ | ||
|
||
#include "MantidKernel/System.h" | ||
#include "MantidAPI/Algorithm.h" | ||
|
||
namespace Mantid | ||
{ | ||
namespace Crystal | ||
{ | ||
|
||
/** AddPeakHKL : 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 AddPeakHKL : public API::Algorithm | ||
{ | ||
public: | ||
AddPeakHKL(); | ||
virtual ~AddPeakHKL(); | ||
|
||
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 Crystal | ||
} // namespace Mantid | ||
|
||
#endif /* MANTID_CRYSTAL_ADDPEAKHKL_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 "MantidCrystal/AddPeakHKL.h" | ||
|
||
namespace Mantid | ||
{ | ||
namespace Crystal | ||
{ | ||
|
||
using Mantid::Kernel::Direction; | ||
using Mantid::API::WorkspaceProperty; | ||
|
||
// Register the algorithm into the AlgorithmFactory | ||
DECLARE_ALGORITHM(AddPeakHKL) | ||
|
||
|
||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Constructor | ||
*/ | ||
AddPeakHKL::AddPeakHKL() | ||
{ | ||
} | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Destructor | ||
*/ | ||
AddPeakHKL::~AddPeakHKL() | ||
{ | ||
} | ||
|
||
|
||
//---------------------------------------------------------------------------------------------- | ||
|
||
/// Algorithms name for identification. @see Algorithm::name | ||
const std::string AddPeakHKL::name() const { return "AddPeakHKL"; } | ||
|
||
/// Algorithm's version for identification. @see Algorithm::version | ||
int AddPeakHKL::version() const { return 1;}; | ||
|
||
/// Algorithm's category for identification. @see Algorithm::category | ||
const std::string AddPeakHKL::category() const { return TODO: FILL IN A CATEGORY;} | ||
|
||
/// Algorithm's summary for use in the GUI and help. @see Algorithm::summary | ||
const std::string AddPeakHKL::summary() const { return TODO: FILL IN A SUMMARY;}; | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Initialize the algorithm's properties. | ||
*/ | ||
void AddPeakHKL::init() | ||
{ | ||
declareProperty(new WorkspaceProperty<>("InputWorkspace","",Direction::Input), "An input workspace."); | ||
declareProperty(new WorkspaceProperty<>("OutputWorkspace","",Direction::Output), "An output workspace."); | ||
} | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Execute the algorithm. | ||
*/ | ||
void AddPeakHKL::exec() | ||
{ | ||
// TODO Auto-generated execute stub | ||
} | ||
|
||
|
||
|
||
} // namespace Crystal | ||
} // 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
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,61 @@ | ||
#ifndef MANTID_CRYSTAL_ADDPEAKHKLTEST_H_ | ||
#define MANTID_CRYSTAL_ADDPEAKHKLTEST_H_ | ||
|
||
#include <cxxtest/TestSuite.h> | ||
|
||
#include "MantidCrystal/AddPeakHKL.h" | ||
|
||
using Mantid::Crystal::AddPeakHKL; | ||
using namespace Mantid::API; | ||
|
||
class AddPeakHKLTest : 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 AddPeakHKLTest *createSuite() { return new AddPeakHKLTest(); } | ||
static void destroySuite( AddPeakHKLTest *suite ) { delete suite; } | ||
|
||
|
||
void test_Init() | ||
{ | ||
AddPeakHKL alg; | ||
TS_ASSERT_THROWS_NOTHING( alg.initialize() ) | ||
TS_ASSERT( alg.isInitialized() ) | ||
} | ||
|
||
void test_exec() | ||
{ | ||
// Name of the output workspace. | ||
std::string outWSName("AddPeakHKLTest_OutputWS"); | ||
|
||
AddPeakHKL 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_CRYSTAL_ADDPEAKHKLTEST_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
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
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
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
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
Oops, something went wrong.