VTK  9.4.20241226
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
12#ifndef vtkHDFWriter_h
13#define vtkHDFWriter_h
14
15#include "vtkIOHDFModule.h" // For export macro
16#include "vtkWriter.h"
17
18#include <memory>
19
20VTK_ABI_NAMESPACE_BEGIN
21
22class vtkCellArray;
24class vtkDataSet;
25class vtkPoints;
26class vtkPointSet;
27class vtkPolyData;
33
34typedef int64_t hid_t;
35
56class VTKIOHDF_EXPORT vtkHDFWriter : public vtkWriter
57{
58
59private:
60 vtkHDFWriter(const vtkHDFWriter&) = delete;
61 void operator=(const vtkHDFWriter&) = delete;
62
63public:
64 static vtkHDFWriter* New();
65 vtkTypeMacro(vtkHDFWriter, vtkWriter);
66 void PrintSelf(ostream& os, vtkIndent indent) override;
67
69
73 vtkGetObjectMacro(Controller, vtkMultiProcessController);
75
77
83
85
89 vtkSetMacro(Overwrite, bool);
90 vtkGetMacro(Overwrite, bool);
92
94
98 vtkSetMacro(WriteAllTimeSteps, bool);
99 vtkGetMacro(WriteAllTimeSteps, bool);
101
103
115 vtkSetMacro(ChunkSize, int);
116 vtkGetMacro(ChunkSize, int);
118
120
132 vtkSetClampMacro(CompressionLevel, int, 0, 9);
133 vtkGetMacro(CompressionLevel, int);
135
137
144 vtkSetMacro(UseExternalComposite, bool);
145 vtkGetMacro(UseExternalComposite, bool);
147
149
163 vtkSetMacro(UseExternalTimeSteps, bool);
164 vtkGetMacro(UseExternalTimeSteps, bool);
166
168
177 vtkSetMacro(UseExternalPartitions, bool);
178 vtkGetMacro(UseExternalPartitions, bool);
180
181protected:
188 vtkInformationVector* outputVector) override;
189
190 int FillInputPortInformation(int port, vtkInformation* info) override;
191
193 vtkInformationVector* outputVector);
194
195 virtual int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
196 vtkInformationVector* outputVector);
197
199 vtkInformationVector* outputVector) override;
200
202 ~vtkHDFWriter() override;
203
204private:
209 void WriteData() override;
210
215 void DispatchDataObject(hid_t group, vtkDataObject* input, unsigned int partId = 0);
216
221 void WriteDistributedMetafile(vtkDataObject* input);
222
224
228 bool WriteDatasetToFile(hid_t group, vtkPolyData* input, unsigned int partId = 0);
229 bool WriteDatasetToFile(hid_t group, vtkUnstructuredGrid* input, unsigned int partId = 0);
230 bool WriteDatasetToFile(hid_t group, vtkPartitionedDataSet* input);
231 bool WriteDatasetToFile(hid_t group, vtkDataObjectTree* input);
233
235
238 bool UpdateStepsGroup(vtkUnstructuredGrid* input);
239 bool UpdateStepsGroup(vtkPolyData* input);
241
243
247 bool InitializeTemporalPolyData();
248 bool InitializeTemporalUnstructuredGrid();
250
252
256 bool InitializeChunkedDatasets(hid_t group, vtkUnstructuredGrid* input);
257 bool InitializeChunkedDatasets(hid_t group, vtkPolyData* input);
258 bool InitializePointDatasets(hid_t group, vtkPoints* input);
259 bool InitializePrimitiveDataset(hid_t group);
261
266 bool AppendNumberOfPoints(hid_t group, vtkPointSet* input);
267
272 bool AppendPoints(hid_t group, vtkPointSet* input);
273
278 bool AppendNumberOfCells(hid_t group, vtkCellArray* input);
279
284 bool AppendNumberOfConnectivityIds(hid_t group, vtkCellArray* input);
285
290 bool AppendCellTypes(hid_t group, vtkUnstructuredGrid* input);
291
296 bool AppendOffsets(hid_t group, vtkCellArray* input);
297
302 bool AppendConnectivity(hid_t group, vtkCellArray* input);
303
308 bool AppendPrimitiveCells(hid_t baseGroup, vtkPolyData* input);
309
311
315 bool AppendDataArrays(hid_t group, vtkDataObject* input, unsigned int partId = 0);
316 bool AppendDataSetAttributes(hid_t group, vtkDataObject* input, unsigned int partId = 0);
317 bool AppendFieldDataArrays(hid_t group, vtkDataObject* input, unsigned int partId = 0);
319
321
325 bool AppendBlocks(hid_t group, vtkPartitionedDataSetCollection* pdc);
327
329
334 bool AppendExternalBlock(vtkDataObject* block, const std::string& blockName);
336
341 bool AppendAssembly(hid_t group, vtkPartitionedDataSetCollection* pdc);
342
348 bool AppendMultiblock(hid_t group, vtkMultiBlockDataSet* mb);
349
351
354 bool AppendDataArrayOffset(
355 vtkAbstractArray* array, const std::string& arrayName, const std::string& offsetsGroupName);
356 bool AppendDataArraySizeOffset(
357 vtkAbstractArray* array, const std::string& arrayName, const std::string& offsetsGroupName);
359
363 bool AppendTimeValues(hid_t group);
364
368 bool HasGeometryChangedFromPreviousStep(vtkDataSet* input);
369
373 void UpdatePreviousStepMeshMTime(vtkDataObject* input);
374
375 class Implementation;
376 std::unique_ptr<Implementation> Impl;
377
378 // Configurable properties
379 char* FileName = nullptr;
380 bool Overwrite = true;
381 bool WriteAllTimeSteps = true;
382 bool UseExternalComposite = false;
383 bool UseExternalTimeSteps = false;
384 bool UseExternalPartitions = false;
385 int ChunkSize = 25000;
386 int CompressionLevel = 0;
387
388 // Temporal-related private variables
389 double* timeSteps = nullptr;
390 bool IsTemporal = false;
391 int CurrentTimeIndex = 0;
392 int NumberOfTimeSteps = 1;
393 vtkMTimeType PreviousStepMeshMTime = 0;
394
395 // Distributed-related variables
396 vtkMultiProcessController* Controller = nullptr;
397 int NbPieces = 1;
398 int CurrentPiece = 0;
399 bool UsesDummyController = false;
400 std::vector<vtkIdType> PointOffsets;
401 std::vector<vtkIdType> CellOffsets;
402 std::vector<vtkIdType> ConnectivityIdOffsets;
403};
404VTK_ABI_NAMESPACE_END
405#endif
Abstract superclass for all arrays.
object to represent cell connectivity
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
Writes input dataset to a VTKHDF file.
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:139
concrete dataset represents vertices, lines, polygons, and triangle strips
dataset represents arbitrary combinations of all possible cell types
abstract class to write data to file(s)
Definition vtkWriter.h:35
virtual void WriteData()=0
int vtkTypeBool
Definition vtkABI.h:64
int64_t hid_t
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270