Mantid
|
Templated class implementation of NXDataSet. More...
#include <NexusClasses.h>
Public Member Functions | |
void | load (const int blocksize=1, int i=-1, int j=-1, int k=-1, int l=-1) override |
Implementation of the virtual NXDataSet::load(...) method. More... | |
NXDataSetTyped (const NXClass &parent, const std::string &name) | |
Constructor. More... | |
T * | operator() () |
const T * | operator() () const |
Returns a pointer to the internal data buffer. More... | |
T & | operator() (int i, int j) |
const T & | operator() (int i, int j) const |
Returns a value assuming the data is a two-dimensional array. More... | |
T & | operator() (int i, int j, int k) |
const T & | operator() (int i, int j, int k) const |
Returns a value assuming the data is a tree-dimensional array. More... | |
T & | operator[] (int i) |
const T & | operator[] (int i) const |
Returns the i-th value in the internal buffer. More... | |
int | size () const |
Returns the size of the data buffer. More... | |
container_T< T > & | vecBuffer () |
Returns a the internal buffer. More... | |
Public Member Functions inherited from Mantid::NeXus::NXDataSet | |
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 |
Private Member Functions | |
void | alloc (int n) |
Allocates memory for the data buffer. More... | |
void | rangeError () const |
A shortcut to "throw std::range_error("Nexus dataset range error");". More... | |
Private Attributes | |
container_T< T > | m_data |
The data buffer. More... | |
int | m_n |
The buffer size. More... | |
int | m_size [4] |
The sizes of the loaded data. More... | |
Additional Inherited Members | |
Public Attributes inherited from Mantid::NeXus::NXObject | |
NXAttributes | attributes |
Attributes. More... | |
NXhandle | m_fileID |
Nexus file id. More... | |
Protected Member Functions inherited from Mantid::NeXus::NXDataSet | |
void | getData (void *data) |
Wrapper to the NXgetdata. More... | |
void | getSlab (void *data, int start[], int size[]) |
Wrapper to the NXgetslab. 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... | |
Templated class implementation of NXDataSet.
After loading the data it can be accessed via operators () and [].
Definition at line 203 of file NexusClasses.h.
|
inline |
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 211 of file NexusClasses.h.
|
inlineprivate |
Allocates memory for the data buffer.
n | :: The number of elements to allocate. |
Definition at line 439 of file NexusClasses.h.
References Mantid::NeXus::NXDataSetTyped< T >::m_data, Mantid::NeXus::NXDataSetTyped< T >::m_n, n, and Mantid::NeXus::NXObject::path().
Referenced by Mantid::NeXus::NXDataSetTyped< T >::load().
|
inlineoverridevirtual |
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).
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 |
k | :: Non-negative value makes it read a chunk of dimension rank()-3. i,j and k are its indeces. 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 indeces. The rank of the data must be 4 |
Reimplemented from Mantid::NeXus::NXDataSet.
Definition at line 289 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::NXDataSet::getSlab(), Mantid::Geometry::m, Mantid::NeXus::NXDataSetTyped< T >::m_data, Mantid::NeXus::NXDataSetTyped< T >::m_size, n, Mantid::NeXus::NXDataSetTyped< T >::rangeError(), and Mantid::NeXus::NXDataSet::rank().
Referenced by Mantid::NeXus::NXNote::author(), Mantid::NeXus::NXLog::createTimeSeries(), Mantid::NeXus::NXNote::description(), Mantid::DataHandling::LoadNexusProcessed::doAccelleratedMultiPeriodLoading(), Mantid::DataHandling::LoadMuonNexus2::doExec(), 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::LoadILLTOF2::getMonitorInfo(), Mantid::DataHandling::LoadILLSANS::getOmegaBinning(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::getPeriodTotalCounts(), Mantid::NeXus::NXClass::getString(), Mantid::DataHandling::LoadHelper::getTimeBinningFromNexusPath(), Mantid::DataHandling::LoadILLSANS::getVariableTimeBinning(), Mantid::DataHandling::LoadILLReflectometry::initNames(), Mantid::DataHandling::LoadILLPolarizedDiffraction::initStaticWorkspace(), Mantid::DataHandling::LoadILLSANS::initWorkSpace(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD11B(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD22B(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD33(), Mantid::DataHandling::LoadNexusProcessed::loadBlock(), Mantid::DataHandling::LoadISISNexus2::loadBlock(), Mantid::DataHandling::LoadILLPolarizedDiffraction::loadData(), Mantid::DataHandling::LoadILLReflectometry::loadData(), Mantid::DataHandling::LoadILLReflectometry::loadDataDetails(), Mantid::DataHandling::LoadILLIndirect2::loadDataDetails(), Mantid::DataHandling::LoadILLSANS::loadDataFromD16ScanMonitors(), Mantid::DataHandling::LoadILLSANS::loadDataFromMonitors(), Mantid::DataHandling::LoadLLB::loadDataIntoTheWorkSpace(), Mantid::DataHandling::LoadSINQFocus::loadDataIntoTheWorkSpace(), Mantid::DataHandling::LoadILLIndirect2::loadDataIntoTheWorkSpace(), Mantid::DataHandling::LoadMLZ::loadDataIntoTheWorkSpace(), Mantid::DataHandling::LoadILLTOF2::loadDataIntoTheWorkSpace(), Mantid::DataHandling::LoadILLDiffraction::loadDataScan(), Mantid::DataHandling::LoadMuonNexus1::loadDeadTimes(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadDeadTimesFromNexus(), Mantid::DataHandling::LoadMuonNexus1::loadDetectorGrouping(), Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadDetectorGroupingFromNexus(), Mantid::DataHandling::LoadILLIndirect2::loadDiffractionData(), 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::loadNXDataSet(), Mantid::DataHandling::LoadBBY::loadNXString(), Mantid::DataHandling::loadNXString(), Mantid::DataHandling::LoadNexusProcessed::loadPeaksEntry(), Mantid::DataHandling::LoadISISNexus2::loadPeriodData(), Mantid::DataHandling::LoadISISNexusHelper::loadRunDetails(), Mantid::DataHandling::LoadISISNexusHelper::loadSampleGeometry(), Mantid::DataHandling::LoadILLReflectometry::loadSingleMonitor(), Mantid::DataHandling::LoadNexusProcessed::loadTableEntry(), Mantid::DataHandling::LoadILLTOF2::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::LoadNexusProcessed::readBinMasking(), and Mantid::DataHandling::LoadILLReflectometry::sampleAngle().
|
inline |
Definition at line 223 of file NexusClasses.h.
References Mantid::NeXus::NXDataSetTyped< T >::m_data, and Mantid::NeXus::NXObject::path().
|
inline |
Returns a pointer to the internal data buffer.
runtime_error | exception if the data have not been loaded / initialized. |
Definition at line 217 of file NexusClasses.h.
References Mantid::NeXus::NXDataSetTyped< T >::m_data, and Mantid::NeXus::NXObject::path().
|
inline |
Definition at line 252 of file NexusClasses.h.
|
inline |
Returns a value assuming the data is a two-dimensional array.
runtime_error | if the data have not been loaded / initialized. |
range_error | if the indeces point outside the buffer. |
Definition at line 251 of file NexusClasses.h.
References Mantid::NeXus::NXDataSet::dim1(), and Mantid::NeXus::NXDataSetTyped< T >::operator[]().
|
inline |
Definition at line 262 of file NexusClasses.h.
|
inline |
Returns a value assuming the data is a tree-dimensional array.
runtime_error | if the data have not been loaded / initialized. |
range_error | if the indeces point outside the buffer. |
Definition at line 261 of file NexusClasses.h.
References Mantid::NeXus::NXDataSet::dim1(), Mantid::NeXus::NXDataSet::dim2(), and Mantid::NeXus::NXDataSetTyped< T >::operator[]().
|
inline |
Definition at line 243 of file NexusClasses.h.
|
inline |
Returns the i-th value in the internal buffer.
i | :: The linear index of the data element |
runtime_error | if the data have not been loaded / initialized. |
range_error | if the index is greater than the buffer size. |
Definition at line 235 of file NexusClasses.h.
References Mantid::NeXus::NXDataSetTyped< T >::m_data, Mantid::NeXus::NXDataSetTyped< T >::m_n, Mantid::NeXus::NXObject::path(), and Mantid::NeXus::NXDataSetTyped< T >::rangeError().
Referenced by Mantid::NeXus::NXDataSetTyped< T >::operator()().
|
inlineprivate |
A shortcut to "throw std::range_error("Nexus dataset range error");".
Definition at line 455 of file NexusClasses.h.
Referenced by Mantid::NeXus::NXDataSetTyped< T >::load(), and Mantid::NeXus::NXDataSetTyped< T >::operator[]().
|
inline |
Returns the size of the data buffer.
Definition at line 267 of file NexusClasses.h.
References Mantid::NeXus::NXDataSetTyped< T >::m_n.
Referenced by Mantid::DataHandling::LoadILLTOF2::getMonitorInfo(), Mantid::DataHandling::LoadNexusProcessed::loadEntry(), Mantid::DataHandling::LoadILLReflectometry::loadSingleMonitor(), and Mantid::DataHandling::LoadMLZ::maskDetectors().
|
inline |
Returns a the internal buffer.
Definition at line 265 of file NexusClasses.h.
References Mantid::NeXus::NXDataSetTyped< T >::m_data.
Referenced by Mantid::DataHandling::LoadISISNexus2::exec(), Mantid::DataHandling::LoadNexusProcessed2::extractMappingInfoNew(), Mantid::DataHandling::LoadNexusProcessed::loadEventEntry(), and Mantid::DataHandling::LoadMuonNexusV2NexusHelper::loadTimeZeroListFromNexusFile().
|
private |
The data buffer.
Definition at line 457 of file NexusClasses.h.
Referenced by Mantid::NeXus::NXDataSetTyped< T >::alloc(), Mantid::NeXus::NXDataSetTyped< T >::load(), Mantid::NeXus::NXDataSetTyped< T >::operator()(), Mantid::NeXus::NXDataSetTyped< T >::operator[](), and Mantid::NeXus::NXDataSetTyped< T >::vecBuffer().
|
private |
The buffer size.
Definition at line 459 of file NexusClasses.h.
Referenced by Mantid::NeXus::NXDataSetTyped< T >::alloc(), Mantid::NeXus::NXDataSetTyped< T >::operator[](), and Mantid::NeXus::NXDataSetTyped< T >::size().
|
private |
The sizes of the loaded data.
Definition at line 458 of file NexusClasses.h.
Referenced by Mantid::NeXus::NXDataSetTyped< T >::load().