00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00055 #ifndef __vtkDataWriter_h
00056 #define __vtkDataWriter_h
00057
00058 #include <stdio.h>
00059 #include "vtkWriter.h"
00060
00061 class vtkDataSet;
00062 class vtkPoints;
00063 class vtkCellArray;
00064 class vtkScalars;
00065 class vtkVectors;
00066 class vtkNormals;
00067 class vtkTCoords;
00068 class vtkTensors;
00069 class vtkGhostLevels;
00070 class vtkDataArray;
00071
00072 class VTK_EXPORT vtkDataWriter : public vtkWriter
00073 {
00074 public:
00075 vtkTypeMacro(vtkDataWriter,vtkWriter);
00076 void PrintSelf(ostream& os, vtkIndent indent);
00077
00080 static vtkDataWriter *New();
00081
00083 vtkSetStringMacro(FileName);
00084 vtkGetStringMacro(FileName);
00085
00087 vtkSetMacro(WriteToOutputString,int);
00088 vtkGetMacro(WriteToOutputString,int);
00089 vtkBooleanMacro(WriteToOutputString,int);
00090
00094 vtkGetMacro(OutputStringLength, int);
00095 vtkGetStringMacro(OutputString);
00096 unsigned char *GetBinaryOutputString() {
00097 return (unsigned char *)this->OutputString;};
00098
00102 char *RegisterAndGetOutputString();
00103
00105 vtkSetStringMacro(Header);
00106 vtkGetStringMacro(Header);
00107
00109 vtkSetClampMacro(FileType,int,VTK_ASCII,VTK_BINARY);
00110 vtkGetMacro(FileType,int);
00111 void SetFileTypeToASCII() {this->SetFileType(VTK_ASCII);};
00112 void SetFileTypeToBinary() {this->SetFileType(VTK_BINARY);};
00113
00116 vtkSetStringMacro(ScalarsName);
00117 vtkGetStringMacro(ScalarsName);
00118
00121 vtkSetStringMacro(VectorsName);
00122 vtkGetStringMacro(VectorsName);
00123
00126 vtkSetStringMacro(TensorsName);
00127 vtkGetStringMacro(TensorsName);
00128
00131 vtkSetStringMacro(GhostLevelsName);
00132 vtkGetStringMacro(GhostLevelsName);
00133
00136 vtkSetStringMacro(NormalsName);
00137 vtkGetStringMacro(NormalsName);
00138
00141 vtkSetStringMacro(TCoordsName);
00142 vtkGetStringMacro(TCoordsName);
00143
00146 vtkSetStringMacro(LookupTableName);
00147 vtkGetStringMacro(LookupTableName);
00148
00151 vtkSetStringMacro(FieldDataName);
00152 vtkGetStringMacro(FieldDataName);
00153
00155 virtual ostream *OpenVTKFile();
00156
00158 int WriteHeader(ostream *fp);
00159
00161 int WritePoints(ostream *fp, vtkPoints *p);
00162
00164 int WriteCoordinates(ostream *fp, vtkScalars *coords, int axes);
00165
00167 int WriteCells(ostream *fp, vtkCellArray *cells, const char *label);
00168
00171 int WriteCellData(ostream *fp, vtkDataSet *ds);
00172
00175 int WritePointData(ostream *fp, vtkDataSet *ds);
00176
00178 int WriteFieldData(ostream *fp, vtkFieldData *f);
00179
00183 int WriteDataSetData(ostream *fp, vtkDataSet *ds);
00184
00186 void CloseVTKFile(ostream *fp);
00187
00188
00189 protected:
00190 vtkDataWriter();
00191 ~vtkDataWriter();
00192 vtkDataWriter(const vtkDataWriter&) {};
00193 void operator=(const vtkDataWriter&) {};
00194
00195 int WriteToOutputString;
00196 char *OutputString;
00197 int OutputStringLength;
00198 int OutputStringAllocatedLength;
00199
00200 void WriteData();
00201
00202 char *FileName;
00203 char *Header;
00204 int FileType;
00205
00206 char *ScalarsName;
00207 char *VectorsName;
00208 char *TensorsName;
00209 char *GhostLevelsName;
00210 char *TCoordsName;
00211 char *NormalsName;
00212 char *LookupTableName;
00213 char *FieldDataName;
00214
00215 int WriteArray(ostream *fp, int dataType, vtkDataArray *data, const char *format,
00216 int num, int numComp);
00217 int WriteScalarData(ostream *fp, vtkScalars *s, int num);
00218 int WriteVectorData(ostream *fp, vtkVectors *v, int num);
00219 int WriteNormalData(ostream *fp, vtkNormals *n, int num);
00220 int WriteTCoordData(ostream *fp, vtkTCoords *tc, int num);
00221 int WriteTensorData(ostream *fp, vtkTensors *t, int num);
00222 int WriteGhostLevelData(ostream *fp, vtkGhostLevels *g, int num);
00223
00224 };
00225
00226 #endif
00227
00228