VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkXMLUnstructuredDataWriter.h,v $ 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 00032 class VTK_IO_EXPORT vtkXMLUnstructuredDataWriter : public vtkXMLWriter 00033 { 00034 public: 00035 vtkTypeRevisionMacro(vtkXMLUnstructuredDataWriter,vtkXMLWriter); 00036 void PrintSelf(ostream& os, vtkIndent indent); 00037 00039 00041 vtkSetMacro(NumberOfPieces, int); 00042 vtkGetMacro(NumberOfPieces, int); 00044 00046 00048 vtkSetMacro(WritePiece, int); 00049 vtkGetMacro(WritePiece, int); 00051 00053 00054 vtkSetMacro(GhostLevel, int); 00055 vtkGetMacro(GhostLevel, int); 00057 00058 // See the vtkAlgorithm for a desciption of what these do 00059 int ProcessRequest(vtkInformation*, 00060 vtkInformationVector**, 00061 vtkInformationVector*); 00062 00063 protected: 00064 vtkXMLUnstructuredDataWriter(); 00065 ~vtkXMLUnstructuredDataWriter(); 00066 00067 vtkPointSet* GetInputAsPointSet(); 00068 virtual const char* GetDataSetName()=0; 00069 virtual void SetInputUpdateExtent(int piece, int numPieces, 00070 int ghostLevel); 00071 00072 virtual int WriteHeader(); 00073 virtual int WriteAPiece(); 00074 virtual int WriteFooter(); 00075 00076 virtual void AllocatePositionArrays(); 00077 virtual void DeletePositionArrays(); 00078 00079 virtual int WriteInlineMode(vtkIndent indent); 00080 virtual void WriteInlinePieceAttributes(); 00081 virtual void WriteInlinePiece(vtkIndent indent); 00082 00083 virtual void WriteAppendedPieceAttributes(int index); 00084 virtual void WriteAppendedPiece(int index, vtkIndent indent); 00085 virtual void WriteAppendedPieceData(int index); 00086 00087 void WriteCellsInline(const char* name, vtkCellArray* cells, 00088 vtkDataArray* types, vtkIndent indent); 00089 void WriteCellsAppended(const char* name, vtkDataArray* types, 00090 vtkIndent indent, OffsetsManagerGroup *cellsManager); 00091 void WriteCellsAppendedData(vtkCellArray* cells, vtkDataArray* types, 00092 int timestep, OffsetsManagerGroup *cellsManager); 00093 void ConvertCells(vtkCellArray* cells); 00094 00095 // Get the number of points/cells. Valid after Update has been 00096 // invoked on the input. 00097 virtual vtkIdType GetNumberOfInputPoints(); 00098 virtual vtkIdType GetNumberOfInputCells()=0; 00099 void CalculateDataFractions(float* fractions); 00100 void CalculateCellFractions(float* fractions, vtkIdType typesSize); 00101 00102 // Number of pieces used for streaming. 00103 int NumberOfPieces; 00104 00105 // Which piece to write, if not all. 00106 int WritePiece; 00107 00108 // The ghost level on each piece. 00109 int GhostLevel; 00110 00111 // Positions of attributes for each piece. 00112 unsigned long* NumberOfPointsPositions; 00113 00114 // For TimeStep support 00115 OffsetsManagerGroup *PointsOM; 00116 OffsetsManagerArray *PointDataOM; 00117 OffsetsManagerArray *CellDataOM; 00118 00119 // Hold the new cell representation arrays while writing a piece. 00120 vtkIdTypeArray* CellPoints; 00121 vtkIdTypeArray* CellOffsets; 00122 00123 int CurrentPiece; 00124 00125 private: 00126 vtkXMLUnstructuredDataWriter(const vtkXMLUnstructuredDataWriter&); // Not implemented. 00127 void operator=(const vtkXMLUnstructuredDataWriter&); // Not implemented. 00128 }; 00129 00130 #endif