VTK  9.0.2
vtkXMLUnstructuredDataWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkXMLUnstructuredDataWriter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
23 #ifndef vtkXMLUnstructuredDataWriter_h
24 #define vtkXMLUnstructuredDataWriter_h
25 
26 #include "vtkIOXMLModule.h" // For export macro
27 #include "vtkXMLWriter.h"
28 
29 #include <vtkSmartPointer.h> // for vtkSmartPointer
30 
31 class vtkPointSet;
32 class vtkCellArray;
33 class vtkCellIterator;
34 class vtkDataArray;
35 class vtkIdTypeArray;
37 
38 class VTKIOXML_EXPORT vtkXMLUnstructuredDataWriter : public vtkXMLWriter
39 {
40 public:
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
45 
49  vtkSetMacro(NumberOfPieces, int);
50  vtkGetMacro(NumberOfPieces, int);
52 
54 
58  vtkSetMacro(WritePiece, int);
59  vtkGetMacro(WritePiece, int);
61 
63 
66  vtkSetMacro(GhostLevel, int);
67  vtkGetMacro(GhostLevel, int);
69 
70  // See the vtkAlgorithm for a description of what these do
73 
74 protected:
77 
79  const char* GetDataSetName() override = 0;
80  virtual void SetInputUpdateExtent(int piece, int numPieces, int ghostLevel);
81 
82  virtual int WriteHeader();
83  virtual int WriteAPiece();
84  virtual int WriteFooter();
85 
86  virtual void AllocatePositionArrays();
87  virtual void DeletePositionArrays();
88 
89  virtual int WriteInlineMode(vtkIndent indent);
91  virtual void WriteInlinePiece(vtkIndent indent);
92 
94  virtual void WriteAppendedPiece(int index, vtkIndent indent);
95  virtual void WriteAppendedPieceData(int index);
96 
97  void WriteCellsInline(const char* name, vtkCellIterator* cellIter, vtkIdType numCells,
98  vtkIdType cellSizeEstimate, vtkIndent indent);
99 
101  const char* name, vtkCellArray* cells, vtkDataArray* types, vtkIndent indent);
102 
103  // New API with face infomration for polyhedron cell support.
104  void WriteCellsInline(const char* name, vtkCellArray* cells, vtkDataArray* types,
105  vtkIdTypeArray* faces, vtkIdTypeArray* faceOffsets, vtkIndent indent);
106 
107  void WriteCellsInlineWorker(const char* name, vtkDataArray* types, vtkIndent indent);
108 
110  const char* name, vtkDataArray* types, vtkIndent indent, OffsetsManagerGroup* cellsManager);
111 
112  void WriteCellsAppended(const char* name, vtkDataArray* types, vtkIdTypeArray* faces,
113  vtkIdTypeArray* faceOffsets, vtkIndent indent, OffsetsManagerGroup* cellsManager);
114 
115  void WriteCellsAppended(const char* name, vtkCellIterator* cellIter, vtkIdType numCells,
116  vtkIndent indent, OffsetsManagerGroup* cellsManager);
117 
119  vtkCellArray* cells, vtkDataArray* types, int timestep, OffsetsManagerGroup* cellsManager);
120 
122  vtkIdType cellSizeEstimate, int timestep, OffsetsManagerGroup* cellsManager);
123 
124  // New API with face infomration for polyhedron cell support.
126  vtkIdTypeArray* faceOffsets, int timestep, OffsetsManagerGroup* cellsManager);
127 
129  vtkDataArray* types, int timestep, OffsetsManagerGroup* cellsManager);
130 
131  void ConvertCells(vtkCellIterator* cellIter, vtkIdType numCells, vtkIdType cellSizeEstimate);
132 
134 
135  // For polyhedron support, conversion results are stored in Faces and FaceOffsets
136  void ConvertFaces(vtkIdTypeArray* faces, vtkIdTypeArray* faceOffsets);
137 
138  // Get the number of points/cells. Valid after Update has been
139  // invoked on the input.
142  void CalculateDataFractions(float* fractions);
143  void CalculateCellFractions(float* fractions, vtkIdType typesSize);
144 
145  // Number of pieces used for streaming.
147 
148  // Which piece to write, if not all.
150 
151  // The ghost level on each piece.
153 
154  // Positions of attributes for each piece.
155  vtkTypeInt64* NumberOfPointsPositions;
156 
157  // For TimeStep support
161 
162  // Hold the new cell representation arrays while writing a piece.
165 
167 
168  // Hold the face arrays for polyhedron cells.
171 
172 private:
174  void operator=(const vtkXMLUnstructuredDataWriter&) = delete;
175 };
176 
177 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:180
Efficient cell iterator for vtkDataSet topologies.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
abstract class for specifying dataset behavior
Definition: vtkPointSet.h:63
dataset represents arbitrary combinations of all possible cell types
Superclass for VTK XML unstructured data writers.
void CalculateDataFractions(float *fractions)
void WriteCellsInline(const char *name, vtkCellIterator *cellIter, vtkIdType numCells, vtkIdType cellSizeEstimate, vtkIndent indent)
void WriteCellsAppended(const char *name, vtkDataArray *types, vtkIdTypeArray *faces, vtkIdTypeArray *faceOffsets, vtkIndent indent, OffsetsManagerGroup *cellsManager)
void ConvertCells(vtkCellArray *cells)
virtual void WriteAppendedPiece(int index, vtkIndent indent)
virtual vtkIdType GetNumberOfInputCells()=0
virtual void SetInputUpdateExtent(int piece, int numPieces, int ghostLevel)
void WriteCellsInline(const char *name, vtkCellArray *cells, vtkDataArray *types, vtkIndent indent)
void WriteCellsAppendedData(vtkCellArray *cells, vtkDataArray *types, vtkIdTypeArray *faces, vtkIdTypeArray *faceOffsets, int timestep, OffsetsManagerGroup *cellsManager)
const char * GetDataSetName() override=0
virtual void WriteAppendedPieceAttributes(int index)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void WriteInlinePiece(vtkIndent indent)
void WriteCellsAppendedData(vtkCellIterator *cellIter, vtkIdType numCells, vtkIdType cellSizeEstimate, int timestep, OffsetsManagerGroup *cellsManager)
vtkSmartPointer< vtkDataArray > CellPoints
virtual int WriteInlineMode(vtkIndent indent)
void WriteCellsAppendedDataWorker(vtkDataArray *types, int timestep, OffsetsManagerGroup *cellsManager)
void WriteCellsInlineWorker(const char *name, vtkDataArray *types, vtkIndent indent)
void WriteCellsAppended(const char *name, vtkDataArray *types, vtkIndent indent, OffsetsManagerGroup *cellsManager)
virtual void WriteInlinePieceAttributes()
void WriteCellsAppendedData(vtkCellArray *cells, vtkDataArray *types, int timestep, OffsetsManagerGroup *cellsManager)
~vtkXMLUnstructuredDataWriter() override
vtkPointSet * GetInputAsPointSet()
virtual void WriteAppendedPieceData(int index)
vtkSmartPointer< vtkDataArray > CellOffsets
void ConvertCells(vtkCellIterator *cellIter, vtkIdType numCells, vtkIdType cellSizeEstimate)
void WriteCellsInline(const char *name, vtkCellArray *cells, vtkDataArray *types, vtkIdTypeArray *faces, vtkIdTypeArray *faceOffsets, vtkIndent indent)
virtual void AllocatePositionArrays()
virtual vtkIdType GetNumberOfInputPoints()
void CalculateCellFractions(float *fractions, vtkIdType typesSize)
void WriteCellsAppended(const char *name, vtkCellIterator *cellIter, vtkIdType numCells, vtkIndent indent, OffsetsManagerGroup *cellsManager)
vtkTypeBool ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Upstream/Downstream requests form the generalized interface through which executives invoke a algorit...
void ConvertFaces(vtkIdTypeArray *faces, vtkIdTypeArray *faceOffsets)
virtual void DeletePositionArrays()
Superclass for VTK's XML file writers.
Definition: vtkXMLWriter.h:62
@ name
Definition: vtkX3D.h:225
@ index
Definition: vtkX3D.h:252
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:338