21#ifndef vtkHDFReaderImplementation_h
22#define vtkHDFReaderImplementation_h
60 const std::array<int, 2>&
GetVersion() {
return this->Version; }
65 bool GetAttribute(
const char* attributeName,
size_t numberOfElements, T* value);
89 int attributeType,
const char* name,
const std::vector<hsize_t>& fileExtent);
102 std::vector<vtkIdType>
GetMetadata(
const char* name, hsize_t size);
129 :
Class(H5T_NO_CLASS)
131 ,
Sign(H5T_SGN_ERROR)
147 hid_t
OpenDataSet(hid_t group,
const char* name, hid_t* nativeType, std::vector<hsize_t>& dims);
152 template <
typename T>
159 template <
typename T>
176 hid_t group,
const char* name,
const std::vector<hsize_t>& fileExtent);
178 const std::vector<hsize_t>& dims,
const std::vector<hsize_t>& fileExtent);
179 template <
typename T>
181 hid_t dataset,
const std::vector<hsize_t>& fileExtent, hsize_t numberOfComponents);
182 template <
typename T>
184 hid_t dataset,
const std::vector<hsize_t>& fileExtent, hsize_t numberOfComponents, T* data);
198 std::string FileName;
202 std::array<hid_t, 3> AttributeDataGroup;
205 std::array<int, 2> Version;
208 const std::vector<hsize_t>& fileExtent, hsize_t numberOfComponents);
209 std::map<TypeDescription, ArrayReader> TypeReaderMap;
211 bool ReadDataSetType();
217 bool ComputeAMRBlocksPerLevels(std::vector<int>& levels);
218 bool ReadLevelSpacing(hid_t levelGroupID,
double* spacing);
219 bool ReadAMRBoxRawValues(hid_t levelGroupID, std::vector<int>& amrBoxRawData);
220 bool ReadLevelTopology(
unsigned int level,
const std::string& levelGroupName,
222 bool ReadLevelData(
unsigned int level,
const std::string& levelGroupName,
vtkOverlappingAMR* data,
230 const char* attributeName,
size_t dim,
int* value);
232 const char* attributeName,
size_t dim,
double* value);
Abstract superclass for all arrays.
Store on/off settings for data arrays, etc.
Implementation for the vtkHDFReader.
vtkDataArray * NewMetadataArray(const char *name, hsize_t offset, hsize_t size)
Reads a 1D metadata array in a DataArray or a vector of vtkIdType.
bool GetPartitionExtent(hsize_t partitionIndex, int *extent)
For an ImageData, sets the extent for 'partitionIndex'.
virtual ~Implementation()
TypeDescription GetTypeDescription(hid_t type)
Associates a struc of three integers with HDF type.
const std::array< int, 2 > & GetVersion()
Returns the version of the VTK HDF implementation.
bool Open(VTK_FILEPATH const char *fileName)
Opens this VTK HDF file and checks if it is valid.
std::vector< vtkIdType > GetMetadata(const char *name, hsize_t size)
Implementation(vtkHDFReader *reader)
vtkDataArray * NewArray(int attributeType, const char *name, const std::vector< hsize_t > &fileExtent)
Reads and returns a new vtkDataArray.
std::vector< hsize_t > GetDimensions(const char *dataset)
Returns the dimensions of a HDF dataset.
bool GetAttribute(const char *attributeName, size_t numberOfElements, T *value)
Reads an attribute from the /VTKHDF group.
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'.
std::vector< std::string > GetArrayNames(int attributeType)
Returns the names of arrays for 'attributeType' (point or cell).
void BuildTypeReaderMap()
Builds a map between native types and GetArray routines for that type.
int GetDataSetType()
Type of vtkDataSet stored by the HDF file, such as VTK_IMAGE_DATA or VTK_UNSTRUCTURED_GRID,...
bool FillAMR(vtkOverlappingAMR *data, unsigned int maximumLevelsToReadByDefault, double origin[3], vtkDataArraySelection *dataArraySelection[3])
Fills the given AMR data with the content of the opened HDF file.
void Close()
Closes the VTK HDF file and releases any allocated resources.
int GetNumberOfPieces()
Returns the number of partitions for this dataset.
vtkAbstractArray * NewFieldArray(const char *name)
bool NewArray(hid_t dataset, const std::vector< hsize_t > &fileExtent, hsize_t numberOfComponents, T *data)
vtkDataArray * NewVtkDataArray()
Create a vtkDataArray based on the C++ template type T.
vtkDataArray * NewArray(hid_t dataset, const std::vector< hsize_t > &fileExtent, hsize_t numberOfComponents)
vtkStringArray * NewStringArray(hid_t dataset, hsize_t size)
hid_t TemplateTypeToHdfNativeType()
Convert C++ template type T to HDF5 native type this can be constexpr in C++17 standard.
vtkDataArray * NewArrayForGroup(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 'numberOfCo...
vtkDataArray * NewArrayForGroup(hid_t dataset, const hid_t nativeType, const std::vector< hsize_t > &dims, const std::vector< hsize_t > &fileExtent)
vtkDataArray * NewArray(int attributeType, const char *name, hsize_t offset, hsize_t size)
hierarchical dataset of vtkUniformGrids
a vtkAbstractArray subclass for strings
Used to store HDF native types in a map.
bool operator<(const TypeDescription &other) const