VTK  9.4.20251007
vtkHDFReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
11
12#ifndef vtkHDFReader_h
13#define vtkHDFReader_h
14
15#include "vtkDataAssembly.h" // For vtkDataAssembly
17#include "vtkIOHDFModule.h" // For export macro
18#include "vtkSmartPointer.h" // For vtkSmartPointer
19
20#include <array> // For storing the time range
21#include <memory> // For std::unique_ptr
22#include <vector> // For storing list of values
23
24VTK_ABI_NAMESPACE_BEGIN
27class vtkCellData;
28class vtkCommand;
31class vtkDataSet;
33class vtkImageData;
35class vtkInformation;
40class vtkPointData;
41class vtkPolyData;
43
61class VTKIOHDF_EXPORT vtkHDFReader : public vtkDataObjectAlgorithm
62{
63public:
64 static vtkHDFReader* New();
66 void PrintSelf(ostream& os, vtkIndent indent) override;
67
69
75
83 virtual int CanReadFile(VTK_FILEPATH const char* name);
84
86
92
94
102
104
110
112
116 const char* GetPointArrayName(int index);
117 const char* GetCellArrayName(int index);
119
121
129 VTK_DEPRECATED_IN_9_4_0("Please use GetTemporalData method instead.")
130 virtual bool GetHasTransientData();
133 vtkGetMacro(Step, vtkIdType);
134 vtkSetMacro(Step, vtkIdType);
135 vtkGetMacro(TimeValue, double);
136 const std::array<double, 2>& GetTimeRange() const { return this->TimeRange; }
138
140
149 vtkGetMacro(UseCache, bool);
150 vtkSetMacro(UseCache, bool);
151 vtkBooleanMacro(UseCache, bool);
153
155
169 vtkGetMacro(MergeParts, bool);
170 vtkSetMacro(MergeParts, bool);
171 vtkBooleanMacro(MergeParts, bool);
173
174 vtkSetMacro(MaximumLevelsToReadByDefaultForAMR, unsigned int);
175 vtkGetMacro(MaximumLevelsToReadByDefaultForAMR, unsigned int);
176
178
181 std::string GetAttributeOriginalIdName(vtkIdType attribute);
182 void SetAttributeOriginalIdName(vtkIdType attribute, const std::string& name);
184
185protected:
187 ~vtkHDFReader() override;
188
192 int CanReadFileVersion(int major, int minor);
193
195
199 int Read(vtkInformation* outInfo, vtkImageData* data);
205 int ReadRecursively(vtkInformation* outInfo, vtkMultiBlockDataSet* data, const std::string& path);
207
213 int Read(const std::vector<vtkIdType>& numberOfPoints,
214 const std::vector<vtkIdType>& numberOfCells,
215 const std::vector<vtkIdType>& numberOfConnectivityIds, vtkIdType partOffset,
216 vtkIdType startingPointOffset, vtkIdType startingCellOffset,
217 vtkIdType startingConnectctivityIdOffset, int filePiece, vtkUnstructuredGrid* pieceData);
218
223
228 vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
229
231
236 vtkInformationVector* outputVector) override;
238 vtkInformationVector* outputVector) override;
240 vtkInformationVector* outputVector) override;
242
247
252
256 char* FileName;
257
263
270
274 double Origin[3];
275 double Spacing[3];
277
282
284
287 // VTK_DEPRECATED_IN_9_4_0( )
288 bool HasTransientData = false;
291 double TimeValue = 0.0;
292 std::array<double, 2> TimeRange;
294
298 bool MergeParts = true;
299
301
302 bool UseCache = false;
303 struct DataCache;
304 std::shared_ptr<DataCache> Cache;
305
306private:
307 vtkHDFReader(const vtkHDFReader&) = delete;
308 void operator=(const vtkHDFReader&) = delete;
309
310 class Implementation;
311 Implementation* Impl;
312
318 void SetHasTemporalData(bool useTemporalData);
319
323 void GenerateAssembly();
324
329 bool RetrieveStepsFromAssembly();
330
334 void RetrieveDataArraysFromAssembly();
335
343 bool AddOriginalIds(vtkDataSetAttributes* attributes, vtkIdType size, const std::string& name);
344
351 void CleanOriginalIds(vtkPartitionedDataSet* output);
352
353 bool MeshGeometryChangedFromPreviousTimeStep = true;
354
356
357 std::map<vtkIdType, std::string> AttributesOriginalIdName{
358 { vtkDataObject::POINT, "__pointsOriginalIds__" },
359 { vtkDataObject::CELL, "__cellOriginalIds__" }, { vtkDataObject::FIELD, "__fieldOriginalIds__" }
360 };
361
362 bool HasTemporalData = false;
363};
364
365VTK_ABI_NAMESPACE_END
366#endif
Abstract superclass for all arrays.
supports function callbacks
represent and manipulate cell attribute data
Definition vtkCellData.h:32
superclass for callback/observer methods
Definition vtkCommand.h:384
Store on/off settings for data arrays, etc.
vtkDataObjectMeshCache is a class to store and reuse the mesh of a vtkDataSet, while forwarding data ...
general representation of visualization data
represent and manipulate attribute data in a dataset
abstract class to specify dataset behavior
Definition vtkDataSet.h:57
Implementation for the vtkHDFReader.
int GetNumberOfPointArrays()
Get the number of point or cell arrays available in the input.
int GetNumberOfCellArrays()
Get the number of point or cell arrays available in the input.
const char * GetCellArrayName(int index)
Get the name of the point or cell array with the given index in the input.
vtkIdType Step
Temporal data properties.
virtual vtkDataArraySelection * GetFieldDataArraySelection()
Get the data array selection tables used to configure which data arrays are loaded by the reader.
vtkDataSet * GetOutputAsDataSet(int index)
Get the output as a vtkDataSet pointer.
std::shared_ptr< DataCache > Cache
virtual vtkDataArraySelection * GetCellDataArraySelection()
Get the data array selection tables used to configure which data arrays are loaded by the reader.
int CanReadFileVersion(int major, int minor)
Test if the reader can read a file with the given version number.
int Read(vtkInformation *outInfo, vtkImageData *data)
Reads the 'data' requested in 'outInfo' (through extents or pieces).
~vtkHDFReader() override
const std::array< double, 2 > & GetTimeRange() const
Getters and setters for temporal data.
int Read(const std::vector< vtkIdType > &numberOfPoints, const std::vector< vtkIdType > &numberOfCells, const std::vector< vtkIdType > &numberOfConnectivityIds, vtkIdType partOffset, vtkIdType startingPointOffset, vtkIdType startingCellOffset, vtkIdType startingConnectctivityIdOffset, int filePiece, vtkUnstructuredGrid *pieceData)
Read 'pieceData' specified by 'filePiece' where number of points, cells and connectivity ids store th...
vtkSetFilePathMacro(FileName)
Get/Set the name of the input file.
int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Standard functions to specify the type, information and read the data from the file.
int RequestDataObject(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Standard functions to specify the type, information and read the data from the file.
int Read(vtkInformation *outInfo, vtkPolyData *data, vtkPartitionedDataSet *pData)
Reads the 'data' requested in 'outInfo' (through extents or pieces).
double Spacing[3]
Image data topology and geometry.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Standard functions to specify the type, information and read the data from the file.
static vtkHDFReader * New()
int WholeExtent[6]
Image data topology and geometry.
vtkGetFilePathMacro(FileName)
Get/Set the name of the input file.
int Read(vtkInformation *outInfo, vtkUnstructuredGrid *data, vtkPartitionedDataSet *pData)
Reads the 'data' requested in 'outInfo' (through extents or pieces).
static void SelectionModifiedCallback(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)
Modify this object when an array selection is changed.
bool MergeParts
Determine whether to merge the partitions (true) or return a vtkPartitionedDataSet (false)
int Read(vtkInformation *outInfo, vtkMultiBlockDataSet *data)
Reads the 'data' requested in 'outInfo' (through extents or pieces).
int AddFieldArrays(vtkDataObject *data)
Read the field arrays from the file and add them to the dataset.
std::array< double, 2 > TimeRange
Temporal data properties.
bool HasTransientData
Temporal data properties.
int Read(vtkInformation *outInfo, vtkPartitionedDataSetCollection *data)
Reads the 'data' requested in 'outInfo' (through extents or pieces).
unsigned int MaximumLevelsToReadByDefaultForAMR
void SetAttributeOriginalIdName(vtkIdType attribute, const std::string &name)
Get or Set the Original id name of an attribute (POINT, CELL, FIELD...)
vtkIdType NumberOfSteps
Temporal data properties.
double TimeValue
Temporal data properties.
const char * GetPointArrayName(int index)
Get the name of the point or cell array with the given index in the input.
double Origin[3]
Image data topology and geometry.
char * FileName
The input file's name.
int ReadRecursively(vtkInformation *outInfo, vtkMultiBlockDataSet *data, const std::string &path)
Reads the 'data' requested in 'outInfo' (through extents or pieces).
int SetupInformation(vtkInformation *outInfo)
Setup the information pass in parameter based on current vtkHDF file loaded.
virtual vtkDataArraySelection * GetPointDataArraySelection()
Get the data array selection tables used to configure which data arrays are loaded by the reader.
bool GetHasTemporalData()
Getters and setters for temporal data.
virtual bool GetHasTransientData()
Getters and setters for temporal data.
vtkDataArraySelection * DataArraySelection[3]
The array selections.
vtkCallbackCommand * SelectionObserver
The observer to modify this object when the array selections are modified.
std::string GetAttributeOriginalIdName(vtkIdType attribute)
Get or Set the Original id name of an attribute (POINT, CELL, FIELD...)
virtual int CanReadFile(VTK_FILEPATH const char *name)
Test whether the file (type) with the given name can be read by this reader.
int Read(vtkInformation *outInfo, vtkOverlappingAMR *data)
Reads the 'data' requested in 'outInfo' (through extents or pieces).
vtkSmartPointer< vtkDataAssembly > Assembly
Assembly used for PartitionedDataSetCollection.
void PrintPieceInformation(vtkInformation *outInfo)
Print update number of pieces, piece number and ghost levels.
vtkDataSet * GetOutputAsDataSet()
Get the output as a vtkDataSet pointer.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Composite dataset that organizes datasets into blocks.
Allocate and hold a VTK object.
Definition vtkNew.h:58
hierarchical dataset of vtkUniformGrids
Composite dataset that groups datasets as a collection.
composite dataset to encapsulates a dataset consisting of partitions.
represent and manipulate point attribute data
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:72
Hold a reference to a vtkObjectBase instance.
dataset represents arbitrary combinations of all possible cell types
#define VTK_DEPRECATED_IN_9_4_0(reason)
int vtkIdType
Definition vtkType.h:315
#define VTK_FILEPATH