26using namespace Kernel;
28using namespace DataObjects;
37 "Name of the workspace to be saved");
39 const std::vector<std::string> fileExts{
".nxs",
".nx5",
".xml"};
41 "The name of the Nexus file to write, as a full or relative\n"
56 declareProperty(
"Title",
"", std::make_shared<NullValidator>(),
"A title to describe the saved workspace");
58 auto mustBePositive = std::make_shared<BoundedValidator<int>>();
59 mustBePositive->setLower(0);
65 "Number of first WorkspaceIndex to read, only for single period data.\n"
66 "Not yet implemented");
68 "Number of last WorkspaceIndex to read, only for single period data.\n"
69 "Not yet implemented.");
71 "List of WorkspaceIndex numbers to read, only for single period data.\n"
72 "Not yet implemented");
74 "Determines whether .nxs file needs to be\n"
75 "over written or appended");
101 if (propertyName ==
"Append") {
102 if (perioidNum != 1) {
112 saveNexusPro->setPropertyValue(
"Filename",
m_filename);
114 std::string inputWorkspace =
"InputWorkspace";
117 std::vector<int> specList =
getProperty(
"WorkspaceIndexList");
118 if (!specList.empty())
119 saveNexusPro->setPropertyValue(
"WorkspaceIndexList",
getPropertyValue(
"WorkspaceIndexList"));
123 saveNexusPro->setPropertyValue(
"WorkspaceIndexMax",
getPropertyValue(
"WorkspaceIndexMax"));
124 saveNexusPro->setPropertyValue(
"WorkspaceIndexMin",
getPropertyValue(
"WorkspaceIndexMin"));
131 saveNexusPro->setProperty<
bool>(
"Append",
getProperty(
"Append"));
135 m_history->fillAlgorithmHistory(
this, Mantid::Types::Core::DateAndTime::getCurrentTime(), 0,
147 saveNexusPro->execute();
148 }
catch (std::runtime_error &) {
149 g_log.
error(
"Unable to successfully run SaveNexusprocessed Child Algorithm");
151 if (!saveNexusPro->isExecuted())
152 g_log.
error(
"Unable to successfully run SaveNexusProcessed Child Algorithm");
#define DECLARE_ALGORITHM(classname)
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
std::string getPropertyValue(const std::string &name) const override
Get the value of a property as a string.
std::shared_ptr< AlgorithmHistory > m_parentHistory
Pointer to the parent history object (if set)
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
std::shared_ptr< AlgorithmHistory > m_history
Pointer to the history for the algorithm being executed.
virtual std::shared_ptr< Algorithm > createChildAlgorithm(const std::string &name, const double startProgress=-1., const double endProgress=-1., const bool enableLogging=true, const int &version=-1)
Create a Child Algorithm.
bool isChild() const override
To query whether algorithm is a child.
void progress(double p, const std::string &msg="", double estimatedTime=0.0, int progressPrecision=0)
Sends ProgressNotification.
virtual void setOtherProperties(IAlgorithm *alg, const std::string &propertyName, const std::string &propertyValue, int periodNum)
Virtual method to set the non workspace properties for this algorithm.
bool trackingHistory()
get whether we are tracking the history for this algorithm,
bool isRecordingHistoryForChild()
static size_t g_execCount
Counter to keep track of algorithm execution order.
@ Save
to specify a file to write to, the file may or may not exist
IAlgorithm is the interface implemented by the Algorithm base class.
A property class for workspaces.
void setOtherProperties(IAlgorithm *alg, const std::string &propertyName, const std::string &propertyValue, int perioidNum) override
sets non workspace properties for the algorithm
std::string m_filename
The name and path of the input file.
void exec() override
Overwrites Algorithm method.
void runSaveNexusProcessed()
Method to execute SNP Child Algorithm.
void init() override
Overwrites Algorithm method.
bool processGroups() override
Override process groups.
API::Workspace_sptr m_inputWorkspace
Pointer to the local workspace.
Support for a property that holds an array of values.
virtual void setPropertyValue(const std::string &name, const std::string &value)=0
Sets property value from a string.
void error(const std::string &msg)
Logs at error level.
std::shared_ptr< IAlgorithm > IAlgorithm_sptr
shared pointer to Mantid::API::IAlgorithm
constexpr int EMPTY_INT() noexcept
Returns what we consider an "empty" integer within a property.
@ Input
An input workspace.