Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound 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 =========================================================================*/
00036 #ifndef __vtkXMLUnstructuredDataWriter_h
00037 #define __vtkXMLUnstructuredDataWriter_h
00038 
00039 #include "vtkXMLWriter.h"
00040 
00041 class vtkPointSet;
00042 class vtkCellArray;
00043 class vtkDataArray;
00044 class vtkIdTypeArray;
00045 
00046 class VTK_IO_EXPORT vtkXMLUnstructuredDataWriter : public vtkXMLWriter
00047 {
00048 public:
00049   vtkTypeRevisionMacro(vtkXMLUnstructuredDataWriter,vtkXMLWriter);
00050   void PrintSelf(ostream& os, vtkIndent indent);
00051   
00053 
00055   vtkSetMacro(NumberOfPieces, int);
00056   vtkGetMacro(NumberOfPieces, int);
00058   
00060 
00061   vtkSetMacro(WritePiece, int);
00062   vtkGetMacro(WritePiece, int);
00064 
00066 
00067   vtkSetMacro(GhostLevel, int);
00068   vtkGetMacro(GhostLevel, int);
00070   
00071 protected:
00072   vtkXMLUnstructuredDataWriter();
00073   ~vtkXMLUnstructuredDataWriter();  
00074   
00075   vtkPointSet* GetInputAsPointSet();
00076   virtual const char* GetDataSetName()=0;
00077   virtual void SetInputUpdateExtent(int piece, int numPieces,
00078                                     int ghostLevel)=0;
00079   
00080   // The actual writing driver required by vtkXMLWriter.
00081   int WriteData();
00082   
00083   virtual void WriteInlineMode(vtkIndent indent);
00084   virtual void WriteInlinePieceAttributes();
00085   virtual void WriteInlinePiece(vtkIndent indent);
00086   
00087   virtual void WriteAppendedMode(vtkIndent indent);
00088   virtual void WriteAppendedPieceAttributes(int index);
00089   virtual void WriteAppendedPiece(int index, vtkIndent indent);
00090   virtual void WriteAppendedPieceData(int index);  
00091   
00092   void WriteCellsInline(const char* name, vtkCellArray* cells,
00093                         vtkDataArray* types, vtkIndent indent);
00094   unsigned long* WriteCellsAppended(const char* name, vtkDataArray* types,
00095                                     vtkIndent indent);
00096   void WriteCellsAppendedData(vtkCellArray* cells, vtkDataArray* types,
00097                               unsigned long* positions);
00098   void ConvertCells(vtkCellArray* cells);
00099   
00100   // Number of pieces used for streaming.
00101   int NumberOfPieces;
00102   
00103   // Which piece to write, if not all.
00104   int WritePiece;
00105   
00106   // The ghost level on each piece.
00107   int GhostLevel;
00108   
00109   // Positions of attributes for each piece.
00110   unsigned long* PointsPositions;
00111   unsigned long* NumberOfPointsPositions;
00112   unsigned long** PointDataPositions;
00113   unsigned long** CellDataPositions;
00114   
00115   // Hold the new cell representation arrays while writing a piece.
00116   vtkIdTypeArray* CellPoints;
00117   vtkIdTypeArray* CellOffsets;
00118   
00119 private:
00120   vtkXMLUnstructuredDataWriter(const vtkXMLUnstructuredDataWriter&);  // Not implemented.
00121   void operator=(const vtkXMLUnstructuredDataWriter&);  // Not implemented.
00122 };
00123 
00124 #endif