VTK  9.6.20260316
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;
50class vtkPoints;
51class vtkPointSet;
52class vtkPolyData;
59
60typedef int64_t hid_t;
61
62class VTKIOHDF_EXPORT vtkHDFWriter : public vtkWriter
63{
64
65private:
66 vtkHDFWriter(const vtkHDFWriter&) = delete;
67 void operator=(const vtkHDFWriter&) = delete;
68
69public:
70 static vtkHDFWriter* New();
71 vtkTypeMacro(vtkHDFWriter, vtkWriter);
72 void PrintSelf(ostream& os, vtkIndent indent) override;
73
75
79 vtkGetObjectMacro(Controller, vtkMultiProcessController);
81
83
89
91
95 vtkSetMacro(Overwrite, bool);
96 vtkGetMacro(Overwrite, bool);
98
100
105 vtkSetMacro(WriteAllTimeSteps, bool);
106 vtkGetMacro(WriteAllTimeSteps, bool);
108
110
122 vtkSetMacro(ChunkSize, int);
123 vtkGetMacro(ChunkSize, int);
125
127
139 vtkSetClampMacro(CompressionLevel, int, 0, 9);
140 vtkGetMacro(CompressionLevel, int);
142
144
151 vtkSetMacro(UseExternalComposite, bool);
152 vtkGetMacro(UseExternalComposite, bool);
154
156
170 vtkSetMacro(UseExternalTimeSteps, bool);
171 vtkGetMacro(UseExternalTimeSteps, bool);
173
175
184 vtkSetMacro(UseExternalPartitions, bool);
185 vtkGetMacro(UseExternalPartitions, bool);
187
188protected:
195 vtkInformationVector* outputVector) override;
196
197 int FillInputPortInformation(int port, vtkInformation* info) override;
198
200 vtkInformationVector* outputVector);
201
202 virtual int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
203 vtkInformationVector* outputVector);
204
206 vtkInformationVector* outputVector) override;
207
209 ~vtkHDFWriter() override;
210
211private:
216 bool WriteDataAndReturn() override;
217
223 bool DispatchDataObject(hid_t group, vtkDataObject* input, unsigned int partId = 0);
224
229 bool WriteDistributedMetafile(vtkDataObject* input);
230
232
236 bool WriteDatasetToFile(hid_t group, vtkPolyData* input, unsigned int partId = 0);
237 bool WriteDatasetToFile(hid_t group, vtkUnstructuredGrid* input, unsigned int partId = 0);
238 bool WriteDatasetToFile(hid_t group, vtkPartitionedDataSet* input);
239 bool WriteDatasetToFile(hid_t group, vtkDataObjectTree* input);
241
243
247 bool UpdateStepsGroup(hid_t group, vtkUnstructuredGrid* input, unsigned int partId);
248 bool UpdateStepsGroup(hid_t group, vtkPolyData* input, unsigned int partId);
250
252
256 bool InitializeTemporalPolyData(hid_t group);
257 bool InitializeTemporalUnstructuredGrid(hid_t group);
258 bool InitializeTemporalPolyhedra(hid_t group);
260
262
266 bool InitializeChunkedDatasets(hid_t group, vtkUnstructuredGrid* input);
267 bool InitializeChunkedDatasets(hid_t group, vtkPolyData* input);
268 bool InitializePointDatasets(hid_t group, vtkPoints* input);
269 bool InitializePrimitiveDataset(hid_t group);
270 bool InitializePolyhedraDatasets(hid_t group);
272
277 bool AppendNumberOfPoints(hid_t group, vtkPointSet* input);
278
283 bool AppendPoints(hid_t group, vtkPointSet* input);
284
289 bool AppendNumberOfCells(hid_t group, vtkCellArray* input);
290
295 bool AppendNumberOfFaceConnectivityIds(hid_t group, vtkCellArray* input);
296
301 bool AppendNumberOfFaces(hid_t group, vtkCellArray* input);
302
307 bool AppendNumberOfConnectivityIds(hid_t group, vtkCellArray* input);
308
313 bool AppendCellTypes(hid_t group, vtkUnstructuredGrid* input);
314
319 bool AppendOffsets(hid_t group, vtkCellArray* input);
320
325 bool AppendConnectivity(hid_t group, vtkCellArray* input);
326
331 bool AppendFaceConnectivity(hid_t group, vtkCellArray* input);
332
337 bool AppendFaceOffsets(hid_t group, vtkCellArray* input);
338
343 bool AppendPolyhedronToFaces(hid_t group, vtkCellArray* input);
344
349 bool AppendPolyhedronOffsets(hid_t group, vtkCellArray* input);
350
355 bool AppendNumberOfPolyhedronToFaceIds(hid_t group, vtkCellArray* input);
356
361 bool AppendPrimitiveCells(hid_t baseGroup, vtkPolyData* input);
362
364
368 bool AppendDataArrays(hid_t group, vtkDataObject* input, unsigned int partId = 0);
369 bool AppendDataSetAttributes(hid_t group, vtkDataObject* input, unsigned int partId = 0);
370 bool AppendFieldDataArrays(hid_t group, vtkDataObject* input, unsigned int partId = 0);
372
374
378 bool AppendBlocks(hid_t group, vtkPartitionedDataSetCollection* pdc);
380
382
387 bool AppendExternalBlock(vtkDataObject* block, const std::string& blockName);
389
394 bool AppendAssembly(hid_t group, vtkPartitionedDataSetCollection* pdc);
395
401 bool AppendMultiblock(hid_t group, vtkMultiBlockDataSet* mb, int& leafIndex);
402
407 bool AppendIterDataObject(vtkDataObjectTreeIterator* treeIter, const int& leafIndex,
408 const std::string& uniqueSubTreeName);
409
416 bool AppendCompositeSubfilesDataObject(const std::string& uniqueSubTreeName);
417
419
422 bool AppendDataArrayOffset(hid_t baseGroup, vtkAbstractArray* array, const std::string& arrayName,
423 const std::string& offsetsGroupName, unsigned int partId);
424 bool AppendDataArraySizeOffset(hid_t baseGroup, vtkAbstractArray* array,
425 const std::string& arrayName, const std::string& offsetsGroupName, unsigned int partId);
427
431 bool AppendTimeValues(hid_t group);
432
436 bool HasGeometryChangedFromPreviousStep(vtkDataSet* input);
437
441 void UpdatePreviousStepMeshMTime(vtkDataObject* input);
442
443 class Implementation;
444 std::unique_ptr<Implementation> Impl;
445
446 // Configurable properties
447 char* FileName = nullptr;
448 bool Overwrite = true;
449 bool WriteAllTimeSteps = true;
450 bool UseExternalComposite = false;
451 bool UseExternalTimeSteps = false;
452 bool UseExternalPartitions = false;
453 int ChunkSize = 25000;
454 int CompressionLevel = 0;
455
456 // Temporal-related private variables
457 std::vector<double> timeSteps;
458 bool IsTemporal = false;
459 int CurrentTimeIndex = 0;
460 int NumberOfTimeSteps = 1;
461 vtkMTimeType PreviousStepMeshMTime = 0;
462 std::map<vtkIdType, vtkMTimeType> CompositeMeshMTime;
463
464 // Distributed-related variables
465 vtkMultiProcessController* Controller = nullptr;
466 int NbPieces = 1;
467 int CurrentPiece = 0;
468 bool UsesDummyController = false;
469 std::vector<vtkIdType> PointOffsets;
470 std::vector<vtkIdType> CellOffsets;
471 std::vector<vtkIdType> ConnectivityIdOffsets;
472};
473VTK_ABI_NAMESPACE_END
474#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 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
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:318