VTK
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 class vtkPointSet;
30 class vtkCellArray;
31 class vtkCellIterator;
32 class vtkDataArray;
33 class vtkIdTypeArray;
35 
36 class VTKIOXML_EXPORT vtkXMLUnstructuredDataWriter : public vtkXMLWriter
37 {
38 public:
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
43 
47  vtkSetMacro(NumberOfPieces, int);
48  vtkGetMacro(NumberOfPieces, int);
50 
52 
56  vtkSetMacro(WritePiece, int);
57  vtkGetMacro(WritePiece, int);
59 
61 
64  vtkSetMacro(GhostLevel, int);
65  vtkGetMacro(GhostLevel, int);
67 
68  // See the vtkAlgorithm for a description of what these do
71  vtkInformationVector*) override;
72 
73 protected:
75  ~vtkXMLUnstructuredDataWriter() override;
76 
77  vtkPointSet* GetInputAsPointSet();
78  const char* GetDataSetName() override =0;
79  virtual void SetInputUpdateExtent(int piece, int numPieces,
80  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);
90  virtual void WriteInlinePieceAttributes();
91  virtual void WriteInlinePiece(vtkIndent indent);
92 
93  virtual void WriteAppendedPieceAttributes(int index);
94  virtual void WriteAppendedPiece(int index, vtkIndent indent);
95  virtual void WriteAppendedPieceData(int index);
96 
97  void WriteCellsInline(const char* name, vtkCellIterator *cellIter,
98  vtkIdType numCells, vtkIdType cellSizeEstimate,
99  vtkIndent indent);
100 
101  void WriteCellsInline(const char* name, vtkCellArray* cells,
102  vtkDataArray* types, vtkIndent indent);
103 
104  // New API with face infomration for polyhedron cell support.
105  void WriteCellsInline(const char* name, vtkCellArray* cells,
106  vtkDataArray* types, vtkIdTypeArray* faces,
107  vtkIdTypeArray* faceOffsets, vtkIndent indent);
108 
109  void WriteCellsInlineWorker(const char* name, vtkDataArray *types,
110  vtkIndent indent);
111 
112  void WriteCellsAppended(const char* name, vtkDataArray* types,
113  vtkIndent indent, OffsetsManagerGroup *cellsManager);
114 
115  void WriteCellsAppended(const char* name, vtkDataArray* types,
116  vtkIdTypeArray* faces, vtkIdTypeArray* faceOffsets,
117  vtkIndent indent, OffsetsManagerGroup *cellsManager);
118 
119  void WriteCellsAppended(const char* name, vtkCellIterator *cellIter,
120  vtkIdType numCells, vtkIndent indent,
121  OffsetsManagerGroup *cellsManager);
122 
123  void WriteCellsAppendedData(vtkCellArray* cells, vtkDataArray* types,
124  int timestep, OffsetsManagerGroup *cellsManager);
125 
126  void WriteCellsAppendedData(vtkCellIterator* cellIter, vtkIdType numCells,
127  vtkIdType cellSizeEstimate, int timestep,
128  OffsetsManagerGroup *cellsManager);
129 
130  // New API with face infomration for polyhedron cell support.
131  void WriteCellsAppendedData(vtkCellArray* cells, vtkDataArray* types,
132  vtkIdTypeArray* faces,vtkIdTypeArray* faceOffsets,
133  int timestep, OffsetsManagerGroup *cellsManager);
134 
135  void WriteCellsAppendedDataWorker(vtkDataArray* types, int timestep,
136  OffsetsManagerGroup *cellsManager);
137 
138  void ConvertCells(vtkCellIterator* cellIter, vtkIdType numCells,
139  vtkIdType cellSizeEstimate);
140 
141  void ConvertCells(vtkCellArray* cells);
142 
143  // For polyhedron support, conversion results are stored in Faces and FaceOffsets
144  void ConvertFaces(vtkIdTypeArray* faces, vtkIdTypeArray* faceOffsets);
145 
146  // Get the number of points/cells. Valid after Update has been
147  // invoked on the input.
148  virtual vtkIdType GetNumberOfInputPoints();
149  virtual vtkIdType GetNumberOfInputCells()=0;
150  void CalculateDataFractions(float* fractions);
151  void CalculateCellFractions(float* fractions, vtkIdType typesSize);
152 
153  // Number of pieces used for streaming.
155 
156  // Which piece to write, if not all.
158 
159  // The ghost level on each piece.
161 
162  // Positions of attributes for each piece.
163  vtkTypeInt64* NumberOfPointsPositions;
164 
165  // For TimeStep support
169 
170  // Hold the new cell representation arrays while writing a piece.
173 
175 
176  // Hold the face arrays for polyhedron cells.
179 
180 private:
182  void operator=(const vtkXMLUnstructuredDataWriter&) = delete;
183 };
184 
185 #endif
virtual const char * GetDataSetName()=0
Store vtkAlgorithm input/output information.
int ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Upstream/Downstream requests form the generalized interface through which executives invoke a algorit...
Superclass for VTK XML unstructured data writers.
abstract class for specifying dataset behavior
Definition: vtkPointSet.h:42
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:347
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Superclass for VTK's XML file writers.
Definition: vtkXMLWriter.h:62
a simple class to control print indentation
Definition: vtkIndent.h:39
dataset represents arbitrary combinations of all possible cell types
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
object to represent cell connectivity
Definition: vtkCellArray.h:50
Store zero or more vtkInformation instances.
Efficient cell iterator for vtkDataSet topologies.