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

vtkXMLUnstructuredDataWriter.h

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