Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

IO/vtkXMLUnstructuredDataWriter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkXMLUnstructuredDataWriter.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00037 #ifndef __vtkXMLUnstructuredDataWriter_h
00038 #define __vtkXMLUnstructuredDataWriter_h
00039 
00040 #include "vtkXMLWriter.h"
00041 
00042 class vtkPointSet;
00043 class vtkCellArray;
00044 class vtkDataArray;
00045 class vtkIdTypeArray;
00046 
00047 class VTK_IO_EXPORT vtkXMLUnstructuredDataWriter : public vtkXMLWriter
00048 {
00049 public:
00050   vtkTypeRevisionMacro(vtkXMLUnstructuredDataWriter,vtkXMLWriter);
00051   void PrintSelf(ostream& os, vtkIndent indent);
00052   
00054 
00056   vtkSetMacro(NumberOfPieces, int);
00057   vtkGetMacro(NumberOfPieces, int);
00059   
00061 
00062   vtkSetMacro(WritePiece, int);
00063   vtkGetMacro(WritePiece, int);
00065 
00067 
00068   vtkSetMacro(GhostLevel, int);
00069   vtkGetMacro(GhostLevel, int);
00071   
00072 protected:
00073   vtkXMLUnstructuredDataWriter();
00074   ~vtkXMLUnstructuredDataWriter();  
00075   
00076   vtkPointSet* GetInputAsPointSet();
00077   virtual const char* GetDataSetName()=0;
00078   virtual void SetInputUpdateExtent(int piece, int numPieces,
00079                                     int ghostLevel)=0;
00080   
00081   // The actual writing driver required by vtkXMLWriter.
00082   int WriteData();
00083   
00084   virtual void WriteInlineMode(vtkIndent indent);
00085   virtual void WriteInlinePieceAttributes();
00086   virtual void WriteInlinePiece(vtkIndent indent);
00087   
00088   virtual void WriteAppendedMode(vtkIndent indent);
00089   virtual void WriteAppendedPieceAttributes(int index);
00090   virtual void WriteAppendedPiece(int index, vtkIndent indent);
00091   virtual void WriteAppendedPieceData(int index);  
00092   
00093   void WriteCellsInline(const char* name, vtkCellArray* cells,
00094                         vtkDataArray* types, vtkIndent indent);
00095   unsigned long* WriteCellsAppended(const char* name, vtkDataArray* types,
00096                                     vtkIndent indent);
00097   void WriteCellsAppendedData(vtkCellArray* cells, vtkDataArray* types,
00098                               unsigned long* positions);
00099   void ConvertCells(vtkCellArray* cells);
00100   
00101   // Number of pieces used for streaming.
00102   int NumberOfPieces;
00103   
00104   // Which piece to write, if not all.
00105   int WritePiece;
00106   
00107   // The ghost level on each piece.
00108   int GhostLevel;
00109   
00110   // Positions of attributes for each piece.
00111   unsigned long* PointsPositions;
00112   unsigned long* NumberOfPointsPositions;
00113   unsigned long** PointDataPositions;
00114   unsigned long** CellDataPositions;
00115   
00116   // Hold the new cell representation arrays while writing a piece.
00117   vtkIdTypeArray* CellPoints;
00118   vtkIdTypeArray* CellOffsets;
00119   
00120 private:
00121   vtkXMLUnstructuredDataWriter(const vtkXMLUnstructuredDataWriter&);  // Not implemented.
00122   void operator=(const vtkXMLUnstructuredDataWriter&);  // Not implemented.
00123 };
00124 
00125 #endif