Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Mantid::NeXus::NXDataSet Class Reference

Abstract base class for a Nexus data set. More...

#include <NexusClasses.h>

Inheritance diagram for Mantid::NeXus::NXDataSet:
Mantid::NeXus::NXObject Mantid::NeXus::NXDataSetTyped< T >

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ NXDataSet()

Mantid::NeXus::NXDataSet::NXDataSet ( const NXClass parent,
const std::string &  name 
)

Constructor.

Parameters
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.

Member Function Documentation

◆ dim0()

int Mantid::NeXus::NXDataSet::dim0 ( ) const

Returns the number of elements along the first dimension.

The size of the first dimension of data.

Returns
An integer indicating the size of the dimension.
Exceptions
out_of_rangeerror 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().

◆ dim1()

int Mantid::NeXus::NXDataSet::dim1 ( ) const

Returns the number of elements along the second dimension.

The size of the second dimension of data.

Returns
An integer indicating the size of the dimension
Exceptions
out_of_rangeerror 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()().

◆ dim2()

int Mantid::NeXus::NXDataSet::dim2 ( ) const

◆ dim3()

int Mantid::NeXus::NXDataSet::dim3 ( ) const

Returns the number of elements along the fourth dimension.

The size of the fourth dimension of data.

Returns
An integer indicating the size of the dimension
Exceptions
out_of_rangeerror 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().

◆ dims()

int Mantid::NeXus::NXDataSet::dims ( int  i) const
inline

Returns the number of elements along i-th dimension.

Definition at line 149 of file NexusClasses.h.

◆ getData()

void Mantid::NeXus::NXDataSet::getData ( void *  data)
protected

Wrapper to the NXgetdata.

Parameters
data:: The pointer to the buffer accepting the data from the file.
Exceptions
runtime_errorif 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().

◆ getSlab()

void Mantid::NeXus::NXDataSet::getSlab ( void *  data,
int  start[],
int  size[] 
)
protected

Wrapper to the NXgetslab.

Parameters
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.
Exceptions
runtime_errorif 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().

◆ load()

virtual void Mantid::NeXus::NXDataSet::load ( const int  blocksize = 1,
int  i = -1,
int  j = -1,
int  k = -1,
int  l = -1 
)
inlinevirtual

Load the data from the file.

Calling this method with all default arguments makes it to read in all the data.

Parameters
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.

◆ name()

std::string Mantid::NeXus::NXDataSet::name ( ) const
inline

Returns the name of the data set.

Definition at line 159 of file NexusClasses.h.

Referenced by getData(), getSlab(), NXDataSet(), open(), and openLocal().

◆ NX_class()

std::string Mantid::NeXus::NXDataSet::NX_class ( ) const
inlineoverridevirtual

NX class name. Returns "SDS".

Implements Mantid::NeXus::NXObject.

Definition at line 140 of file NexusClasses.h.

◆ open()

void Mantid::NeXus::NXDataSet::open ( )

◆ openLocal()

void Mantid::NeXus::NXDataSet::openLocal ( )

◆ rank()

int Mantid::NeXus::NXDataSet::rank ( ) const
inline

◆ type()

int Mantid::NeXus::NXDataSet::type ( ) const
inline

Returns the Nexus type of the data. The types are defied in napi.h.

Definition at line 161 of file NexusClasses.h.

Member Data Documentation

◆ m_info

NXInfo Mantid::NeXus::NXDataSet::m_info
private

Holds the data info.

Definition at line 194 of file NexusClasses.h.

Referenced by dim0(), dim1(), dim2(), dim3(), NXDataSet(), open(), and openLocal().


The documentation for this class was generated from the following files: