VTK  9.4.20241108
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
31#ifndef vtkHDFReader_h
32#define vtkHDFReader_h
33
34#include "vtkDataAssembly.h" // For vtkDataAssembly
36#include "vtkIOHDFModule.h" // For export macro
37#include "vtkSmartPointer.h" // For vtkSmartPointer
38
39#include <array> // For storing the time range
40#include <memory> // For std::unique_ptr
41#include <vector> // For storing list of values
42
43VTK_ABI_NAMESPACE_BEGIN
46class vtkCellData;
47class vtkCommand;
50class vtkDataSet;
52class vtkImageData;
54class vtkInformation;
59class vtkPointData;
60class vtkPolyData;
62
80class VTKIOHDF_EXPORT vtkHDFReader : public vtkDataObjectAlgorithm
81{
82public:
83 static vtkHDFReader* New();
85 void PrintSelf(ostream& os, vtkIndent indent) override;
86
88
94
102 virtual int CanReadFile(VTK_FILEPATH const char* name);
103
105
111
113
121
123
129
131
135 const char* GetPointArrayName(int index);
136 const char* GetCellArrayName(int index);
138
140
148 VTK_DEPRECATED_IN_9_4_0("Please use GetTemporalData method instead.")
149 virtual bool GetHasTransientData();
150 bool GetHasTemporalData();
151 vtkGetMacro(NumberOfSteps, vtkIdType);
152 vtkGetMacro(Step, vtkIdType);
153 vtkSetMacro(Step, vtkIdType);
154 vtkGetMacro(TimeValue, double);
155 const std::array<double, 2>& GetTimeRange() const { return this->TimeRange; }
157
159
168 vtkGetMacro(UseCache, bool);
169 vtkSetMacro(UseCache, bool);
170 vtkBooleanMacro(UseCache, bool);
172
174
188 vtkGetMacro(MergeParts, bool);
189 vtkSetMacro(MergeParts, bool);
190 vtkBooleanMacro(MergeParts, bool);
192
193 vtkSetMacro(MaximumLevelsToReadByDefaultForAMR, unsigned int);
194 vtkGetMacro(MaximumLevelsToReadByDefaultForAMR, unsigned int);
195
197
200 std::string GetAttributeOriginalIdName(vtkIdType attribute);
201 void SetAttributeOriginalIdName(vtkIdType attribute, const std::string& name);
203
204protected:
206 ~vtkHDFReader() override;
207
211 int CanReadFileVersion(int major, int minor);
212
214
218 int Read(vtkInformation* outInfo, vtkImageData* data);
224 int ReadRecursively(vtkInformation* outInfo, vtkMultiBlockDataSet* data, const std::string& path);
226
232 int Read(const std::vector<vtkIdType>& numberOfPoints,
233 const std::vector<vtkIdType>& numberOfCells,
234 const std::vector<vtkIdType>& numberOfConnectivityIds, vtkIdType partOffset,
235 vtkIdType startingPointOffset, vtkIdType startingCellOffset,
236 vtkIdType startingConnectctivityIdOffset, int filePiece, vtkUnstructuredGrid* pieceData);
237
242
247 vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
248
250
255 vtkInformationVector* outputVector) override;
257 vtkInformationVector* outputVector) override;
259 vtkInformationVector* outputVector) override;
261
266
271
275 char* FileName;
276
281 vtkDataArraySelection* DataArraySelection[3];
282
289
292 int WholeExtent[6];
293 double Origin[3];
294 double Spacing[3];
296
301
303
306 // VTK_DEPRECATED_IN_9_4_0( )
307 bool HasTransientData = false;
308 vtkIdType Step = 0;
309 vtkIdType NumberOfSteps = 1;
310 double TimeValue = 0.0;
311 std::array<double, 2> TimeRange;
313
317 bool MergeParts = true;
318
319 unsigned int MaximumLevelsToReadByDefaultForAMR = 0;
320
321 bool UseCache = false;
322 struct DataCache;
323 std::shared_ptr<DataCache> Cache;
324
325private:
326 vtkHDFReader(const vtkHDFReader&) = delete;
327 void operator=(const vtkHDFReader&) = delete;
328
329 class Implementation;
330 Implementation* Impl;
331
337 void SetHasTemporalData(bool useTemporalData);
338
342 void GenerateAssembly();
343
348 bool RetrieveStepsFromAssembly();
349
353 void RetrieveDataArraysFromAssembly();
354
362 bool AddOriginalIds(vtkDataSetAttributes* attributes, vtkIdType size, const std::string& name);
363
370 void CleanOriginalIds(vtkPartitionedDataSet* output);
371
372 bool MeshGeometryChangedFromPreviousTimeStep = true;
373
375
376 std::map<vtkIdType, std::string> AttributesOriginalIdName{
377 { vtkDataObject::POINT, "__pointsOriginalIds__" },
378 { vtkDataObject::CELL, "__cellOriginalIds__" }, { vtkDataObject::FIELD, "__fieldOriginalIds__" }
379 };
380
381 bool HasTemporalData = false;
382};
383
384VTK_ABI_NAMESPACE_END
385#endif
Abstract superclass for all arrays.
supports function callbacks
represent and manipulate cell attribute data
superclass for callback/observer methods
Definition vtkCommand.h:384
Store on/off settings for data arrays, etc.
Superclass for algorithms that produce only data object as output.
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:166
Implementation for the vtkHDFReader.
Reads data saved using the VTK HDF format which supports all vtkDataSet types (image data,...
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.
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
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).
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()
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.
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.
int Read(vtkInformation *outInfo, vtkPartitionedDataSetCollection *data)
Reads the 'data' requested in 'outInfo' (through extents or pieces).
void SetAttributeOriginalIdName(vtkIdType attribute, const std::string &name)
Get or Set the Original id name of an attribute (POINT, CELL, FIELD...)
const char * GetPointArrayName(int index)
Get the name of the point or cell array with the given index in the input.
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.
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:108
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:167
abstract base class for most VTK objects
Definition vtkObject.h:162
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
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