Mantid
Loading...
Searching...
No Matches
SaveReflectometryAscii.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 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
11#include "MantidDataHandling/DllConfig.h"
12#include <fstream>
13#include <string>
14#include <vector>
15
16namespace Mantid {
17namespace DataHandling {
22class MANTID_DATAHANDLING_DLL SaveReflectometryAscii final : public API::Algorithm {
23public:
25 const std::string name() const override { return "SaveReflectometryAscii"; }
27 int version() const override { return 1; }
29 const std::string category() const override { return "DataHandling\\Text;ILL\\Reflectometry;Reflectometry"; }
31 const std::string summary() const override { return "Saves a 2D workspace to an ascii file"; }
33 const std::vector<std::string> seeAlso() const override { return {"SaveAscii"}; }
35 std::map<std::string, std::string> validateInputs() override;
37 bool checkGroups() override;
38
39private:
41 void init() override;
43 void exec() override;
45 bool processGroups() override;
47 void checkFile(const std::string &filename);
49 void data();
51 template <typename T> void outputval(const T &val, bool firstColumn = false);
53 std::string sampleLogValue(const std::string &logName);
55 std::string sampleLogUnit(const std::string &logName);
57 void writeInfo(const std::string &logName, const std::string &logNameFixed = "");
59 void header();
61 void separator();
63 bool includeQResolution() const;
65 char m_sep{'\t'};
67 std::string m_filename;
69 std::string m_ext;
73 std::vector<API::MatrixWorkspace_const_sptr> m_group;
75 std::vector<std::string> m_wsName;
77 std::ofstream m_file;
79 double m_theta;
80};
81} // namespace DataHandling
82} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
Saves a file of desired (mft, txt, dat or custom) Ascii format from a 2D workspace.
std::ofstream m_file
The output file stream.
std::vector< std::string > m_wsName
Names of the workspaces in a group.
std::vector< API::MatrixWorkspace_const_sptr > m_group
Input workspace group.
API::MatrixWorkspace_const_sptr m_ws
Input workspace.
double m_theta
The angle used to calculate wavelength from momentum exchange, in rad.
int version() const override
Algorithm's version.
const std::string category() const override
Algorithm's category for identification.
const std::vector< std::string > seeAlso() const override
Algorithm's with similar purpose.
const std::string summary() const override
Summary of algorithms purpose.
const std::string name() const override
Algorithm's name.
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.