Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::Nexus::NXDataSetTyped< T > Class Template Reference

Templated class implementation of NXDataSet. More...

#include <NexusClasses.h>

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

Public Member Functions

void load ()
 Read all of the datablock in.
 
void load (dimsize_t const blocksize, dimsize_t const i)
 
void load (dimsize_t const blocksize, dimsize_t const i, dimsize_t const j)
 Implementation of the virtual NXDataSet::load(...) method.
 
 NXDataSetTyped (NXClass const &parent, std::string const &name)
 Constructor.
 
T * operator() ()
 
const T * operator() () const
 Returns a pointer to the internal data buffer.
 
T & operator() (std::size_t i, std::size_t j)
 
const T & operator() (std::size_t i, std::size_t j) const
 Returns a value assuming the data is a two-dimensional array.
 
T & operator() (std::size_t i, std::size_t j, std::size_t k)
 
const T & operator() (std::size_t i, std::size_t j, std::size_t k) const
 Returns a value assuming the data is a tree-dimensional array.
 
T & operator[] (std::size_t i)
 
const T & operator[] (std::size_t i) const
 Returns the i-th value in the internal buffer.
 
std::size_t size () const
 Returns the size of the data buffer.
 
container_T< T > & vecBuffer ()
 Returns a the internal buffer.
 
- Public Member Functions inherited from Mantid::Nexus::NXDataSet
dimsize_t dim0 () const
 Returns the number of elements along the first dimension.
 
dimsize_t dim1 () const
 Returns the number of elements along the second dimension.
 
dimsize_t dim2 () const
 Returns the number of elements along the third dimension.
 
dimsize_t dim3 () const
 Returns the number of elements along the fourth dimension.
 
dimsize_t dims (std::size_t i) const
 Returns the number of elements along i-th dimension.
 
std::string name () const
 Returns the name of the data set.
 
std::string NX_class () const override
 NX class name. Returns "SDS".
 
 NXDataSet (NXClass const &parent, std::string const &name)
 Constructor.
 
void open ()
 Opens the data set. Does not read in any data. Call load(...) to load the data.
 
void openLocal ()
 Opens datasets faster but the parent group must be already open.
 
std::size_t rank () const
 Returns the rank (number of dimensions) of the data. The maximum is 4.
 
NXnumtype type () const
 Returns the Nexus type of the data. The types are defined in NexusFile_fwd.h.
 
- Public Member Functions inherited from Mantid::Nexus::NXObject
NexusAddress const & address () const
 Returns the absolute address to the object.
 
std::string name () const
 Returns the name of the object.
 
 NXObject (File *fileID, NXClass const *parent, std::string const &name)
 NXObject constructor.
 
 NXObject (std::shared_ptr< File > const &fileID, NXClass const *parent, std::string const &name)
 NXObject constructor.
 
virtual ~NXObject ()=default
 

Private Member Functions

void alloc (dimsize_t new_size)
 Allocates memory for the data buffer.
 
void rangeError () const
 A shortcut to "throw std::range_error("Nexus dataset range error");".
 

Private Attributes

container_T< T > m_data
 The data buffer.
 
std::size_t m_size
 The buffer size.
 

Additional Inherited Members

- Public Attributes inherited from Mantid::Nexus::NXDataSet
NXAttributes attributes
 Attributes.
 
- Public Attributes inherited from Mantid::Nexus::NXObject
std::shared_ptr< File > m_fileID
 Nexus file id.
 
- Protected Member Functions inherited from Mantid::Nexus::NXDataSet
template<typename NumT >
void getData (NumT *data)
 Wrapper to the NXgetdata.
 
template<typename NumT >
void getSlab (NumT *data, DimVector const &start, DimVector const &size)
 Wrapper to the NXgetslab.
 
- Protected Attributes inherited from Mantid::Nexus::NXObject
NexusAddress m_address
 Keeps the absolute address to the object.
 
bool m_open
 Set to true if the object has been open.
 

Detailed Description

template<class T>
class Mantid::Nexus::NXDataSetTyped< T >

Templated class implementation of NXDataSet.

After loading the data it can be accessed via operators () and [].

Definition at line 196 of file NexusClasses.h.

Constructor & Destructor Documentation

◆ NXDataSetTyped()

template<class T >
Mantid::Nexus::NXDataSetTyped< T >::NXDataSetTyped ( NXClass const &  parent,
std::string const &  name 
)
inline

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 205 of file NexusClasses.h.

Member Function Documentation

◆ alloc()

template<class T >
void Mantid::Nexus::NXDataSetTyped< T >::alloc ( dimsize_t  new_size)
inlineprivate

◆ load() [1/3]

template<class T >
void Mantid::Nexus::NXDataSetTyped< T >::load ( )
inline

Read all of the datablock in.

Definition at line 276 of file NexusClasses.h.

