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