VTK  9.1.0
Classes | Public Member Functions | Protected Member Functions | List of all members
vtkHDFReader::Implementation Class Reference

Implementation for the vtkHDFReader. More...

#include <vtkHDFReaderImplementation.h>

Classes

struct  TypeDescription
 Used to store HDF native types in a map. More...
 

Public Member Functions

 Implementation (vtkHDFReader *reader)
 
virtual ~Implementation ()
 
bool Open (VTK_FILEPATH const char *fileName)
 Opens this VTK HDF file and checks if it is valid. More...
 
void Close ()
 Closes the VTK HDF file and releases any allocated resources. More...
 
int GetDataSetType ()
 Type of vtkDataSet stored by the HDF file, such as VTK_IMAGE_DATA or VTK_UNSTRUCTURED_GRID, from vtkTypes.h. More...
 
const std::array< int, 2 > & GetVersion ()
 Returns the version of the VTK HDF implementation. More...
 
template<typename T >
bool GetAttribute (const char *attributeName, size_t numberOfElements, T *value)
 Reads an attribute from the /VTKHDF group. More...
 
int GetNumberOfPieces ()
 Returns the number of partitions for this dataset. More...
 
bool GetPartitionExtent (hsize_t partitionIndex, int *extent)
 For an ImageData, sets the extent for 'partitionIndex'. More...
 
std::vector< std::string > GetArrayNames (int attributeType)
 Returns the names of arrays for 'attributeType' (point or cell). More...
 
vtkDataArrayNewArray (int attributeType, const char *name, const std::vector< hsize_t > &fileExtent)
 Reads and returns a new vtkDataArray. More...
 
vtkDataArrayNewArray (int attributeType, const char *name, hsize_t offset, hsize_t size)
 
vtkAbstractArrayNewFieldArray (const char *name)
 
vtkDataArrayNewMetadataArray (const char *name, hsize_t offset, hsize_t size)
 Reads a 1D metadata array in a DataArray or a vector of vtkIdType. More...
 
std::vector< vtkIdTypeGetMetadata (const char *name, hsize_t size)
 
std::vector< hsize_t > GetDimensions (const char *dataset)
 Returns the dimensions of a HDF dataset. More...
 

Protected Member Functions

hid_t OpenDataSet (hid_t group, const char *name, hid_t *nativeType, std::vector< hsize_t > &dims)
 Opens the hdf5 dataset given the 'group' and 'name'. More...
 
template<typename T >
hid_t TemplateTypeToHdfNativeType ()
 Convert C++ template type T to HDF5 native type this can be constexpr in C++17 standard. More...
 
template<typename T >
vtkDataArrayNewVtkDataArray ()
 Create a vtkDataArray based on the C++ template type T. More...
 
vtkDataArrayNewArray (hid_t group, const char *name, const std::vector< hsize_t > &fileExtent)
 Reads a vtkDataArray of type T from the attributeType, dataset The array has type 'T' and 'numberOfComponents'. More...
 
template<typename T >
vtkDataArrayNewArray (hid_t dataset, const std::vector< hsize_t > &fileExtent, hsize_t numberOfComponents)
 
template<typename T >
bool NewArray (hid_t dataset, const std::vector< hsize_t > &fileExtent, hsize_t numberOfComponents, T *data)
 
vtkStringArrayNewStringArray (hid_t dataset, hsize_t size)
 
void BuildTypeReaderMap ()
 Builds a map between native types and GetArray routines for that type. More...
 
TypeDescription GetTypeDescription (hid_t type)
 Associates a struc of three integers with HDF type. More...
 

Detailed Description

Implementation for the vtkHDFReader.

Opens, closes and reads information from a VTK HDF file.

Definition at line 39 of file vtkHDFReaderImplementation.h.

Constructor & Destructor Documentation

◆ Implementation()

vtkHDFReader::Implementation::Implementation ( vtkHDFReader reader)

◆ ~Implementation()

virtual vtkHDFReader::Implementation::~Implementation ( )
virtual

Member Function Documentation

◆ Open()

bool vtkHDFReader::Implementation::Open ( VTK_FILEPATH const char *  fileName)

Opens this VTK HDF file and checks if it is valid.

◆ Close()

void vtkHDFReader::Implementation::Close ( )

Closes the VTK HDF file and releases any allocated resources.

◆ GetDataSetType()

int vtkHDFReader::Implementation::GetDataSetType ( )
inline

Type of vtkDataSet stored by the HDF file, such as VTK_IMAGE_DATA or VTK_UNSTRUCTURED_GRID, from vtkTypes.h.

Definition at line 56 of file vtkHDFReaderImplementation.h.

◆ GetVersion()

const std::array< int, 2 > & vtkHDFReader::Implementation::GetVersion ( )
inline

Returns the version of the VTK HDF implementation.

Definition at line 60 of file vtkHDFReaderImplementation.h.

◆ GetAttribute()

