-
Notifications
You must be signed in to change notification settings - Fork 122
/
LoadSassena.h
104 lines (86 loc) · 3.62 KB
/
LoadSassena.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2010 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/IFileLoader.h"
#include "MantidAPI/WorkspaceGroup_fwd.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidKernel/NexusDescriptor.h"
#include <hdf5.h>
namespace Mantid {
namespace DataHandling {
/** Load Sassena Output files.
Required Properties:
<UL>
<LI> Filename - The name of and path to the Sassena file </LI>
<LI> Workspace - The name of the group workspace to output
</UL>
@author Jose Borreguero
@date 2012-04-24
*/
/* Base class to Load a sassena dataset into a MatrixWorkspace
* Derived implementations will load different scattering functions
class LoadDataSet
{
};
*/
class DLLExport LoadSassena : public API::IFileLoader<Kernel::NexusDescriptor> {
public:
/// Algorithm's name
const std::string name() const override { return "LoadSassena"; }
/// Summary of algorithms purpose
const std::string summary() const override {
return " load a Sassena output file into a group workspace.";
}
/// Algorithm's version
int version() const override { return 1; }
/// Algorithm's category for identification
const std::string category() const override {
return "DataHandling\\Sassena";
}
/// Returns a confidence value that this algorithm can load a file
int confidence(Kernel::NexusDescriptor &descriptor) const override;
protected:
/// Add a workspace to the group and register in the analysis data service
void registerWorkspace(const API::WorkspaceGroup_sptr &gws,
const std::string &wsName,
const DataObjects::Workspace2D_sptr &ws,
const std::string &description);
/// Read info about one HDF5 dataset, log if error
herr_t dataSetInfo(const hid_t &h5file, const std::string &setName,
hsize_t *dims) const;
/// Read dataset data to a buffer ot type double
herr_t dataSetDouble(const hid_t &h5file, const std::string &setName,
std::vector<double> &buf);
/// Load qvectors dataset, calculate modulus of vectors
HistogramData::Points loadQvectors(const hid_t &h5file,
const API::WorkspaceGroup_sptr &gws,
std::vector<int> &sorting_indexes);
/// Load structure factor asa function of q-vector modulus
void loadFQ(const hid_t &h5file, const API::WorkspaceGroup_sptr &gws,
const std::string &setName, const HistogramData::Points &qvmod,
const std::vector<int> &sorting_indexes);
/// Load time-dependent structure factor
void loadFQT(const hid_t &h5file, const API::WorkspaceGroup_sptr &gws,
const std::string &setName, const HistogramData::Points &qvmod,
const std::vector<int> &sorting_indexes);
private:
/// Initialization code
void init() override; // Overwrites Algorithm method.
/// Execution code
void exec() override; // Overwrites Algorithm method
/// Loads one dataset
void loadSet(const std::string &version, const std::string &setName);
/// valid datasets
std::vector<std::string> m_validSets;
/// name and path of input file
std::string m_filename;
}; // class LoadSassena
} // namespace DataHandling
} // namespace Mantid