VTK  9.3.1
vtkXMLUnstructuredDataWriter.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
11 #ifndef vtkXMLUnstructuredDataWriter_h
12 #define vtkXMLUnstructuredDataWriter_h
13 
14 #include "vtkIOXMLModule.h" // For export macro
15 #include "vtkXMLWriter.h"
16 
17 #include <vtkSmartPointer.h> // for vtkSmartPointer
18 
19 VTK_ABI_NAMESPACE_BEGIN
20 class vtkPointSet;
21 class vtkCellArray;
22 class vtkCellIterator;
23 class vtkDataArray;
24 class vtkIdTypeArray;
26 
27 class VTKIOXML_EXPORT vtkXMLUnstructuredDataWriter : public vtkXMLWriter
28 {
29 public:
31  void PrintSelf(ostream& os, vtkIndent indent) override;
32 
34 
38  vtkSetMacro(NumberOfPieces, int);
39  vtkGetMacro(NumberOfPieces, int);
41 
43 
47  vtkSetMacro(WritePiece, int);
48  vtkGetMacro(WritePiece, int);
50 
52 
55  vtkSetMacro(GhostLevel, int);
56  vtkGetMacro(GhostLevel, int);
58 
59  // See the vtkAlgorithm for a description of what these do
62 
63 protected:
65  ~vtkXMLUnstructuredDataWriter() override;
66 
67  vtkPointSet* GetInputAsPointSet();
68  const char* GetDataSetName() override = 0;
69  virtual void SetInputUpdateExtent(int piece, int numPieces, int ghostLevel);
70 
71  virtual int WriteHeader();
72  virtual int WriteAPiece();
73  virtual int WriteFooter();
74 
75  virtual void AllocatePositionArrays();
76  virtual void DeletePositionArrays();
77 
78  virtual int WriteInlineMode(vtkIndent indent);
79  virtual void WriteInlinePieceAttributes();
80  virtual void WriteInlinePiece(vtkIndent indent);
81 
82  virtual void WriteAppendedPieceAttributes(int index);
83  virtual void WriteAppendedPiece(int index, vtkIndent indent);
84  virtual void WriteAppendedPieceData(int index);
85 
86  void WriteCellsInline(const char* name, vtkCellIterator* cellIter, vtkIdType numCells,
87  vtkIdType cellSizeEstimate, vtkIndent indent);
88 
89  void WriteCellsInline(
90  const char* name, vtkCellArray* cells, vtkDataArray* types, vtkIndent indent);
91 
92  // New API with face information for polyhedron cell support.
93  void WriteCellsInline(const char* name, vtkCellArray* cells, vtkDataArray* types,
94  vtkIdTypeArray* faces, vtkIdTypeArray* faceOffsets, vtkIndent indent);
95 
96  void WriteCellsInlineWorker(const char* name, vtkDataArray* types, vtkIndent indent);
97 
98  void WriteCellsAppended(
99  const char* name, vtkDataArray* types, vtkIndent indent, OffsetsManagerGroup* cellsManager);
100 
101  void WriteCellsAppended(const char* name, vtkDataArray* types, vtkIdTypeArray* faces,
102  vtkIdTypeArray* faceOffsets, vtkIndent indent, OffsetsManagerGroup* cellsManager);
103 
104  void WriteCellsAppended(const char* name, vtkCellIterator* cellIter, vtkIdType numCells,
105  vtkIndent indent, OffsetsManagerGroup* cellsManager);
106 
107  void WriteCellsAppendedData(
108  vtkCellArray* cells, vtkDataArray* types, int timestep, OffsetsManagerGroup* cellsManager);
109 
110  void WriteCellsAppendedData(vtkCellIterator* cellIter, vtkIdType numCells,
111  vtkIdType cellSizeEstimate, int timestep, OffsetsManagerGroup* cellsManager);
112 
113  // New API with face information for polyhedron cell support.
114  void WriteCellsAppendedData(vtkCellArray* cells, vtkDataArray* types, vtkIdTypeArray* faces,
115  vtkIdTypeArray* faceOffsets, int timestep, OffsetsManagerGroup* cellsManager);
116 
117  void WriteCellsAppendedDataWorker(
118  vtkDataArray* types, int timestep, OffsetsManagerGroup* cellsManager);
119 
120  void ConvertCells(vtkCellIterator* cellIter, vtkIdType numCells, vtkIdType cellSizeEstimate);
121 
122  void ConvertCells(vtkCellArray* cells);
123 
124  // For polyhedron support, conversion results are stored in Faces and FaceOffsets
125  void ConvertFaces(vtkIdTypeArray* faces, vtkIdTypeArray* faceOffsets);
126 
127  // Get the number of points/cells. Valid after Update has been
128  // invoked on the input.
129  virtual vtkIdType GetNumberOfInputPoints();
130  virtual vtkIdType GetNumberOfInputCells() = 0;
131  void CalculateDataFractions(float* fractions);
132  void CalculateCellFractions(float* fractions, vtkIdType typesSize);
133 
134  // Number of pieces used for streaming.
136 
137  // Which piece to write, if not all.
139 
140  // The ghost level on each piece.
142 
143  // Positions of attributes for each piece.
144  vtkTypeInt64* NumberOfPointsPositions;
145 
146  // For TimeStep support
150 
151  // Hold the new cell representation arrays while writing a piece.
154 
156 
157  // Hold the face arrays for polyhedron cells.
160 
161 private:
163  void operator=(const vtkXMLUnstructuredDataWriter&) = delete;
164 };
165 
166 VTK_ABI_NAMESPACE_END
167 #endif
virtual const char * GetDataSetName()=0
Store vtkAlgorithm input/output information.
Superclass for VTK XML unstructured data writers.
concrete class for storing a set of points
Definition: vtkPointSet.h:58
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:315
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Upstream/Downstream requests form the generalized interface through which executives invoke a algorit...
int vtkTypeBool
Definition: vtkABI.h:64
Superclass for VTK's XML file writers.
Definition: vtkXMLWriter.h:53
a simple class to control print indentation
Definition: vtkIndent.h:28
dataset represents arbitrary combinations of all possible cell types
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
vtkSmartPointer< vtkDataArray > CellOffsets
vtkSmartPointer< vtkDataArray > CellPoints
object to represent cell connectivity
Definition: vtkCellArray.h:175
Store zero or more vtkInformation instances.
Efficient cell iterator for vtkDataSet topologies.