00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00025 #ifndef __vtkGenericEnSightReader_h
00026 #define __vtkGenericEnSightReader_h
00027
00028 #include "vtkMultiBlockDataSetAlgorithm.h"
00029
00030 class vtkCallbackCommand;
00031 class vtkDataArrayCollection;
00032 class vtkDataArraySelection;
00033 class vtkIdListCollection;
00034
00035
00036 class TranslationTableType;
00037
00038
00039
00040
00041
00042
00043
00044 enum EnsightReaderCellIdMode
00045 {
00046 SINGLE_PROCESS_MODE,
00047 SPARSE_MODE,
00048 NON_SPARSE_MODE,
00049 IMPLICIT_STRUCTURED_MODE
00050 };
00051
00052
00053 class VTK_IO_EXPORT vtkGenericEnSightReader : public vtkMultiBlockDataSetAlgorithm
00054 {
00055 public:
00056 static vtkGenericEnSightReader *New();
00057 vtkTypeMacro(vtkGenericEnSightReader, vtkMultiBlockDataSetAlgorithm);
00058 void PrintSelf(ostream& os, vtkIndent indent);
00059
00061
00062 void SetCaseFileName(const char* fileName);
00063 vtkGetStringMacro(CaseFileName);
00065
00067
00068 vtkSetStringMacro(FilePath);
00069 vtkGetStringMacro(FilePath);
00071
00073
00074 vtkGetMacro(EnSightVersion, int);
00076
00078
00079 vtkGetMacro(NumberOfVariables, int);
00080 vtkGetMacro(NumberOfComplexVariables, int);
00082
00084
00085 int GetNumberOfVariables(int type);
00086 vtkGetMacro(NumberOfScalarsPerNode, int);
00087 vtkGetMacro(NumberOfVectorsPerNode, int);
00088 vtkGetMacro(NumberOfTensorsSymmPerNode, int);
00089 vtkGetMacro(NumberOfScalarsPerElement, int);
00090 vtkGetMacro(NumberOfVectorsPerElement, int);
00091 vtkGetMacro(NumberOfTensorsSymmPerElement, int);
00092 vtkGetMacro(NumberOfScalarsPerMeasuredNode, int);
00093 vtkGetMacro(NumberOfVectorsPerMeasuredNode, int);
00094 vtkGetMacro(NumberOfComplexScalarsPerNode, int);
00095 vtkGetMacro(NumberOfComplexVectorsPerNode, int);
00096 vtkGetMacro(NumberOfComplexScalarsPerElement, int);
00097 vtkGetMacro(NumberOfComplexVectorsPerElement, int);
00099
00101 const char* GetDescription(int n);
00102
00104 const char* GetComplexDescription(int n);
00105
00114 const char* GetDescription(int n, int type);
00115
00117
00118 int GetVariableType(int n);
00119 int GetComplexVariableType(int n);
00121
00123
00124 virtual void SetTimeValue(float value);
00125 vtkGetMacro(TimeValue, float);
00127
00129
00130 vtkGetMacro(MinimumTimeValue, float);
00131 vtkGetMacro(MaximumTimeValue, float);
00133
00135
00136 vtkGetObjectMacro(TimeSets, vtkDataArrayCollection);
00138
00143 int DetermineEnSightVersion(int quiet=0);
00144
00146
00147 vtkBooleanMacro(ReadAllVariables, int);
00148 vtkSetMacro(ReadAllVariables, int);
00149 vtkGetMacro(ReadAllVariables, int);
00151
00153
00155 vtkGetObjectMacro(PointDataArraySelection, vtkDataArraySelection);
00156 vtkGetObjectMacro(CellDataArraySelection, vtkDataArraySelection);
00158
00160
00161 int GetNumberOfPointArrays();
00162 int GetNumberOfCellArrays();
00164
00166
00168 const char* GetPointArrayName(int index);
00169 const char* GetCellArrayName(int index);
00171
00173
00175 int GetPointArrayStatus(const char* name);
00176 int GetCellArrayStatus(const char* name);
00177 void SetPointArrayStatus(const char* name, int status);
00178 void SetCellArrayStatus(const char* name, int status);
00180
00181
00182 enum FileTypes
00183 {
00184 ENSIGHT_6 = 0,
00185 ENSIGHT_6_BINARY = 1,
00186 ENSIGHT_GOLD = 2,
00187 ENSIGHT_GOLD_BINARY = 3,
00188 ENSIGHT_MASTER_SERVER = 4
00189 };
00190
00191
00193
00196 void SetByteOrderToBigEndian();
00197 void SetByteOrderToLittleEndian();
00198 vtkSetMacro(ByteOrder, int);
00199 vtkGetMacro(ByteOrder, int);
00200 const char *GetByteOrderAsString();
00202
00203
00204 enum
00205 {
00206 FILE_BIG_ENDIAN=0,
00207 FILE_LITTLE_ENDIAN=1,
00208 FILE_UNKNOWN_ENDIAN=2
00209 };
00210
00211
00213
00215 vtkGetStringMacro(GeometryFileName);
00217
00219
00227 vtkSetMacro(ParticleCoordinatesByIndex, int);
00228 vtkGetMacro(ParticleCoordinatesByIndex, int);
00229 vtkBooleanMacro(ParticleCoordinatesByIndex, int);
00231
00234 static int CanReadFile(const char *casefilename);
00235
00236
00237 vtkGenericEnSightReader* GetReader() { return this->Reader; }
00238
00239
00240 protected:
00241 vtkGenericEnSightReader();
00242 ~vtkGenericEnSightReader();
00243
00244 virtual int FillOutputPortInformation(int port, vtkInformation* info);
00245 virtual int RequestInformation(vtkInformation*,
00246 vtkInformationVector**,
00247 vtkInformationVector*);
00248 virtual int RequestData(vtkInformation*,
00249 vtkInformationVector**,
00250 vtkInformationVector*);
00251
00254 int ReadLine(char result[256]);
00255
00258 int ReadBinaryLine(char result[80]);
00259
00260
00261
00262
00263 int ReadNextDataLine(char result[256]);
00264
00266
00267 vtkSetStringMacro(GeometryFileName);
00269
00271
00272 void AddVariableDescription(const char* description);
00273 void AddComplexVariableDescription(const char* description);
00275
00277
00278 void AddVariableType(int variableType);
00279 void AddComplexVariableType(int variableType);
00281
00283
00285 int ReplaceWildcards(char* fileName, int timeSet, int fileSet);
00286 void ReplaceWildcardsHelper(char* fileName, int num);
00288
00289
00290 static void SelectionModifiedCallback(vtkObject* caller, unsigned long eid,
00291 void* clientdata, void* calldata);
00292 void SelectionModified();
00293
00294
00295 char** CreateStringArray(int numStrings);
00296 void DestroyStringArray(int numStrings, char** strings);
00297
00298
00299
00300 void SetDataArraySelectionSetsFromVariables();
00301
00302
00303
00304 void SetDataArraySelectionSetsFromReader();
00305
00306
00307
00308 void SetReaderDataArraySelectionSetsFromSelf();
00309
00310 istream* IS;
00311 FILE *IFile;
00312 vtkGenericEnSightReader *Reader;
00313
00314 char* CaseFileName;
00315 char* GeometryFileName;
00316 char* FilePath;
00317
00318
00319 int* VariableTypes;
00320 int* ComplexVariableTypes;
00321
00322
00323 char** VariableDescriptions;
00324 char** ComplexVariableDescriptions;
00325
00326 int NumberOfVariables;
00327 int NumberOfComplexVariables;
00328
00329
00330 int NumberOfScalarsPerNode;
00331 int NumberOfVectorsPerNode;
00332 int NumberOfTensorsSymmPerNode;
00333 int NumberOfScalarsPerElement;
00334 int NumberOfVectorsPerElement;
00335 int NumberOfTensorsSymmPerElement;
00336 int NumberOfScalarsPerMeasuredNode;
00337 int NumberOfVectorsPerMeasuredNode;
00338 int NumberOfComplexScalarsPerNode;
00339 int NumberOfComplexVectorsPerNode;
00340 int NumberOfComplexScalarsPerElement;
00341 int NumberOfComplexVectorsPerElement;
00342
00343 float TimeValue;
00344 float MinimumTimeValue;
00345 float MaximumTimeValue;
00346
00347
00348 int TimeValueInitialized;
00349
00350 vtkDataArrayCollection *TimeSets;
00351 virtual void SetTimeSets(vtkDataArrayCollection*);
00352
00353 int ReadAllVariables;
00354
00355 int ByteOrder;
00356 int ParticleCoordinatesByIndex;
00357
00358
00359
00360 int EnSightVersion;
00361
00362
00363
00364 vtkDataArraySelection* PointDataArraySelection;
00365 vtkDataArraySelection* CellDataArraySelection;
00366
00367
00368
00369 vtkCallbackCommand* SelectionObserver;
00370
00371
00372
00373 int SelectionModifiedDoNotCallModified;
00374
00375
00376 int InsertNewPartId(int partId);
00377
00378
00379 TranslationTableType *TranslationTable;
00380
00381 private:
00382 vtkGenericEnSightReader(const vtkGenericEnSightReader&);
00383 void operator=(const vtkGenericEnSightReader&);
00384 };
00385
00386 #endif