vtkGenericEnSightReader.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00038 #ifndef __vtkGenericEnSightReader_h
00039 #define __vtkGenericEnSightReader_h
00040
00041 #include "vtkDataSetSource.h"
00042
00043 class vtkCallbackCommand;
00044 class vtkDataArrayCollection;
00045 class vtkDataArraySelection;
00046 class vtkIdListCollection;
00047
00048 class VTK_IO_EXPORT vtkGenericEnSightReader : public vtkDataSetSource
00049 {
00050 public:
00051 static vtkGenericEnSightReader *New();
00052 vtkTypeRevisionMacro(vtkGenericEnSightReader, vtkDataSetSource);
00053 void PrintSelf(ostream& os, vtkIndent indent);
00054
00056
00057 void SetCaseFileName(const char* fileName);
00058 vtkGetStringMacro(CaseFileName);
00060
00062
00063 vtkSetStringMacro(FilePath);
00064 vtkGetStringMacro(FilePath);
00066
00067 virtual void Update();
00068 virtual void ExecuteInformation();
00069
00071
00072 int GetNumberOfVariables() { return this->NumberOfVariables; }
00073 int GetNumberOfComplexVariables() { return this->NumberOfComplexVariables; }
00075
00077
00078 int GetNumberOfVariables(int type);
00079 vtkGetMacro(NumberOfScalarsPerNode, int);
00080 vtkGetMacro(NumberOfVectorsPerNode, int);
00081 vtkGetMacro(NumberOfTensorsSymmPerNode, int);
00082 vtkGetMacro(NumberOfScalarsPerElement, int);
00083 vtkGetMacro(NumberOfVectorsPerElement, int);
00084 vtkGetMacro(NumberOfTensorsSymmPerElement, int);
00085 vtkGetMacro(NumberOfScalarsPerMeasuredNode, int);
00086 vtkGetMacro(NumberOfVectorsPerMeasuredNode, int);
00087 vtkGetMacro(NumberOfComplexScalarsPerNode, int);
00088 vtkGetMacro(NumberOfComplexVectorsPerNode, int);
00089 vtkGetMacro(NumberOfComplexScalarsPerElement, int);
00090 vtkGetMacro(NumberOfComplexVectorsPerElement, int);
00092
00094 char* GetDescription(int n);
00095
00097 char* GetComplexDescription(int n);
00098
00107 char* GetDescription(int n, int type);
00108
00110
00111 int GetVariableType(int n);
00112 int GetComplexVariableType(int n);
00114
00116
00117 virtual void SetTimeValue(float value);
00118 vtkGetMacro(TimeValue, float);
00120
00122
00123 vtkGetMacro(MinimumTimeValue, float);
00124 vtkGetMacro(MaximumTimeValue, float);
00126
00128
00129 vtkGetObjectMacro(TimeSets, vtkDataArrayCollection);
00131
00136 int DetermineEnSightVersion();
00137
00139
00140 vtkBooleanMacro(ReadAllVariables, int);
00141 vtkSetMacro(ReadAllVariables, int);
00142 vtkGetMacro(ReadAllVariables, int);
00144
00146
00148 vtkGetObjectMacro(PointDataArraySelection, vtkDataArraySelection);
00149 vtkGetObjectMacro(CellDataArraySelection, vtkDataArraySelection);
00151
00153
00154 int GetNumberOfPointArrays();
00155 int GetNumberOfCellArrays();
00157
00159
00161 const char* GetPointArrayName(int index);
00162 const char* GetCellArrayName(int index);
00164
00166
00168 int GetPointArrayStatus(const char* name);
00169 int GetCellArrayStatus(const char* name);
00170 void SetPointArrayStatus(const char* name, int status);
00171 void SetCellArrayStatus(const char* name, int status);
00173
00174
00175 enum FileTypes
00176 {
00177 ENSIGHT_6 = 0,
00178 ENSIGHT_6_BINARY = 1,
00179 ENSIGHT_GOLD = 2,
00180 ENSIGHT_GOLD_BINARY = 3,
00181 ENSIGHT_MASTER_SERVER = 4
00182 };
00183
00184
00186
00189 void SetByteOrderToBigEndian();
00190 void SetByteOrderToLittleEndian();
00191 vtkSetMacro(ByteOrder, int);
00192 vtkGetMacro(ByteOrder, int);
00193 const char *GetByteOrderAsString();
00195
00196
00197 enum
00198 {
00199 FILE_BIG_ENDIAN=0,
00200 FILE_LITTLE_ENDIAN=1,
00201 FILE_UNKNOWN_ENDIAN=2
00202 };
00203
00204
00205 protected:
00206 vtkGenericEnSightReader();
00207 ~vtkGenericEnSightReader();
00208
00209 void Execute();
00210
00213 int ReadLine(char result[256]);
00214
00217 int ReadBinaryLine(char result[80]);
00218
00219
00220
00221
00222 int ReadNextDataLine(char result[256]);
00223
00225
00226 vtkSetStringMacro(GeometryFileName);
00227 vtkGetStringMacro(GeometryFileName);
00229
00231
00232 void AddVariableDescription(char* description);
00233 void AddComplexVariableDescription(char* description);
00235
00237
00238 void AddVariableType(int variableType);
00239 void AddComplexVariableType(int variableType);
00241
00243
00245 void ReplaceWildcards(char* fileName, int timeSet, int fileSet);
00246 void ReplaceWildcardsHelper(char* fileName, int num);
00248
00249
00250 static void SelectionModifiedCallback(vtkObject* caller, unsigned long eid,
00251 void* clientdata, void* calldata);
00252 void SelectionModified();
00253
00254
00255 char** CreateStringArray(int numStrings);
00256 void DestroyStringArray(int numStrings, char** strings);
00257
00258
00259
00260 void SetDataArraySelectionSetsFromVariables();
00261
00262
00263
00264 void SetDataArraySelectionSetsFromReader();
00265
00266
00267
00268 void SetReaderDataArraySelectionSetsFromSelf();
00269
00270 istream* IS;
00271 FILE *IFile;
00272 vtkGenericEnSightReader *Reader;
00273
00274 char* CaseFileName;
00275 char* GeometryFileName;
00276 char* FilePath;
00277
00278
00279 int* VariableTypes;
00280 int* ComplexVariableTypes;
00281
00282
00283 char** VariableDescriptions;
00284 char** ComplexVariableDescriptions;
00285
00286 int NumberOfVariables;
00287 int NumberOfComplexVariables;
00288
00289
00290 int NumberOfScalarsPerNode;
00291 int NumberOfVectorsPerNode;
00292 int NumberOfTensorsSymmPerNode;
00293 int NumberOfScalarsPerElement;
00294 int NumberOfVectorsPerElement;
00295 int NumberOfTensorsSymmPerElement;
00296 int NumberOfScalarsPerMeasuredNode;
00297 int NumberOfVectorsPerMeasuredNode;
00298 int NumberOfComplexScalarsPerNode;
00299 int NumberOfComplexVectorsPerNode;
00300 int NumberOfComplexScalarsPerElement;
00301 int NumberOfComplexVectorsPerElement;
00302
00303 float TimeValue;
00304 float MinimumTimeValue;
00305 float MaximumTimeValue;
00306
00307
00308 int TimeValueInitialized;
00309
00310 vtkDataArrayCollection *TimeSets;
00311 virtual void SetTimeSets(vtkDataArrayCollection*);
00312
00313 int ReadAllVariables;
00314
00315 int ByteOrder;
00316
00317
00318
00319 int EnSightVersion;
00320
00321
00322
00323 vtkDataArraySelection* PointDataArraySelection;
00324 vtkDataArraySelection* CellDataArraySelection;
00325
00326
00327
00328 vtkCallbackCommand* SelectionObserver;
00329
00330
00331
00332 int SelectionModifiedDoNotCallModified;
00333
00334 private:
00335 vtkGenericEnSightReader(const vtkGenericEnSightReader&);
00336 void operator=(const vtkGenericEnSightReader&);
00337 };
00338
00339 #endif