References Mantid::Nexus::NXDataSetTyped< T >::alloc(), Mantid::Nexus::NXDataSet::dim0(), Mantid::Nexus::NXDataSet::dim1(), Mantid::Nexus::NXDataSet::dim2(), Mantid::Nexus::NXDataSet::dim3(), Mantid::Nexus::NXDataSet::getData(), Mantid::Nexus::NXDataSetTyped< T >::m_data, and Mantid::Nexus::NXDataSet::rank().

Referenced by Mantid::DataHandling::LoadNexusProcessed::doAccelleratedMultiPeriodLoading(), Mantid::DataHandling::LoadISISNexus2::exec(), Mantid::DataHandling::LoadQKK::exec(), Mantid::DataHandling::LoadNexusProcessed2::extractMappingInfoNew(), Mantid::DataHandling::LoadISISNexusHelper::findDetectorIDsAndSpectrumNumber(), Mantid::DataHandling::LoadISISNexusHelper::findNumberOfSpectra(), Mantid::Nexus::NXClass::getDouble(), Mantid::Nexus::NXClass::getFloat(), Mantid::Nexus::NXClass::getInt(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::getIntVector(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::getPeriodTotalCounts(), Mantid::DataHandling::LoadHelper::getTimeBinningFromNexusAddress(), Mantid::DataHandling::LoadILLSANS::getVariableTimeBinning(), Mantid::DataHandling::LoadILLReflectometry::initNames(), Mantid::DataHandling::LoadILLPolarizedDiffraction::initStaticWorkspace(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD11B(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD22B(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD33(), Mantid::DataHandling::LoadNexusProcessed::loadBlock(), Mantid::DataHandling::LoadNexusProcessed::loadBlock(), Mantid::DataHandling::LoadNexusProcessed::loadBlock(), Mantid::DataHandling::LoadISISNexus2::loadBlock(), Mantid::DataHandling::LoadILLIndirect2::loadDataDetails(), Mantid::DataHandling::LoadILLReflectometry::loadDataDetails(), Mantid::DataHandling::LoadMLZ::loadDataIntoTheWorkSpace(), Mantid::DataHandling::LoadSINQFocus::loadDataIntoTheWorkSpace(), Mantid::DataHandling::LoadILLDiffraction::loadDataScan(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadDeadTimesFromNexus(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadDetectorGroupingFromNexus(), Mantid::DataHandling::LoadNexusProcessed::loadEntry(), Mantid::DataHandling::LoadNexusProcessed::loadEventEntry(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadGoodFramesDataFromNexus(), Mantid::DataHandling::LoadNexusProcessed::loadLeanElasticPeaksEntry(), Mantid::DataHandling::LoadNexusProcessed::loadNonSpectraAxis(), Mantid::DataHandling::LoadNexusProcessed::loadNumericColumn(), Mantid::DataHandling::LoadBBY::loadNXDataSet(), Mantid::DataHandling::ANSTO::Anxs::loadNXDataSet(), Mantid::DataHandling::loadNXDataSet(), Mantid::DataHandling::LoadNexusProcessed::loadPeaksEntry(), Mantid::DataHandling::LoadISISNexus2::loadPeriodData(), Mantid::DataHandling::LoadISISNexusHelper::loadRunDetails(), Mantid::DataHandling::LoadISISNexusHelper::loadSampleGeometry(), Mantid::DataHandling::LoadILLTOF3::loadTimeDetails(), Mantid::DataHandling::LoadMLZ::loadTimeDetails(), Mantid::DataHandling::LoadILLPolarizedDiffraction::loadTwoThetaDetectors(), Mantid::DataHandling::LoadNexusProcessed::loadV3DColumn(), Mantid::DataHandling::LoadNexusProcessed::loadVectorColumn(), Mantid::DataHandling::LoadMLZ::maskDetectors(), Mantid::DataHandling::LoadILLIndirect2::moveSingleDetectors(), Mantid::DataHandling::LoadILLPolarizedDiffraction::moveTwoTheta(), Mantid::DataHandling::LoadILLPolarizedDiffraction::prepareAxes(), Mantid::DataHandling::LoadILLTOF3::prepareAxis(), Mantid::DataHandling::LoadNexusProcessed::readBinMasking(), and Mantid::DataHandling::LoadILLReflectometry::sampleAngle().

◆ load() [2/3]

template<class T >
void Mantid::Nexus::NXDataSetTyped< T >::load ( dimsize_t const  blocksize,
dimsize_t const  i 
)
inline

◆ load() [3/3]

template<class T >
void Mantid::Nexus::NXDataSetTyped< T >::load ( dimsize_t const  blocksize,
dimsize_t const  i,
dimsize_t const  j 
)
inline

Implementation of the virtual NXDataSet::load(...) method.

Internally the data are stored as a 1d array. If the data are loaded in chunks the newly read in data replace the old ones. The actual rank of the loaded data is equal or less than the rank of the dataset (returned by rank() method).

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 indeces. The rank of the data must be >= 2

Definition at line 357 of file NexusClasses.h.

References Mantid::Nexus::NXDataSetTyped< T >::alloc(), Mantid::Nexus::NXDataSet::dim0(), Mantid::Nexus::NXDataSet::dim1(), Mantid::Nexus::NXDataSet::dim2(), Mantid::Nexus::NXDataSet::dim3(), Mantid::Nexus::NXDataSet::getSlab(), Mantid::Geometry::m, Mantid::Nexus::NXDataSetTyped< T >::m_data, n, Mantid::Nexus::NXDataSetTyped< T >::rangeError(), and Mantid::Nexus::NXDataSet::rank().

◆ operator()() [1/6]

template<class T >
T * Mantid::Nexus::NXDataSetTyped< T >::operator() ( )
inline

◆ operator()() [2/6]

template<class T >
const T * Mantid::Nexus::NXDataSetTyped< T >::operator() ( ) const
inline

Returns a pointer to the internal data buffer.

Exceptions
runtime_errorexception if the data have not been loaded / initialized.
Returns
a pointer to the array of items

Definition at line 212 of file NexusClasses.h.

References Mantid::Nexus::NXObject::address(), and Mantid::Nexus::NXDataSetTyped< T >::m_data.

◆ operator()() [3/6]

template<class T >
T & Mantid::Nexus::NXDataSetTyped< T >::operator() ( std::size_t  i,
std::size_t  j 
)
inline

Definition at line 251 of file NexusClasses.h.

◆ operator()() [4/6]

template<class T >
const T & Mantid::Nexus::NXDataSetTyped< T >::operator() ( std::size_t  i,
std::size_t  j 
) const
inline

Returns a value assuming the data is a two-dimensional array.

Parameters
i:: The index along dim0()
j:: The index along dim1()
Exceptions
runtime_errorif the data have not been loaded / initialized.
range_errorif the indeces point outside the buffer.
Returns
A reference to the value

Definition at line 250 of file NexusClasses.h.

References Mantid::Nexus::NXDataSet::dim1(), and Mantid::Nexus::NXDataSetTyped< T >::operator[]().

◆ operator()() [5/6]

template<class T >
T & Mantid::Nexus::NXDataSetTyped< T >::operator() ( std::size_t  i,
std::size_t  j,
std::size_t  k 
)
inline

Definition at line 266 of file NexusClasses.h.

◆ operator()() [6/6]

template<class T >
const T & Mantid::Nexus::NXDataSetTyped< T >::operator() ( std::size_t  i,
std::size_t  j,
std::size_t  k 
) const
inline

Returns a value assuming the data is a tree-dimensional array.

Parameters
i:: The index along dim0()
j:: The index along dim1()
k:: The index along dim2()
Exceptions
runtime_errorif the data have not been loaded / initialized.
range_errorif the indeces point outside the buffer.
Returns
A reference to the value

Definition at line 263 of file NexusClasses.h.

References Mantid::Nexus::NXDataSet::dim1(), Mantid::Nexus::NXDataSet::dim2(), and Mantid::Nexus::NXDataSetTyped< T >::operator[]().

◆ operator[]() [1/2]

template<class T >
T & Mantid::Nexus::NXDataSetTyped< T >::operator[] ( std::size_t  i)
inline

Definition at line 240 of file NexusClasses.h.

◆ operator[]() [2/2]

template<class T >
const T & Mantid::Nexus::NXDataSetTyped< T >::operator[] ( std::size_t  i) const
inline

Returns the i-th value in the internal buffer.

Parameters
i:: The linear index of the data element
Exceptions
runtime_errorif the data have not been loaded / initialized.
range_errorif the index is greater than the buffer size.
Returns
A reference to the value

Definition at line 232 of file NexusClasses.h.

References Mantid::Nexus::NXObject::address(), Mantid::Nexus::NXDataSetTyped< T >::m_data, Mantid::Nexus::NXDataSetTyped< T >::m_size, and Mantid::Nexus::NXDataSetTyped< T >::rangeError().

Referenced by Mantid::Nexus::NXDataSetTyped< T >::operator()(), and Mantid::Nexus::NXDataSetTyped< T >::operator()().

◆ rangeError()

template<class T >
void Mantid::Nexus::NXDataSetTyped< T >::rangeError ( ) const
inlineprivate

A shortcut to "throw std::range_error("Nexus dataset range error");".

Definition at line 417 of file NexusClasses.h.

Referenced by Mantid::Nexus::NXDataSetTyped< T >::load(), Mantid::Nexus::NXDataSetTyped< T >::load(), and Mantid::Nexus::NXDataSetTyped< T >::operator[]().

◆ size()

template<class T >
std::size_t Mantid::Nexus::NXDataSetTyped< T >::size ( ) const
inline

◆ vecBuffer()

template<class T >
container_T< T > & Mantid::Nexus::NXDataSetTyped< T >::vecBuffer ( )
inline

Member Data Documentation

◆ m_data

template<class T >
container_T<T> Mantid::Nexus::NXDataSetTyped< T >::m_data
private

◆ m_size

template<class T >
std::size_t Mantid::Nexus::NXDataSetTyped< T >::m_size
private

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