VTK  9.6.20260704
vtkHDFWriter.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
35
36#ifndef vtkHDFWriter_h
37#define vtkHDFWriter_h
38
39#include "vtkIOHDFModule.h" // For export macro
40#include "vtkWriter.h"
41
42#include <map>
43#include <memory>
44
45VTK_ABI_NAMESPACE_BEGIN
46
47class vtkCellArray;
49class vtkDataSet;
51class vtkImageData;
52class vtkPoints;
53class vtkPointSet;
54class vtkPolyData;
57class vtkTable;
64
65typedef int64_t hid_t;
66
67class VTKIOHDF_EXPORT vtkHDFWriter : public vtkWriter
68{
69
70private:
71 vtkHDFWriter(const vtkHDFWriter&) = delete;
72 void operator=(const vtkHDFWriter&) = delete;
73
74public:
75 static vtkHDFWriter* New();
76 vtkTypeMacro(vtkHDFWriter, vtkWriter);
77 void PrintSelf(ostream& os, vtkIndent indent) override;
78
80
84 vtkGetObjectMacro(Controller, vtkMultiProcessController);
86
88
94
96
100 vtkSetMacro(Overwrite, bool);
101 vtkGetMacro(Overwrite, bool);
103
105
110 vtkSetMacro(WriteAllTimeSteps, bool);
111 vtkGetMacro(WriteAllTimeSteps, bool);
113
115
127 vtkSetMacro(ChunkSize, int);
128 vtkGetMacro(ChunkSize, int);
130
132
144 vtkSetClampMacro(CompressionLevel, int, 0, 9);
145 vtkGetMacro(CompressionLevel, int);
147
149
156 vtkSetMacro(UseExternalComposite, bool);
157 vtkGetMacro(UseExternalComposite, bool);
159
161
175 vtkSetMacro(UseExternalTimeSteps, bool);
176 vtkGetMacro(UseExternalTimeSteps, bool);
178
180
189 vtkSetMacro(UseExternalPartitions, bool);
190 vtkGetMacro(UseExternalPartitions, bool);
192
193protected:
200 vtkInformationVector* outputVector) override;
201
202 int FillInputPortInformation(int port, vtkInformation* info) override;
203
205 vtkInformationVector* outputVector);
206
207 virtual int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
208 vtkInformationVector* outputVector);
209
211 vtkInformationVector* outputVector) override;
212
214 ~vtkHDFWriter() override;
215
216private:
221 bool WriteDataAndReturn() override;
222
228 bool DispatchDataObject(hid_t group, vtkDataObject* input, unsigned int partId = 0);
229
234 bool WriteDistributedMetafile(vtkDataObject* input);
235
237
241 bool WriteDatasetToFile(hid_t group, vtkImageData* input, unsigned int partId = 0);
242 bool WriteDatasetToFile(hid_t group, vtkRectilinearGrid* input, unsigned int partId = 0);
243 bool WriteDatasetToFile(hid_t group, vtkStructuredGrid* input, unsigned int partId = 0);
244 bool WriteDatasetToFile(hid_t group, vtkPolyData* input, unsigned int partId = 0);
245 bool WriteDatasetToFile(hid_t group, vtkUnstructuredGrid* input, unsigned int partId = 0);
246 bool WriteDatasetToFile(hid_t group, vtkTable* input, unsigned int partId = 0);
247 bool WriteDatasetToFile(hid_t group, vtkHyperTreeGrid* input, unsigned int partId = 0);
248 bool WriteDatasetToFile(hid_t group, vtkPartitionedDataSet* input);
249 bool WriteDatasetToFile(hid_t group, vtkDataObjectTree* input);
251
253
257 bool UpdateStepsGroup(hid_t group, vtkRectilinearGrid* input);
258 bool UpdateStepsGroup(hid_t group, vtkStructuredGrid* input);
259 bool UpdateStepsGroup(hid_t group, vtkUnstructuredGrid* input, unsigned int partId);
260 bool UpdateStepsGroup(hid_t group, vtkPolyData* input, unsigned int partId);
261 bool UpdateStepsGroup(hid_t group, vtkHyperTreeGrid* input, unsigned int partId,
262 vtkIdType numberOfCellsPerDepthSize, vtkIdType descriptorsSize, vtkIdType maskSize);
264
266
270 bool InitializeTemporalRectilinearGrid(hid_t group);
271 bool InitializeTemporalStructuredGrid(hid_t group);
272 bool InitializeTemporalPolyData(hid_t group);
273 bool InitializeTemporalUnstructuredGrid(hid_t group);
274 bool InitializeTemporalPolyhedra(hid_t group);
275 bool InitializeTemporalHTG(hid_t group);
277
279
283 bool InitializeChunkedDatasets(hid_t group, vtkUnstructuredGrid* input);
284 bool InitializeChunkedDatasets(hid_t group, vtkPolyData* input);
285 bool InitializeChunkedDatasets(hid_t group, vtkHyperTreeGrid* input);
286 bool InitializePointDatasets(hid_t group, vtkPoints* input);
287 bool InitializePrimitiveDataset(hid_t group);
288 bool InitializePolyhedraDatasets(hid_t group);
290
295 bool AppendRectilinearCoordinates(hid_t group, vtkRectilinearGrid* input);
296
301 bool AppendNumberOfPoints(hid_t group, vtkPointSet* input);
302
309 bool AppendPoints(hid_t group, vtkPointSet* input, const int* dims = nullptr);
310
315 bool AppendNumberOfCells(hid_t group, vtkCellArray* input);
316
321 bool AppendNumberOfFaceConnectivityIds(hid_t group, vtkCellArray* input);
322
327 bool AppendNumberOfFaces(hid_t group, vtkCellArray* input);
328
333 bool AppendNumberOfConnectivityIds(hid_t group, vtkCellArray* input);
334
339 bool AppendCellTypes(hid_t group, vtkUnstructuredGrid* input);
340
345 bool AppendOffsets(hid_t group, vtkCellArray* input);
346
351 bool AppendConnectivity(hid_t group, vtkCellArray* input);
352
357 bool AppendFaceConnectivity(hid_t group, vtkCellArray* input);
358
363 bool AppendFaceOffsets(hid_t group, vtkCellArray* input);
364
369 bool AppendPolyhedronToFaces(hid_t group, vtkCellArray* input);
370
375 bool AppendPolyhedronOffsets(hid_t group, vtkCellArray* input);
376
381 bool AppendNumberOfPolyhedronToFaceIds(hid_t group, vtkCellArray* input);
382
387 bool AppendPrimitiveCells(hid_t baseGroup, vtkPolyData* input);
388
390
398 bool AppendDataArrays(hid_t group, vtkDataObject* input, unsigned int partId = 0);
399 bool AppendDataSetAttributes(hid_t group, vtkDataObject* input, unsigned int partId = 0,
400 vtkIdList* cellIdMap = nullptr, const int* dims = nullptr);
401 bool AppendFieldDataArrays(hid_t group, vtkDataObject* input, unsigned int partId = 0);
403
405
409 bool AppendBlocks(hid_t group, vtkPartitionedDataSetCollection* pdc);
411
413
418 bool AppendExternalBlock(vtkDataObject* block, const std::string& blockName);
420
425 bool AppendAssembly(hid_t group, vtkPartitionedDataSetCollection* pdc);
426
432 bool AppendMultiblock(hid_t group, vtkMultiBlockDataSet* mb, int& leafIndex);
433
438 bool AppendIterDataObject(vtkDataObjectTreeIterator* treeIter, const int& leafIndex,
439 const std::string& uniqueSubTreeName);
440
447 bool AppendCompositeSubfilesDataObject(const std::string& uniqueSubTreeName);
448
450
453 bool AppendDataArrayOffset(hid_t baseGroup, vtkAbstractArray* array, const std::string& arrayName,
454 const std::string& offsetsGroupName, unsigned int partId, bool isStructured = false);
455 bool AppendDataArraySizeOffset(hid_t baseGroup, vtkAbstractArray* array,
456 const std::string& arrayName, const std::string& offsetsGroupName, unsigned int partId);
458
462 bool AppendTimeValues(hid_t group);
463
467 bool HasGeometryChangedFromPreviousStep(vtkDataSet* input);
468
472 void UpdatePreviousStepMeshMTime(vtkDataObject* input);
473
474 class Implementation;
475 std::unique_ptr<Implementation> Impl;
476
477 // Configurable properties
478 char* FileName = nullptr;
479 bool Overwrite = true;
480 bool WriteAllTimeSteps = true;
481 bool UseExternalComposite = false;
482 bool UseExternalTimeSteps = false;
483 bool UseExternalPartitions = false;
484 int ChunkSize = 25000;
485 int CompressionLevel = 0;
486
487 // Temporal-related private variables
488 std::vector<double> timeSteps;
489 bool IsTemporal = false;
490 int CurrentTimeIndex = 0;
491 int NumberOfTimeSteps = 1;
492 vtkMTimeType PreviousStepMeshMTime = 0;
493 std::map<vtkIdType, vtkMTimeType> CompositeMeshMTime;
494
495 // Distributed-related variables
496 vtkMultiProcessController* Controller = nullptr;
497 int NbPieces = 1;
498 int CurrentPiece = 0;
499 bool UsesDummyController = false;
500 std::vector<vtkIdType> PointOffsets;
501 std::vector<vtkIdType> CellOffsets;
502 std::vector<vtkIdType> ConnectivityIdOffsets;
503};
504VTK_ABI_NAMESPACE_END
505#endif
Abstract superclass for all arrays.
object to represent cell connectivity
superclass for composite data iterators
provides implementation for most abstract methods in the superclass vtkCompositeDataSet
general representation of visualization data
abstract class to specify dataset behavior
Definition vtkDataSet.h:166
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Override vtkWriter's ProcessRequest method, in order to dispatch the request not only to RequestData ...
virtual int RequestUpdateExtent(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSetFilePathMacro(FileName)
Get/Set the file name of the vtkHDF file.
static vtkHDFWriter * New()
virtual void SetController(vtkMultiProcessController *)
Set and get the controller.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
vtkGetFilePathMacro(FileName)
Get/Set the file name of the vtkHDF file.
~vtkHDFWriter() override
int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
list of point or cell ids
Definition vtkIdList.h:135
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.
Multiprocessing communication superclass.
Composite dataset that groups datasets as a collection.
composite dataset to encapsulates a dataset consisting of partitions.
concrete class for storing a set of points
Definition vtkPointSet.h:98
represent and manipulate 3D points
Definition vtkPoints.h:140
concrete dataset represents vertices, lines, polygons, and triangle strips
a dataset that is topologically regular with variable spacing in the three coordinate directions
topologically regular array of data
A table, which contains similar-typed columns of data.
Definition vtkTable.h:169
dataset represents arbitrary combinations of all possible cell types
virtual bool WriteDataAndReturn()
int vtkTypeBool
Definition vtkABI.h:64
int64_t hid_t
int vtkIdType
Definition vtkType.h:363
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:318