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 
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 
00047   vtkSetMacro(WritePiece, int);
00048   vtkGetMacro(WritePiece, int);
00050 
00052 
00053   vtkSetMacro(GhostLevel, int);
00054   vtkGetMacro(GhostLevel, int);
00056   
00057 protected:
00058   vtkXMLUnstructuredDataWriter();
00059   ~vtkXMLUnstructuredDataWriter();  
00060   
00061   vtkPointSet* GetInputAsPointSet();
00062   virtual const char* GetDataSetName()=0;
00063   virtual void SetInputUpdateExtent(int piece, int numPieces,
00064                                     int ghostLevel)=0;
00065   
00066   // The actual writing driver required by vtkXMLWriter.
00067   int WriteData();
00068   
00069   virtual int WriteInlineMode(vtkIndent indent);
00070   virtual void WriteInlinePieceAttributes();
00071   virtual void WriteInlinePiece(vtkIndent indent);
00072   
00073   virtual int WriteAppendedMode(vtkIndent indent);
00074   virtual void WriteAppendedPieceAttributes(int index);
00075   virtual void WriteAppendedPiece(int index, vtkIndent indent);
00076   virtual void WriteAppendedPieceData(int index);  
00077   
00078   void WriteCellsInline(const char* name, vtkCellArray* cells,
00079                         vtkDataArray* types, vtkIndent indent);
00080   unsigned long* WriteCellsAppended(const char* name, vtkDataArray* types,
00081                                     vtkIndent indent);
00082   void WriteCellsAppendedData(vtkCellArray* cells, vtkDataArray* types,
00083                               unsigned long* positions);
00084   void ConvertCells(vtkCellArray* cells);
00085   
00086   // Get the number of points/cells.  Valid after Update has been
00087   // invoked on the input.
00088   virtual vtkIdType GetNumberOfInputPoints();
00089   virtual vtkIdType GetNumberOfInputCells()=0;
00090   void CalculateDataFractions(float* fractions);
00091   void CalculateCellFractions(float* fractions, vtkIdType typesSize);
00092   
00093   // Number of pieces used for streaming.
00094   int NumberOfPieces;
00095   
00096   // Which piece to write, if not all.
00097   int WritePiece;
00098   
00099   // The ghost level on each piece.
00100   int GhostLevel;
00101   
00102   // Positions of attributes for each piece.
00103   unsigned long* PointsPositions;
00104   unsigned long* NumberOfPointsPositions;
00105   unsigned long** PointDataPositions;
00106   unsigned long** CellDataPositions;
00107   
00108   // Hold the new cell representation arrays while writing a piece.
00109   vtkIdTypeArray* CellPoints;
00110   vtkIdTypeArray* CellOffsets;
00111   
00112 private:
00113   vtkXMLUnstructuredDataWriter(const vtkXMLUnstructuredDataWriter&);  // Not implemented.
00114   void operator=(const vtkXMLUnstructuredDataWriter&);  // Not implemented.
00115 };
00116 
00117 #endif