VTK
|
00001 /*========================================================================= 00002 00003 Program: ParaView 00004 Module: vtkXMLCompositeDataWriter.h 00005 00006 Copyright (c) Kitware, Inc. 00007 All rights reserved. 00008 See Copyright.txt or http://www.paraview.org/HTML/Copyright.html 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 =========================================================================*/ 00025 #ifndef vtkXMLCompositeDataWriter_h 00026 #define vtkXMLCompositeDataWriter_h 00027 00028 #include "vtkIOXMLModule.h" // For export macro 00029 #include "vtkXMLWriter.h" 00030 #include "vtkStdString.h" // needed for vtkStdString. 00031 00032 class vtkCallbackCommand; 00033 class vtkCompositeDataSet; 00034 class vtkXMLDataElement; 00035 class vtkXMLCompositeDataWriterInternals; 00036 00037 class VTKIOXML_EXPORT vtkXMLCompositeDataWriter : public vtkXMLWriter 00038 { 00039 public: 00040 vtkTypeMacro(vtkXMLCompositeDataWriter,vtkXMLWriter); 00041 void PrintSelf(ostream& os, vtkIndent indent); 00042 00044 virtual const char* GetDefaultFileExtension(); 00045 00050 vtkGetMacro(GhostLevel, int); 00051 vtkSetMacro(GhostLevel, int); 00053 00055 00056 vtkGetMacro(WriteMetaFile, int); 00057 virtual void SetWriteMetaFile(int flag); 00059 00061 00062 int ProcessRequest(vtkInformation*, 00063 vtkInformationVector**, 00064 vtkInformationVector*); 00066 00067 protected: 00068 vtkXMLCompositeDataWriter(); 00069 ~vtkXMLCompositeDataWriter(); 00070 00072 00075 virtual int GetDataSetMajorVersion() { return 1; } 00076 virtual int GetDataSetMinorVersion() { return 0; } 00078 00080 vtkStdString CreatePieceFileName(int Piece); 00081 00082 // see algorithm for more info 00083 virtual int FillInputPortInformation(int port, vtkInformation* info); 00084 00085 int RequestData( 00086 vtkInformation* , vtkInformationVector** , vtkInformationVector*); 00087 int RequestUpdateExtent( 00088 vtkInformation* , vtkInformationVector** , vtkInformationVector*); 00089 00090 virtual int WriteData(); 00091 virtual const char* GetDataSetName(); 00092 00093 // Create a default executive. 00094 virtual vtkExecutive* CreateDefaultExecutive(); 00095 00096 vtkInformation* InputInformation; 00097 00099 virtual void FillDataTypes(vtkCompositeDataSet*); 00100 00102 unsigned int GetNumberOfDataTypes(); 00103 00105 int* GetDataTypesPointer(); 00106 00107 // Methods to create the set of writers matching the set of inputs. 00108 void CreateWriters(vtkCompositeDataSet*); 00109 vtkXMLWriter* GetWriter(int index); 00110 00111 // Methods to help construct internal file names. 00112 void SplitFileName(); 00113 const char* GetFilePrefix(); 00114 const char* GetFilePath(); 00115 00119 int WriteMetaFileIfRequested(); 00120 00121 // Make a directory. 00122 void MakeDirectory(const char* name); 00123 00124 // Remove a directory. 00125 void RemoveADirectory(const char* name); 00126 00127 // Internal implementation details. 00128 vtkXMLCompositeDataWriterInternals* Internal; 00129 00130 // The number of ghost levels to write for unstructured data. 00131 int GhostLevel; 00132 00136 int WriteMetaFile; 00137 00138 // Callback registered with the ProgressObserver. 00139 static void ProgressCallbackFunction(vtkObject*, unsigned long, void*, 00140 void*); 00141 // Progress callback from internal writer. 00142 virtual void ProgressCallback(vtkAlgorithm* w); 00143 00144 // The observer to report progress from the internal writer. 00145 vtkCallbackCommand* ProgressObserver; 00146 00148 00154 virtual int WriteComposite(vtkCompositeDataSet* compositeData, 00155 vtkXMLDataElement* element, int &writerIdx)=0; 00157 00159 00166 virtual int WriteNonCompositeData( 00167 vtkDataObject* dObj, vtkXMLDataElement* element, 00168 int& writerIdx, const char* FileName); 00170 00173 virtual void RemoveWrittenFiles(const char* SubDirectory); 00174 00175 private: 00176 vtkXMLCompositeDataWriter(const vtkXMLCompositeDataWriter&); // Not implemented. 00177 void operator=(const vtkXMLCompositeDataWriter&); // Not implemented. 00178 }; 00179 00180 #endif