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