Mantid
|
Abstract base class for a Nexus data set. More...
#include <NexusClasses.h>
Public Member Functions | |
int | dim0 () const |
Returns the number of elements along the first dimension. More... | |
int | dim1 () const |
Returns the number of elements along the second dimension. More... | |
int | dim2 () const |
Returns the number of elements along the third dimension. More... | |
int | dim3 () const |
Returns the number of elements along the fourth dimension. More... | |
int | dims (int i) const |
Returns the number of elements along i-th dimension. More... | |
virtual void | load (const int blocksize=1, int i=-1, int j=-1, int k=-1, int l=-1) |
Load the data from the file. More... | |
std::string | name () const |
Returns the name of the data set. More... | |
std::string | NX_class () const override |
NX class name. Returns "SDS". More... | |
NXDataSet (const NXClass &parent, const std::string &name) | |
Constructor. More... | |
void | open () |
Opens the data set. More... | |
void | openLocal () |
Opens datasets faster but the parent group must be already open. More... | |
int | rank () const |
Returns the rank (number of dimensions) of the data. The maximum is 4. More... | |
int | type () const |
Returns the Nexus type of the data. The types are defied in napi.h. More... | |
Public Member Functions inherited from Mantid::NeXus::NXObject | |
std::string | name () const |
Returns the name of the object. More... | |
virtual std::string | NX_class () const =0 |
Return the NX class name for a class (HDF group) or "SDS" for a data set;. More... | |
NXObject (const NXhandle fileID, const NXClass *parent, const std::string &name) | |
NXObject constructor. More... | |
std::string | path () const |
Returns the absolute path to the object. More... | |
virtual | ~NXObject ()=default |
Protected Member Functions | |
void | getData (void *data) |
Wrapper to the NXgetdata. More... | |
void | getSlab (void *data, int start[], int size[]) |
Wrapper to the NXgetslab. More... | |
Private Attributes | |
NXInfo | m_info |
Holds the data info. More... | |
Additional Inherited Members | |
Public Attributes inherited from Mantid::NeXus::NXObject | |
NXAttributes | attributes |
Attributes. More... | |
NXhandle | m_fileID |
Nexus file id. More... | |
Protected Attributes inherited from Mantid::NeXus::NXObject | |
bool | m_open |
Set to true if the object has been open. More... | |
std::string | m_path |
Keeps the absolute path to the object. More... | |
Abstract base class for a Nexus data set.
A typical use include:
There is no need to free the memory allocated by the NXDataSet as it is done at the destruction.
Definition at line 135 of file NexusClasses.h.
Mantid::NeXus::NXDataSet::NXDataSet | ( | const NXClass & | parent, |
const std::string & | name | ||
) |
Constructor.
parent | :: The parent Nexus class. In terms of HDF it is the group containing the dataset. |
name | :: The name of the dataset relative to its parent |
Definition at line 431 of file NexusClasses.cpp.
References m_info, name(), and Mantid::NeXus::NXInfo::nxname.
int Mantid::NeXus::NXDataSet::dim0 | ( | ) | const |
Returns the number of elements along the first dimension.
The size of the first dimension of data.
out_of_range | error if requested on an object of rank 0 |
Definition at line 479 of file NexusClasses.cpp.
References Mantid::NeXus::NXInfo::dims, m_info, and Mantid::NeXus::NXInfo::rank.
Referenced by Mantid::NeXus::NXNote::author(), Mantid::NeXus::NXLog::createTimeSeries(), Mantid::NeXus::NXNote::description(), Mantid::DataHandling::LoadMuonNexus2::doExec(), Mantid::DataHandling::LoadISISNexus2::exec(), Mantid::DataHandling::LoadNexusProcessed2::extractMappingInfoNew(), Mantid::DataHandling::LoadISISNexusHelper::findNumberOfSpectra(), Mantid::DataHandling::LoadISISNexus2::findSpectraDetRangeInFile(), Mantid::DataHandling::LoadILLSANS::getDataDimensions(), Mantid::NeXus::NXClass::getString(), Mantid::DataHandling::LoadHelper::getTimeBinningFromNexusPath(), Mantid::DataHandling::LoadILLSANS::getVariableTimeBinning(), Mantid::DataHandling::LoadLLB::initWorkSpace(), Mantid::DataHandling::LoadSINQFocus::initWorkSpace(), Mantid::DataHandling::LoadILLSANS::initWorkSpace(), Mantid::DataHandling::LoadMLZ::initWorkSpace(), Mantid::DataHandling::LoadILLTOF2::initWorkSpace(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD11B(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD22B(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD33(), Mantid::NeXus::NXDataSetTyped< T >::load(), Mantid::DataHandling::LoadILLIndirect2::loadDataDetails(), Mantid::DataHandling::LoadILLSANS::loadDataFromMonitors(), Mantid::DataHandling::LoadILLTOF2::loadDataIntoTheWorkSpace(), Mantid::DataHandling::LoadILLDiffraction::loadDataScan(), Mantid::DataHandling::LoadMuonNexus1::loadDeadTimes(), Mantid::DataHandling::LoadMuonNexus1::loadDetectorGrouping(), Mantid::DataHandling::LoadMuonNexus2::loadDetectorMapping(), Mantid::DataHandling::LoadNexusProcessed::loadEntry(), Mantid::DataHandling::LoadNexusProcessed::loadEventEntry(), Mantid::DataHandling::LoadNexusProcessed::loadLeanElasticPeaksEntry(), Mantid::DataHandling::LoadNexusProcessed::loadNonEventEntry(), Mantid::DataHandling::LoadNexusProcessed::loadNonSpectraAxis(), Mantid::DataHandling::LoadNexusProcessed::loadNumericColumn(), Mantid::DataHandling::LoadBBY::loadNXString(), Mantid::DataHandling::loadNXString(), Mantid::DataHandling::LoadNexusProcessed::loadPeaksEntry(), Mantid::DataHandling::LoadISISNexus2::loadPeriodData(), Mantid::DataHandling::LoadISISNexusHelper::loadTimeData(), Mantid::DataHandling::LoadNexusProcessed::loadV3DColumn(), and Mantid::DataHandling::LoadNexusProcessed::readBinMasking().
int Mantid::NeXus::NXDataSet::dim1 | ( | ) | const |
Returns the number of elements along the second dimension.
The size of the second dimension of data.
out_of_range | error if requested on an object of rank < 2 |
Definition at line 491 of file NexusClasses.cpp.
References Mantid::NeXus::NXInfo::dims, m_info, and Mantid::NeXus::NXInfo::rank.
Referenced by Mantid::DataHandling::LoadNexusProcessed::doAccelleratedMultiPeriodLoading(), Mantid::DataHandling::LoadQKK::exec(), Mantid::DataHandling::LoadILLSANS::getDataDimensions(), Mantid::DataHandling::LoadILLSANS::getOmegaBinning(), Mantid::DataHandling::LoadLLB::initWorkSpace(), Mantid::DataHandling::LoadSINQFocus::initWorkSpace(), Mantid::DataHandling::LoadILLSANS::initWorkSpace(), Mantid::DataHandling::LoadMLZ::initWorkSpace(), Mantid::DataHandling::LoadILLTOF2::initWorkSpace(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD11B(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD22B(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD33(), Mantid::NeXus::NXDataSetTyped< T >::load(), Mantid::DataHandling::LoadNexusProcessed::loadBlock(), Mantid::DataHandling::LoadMuonNexus2::loadData(), Mantid::DataHandling::LoadILLIndirect2::loadDataDetails(), Mantid::DataHandling::LoadILLSANS::loadDataFromD16ScanMonitors(), Mantid::DataHandling::LoadILLSANS::loadDataFromMonitors(), Mantid::DataHandling::LoadILLDiffraction::loadDataScan(), Mantid::DataHandling::LoadNexusProcessed::loadEntry(), Mantid::DataHandling::LoadNexusProcessed::loadEventEntry(), Mantid::DataHandling::LoadNexusProcessed::loadNonEventEntry(), and Mantid::NeXus::NXDataSetTyped< T >::operator()().
int Mantid::NeXus::NXDataSet::dim2 | ( | ) | const |
Returns the number of elements along the third dimension.
The size of the third dimension of data.
out_of_range | error if requested on an object of rank < 3 |
Definition at line 503 of file NexusClasses.cpp.
References Mantid::NeXus::NXInfo::dims, m_info, and Mantid::NeXus::NXInfo::rank.
Referenced by Mantid::DataHandling::LoadQKK::exec(), Mantid::DataHandling::LoadISISNexus2::findSpectraDetRangeInFile(), Mantid::DataHandling::LoadILLSANS::getDataDimensions(), Mantid::DataHandling::LoadILLSANS::initWorkSpace(), Mantid::DataHandling::LoadMLZ::initWorkSpace(), Mantid::DataHandling::LoadILLTOF2::initWorkSpace(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD33(), Mantid::NeXus::NXDataSetTyped< T >::load(), Mantid::DataHandling::LoadMuonNexus2::loadData(), Mantid::DataHandling::LoadILLIndirect2::loadDataDetails(), Mantid::DataHandling::LoadILLSANS::loadDataFromMonitors(), Mantid::DataHandling::LoadILLDiffraction::loadDataScan(), and Mantid::NeXus::NXDataSetTyped< T >::operator()().
int Mantid::NeXus::NXDataSet::dim3 | ( | ) | const |
Returns the number of elements along the fourth dimension.
The size of the fourth dimension of data.
out_of_range | error if requested on an object of rank < 4 |
Definition at line 515 of file NexusClasses.cpp.
References Mantid::NeXus::NXInfo::dims, m_info, and Mantid::NeXus::NXInfo::rank.
Referenced by Mantid::NeXus::NXDataSetTyped< T >::load().
|
inline |
Returns the number of elements along i-th dimension.
Definition at line 149 of file NexusClasses.h.
|
protected |
Wrapper to the NXgetdata.
data | :: The pointer to the buffer accepting the data from the file. |
runtime_error | if the operation fails. |
Definition at line 526 of file NexusClasses.cpp.
References Mantid::NeXus::NXObject::m_fileID, and name().
Referenced by Mantid::NeXus::NXDataSetTyped< T >::load().
|
protected |
Wrapper to the NXgetslab.
data | :: The pointer to the buffer accepting the data from the file. |
start | :: The array of starting indeces to read in from the file. The size of the array must be equal to the rank of the data. |
size | :: The array of numbers of data elements to read along each dimenstion. The number of dimensions (the size of the array) must be equal to the rank of the data. |
runtime_error | if the operation fails. |
Definition at line 544 of file NexusClasses.cpp.
References Mantid::NeXus::NXObject::m_fileID, and name().
Referenced by Mantid::NeXus::NXDataSetTyped< T >::load().
|
inlinevirtual |
Load the data from the file.
Calling this method with all default arguments makes it to read in all the data.
blocksize | :: The size of the block of data that should be read. Note that this is only used for rank 2 and 3 datasets currently |
i | :: Calling load with non-negative i reads in a chunk of dimension rank()-1 and i is the index of the chunk. The rank of the data must be >= 1 |
j | :: Non-negative value makes it read a chunk of dimension rank()-2. i and j are its indices. The rank of the data must be >= 2 |
k | :: Non-negative value makes it read a chunk of dimension rank()-3. i,j and k are its indices. The rank of the data must be >= 3 |
l | :: Non-negative value makes it read a chunk of dimension rank()-4. i,j,k and l are its indices. The rank of the data must be 4 |
Reimplemented in Mantid::NeXus::NXDataSetTyped< T >.
Definition at line 180 of file NexusClasses.h.
|
inline |
Returns the name of the data set.
Definition at line 159 of file NexusClasses.h.
Referenced by getData(), getSlab(), NXDataSet(), open(), and openLocal().
|
inlineoverridevirtual |
NX class name. Returns "SDS".
Implements Mantid::NeXus::NXObject.
Definition at line 140 of file NexusClasses.h.
void Mantid::NeXus::NXDataSet::open | ( | ) |
Opens the data set.
Does not read in any data. Call load(...) to load the data
Definition at line 443 of file NexusClasses.cpp.
References Mantid::NeXus::NXInfo::dims, Mantid::NeXus::NXObject::getAttributes(), Mantid::NeXus::NXObject::m_fileID, m_info, Mantid::NeXus::NXObject::m_path, name(), Mantid::NeXus::NXInfo::rank, and Mantid::NeXus::NXInfo::type.
Referenced by Mantid::DataHandling::LoadISISNexus2::loadPeriodData(), Mantid::NeXus::NXData::openData(), and Mantid::NeXus::NXClass::openNXDataSet().
void Mantid::NeXus::NXDataSet::openLocal | ( | ) |
Opens datasets faster but the parent group must be already open.
Definition at line 463 of file NexusClasses.cpp.
References Mantid::NeXus::NXInfo::dims, Mantid::NeXus::NXObject::getAttributes(), Mantid::NeXus::NXObject::m_fileID, m_info, name(), Mantid::NeXus::NXInfo::rank, and Mantid::NeXus::NXInfo::type.
Referenced by Mantid::NeXus::NXLog::createTimeSeries(), and Mantid::DataHandling::LoadNexusProcessed::doAccelleratedMultiPeriodLoading().
|
inline |
Returns the rank (number of dimensions) of the data. The maximum is 4.
Definition at line 147 of file NexusClasses.h.
Referenced by Mantid::NeXus::NXDataSetTyped< T >::load(), Mantid::DataHandling::LoadMuonNexus2::loadData(), Mantid::DataHandling::LoadNexusProcessed::loadEntry(), and Mantid::DataHandling::LoadNexusProcessed::loadEventEntry().
|
inline |
Returns the Nexus type of the data. The types are defied in napi.h.
Definition at line 161 of file NexusClasses.h.
|
private |
Holds the data info.
Definition at line 194 of file NexusClasses.h.
Referenced by dim0(), dim1(), dim2(), dim3(), NXDataSet(), open(), and openLocal().