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 =========================================================================*/
22 #ifndef vtkXMLUnstructuredDataWriter_h
23 #define vtkXMLUnstructuredDataWriter_h
24 
25 #include "vtkIOXMLModule.h" // For export macro
26 #include "vtkXMLWriter.h"
27 
28 class vtkPointSet;
29 class vtkCellArray;
30 class vtkCellIterator;
31 class vtkDataArray;
32 class vtkIdTypeArray;
34 
36 {
37 public:
39  void PrintSelf(ostream& os, vtkIndent indent);
40 
42 
44  vtkSetMacro(NumberOfPieces, int);
45  vtkGetMacro(NumberOfPieces, int);
47 
49 
51  vtkSetMacro(WritePiece, int);
52  vtkGetMacro(WritePiece, int);
54 
56 
57  vtkSetMacro(GhostLevel, int);
58  vtkGetMacro(GhostLevel, int);
60 
61  // See the vtkAlgorithm for a desciption of what these do
65 
66 protected:
69 
70  vtkPointSet* GetInputAsPointSet();
71  virtual const char* GetDataSetName()=0;
72  virtual void SetInputUpdateExtent(int piece, int numPieces,
73  int ghostLevel);
74 
75  virtual int WriteHeader();
76  virtual int WriteAPiece();
77  virtual int WriteFooter();
78 
79  virtual void AllocatePositionArrays();
80  virtual void DeletePositionArrays();
81 
82  virtual int WriteInlineMode(vtkIndent indent);
83  virtual void WriteInlinePieceAttributes();
84  virtual void WriteInlinePiece(vtkIndent indent);
85 
86  virtual void WriteAppendedPieceAttributes(int index);
87  virtual void WriteAppendedPiece(int index, vtkIndent indent);
88  virtual void WriteAppendedPieceData(int index);
89 
90  void WriteCellsInline(const char* name, vtkCellIterator *cellIter,
91  vtkIdType numCells, vtkIdType cellSizeEstimate,
92  vtkIndent indent);
93 
94  void WriteCellsInline(const char* name, vtkCellArray* cells,
95  vtkDataArray* types, vtkIndent indent);
96 
97  // New API with face infomration for polyhedron cell support.
98  void WriteCellsInline(const char* name, vtkCellArray* cells,
99  vtkDataArray* types, vtkIdTypeArray* faces,
100  vtkIdTypeArray* faceOffsets, vtkIndent indent);
101 
102  void WriteCellsInlineWorker(const char* name, vtkDataArray *types,
103  vtkIndent indent);
104 
105  void WriteCellsAppended(const char* name, vtkDataArray* types,
106  vtkIndent indent, OffsetsManagerGroup *cellsManager);
107 
108  void WriteCellsAppended(const char* name, vtkCellIterator *cellIter,
109  vtkIdType numCells, vtkIndent indent,
110  OffsetsManagerGroup *cellsManager);
111 
112  void WriteCellsAppendedData(vtkCellArray* cells, vtkDataArray* types,
113  int timestep, OffsetsManagerGroup *cellsManager);
114 
115  void WriteCellsAppendedData(vtkCellIterator* cellIter, vtkIdType numCells,
116  vtkIdType cellSizeEstimate, int timestep,
117  OffsetsManagerGroup *cellsManager);
118 
119  // New API with face infomration for polyhedron cell support.
120  void WriteCellsAppendedData(vtkCellArray* cells, vtkDataArray* types,
121  vtkIdTypeArray* faces,vtkIdTypeArray* faceOffsets,
122  int timestep, OffsetsManagerGroup *cellsManager);
123 
124  void WriteCellsAppendedDataWorker(vtkDataArray* types, int timestep,
125  OffsetsManagerGroup *cellsManager);
126 
127  void ConvertCells(vtkCellIterator* cellIter, vtkIdType numCells,
128  vtkIdType cellSizeEstimate);
129 
130  void ConvertCells(vtkCellArray* cells);
131 
132  // For polyhedron support, conversion results are stored in Faces and FaceOffsets
133  void ConvertFaces(vtkIdTypeArray* faces, vtkIdTypeArray* faceOffsets);
134 
135  // Get the number of points/cells. Valid after Update has been
136  // invoked on the input.
137  virtual vtkIdType GetNumberOfInputPoints();
138  virtual vtkIdType GetNumberOfInputCells()=0;
139  void CalculateDataFractions(float* fractions);
140  void CalculateCellFractions(float* fractions, vtkIdType typesSize);
141 
142  // Number of pieces used for streaming.
144 
145  // Which piece to write, if not all.
147 
148  // The ghost level on each piece.
150 
151  // Positions of attributes for each piece.
152  vtkTypeInt64* NumberOfPointsPositions;
153 
154  // For TimeStep support
158 
159  // Hold the new cell representation arrays while writing a piece.
162 
164 
165  // Hold the face arrays for polyhedron cells.
168 
169 private:
171  void operator=(const vtkXMLUnstructuredDataWriter&); // Not implemented.
172 };
173 
174 #endif
virtual const char * GetDataSetName()=0
Store vtkAlgorithm input/output information.
Superclass for VTK XML unstructured data writers.
abstract class for specifying dataset behavior
Definition: vtkPointSet.h:44
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:275
Superclass for VTK's XML file writers.
Definition: vtkXMLWriter.h:53
a simple class to control print indentation
Definition: vtkIndent.h:38
#define VTKIOXML_EXPORT
dataset represents arbitrary combinations of all possible cell types
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
void PrintSelf(ostream &os, vtkIndent indent)
virtual int ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
object to represent cell connectivity
Definition: vtkCellArray.h:49
Store zero or more vtkInformation instances.
Efficient cell iterator for vtkDataSet topologies.