Mantid
Loading...
Searching...
No Matches
LoadDaveGrp.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#include <fstream>
10#include <string>
11#include <vector>
12
14#include "MantidDataHandling/DllConfig.h"
17
18namespace Mantid {
19namespace DataHandling {
54class MANTID_DATAHANDLING_DLL LoadDaveGrp : public API::IFileLoader<Kernel::FileDescriptor> {
55public:
59 const std::string name() const override { return "LoadDaveGrp"; }
61 const std::string summary() const override {
62 return "Loads data from a DAVE grouped ASCII file and stores it in a 2D "
63 "workspace (Workspace2D class).";
64 }
65
67 int version() const override { return (1); }
68 const std::vector<std::string> seeAlso() const override { return {"SaveDaveGrp"}; }
70 const std::string category() const override { return "DataHandling\\Text;Inelastic\\DataHandling"; }
72 int confidence(Kernel::FileDescriptor &descriptor) const override;
73
74private:
76 void init() override;
78 void exec() override;
86 void getAxisLength(size_t &length);
87
95 void getAxisValues(std::vector<double> &axis, const std::size_t length);
96
102 void getData(const API::MatrixWorkspace_sptr &workspace);
103
109 API::MatrixWorkspace_sptr setupWorkspace() const;
110
118 void setWorkspaceAxes(const API::MatrixWorkspace_sptr &workspace, const std::vector<double> &xAxis,
119 const std::vector<double> &yAxis) const;
120
128
133 void readLine();
134
136 std::ifstream ifile;
138 std::string line;
140 std::size_t nGroups;
142 std::size_t xLength;
143};
144
145} // namespace DataHandling
146} // namespace Mantid
IPeaksWorkspace_sptr workspace
Definition: IndexPeaks.cpp:114
Defines an interface to an algorithm that loads a file so that it can take part in the automatic sele...
Definition: IFileLoader.h:19
Reads the DAVE grouped ASCII format into a workspace.
Definition: LoadDaveGrp.h:54
int version() const override
Algorithm's version.
Definition: LoadDaveGrp.h:67
const std::string name() const override
Algorithm's name.
Definition: LoadDaveGrp.h:59
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
Definition: LoadDaveGrp.h:68
std::string line
Placeholder for file lines.
Definition: LoadDaveGrp.h:138
std::ifstream ifile
Handle for input data file.
Definition: LoadDaveGrp.h:136
std::size_t nGroups
The number of groups present in the data file.
Definition: LoadDaveGrp.h:140
const std::string summary() const override
Summary of algorithms purpose.
Definition: LoadDaveGrp.h:61
const std::string category() const override
Algorithm's category for identification.
Definition: LoadDaveGrp.h:70
std::size_t xLength
The size of the x-axis in the data file.
Definition: LoadDaveGrp.h:142
Defines a wrapper around an open file.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.