template<typename T >
template bool vtkHDFReader::Implementation::GetAttribute< double > ( const char *  attributeName,
size_t  numberOfElements,
T *  value 
)

Reads an attribute from the /VTKHDF group.

◆ GetNumberOfPieces()

int vtkHDFReader::Implementation::GetNumberOfPieces ( )
inline

Returns the number of partitions for this dataset.

Definition at line 69 of file vtkHDFReaderImplementation.h.

◆ GetPartitionExtent()

bool vtkHDFReader::Implementation::GetPartitionExtent ( hsize_t  partitionIndex,
int *  extent 
)

For an ImageData, sets the extent for 'partitionIndex'.

Returns true for success and false otherwise.

◆ GetArrayNames()

std::vector< std::string > vtkHDFReader::Implementation::GetArrayNames ( int  attributeType)

Returns the names of arrays for 'attributeType' (point or cell).

◆ NewArray() [1/5]

vtkDataArray * vtkHDFReader::Implementation::NewArray ( int  attributeType,
const char *  name,
const std::vector< hsize_t > &  fileExtent 
)

Reads and returns a new vtkDataArray.

The actual type of the array depends on the type of the HDF array. The array is read from the PointData or CellData groups depending on the 'attributeType' parameter. There are two versions: a first one that reads from a 3D array using a fileExtent, and a second one that reads from a linear array using an offset and size. The array has to be deleted by the user.

◆ NewArray() [2/5]

vtkDataArray * vtkHDFReader::Implementation::NewArray ( int  attributeType,
const char *  name,
hsize_t  offset,
hsize_t  size 
)

◆ NewFieldArray()

vtkAbstractArray * vtkHDFReader::Implementation::NewFieldArray ( const char *  name)

◆ NewMetadataArray()

vtkDataArray * vtkHDFReader::Implementation::NewMetadataArray ( const char *  name,
hsize_t  offset,
hsize_t  size 
)

Reads a 1D metadata array in a DataArray or a vector of vtkIdType.

We read either the whole array for the vector version or a slice specified with (offset, size). For an error we return nullptr or an empty vector.

◆ GetMetadata()

std::vector< vtkIdType > vtkHDFReader::Implementation::GetMetadata ( const char *  name,
hsize_t  size 
)

◆ GetDimensions()

std::vector< hsize_t > vtkHDFReader::Implementation::GetDimensions ( const char *  dataset)

Returns the dimensions of a HDF dataset.

◆ OpenDataSet()

hid_t vtkHDFReader::Implementation::OpenDataSet ( hid_t  group,
const char *  name,
hid_t *  nativeType,
std::vector< hsize_t > &  dims 
)
protected

Opens the hdf5 dataset given the 'group' and 'name'.

Returns the hdf dataset and sets 'nativeType' and 'dims'.

◆ TemplateTypeToHdfNativeType()

template<typename T >
hid_t vtkHDFReader::Implementation::TemplateTypeToHdfNativeType ( )
protected

Convert C++ template type T to HDF5 native type this can be constexpr in C++17 standard.

◆ NewVtkDataArray()

template<typename T >
vtkDataArray * vtkHDFReader::Implementation::NewVtkDataArray ( )
protected

Create a vtkDataArray based on the C++ template type T.

For instance, for a float we create a vtkFloatArray. this can be constexpr in C++17 standard

◆ NewArray() [3/5]

vtkDataArray * vtkHDFReader::Implementation::NewArray ( hid_t  group,
const char *  name,
const std::vector< hsize_t > &  fileExtent 
)
protected

Reads a vtkDataArray of type T from the attributeType, dataset The array has type 'T' and 'numberOfComponents'.

We are reading fileExtent slab from the array. It returns the array or nullptr in case of an error. There are three cases for fileExtent: fileExtent.size() == 0 - in this case we expect a 1D array and we read the whole array. Used for field arrays. fileExtent.size()>>1 == ndims - in this case we read a scalar fileExtent.size()>>1 + 1 == ndims - in this case we read an array with the number of components > 1.

◆ NewArray() [4/5]

template<typename T >
vtkDataArray * vtkHDFReader::Implementation::NewArray ( hid_t  dataset,
const std::vector< hsize_t > &  fileExtent,
hsize_t  numberOfComponents 
)
protected

◆ NewArray() [5/5]

template<typename T >
bool vtkHDFReader::Implementation::NewArray ( hid_t  dataset,
const std::vector< hsize_t > &  fileExtent,
hsize_t  numberOfComponents,
T *  data 
)
protected

◆ NewStringArray()

vtkStringArray * vtkHDFReader::Implementation::NewStringArray ( hid_t  dataset,
hsize_t  size 
)
protected

◆ BuildTypeReaderMap()

void vtkHDFReader::Implementation::BuildTypeReaderMap ( )
protected

Builds a map between native types and GetArray routines for that type.

◆ GetTypeDescription()

TypeDescription vtkHDFReader::Implementation::GetTypeDescription ( hid_t  type)
protected

Associates a struc of three integers with HDF type.

This can be used as key in a map.


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