VTK
dox/IO/XML/vtkXMLStructuredDataWriter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkXMLStructuredDataWriter.h
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 __vtkXMLStructuredDataWriter_h
00023 #define __vtkXMLStructuredDataWriter_h
00024 
00025 #include "vtkIOXMLModule.h" // For export macro
00026 #include "vtkXMLWriter.h"
00027 
00028 class vtkAbstractArray;
00029 class vtkExtentTranslator;
00030 class vtkInformation;
00031 class vtkInformationVector;
00032 
00033 class VTKIOXML_EXPORT vtkXMLStructuredDataWriter : public vtkXMLWriter
00034 {
00035 public:
00036   vtkTypeMacro(vtkXMLStructuredDataWriter,vtkXMLWriter);
00037   void PrintSelf(ostream& os, vtkIndent indent);
00038 
00040 
00042   vtkSetMacro(NumberOfPieces, int);
00043   vtkGetMacro(NumberOfPieces, int);
00045 
00047 
00050   vtkSetVector6Macro(WriteExtent, int);
00051   vtkGetVector6Macro(WriteExtent, int);
00053 
00055 
00056   virtual void SetExtentTranslator(vtkExtentTranslator*);
00057   vtkGetObjectMacro(ExtentTranslator, vtkExtentTranslator);
00059 
00060 protected:
00061   vtkXMLStructuredDataWriter();
00062   ~vtkXMLStructuredDataWriter();
00063 
00064   // Writing drivers defined by subclasses.
00065   virtual void WritePrimaryElementAttributes(ostream &os, vtkIndent indent);
00066   virtual void WriteAppendedPiece(int index, vtkIndent indent);
00067   virtual void WriteAppendedPieceData(int index);
00068   virtual void WriteInlinePiece(vtkIndent indent);
00069   virtual void GetInputExtent(int* extent)=0;
00070 
00071   virtual int WriteHeader();
00072   virtual int WriteAPiece();
00073   virtual int WriteFooter();
00074 
00075   virtual void AllocatePositionArrays();
00076   virtual void DeletePositionArrays();
00077 
00078   void SetupExtentTranslator();
00079   vtkAbstractArray* CreateExactExtent(vtkAbstractArray* array, int* inExtent,
00080                                   int* outExtent, int isPoint);
00081   virtual int WriteInlineMode(vtkIndent indent);
00082   vtkIdType GetStartTuple(int* extent, vtkIdType* increments,
00083                           int i, int j, int k);
00084   void CalculatePieceFractions(float* fractions);
00085 
00086   // Define utility methods required by vtkXMLWriter.
00087   virtual vtkAbstractArray* CreateArrayForPoints(vtkAbstractArray* inArray);
00088   virtual vtkAbstractArray* CreateArrayForCells(vtkAbstractArray* inArray);
00089 
00090   void SetInputUpdateExtent(int piece);
00091   int ProcessRequest(vtkInformation* request,
00092                      vtkInformationVector** inputVector,
00093                      vtkInformationVector* outputVector);
00094 
00095   vtkSetVector6Macro(InternalWriteExtent, int);
00096 
00097   // The extent of the input to write, as specified by user
00098   int WriteExtent[6];
00099 
00100   // The actual extent of the input to write.
00101   int InternalWriteExtent[6];
00102 
00103   // Number of pieces used for streaming.
00104   int NumberOfPieces;
00105 
00106   // Translate piece number to extent.
00107   vtkExtentTranslator* ExtentTranslator;
00108 
00109   float* ProgressFractions;
00110 
00111   int CurrentPiece;
00112 
00113   // Appended data offsets of point and cell data arrays.
00114   // Store offset position (add TimeStep support)
00115   OffsetsManagerArray *PointDataOM;
00116   OffsetsManagerArray *CellDataOM;
00117 
00118 private:
00119   vtkXMLStructuredDataWriter(const vtkXMLStructuredDataWriter&);  // Not implemented.
00120   void operator=(const vtkXMLStructuredDataWriter&);  // Not implemented.
00121 };
00122 
00123 #endif