VTK  9.7.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* GetPointSetInput();
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  void WritePolyCellsInline(const char* name, vtkCellArray* cells, vtkDataArray* types,
93  vtkCellArray* faces, vtkCellArray* faceOffsets, vtkIndent indent);
94 
95  void WriteCellsInlineWorker(const char* name, vtkDataArray* types, vtkIndent indent);
96 
97  void WriteCellsAppended(
98  const char* name, vtkDataArray* types, vtkIndent indent, OffsetsManagerGroup* cellsManager);
99 
100  void WriteCellsAppended(const char* name, vtkCellIterator* cellIter, vtkIdType numCells,
101  vtkIndent indent, OffsetsManagerGroup* cellsManager);
102 
103  void WritePolyCellsAppended(const char* name, vtkDataArray* types, vtkCellArray* faces,
104  vtkCellArray* faceOffsets, vtkIndent indent, OffsetsManagerGroup* cellsManager);
105 
106  void WriteCellsAppendedData(
107  vtkCellArray* cells, vtkDataArray* types, int timestep, OffsetsManagerGroup* cellsManager);
108 
109  void WriteCellsAppendedData(vtkCellIterator* cellIter, vtkIdType numCells,
110  vtkIdType cellSizeEstimate, int timestep, OffsetsManagerGroup* cellsManager);
111 
112  void WritePolyCellsAppendedData(vtkCellArray* cells, vtkDataArray* types, vtkCellArray* faces,
113  vtkCellArray* faceOffsets, int timestep, OffsetsManagerGroup* cellsManager);
114 
115  void WriteCellsAppendedDataWorker(
116  vtkDataArray* types, int timestep, OffsetsManagerGroup* cellsManager);
117 
118  void ConvertCells(vtkCellIterator* cellIter, vtkIdType numCells, vtkIdType cellSizeEstimate);
119 
120  void ConvertCells(vtkCellArray* cells);
121 
122  // For polyhedron support, conversion results are stored in Faces and FaceOffsets
123  void ConvertPolyFaces(vtkCellArray* faces, vtkCellArray* faceOffsets);
124 
125  // Get the number of points/cells. Valid after Update has been
126  // invoked on the input.
127  virtual vtkIdType GetNumberOfInputPoints();
128  virtual vtkIdType GetNumberOfInputCells() = 0;
129  void CalculateDataFractions(float* fractions);
130  void CalculateCellFractions(float* fractions, vtkIdType typesSize);
131 
132  // Number of pieces used for streaming.
134 
135  // Which piece to write, if not all.
137 
138  // The ghost level on each piece.
140 
141  // Positions of attributes for each piece.
142  vtkTypeInt64* NumberOfPointsPositions;
143 
144  // For TimeStep support
148 
149  // Hold the new cell representation arrays while writing a piece.
152 
154 
155  // 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.
vtkSmartPointer< vtkDataArray > FaceOffsets
concrete class for storing a set of points
Definition: vtkPointSet.h:58
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:363
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
vtkSmartPointer< vtkDataArray > PolyhedronOffsets
dataset represents arbitrary combinations of all possible cell types
vtkSmartPointer< vtkDataArray > FaceConnectivity
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:177
Store zero or more vtkInformation instances.
Efficient cell iterator for vtkDataSet topologies.
vtkSmartPointer< vtkDataArray > PolyhedronToFaces