VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkXMLUnstructuredDataWriter.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00022 #ifndef __vtkXMLUnstructuredDataWriter_h 00023 #define __vtkXMLUnstructuredDataWriter_h 00024 00025 #include "vtkXMLWriter.h" 00026 00027 class vtkPointSet; 00028 class vtkCellArray; 00029 class vtkDataArray; 00030 class vtkIdTypeArray; 00031 class vtkUnstructuredGrid; 00032 00033 class VTK_IO_EXPORT vtkXMLUnstructuredDataWriter : public vtkXMLWriter 00034 { 00035 public: 00036 vtkTypeMacro(vtkXMLUnstructuredDataWriter,vtkXMLWriter); 00037 void PrintSelf(ostream& os, vtkIndent indent); 00038 00040 00042 vtkSetMacro(NumberOfPieces, int); 00043 vtkGetMacro(NumberOfPieces, int); 00045 00047 00049 vtkSetMacro(WritePiece, int); 00050 vtkGetMacro(WritePiece, int); 00052 00054 00055 vtkSetMacro(GhostLevel, int); 00056 vtkGetMacro(GhostLevel, int); 00058 00059 // See the vtkAlgorithm for a desciption of what these do 00060 int ProcessRequest(vtkInformation*, 00061 vtkInformationVector**, 00062 vtkInformationVector*); 00063 00064 protected: 00065 vtkXMLUnstructuredDataWriter(); 00066 ~vtkXMLUnstructuredDataWriter(); 00067 00068 vtkPointSet* GetInputAsPointSet(); 00069 virtual const char* GetDataSetName()=0; 00070 virtual void SetInputUpdateExtent(int piece, int numPieces, 00071 int ghostLevel); 00072 00073 virtual int WriteHeader(); 00074 virtual int WriteAPiece(); 00075 virtual int WriteFooter(); 00076 00077 virtual void AllocatePositionArrays(); 00078 virtual void DeletePositionArrays(); 00079 00080 virtual int WriteInlineMode(vtkIndent indent); 00081 virtual void WriteInlinePieceAttributes(); 00082 virtual void WriteInlinePiece(vtkIndent indent); 00083 00084 virtual void WriteAppendedPieceAttributes(int index); 00085 virtual void WriteAppendedPiece(int index, vtkIndent indent); 00086 virtual void WriteAppendedPieceData(int index); 00087 00088 void WriteCellsInline(const char* name, vtkCellArray* cells, 00089 vtkDataArray* types, vtkIndent indent); 00090 00091 // New API with face infomration for polyhedron cell support. 00092 void WriteCellsInline(const char* name, vtkCellArray* cells, 00093 vtkDataArray* types, vtkIdTypeArray* faces, 00094 vtkIdTypeArray* faceOffsets, vtkIndent indent); 00095 00096 void WriteCellsAppended(const char* name, vtkDataArray* types, 00097 vtkIndent indent, OffsetsManagerGroup *cellsManager); 00098 00099 void WriteCellsAppendedData(vtkCellArray* cells, vtkDataArray* types, 00100 int timestep, OffsetsManagerGroup *cellsManager); 00101 00102 // New API with face infomration for polyhedron cell support. 00103 void WriteCellsAppendedData(vtkCellArray* cells, vtkDataArray* types, 00104 vtkIdTypeArray* faces,vtkIdTypeArray* faceOffsets, 00105 int timestep, OffsetsManagerGroup *cellsManager); 00106 00107 void ConvertCells(vtkCellArray* cells); 00108 00109 // For polyhedron support, convertion results are stored in Faces and FaceOffsets 00110 void ConvertFaces(vtkIdTypeArray* faces, vtkIdTypeArray* faceOffsets); 00111 00112 // Get the number of points/cells. Valid after Update has been 00113 // invoked on the input. 00114 virtual vtkIdType GetNumberOfInputPoints(); 00115 virtual vtkIdType GetNumberOfInputCells()=0; 00116 void CalculateDataFractions(float* fractions); 00117 void CalculateCellFractions(float* fractions, vtkIdType typesSize); 00118 00119 // Number of pieces used for streaming. 00120 int NumberOfPieces; 00121 00122 // Which piece to write, if not all. 00123 int WritePiece; 00124 00125 // The ghost level on each piece. 00126 int GhostLevel; 00127 00128 // Positions of attributes for each piece. 00129 unsigned long* NumberOfPointsPositions; 00130 00131 // For TimeStep support 00132 OffsetsManagerGroup *PointsOM; 00133 OffsetsManagerArray *PointDataOM; 00134 OffsetsManagerArray *CellDataOM; 00135 00136 // Hold the new cell representation arrays while writing a piece. 00137 vtkIdTypeArray* CellPoints; 00138 vtkIdTypeArray* CellOffsets; 00139 00140 int CurrentPiece; 00141 00142 // Hold the face arrays for polyhedron cells. 00143 vtkIdTypeArray* Faces; 00144 vtkIdTypeArray* FaceOffsets; 00145 00146 private: 00147 vtkXMLUnstructuredDataWriter(const vtkXMLUnstructuredDataWriter&); // Not implemented. 00148 void operator=(const vtkXMLUnstructuredDataWriter&); // Not implemented. 00149 }; 00150 00151 #endif