Mantid
Loading...
Searching...
No Matches
SaveOpenGenieAscii.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//---------------------------------------------------
10// Includes
11//---------------------------------------------------
12#include "MantidAPI/Algorithm.h"
13#include "MantidDataHandling/DllConfig.h"
14#include <iosfwd>
15
16namespace Mantid {
17namespace DataHandling {
18
19class MANTID_DATAHANDLING_DLL SaveOpenGenieAscii : public Mantid::API::Algorithm {
20public:
22 SaveOpenGenieAscii() = default;
24
26 const std::string name() const override { return "SaveOpenGenieAscii"; }
27
29 const std::string summary() const override { return "Saves a focused data set into an OpenGenie ASCII file "; }
30
32 int version() const override { return (1); }
33 const std::vector<std::string> seeAlso() const override { return {"SaveAscii"}; }
34
36 const std::string category() const override { return "Diffraction\\DataHandling;DataHandling\\Text"; }
37
38private:
40 using OutputBufferEntry = std::tuple<std::string, std::string, std::string>;
41
43 void init() override;
44
46 void exec() override;
47
48 inline void addToOutputBuffer(const std::string &outName, const std::string &outType, const std::string &outVal) {
49 m_outputVector.emplace_back(OutputBufferEntry(outName, outType, outVal));
50 }
51
53 void applyEnginxFormat();
54
56 void calculateXYZDelta(const std::string &unit, const Kernel::Property *values);
57
60 template <typename T> void convertWorkspaceData(const T &histoData, const char &axis);
61
63 void determineEnginXBankId();
64
66 void getSampleLogs();
67
69 void inputValidation();
70
72 void openFileStream(std::ofstream &stream);
73
75 void storeEmptyFields();
76
78 void storeWorkspaceInformation();
79
81 void writeDataToFile(std::ofstream &outfile);
82
84 std::vector<OutputBufferEntry> m_outputVector;
88 const std::string m_stringType = "String";
90 const std::string m_floatType = "Float";
92 const std::string m_intType = "Integer";
93};
94} // namespace DataHandling
95} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
API::MatrixWorkspace_const_sptr m_inputWS
Workspace to save.
const std::string category() const override
Algorithm's category for identification.
std::tuple< std::string, std::string, std::string > OutputBufferEntry
Typedef of a tuple containing the name, type and value as strings.
const std::string summary() const override
Summary of algorithms purpose.
SaveOpenGenieAscii()=default
(Empty) Constructor
std::vector< OutputBufferEntry > m_outputVector
Output buffer which holds the tuples to be written.
int version() const override
Algorithm's version.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
const std::string name() const override
Algorithm's name.
void addToOutputBuffer(const std::string &outName, const std::string &outType, const std::string &outVal)
Base class for properties.
Definition: Property.h:94
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
Helper class which provides the Collimation Length for SANS instruments.