VTK  9.5.2
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;
53class vtkImageData;
55class vtkInformation;
60class vtkPointData;
61class vtkPolyData;
63
65{
67}
68
69class VTKIOHDF_EXPORT vtkHDFReader : public vtkDataObjectAlgorithm
70{
71public:
72 static vtkHDFReader* New();
74 void PrintSelf(ostream& os, vtkIndent indent) override;
75
77
83
91 virtual int CanReadFile(VTK_FILEPATH const char* name);
92
94
100
102
110
112
118
120
124 const char* GetPointArrayName(int index);
125 const char* GetCellArrayName(int index);
127
129
137 VTK_DEPRECATED_IN_9_4_0("Please use GetTemporalData method instead.")
138 virtual bool GetHasTransientData();
139 bool GetHasTemporalData();
140 vtkGetMacro(NumberOfSteps, vtkIdType);
141 vtkGetMacro(Step, vtkIdType);
142 vtkSetMacro(Step, vtkIdType);
143 vtkGetMacro(TimeValue, double);
144 const std::array<double, 2>& GetTimeRange() const { return this->TimeRange; }
146
148
157 vtkGetMacro(UseCache, bool);
158 vtkSetMacro(UseCache, bool);
159 vtkBooleanMacro(UseCache, bool);
161
163
181 VTK_DEPRECATED_IN_9_5_0("Use vtkMergeBlocks or vtkAppendDataSets instead.")
182 vtkGetMacro(MergeParts, bool);
184 vtkSetMacro(MergeParts, bool);
186 virtual void MergePartsOn();
188 virtual void MergePartsOff();
190
192
198 vtkSetMacro(MaximumLevelsToReadByDefaultForAMR, unsigned int);
199 vtkGetMacro(MaximumLevelsToReadByDefaultForAMR, unsigned int);
201
203
206 std::string GetAttributeOriginalIdName(vtkIdType attribute);
207 void SetAttributeOriginalIdName(vtkIdType attribute, const std::string& name);
209
210protected:
212 ~vtkHDFReader() override;
213
217 int CanReadFileVersion(int major, int minor);
218
220
225 int Read(vtkInformation* outInfo, vtkImageData* data);
232 int ReadRecursively(vtkInformation* outInfo, vtkMultiBlockDataSet* data, const std::string& path);
234
240 int Read(const std::vector<vtkIdType>& numberOfPoints,
241 const std::vector<vtkIdType>& numberOfCells,
242 const std::vector<vtkIdType>& numberOfConnectivityIds, vtkIdType partOffset,
243 vtkIdType startingPointOffset, vtkIdType startingCellOffset,
244 vtkIdType startingConnectctivityIdOffset, int filePiece, vtkUnstructuredGrid* pieceData);
245
249 int AddFieldArrays(vtkDataObject* data);
250
254 static void SelectionModifiedCallback(
255 vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
256
258
262 int RequestDataObject(vtkInformation* request, vtkInformationVector** inputVector,
263 vtkInformationVector* outputVector) override;
264 int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
265 vtkInformationVector* outputVector) override;
266 int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
267 vtkInformationVector* outputVector) override;
269
273 void PrintPieceInformation(vtkInformation* outInfo);
274
278 int SetupInformation(vtkInformation* outInfo);
279
283 char* FileName;
284
289 vtkDataArraySelection* DataArraySelection[3];
290
295 vtkCallbackCommand* SelectionObserver;
297
302
304
307 // VTK_DEPRECATED_IN_9_4_0( )
308 bool HasTransientData = false;
309 vtkIdType Step = 0;
310 vtkIdType NumberOfSteps = 1;
311 double TimeValue = 0.0;
312 std::array<double, 2> TimeRange;
314
319 // VTK_DEPRECATED_IN_9_5_0( )
320 bool MergeParts = false;
321
322 unsigned int MaximumLevelsToReadByDefaultForAMR = 0;
323
324 bool UseCache = false;
325 struct DataCache;
326 std::shared_ptr<DataCache> Cache;
327
328private:
329 vtkHDFReader(const vtkHDFReader&) = delete;
330 void operator=(const vtkHDFReader&) = delete;
331
332 class Implementation;
333 Implementation* Impl;
334
339 bool ReadData(vtkInformation* outInfo, vtkDataObject* data);
340
346 int Read(const std::vector<vtkIdType>& numberOfTrees, const std::vector<vtkIdType>& numberOfCells,
347 const std::vector<vtkIdType>& numberOfDepths, const std::vector<vtkIdType>& descriptorSizes,
348 const vtkHDFUtilities::TemporalHyperTreeGridOffsets& htgTemporalOffsets, int filePiece,
349 vtkHyperTreeGrid* pieceData);
350
356 void SetHasTemporalData(bool useTemporalData);
357
361 void GenerateAssembly();
362
367 bool RetrieveStepsFromAssembly();
368
373 bool RetrieveDataArraysFromAssembly();
374
382 bool AddOriginalIds(vtkDataSetAttributes* attributes, vtkIdType size, const std::string& name);
383
390 void CleanOriginalIds(vtkPartitionedDataSet* output);
391
392 bool MeshGeometryChangedFromPreviousTimeStep = true;
393
395
396 std::map<vtkIdType, std::string> AttributesOriginalIdName{
397 { vtkDataObject::POINT, "__pointsOriginalIds__" },
398 { vtkDataObject::CELL, "__cellOriginalIds__" }, { vtkDataObject::FIELD, "__fieldOriginalIds__" }
399 };
400
401 bool HasTemporalData = false;
402 std::string CompositeCachePath; // Identifier for the current composite piece
403};
404
405VTK_ABI_NAMESPACE_END
406#endif
Abstract superclass for all arrays.
Appends one or more datasets together into a single output vtkPointSet.
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.
hierarchical representation to use with vtkPartitionedDataSetCollection
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
Definition: vtkDataObject.h:56
represent and manipulate attribute data in a dataset
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
Implementation for the vtkHDFReader.
Read VTK HDF files.
Definition: vtkHDFReader.h:70
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.
virtual vtkDataArraySelection * GetCellDataArraySelection()
Get the data array selection tables used to configure which data arrays are loaded by the reader.
vtkSetFilePathMacro(FileName)
Get/Set the name of the input file.
static vtkHDFReader * New()
vtkGetFilePathMacro(FileName)
Get/Set the name of the input file.
const char * GetPointArrayName(int index)
Get the name of the point or cell array with the given index in the input.
virtual vtkDataArraySelection * GetPointDataArraySelection()
Get the data array selection tables used to configure which data arrays are loaded by the reader.
virtual int CanReadFile(VTK_FILEPATH const char *name)
Test whether the file (type) with the given name can be read by this reader.
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.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
topologically and geometrically regular array of data
Definition: vtkImageData.h:47
a simple class to control print indentation
Definition: vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
merges blocks in a composite dataset to a dataset.
Composite dataset that organizes datasets into blocks.
Allocate and hold a VTK object.
Definition: vtkNew.h:58
abstract base class for most VTK objects
Definition: vtkObject.h:53
a multi-resolution dataset based on vtkUniformGrid allowing overlaps
Composite dataset that groups datasets as a collection.
composite dataset to encapsulates a dataset consisting of partitions.
represent and manipulate point attribute data
Definition: vtkPointData.h:31
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
Common utility variables and functions for reader and writer of vtkHDF.
Definition: vtkHDFReader.h:65
@ vector
Definition: vtkX3D.h:237
@ name
Definition: vtkX3D.h:219
@ size
Definition: vtkX3D.h:253
@ index
Definition: vtkX3D.h:246
@ data
Definition: vtkX3D.h:315
@ string
Definition: vtkX3D.h:490
#define VTK_DEPRECATED_IN_9_4_0(reason)
#define VTK_DEPRECATED_IN_9_5_0(reason)
int vtkIdType
Definition: vtkType.h:332
#define VTK_FILEPATH