VTK  9.6.20260430
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 vtkPoints;
52class vtkPointSet;
53class vtkPolyData;
60
61typedef int64_t hid_t;
62
63class VTKIOHDF_EXPORT vtkHDFWriter : public vtkWriter
64{
65
66private:
67 vtkHDFWriter(const vtkHDFWriter&) = delete;
68 void operator=(const vtkHDFWriter&) = delete;
69
70public:
71 static vtkHDFWriter* New();
72 vtkTypeMacro(vtkHDFWriter, vtkWriter);
73 void PrintSelf(ostream& os, vtkIndent indent) override;
74
76
80 vtkGetObjectMacro(Controller, vtkMultiProcessController);
82
84
90
92
96 vtkSetMacro(Overwrite, bool);
97 vtkGetMacro(Overwrite, bool);
99
101
106 vtkSetMacro(WriteAllTimeSteps, bool);
107 vtkGetMacro(WriteAllTimeSteps, bool);
109
111
123 vtkSetMacro(ChunkSize, int);
124 vtkGetMacro(ChunkSize, int);
126
128
140 vtkSetClampMacro(CompressionLevel, int, 0, 9);
141 vtkGetMacro(CompressionLevel, int);
143
145
152 vtkSetMacro(UseExternalComposite, bool);
153 vtkGetMacro(UseExternalComposite, bool);
155
157
171 vtkSetMacro(UseExternalTimeSteps, bool);
172 vtkGetMacro(UseExternalTimeSteps, bool);
174
176
185 vtkSetMacro(UseExternalPartitions, bool);
186 vtkGetMacro(UseExternalPartitions, bool);
188
189protected:
196 vtkInformationVector* outputVector) override;
197
198 int FillInputPortInformation(int port, vtkInformation* info) override;
199
201 vtkInformationVector* outputVector);
202
203 virtual int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
204 vtkInformationVector* outputVector);
205
207 vtkInformationVector* outputVector) override;
208
210 ~vtkHDFWriter() override;
211
212private:
217 bool WriteDataAndReturn() override;
218
224 bool DispatchDataObject(hid_t group, vtkDataObject* input, unsigned int partId = 0);
225
230 bool WriteDistributedMetafile(vtkDataObject* input);
231
233
237 bool WriteDatasetToFile(hid_t group, vtkPolyData* input, unsigned int partId = 0);
238 bool WriteDatasetToFile(hid_t group, vtkUnstructuredGrid* input, unsigned int partId = 0);
239 bool WriteDatasetToFile(hid_t group, vtkHyperTreeGrid* input, unsigned int partId = 0);
240 bool WriteDatasetToFile(hid_t group, vtkPartitionedDataSet* input);
241 bool WriteDatasetToFile(hid_t group, vtkDataObjectTree* input);
243
245
249 bool UpdateStepsGroup(hid_t group, vtkUnstructuredGrid* input, unsigned int partId);
250 bool UpdateStepsGroup(hid_t group, vtkPolyData* input, unsigned int partId);
251 bool UpdateStepsGroup(hid_t group, vtkHyperTreeGrid* input, unsigned int partId,
252 vtkIdType numberOfCellsPerDepthSize, vtkIdType descriptorsSize, vtkIdType maskSize);
254
256
260 bool InitializeTemporalPolyData(hid_t group);
261 bool InitializeTemporalUnstructuredGrid(hid_t group);
262 bool InitializeTemporalPolyhedra(hid_t group);
263 bool InitializeTemporalHTG(hid_t group);
265
267
271 bool InitializeChunkedDatasets(hid_t group, vtkUnstructuredGrid* input);
272 bool InitializeChunkedDatasets(hid_t group, vtkPolyData* input);
273 bool InitializeChunkedDatasets(hid_t group, vtkHyperTreeGrid* input);
274 bool InitializePointDatasets(hid_t group, vtkPoints* input);
275 bool InitializePrimitiveDataset(hid_t group);
276 bool InitializePolyhedraDatasets(hid_t group);
278
283 bool AppendNumberOfPoints(hid_t group, vtkPointSet* input);
284
289 bool AppendPoints(hid_t group, vtkPointSet* input);
290
295 bool AppendNumberOfCells(hid_t group, vtkCellArray* input);
296
301 bool AppendNumberOfFaceConnectivityIds(hid_t group, vtkCellArray* input);
302
307 bool AppendNumberOfFaces(hid_t group, vtkCellArray* input);
308
313 bool AppendNumberOfConnectivityIds(hid_t group, vtkCellArray* input);
314
319 bool AppendCellTypes(hid_t group, vtkUnstructuredGrid* input);
320
325 bool AppendOffsets(hid_t group, vtkCellArray* input);
326
331 bool AppendConnectivity(hid_t group, vtkCellArray* input);
332
337 bool AppendFaceConnectivity(hid_t group, vtkCellArray* input);
338
343 bool AppendFaceOffsets(hid_t group, vtkCellArray* input);
344
349 bool AppendPolyhedronToFaces(hid_t group, vtkCellArray* input);
350
355 bool AppendPolyhedronOffsets(hid_t group, vtkCellArray* input);
356
361 bool AppendNumberOfPolyhedronToFaceIds(hid_t group, vtkCellArray* input);
362
367 bool AppendPrimitiveCells(hid_t baseGroup, vtkPolyData* input);
368
370
376 bool AppendDataArrays(hid_t group, vtkDataObject* input, unsigned int partId = 0);
377 bool AppendDataSetAttributes(
378 hid_t group, vtkDataObject* input, unsigned int partId = 0, vtkIdList* cellIdMap = nullptr);
379 bool AppendFieldDataArrays(hid_t group, vtkDataObject* input, unsigned int partId = 0);
381
383
387 bool AppendBlocks(hid_t group, vtkPartitionedDataSetCollection* pdc);
389
391
396 bool AppendExternalBlock(vtkDataObject* block, const std::string& blockName);
398
403 bool AppendAssembly(hid_t group, vtkPartitionedDataSetCollection* pdc);
404
410 bool AppendMultiblock(hid_t group, vtkMultiBlockDataSet* mb, int& leafIndex);
411
416 bool AppendIterDataObject(vtkDataObjectTreeIterator* treeIter, const int& leafIndex,
417 const std::string& uniqueSubTreeName);
418
425 bool AppendCompositeSubfilesDataObject(const std::string& uniqueSubTreeName);
426
428
431 bool AppendDataArrayOffset(hid_t baseGroup, vtkAbstractArray* array, const std::string& arrayName,
432 const std::string& offsetsGroupName, unsigned int partId);
433 bool AppendDataArraySizeOffset(hid_t baseGroup, vtkAbstractArray* array,
434 const std::string& arrayName, const std::string& offsetsGroupName, unsigned int partId);
436
440 bool AppendTimeValues(hid_t group);
441
445 bool HasGeometryChangedFromPreviousStep(vtkDataSet* input);
446
450 void UpdatePreviousStepMeshMTime(vtkDataObject* input);
451
452 class Implementation;
453 std::unique_ptr<Implementation> Impl;
454
455 // Configurable properties
456 char* FileName = nullptr;
457 bool Overwrite = true;
458 bool WriteAllTimeSteps = true;
459 bool UseExternalComposite = false;
460 bool UseExternalTimeSteps = false;
461 bool UseExternalPartitions = false;
462 int ChunkSize = 25000;
463 int CompressionLevel = 0;
464
465 // Temporal-related private variables
466 std::vector<double> timeSteps;
467 bool IsTemporal = false;
468 int CurrentTimeIndex = 0;
469 int NumberOfTimeSteps = 1;
470 vtkMTimeType PreviousStepMeshMTime = 0;
471 std::map<vtkIdType, vtkMTimeType> CompositeMeshMTime;
472
473 // Distributed-related variables
474 vtkMultiProcessController* Controller = nullptr;
475 int NbPieces = 1;
476 int CurrentPiece = 0;
477 bool UsesDummyController = false;
478 std::vector<vtkIdType> PointOffsets;
479 std::vector<vtkIdType> CellOffsets;
480 std::vector<vtkIdType> ConnectivityIdOffsets;
481};
482VTK_ABI_NAMESPACE_END
483#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
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
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