VTK  9.7.20260726
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 UpdateStepsGroupCommon(hid_t group, vtkDataObject* input, unsigned int partId);
258 bool UpdateStepsGroup(hid_t group, vtkRectilinearGrid* input);
259 bool UpdateStepsGroup(hid_t group, vtkStructuredGrid* input);
260 bool UpdateStepsGroup(hid_t group, vtkUnstructuredGrid* input, unsigned int partId);
261 bool UpdateStepsGroup(hid_t group, vtkPolyData* input, unsigned int partId);
262 bool UpdateStepsGroup(hid_t group, vtkHyperTreeGrid* input, unsigned int partId,
263 vtkIdType numberOfCellsPerDepthSize, vtkIdType descriptorsSize, vtkIdType maskSize);
265
267
271 bool InitializeTemporalRectilinearGrid(hid_t group);
272 bool InitializeTemporalStructuredGrid(hid_t group);
273 bool InitializeTemporalPolyData(hid_t group);
274 bool InitializeTemporalUnstructuredGrid(hid_t group);
275 bool InitializeTemporalPolyhedra(hid_t group);
276 bool InitializeTemporalHTG(hid_t group);
278
280
283 bool CreatePrimitiveGroups(hid_t group, vtkPolyData* input);
285
290 bool AppendRectilinearCoordinates(hid_t group, vtkRectilinearGrid* input);
291
296 bool AppendNumberOfPoints(hid_t group, vtkPointSet* input);
297
304 bool AppendPoints(hid_t group, vtkPointSet* input, const int* dims = nullptr);
305
310 bool AppendNumberOfCells(hid_t group, vtkCellArray* input);
311
316 bool AppendNumberOfFaceConnectivityIds(hid_t group, vtkCellArray* input);
317
322 bool AppendNumberOfFaces(hid_t group, vtkCellArray* input);
323
328 bool AppendNumberOfConnectivityIds(hid_t group, vtkCellArray* input);
329
334 bool AppendCellTypes(hid_t group, vtkUnstructuredGrid* input);
335
340 bool AppendOffsets(hid_t group, vtkCellArray* input);
341
346 bool AppendConnectivity(hid_t group, vtkCellArray* input);
347
352 bool AppendFaceConnectivity(hid_t group, vtkCellArray* input);
353
358 bool AppendFaceOffsets(hid_t group, vtkCellArray* input);
359
364 bool AppendPolyhedronToFaces(hid_t group, vtkCellArray* input);
365
370 bool AppendPolyhedronOffsets(hid_t group, vtkCellArray* input);
371
376 bool AppendNumberOfPolyhedronToFaceIds(hid_t group, vtkCellArray* input);
377
382 bool AppendPrimitiveCells(hid_t baseGroup, vtkPolyData* input);
383
385
393 bool AppendDataArrays(hid_t group, vtkDataObject* input, unsigned int partId = 0);
394 bool AppendDataSetAttributes(hid_t group, vtkDataObject* input, unsigned int partId = 0,
395 vtkIdList* cellIdMap = nullptr, const int* dims = nullptr);
396 bool AppendFieldDataArrays(hid_t group, vtkDataObject* input, unsigned int partId = 0);
398
400
404 bool AppendBlocks(hid_t group, vtkPartitionedDataSetCollection* pdc);
406
408
413 bool AppendExternalBlock(vtkDataObject* block, const std::string& blockName);
415
420 bool AppendAssembly(hid_t group, vtkPartitionedDataSetCollection* pdc);
421
427 bool AppendMultiblock(hid_t group, vtkMultiBlockDataSet* mb, int& leafIndex);
428
433 bool AppendIterDataObject(vtkDataObjectTreeIterator* treeIter, const int& leafIndex,
434 const std::string& uniqueSubTreeName);
435
442 bool AppendCompositeSubfilesDataObject(const std::string& uniqueSubTreeName);
443
445
448 bool AppendDataArrayOffset(hid_t baseGroup, vtkAbstractArray* array, const std::string& arrayName,
449 const std::string& offsetsGroupName, unsigned int partId, bool isStructured = false);
450 bool AppendDataArraySizeOffset(hid_t baseGroup, vtkAbstractArray* array,
451 const std::string& arrayName, const std::string& offsetsGroupName, unsigned int partId);
453
457 bool AppendTimeValues(hid_t group);
458
462 bool HasGeometryChangedFromPreviousStep(vtkDataSet* input);
463
467 void UpdatePreviousStepMeshMTime(vtkDataObject* input);
468
469 class Implementation;
470 std::unique_ptr<Implementation> Impl;
471
472 // Configurable properties
473 char* FileName = nullptr;
474 bool Overwrite = true;
475 bool WriteAllTimeSteps = true;
476 bool UseExternalComposite = false;
477 bool UseExternalTimeSteps = false;
478 bool UseExternalPartitions = false;
479 int ChunkSize = 25000;
480 int CompressionLevel = 0;
481
482 // Temporal-related private variables
483 std::vector<double> timeSteps;
484 bool IsTemporal = false;
485 int CurrentTimeIndex = 0;
486 int NumberOfTimeSteps = 1;
487 vtkMTimeType PreviousStepMeshMTime = 0;
488 std::map<vtkIdType, vtkMTimeType> CompositeMeshMTime;
489
490 // Distributed-related variables
491 vtkMultiProcessController* Controller = nullptr;
492 int NbPieces = 1;
493 int CurrentPiece = 0;
494 bool UsesDummyController = false;
495 std::vector<vtkIdType> PointOffsets;
496 std::vector<vtkIdType> CellOffsets;
497 std::vector<vtkIdType> ConnectivityIdOffsets;
498};
499VTK_ABI_NAMESPACE_END
500#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:165
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:170
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