Mantid
Loading...
Searching...
No Matches
H5Util.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2016 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 "MantidDataHandling/DllConfig.h"
10
11#include <map>
12#include <string>
13#include <vector>
14
15// forward declarations
16namespace H5 {
17class DataSpace;
18class DataSet;
19class DSetCreatPropList;
20class DataType;
21class Group;
22class H5File;
23} // namespace H5
24
25namespace Mantid {
26namespace DataHandling {
27namespace H5Util {
32MANTID_DATAHANDLING_DLL H5::DataSpace getDataSpace(const size_t length);
33
35template <typename NumT> H5::DataSpace getDataSpace(const std::vector<NumT> &data);
36
38template <typename NumT> H5::DataType getType();
39
40MANTID_DATAHANDLING_DLL H5::Group createGroupNXS(H5::H5File &file, const std::string &name, const std::string &nxtype);
41
42MANTID_DATAHANDLING_DLL H5::Group createGroupNXS(H5::Group &group, const std::string &name, const std::string &nxtype);
43
44MANTID_DATAHANDLING_DLL H5::Group createGroupCanSAS(H5::Group &group, const std::string &name,
45 const std::string &nxtype, const std::string &cstype);
46
47MANTID_DATAHANDLING_DLL H5::Group createGroupCanSAS(H5::H5File &file, const std::string &name,
48 const std::string &nxtype, const std::string &cstype);
49
56MANTID_DATAHANDLING_DLL H5::DSetCreatPropList setCompressionAttributes(const std::size_t length,
57 const int deflateLevel = 6);
58
59template <typename LocationType>
60void writeStrAttribute(LocationType &location, const std::string &name, const std::string &value);
61
62template <typename NumT, typename LocationType>
63void writeNumAttribute(LocationType &location, const std::string &name, const NumT &value);
64
65template <typename NumT, typename LocationType>
66void writeNumAttribute(LocationType &location, const std::string &name, const std::vector<NumT> &value);
67
68MANTID_DATAHANDLING_DLL void write(H5::Group &group, const std::string &name, const std::string &value);
69
70template <typename T>
71void writeScalarDataSetWithStrAttributes(H5::Group &group, const std::string &name, const T &value,
72 const std::map<std::string, std::string> &attributes);
73
74template <typename NumT> void writeArray1D(H5::Group &group, const std::string &name, const std::vector<NumT> &values);
75
76MANTID_DATAHANDLING_DLL std::string readString(H5::H5File &file, const std::string &path);
77
78MANTID_DATAHANDLING_DLL std::string readString(H5::Group &group, const std::string &name);
79
80MANTID_DATAHANDLING_DLL std::string readString(H5::DataSet &dataset);
81
82MANTID_DATAHANDLING_DLL std::vector<std::string> readStringVector(H5::Group &, const std::string &);
83
84template <typename LocationType>
85std::string readAttributeAsString(LocationType &dataset, const std::string &attributeName);
86
87template <typename NumT, typename LocationType>
88NumT readNumAttributeCoerce(LocationType &location, const std::string &attributeName);
89
90template <typename NumT, typename LocationType>
91std::vector<NumT> readNumArrayAttributeCoerce(LocationType &location, const std::string &attributeName);
92
93template <typename NumT> std::vector<NumT> readArray1DCoerce(H5::Group &group, const std::string &name);
94
95template <typename NumT> std::vector<NumT> readArray1DCoerce(H5::DataSet &dataset);
96
97} // namespace H5Util
98} // namespace DataHandling
99} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
Definition: H5Util.h:16
MANTID_DATAHANDLING_DLL H5::DSetCreatPropList setCompressionAttributes(const std::size_t length, const int deflateLevel=6)
Sets up the chunking and compression rate.
Definition: H5Util.cpp:107
MANTID_DATAHANDLING_DLL std::string readString(H5::H5File &file, const std::string &path)
Definition: H5Util.cpp:174
MANTID_DATAHANDLING_DLL std::vector< std::string > readStringVector(H5::Group &, const std::string &)
MANTID_DATAHANDLING_DLL H5::Group createGroupCanSAS(H5::Group &group, const std::string &name, const std::string &nxtype, const std::string &cstype)
void writeNumAttribute(LocationType &location, const std::string &name, const NumT &value)
Definition: H5Util.cpp:124
void writeArray1D(H5::Group &group, const std::string &name, const std::vector< NumT > &values)
MANTID_DATAHANDLING_DLL H5::DataSpace getDataSpace(const size_t length)
H5Util : TODO: DESCRIPTION.
Definition: H5Util.cpp:46
MANTID_DATAHANDLING_DLL H5::Group createGroupNXS(H5::H5File &file, const std::string &name, const std::string &nxtype)
std::string readAttributeAsString(LocationType &dataset, const std::string &attributeName)
Definition: H5Util.cpp:234
NumT readNumAttributeCoerce(LocationType &location, const std::string &attributeName)
Definition: H5Util.cpp:304
MANTID_DATAHANDLING_DLL void write(H5::Group &group, const std::string &name, const std::string &value)
std::vector< NumT > readNumArrayAttributeCoerce(LocationType &location, const std::string &attributeName)
Definition: H5Util.cpp:332
void writeStrAttribute(LocationType &location, const std::string &name, const std::string &value)
Definition: H5Util.cpp:116
std::vector< NumT > readArray1DCoerce(H5::Group &group, const std::string &name)
Definition: H5Util.cpp:241
void writeScalarDataSetWithStrAttributes(H5::Group &group, const std::string &name, const T &value, const std::map< std::string, std::string > &attributes)
Definition: H5Util.cpp:152
H5::DataType getType()
Convert a primitive type to the appropriate H5::DataType.
Definition: H5Util.cpp:32
Helper class which provides the Collimation Length for SANS instruments.