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 class TranslationTableType;
00036
00037
00038 class VTK_IO_EXPORT vtkGenericEnSightReader : public vtkMultiBlockDataSetAlgorithm
00039 {
00040 public:
00041 static vtkGenericEnSightReader *New();
00042 vtkTypeMacro(vtkGenericEnSightReader, vtkMultiBlockDataSetAlgorithm);
00043 void PrintSelf(ostream& os, vtkIndent indent);
00044
00046
00047 void SetCaseFileName(const char* fileName);
00048 vtkGetStringMacro(CaseFileName);
00050
00052
00053 vtkSetStringMacro(FilePath);
00054 vtkGetStringMacro(FilePath);
00056
00058
00059 vtkGetMacro(NumberOfVariables, int);
00060 vtkGetMacro(NumberOfComplexVariables, int);
00062
00064
00065 int GetNumberOfVariables(int type);
00066 vtkGetMacro(NumberOfScalarsPerNode, int);
00067 vtkGetMacro(NumberOfVectorsPerNode, int);
00068 vtkGetMacro(NumberOfTensorsSymmPerNode, int);
00069 vtkGetMacro(NumberOfScalarsPerElement, int);
00070 vtkGetMacro(NumberOfVectorsPerElement, int);
00071 vtkGetMacro(NumberOfTensorsSymmPerElement, int);
00072 vtkGetMacro(NumberOfScalarsPerMeasuredNode, int);
00073 vtkGetMacro(NumberOfVectorsPerMeasuredNode, int);
00074 vtkGetMacro(NumberOfComplexScalarsPerNode, int);
00075 vtkGetMacro(NumberOfComplexVectorsPerNode, int);
00076 vtkGetMacro(NumberOfComplexScalarsPerElement, int);
00077 vtkGetMacro(NumberOfComplexVectorsPerElement, int);
00079
00081 const char* GetDescription(int n);
00082
00084 const char* GetComplexDescription(int n);
00085
00094 const char* GetDescription(int n, int type);
00095
00097
00098 int GetVariableType(int n);
00099 int GetComplexVariableType(int n);
00101
00103
00104 virtual void SetTimeValue(float value);
00105 vtkGetMacro(TimeValue, float);
00107
00109
00110 vtkGetMacro(MinimumTimeValue, float);
00111 vtkGetMacro(MaximumTimeValue, float);
00113
00115
00116 vtkGetObjectMacro(TimeSets, vtkDataArrayCollection);
00118
00123 int DetermineEnSightVersion(int quiet=0);
00124
00126
00127 vtkBooleanMacro(ReadAllVariables, int);
00128 vtkSetMacro(ReadAllVariables, int);
00129 vtkGetMacro(ReadAllVariables, int);
00131
00133
00135 vtkGetObjectMacro(PointDataArraySelection, vtkDataArraySelection);
00136 vtkGetObjectMacro(CellDataArraySelection, vtkDataArraySelection);
00138
00140
00141 int GetNumberOfPointArrays();
00142 int GetNumberOfCellArrays();
00144
00146
00148 const char* GetPointArrayName(int index);
00149 const char* GetCellArrayName(int index);
00151
00153
00155 int GetPointArrayStatus(const char* name);
00156 int GetCellArrayStatus(const char* name);
00157 void SetPointArrayStatus(const char* name, int status);
00158 void SetCellArrayStatus(const char* name, int status);
00160
00161
00162 enum FileTypes
00163 {
00164 ENSIGHT_6 = 0,
00165 ENSIGHT_6_BINARY = 1,
00166 ENSIGHT_GOLD = 2,
00167 ENSIGHT_GOLD_BINARY = 3,
00168 ENSIGHT_MASTER_SERVER = 4
00169 };
00170
00171
00173
00176 void SetByteOrderToBigEndian();
00177 void SetByteOrderToLittleEndian();
00178 vtkSetMacro(ByteOrder, int);
00179 vtkGetMacro(ByteOrder, int);
00180 const char *GetByteOrderAsString();
00182
00183
00184 enum
00185 {
00186 FILE_BIG_ENDIAN=0,
00187 FILE_LITTLE_ENDIAN=1,
00188 FILE_UNKNOWN_ENDIAN=2
00189 };
00190
00191
00193
00195 vtkGetStringMacro(GeometryFileName);
00197
00199
00207 vtkSetMacro(ParticleCoordinatesByIndex, int);
00208 vtkGetMacro(ParticleCoordinatesByIndex, int);
00209 vtkBooleanMacro(ParticleCoordinatesByIndex, int);
00211
00214 static int CanReadFile(const char *casefilename);
00215
00216 protected:
00217 vtkGenericEnSightReader();
00218 ~vtkGenericEnSightReader();
00219
00220 virtual int FillOutputPortInformation(int port, vtkInformation* info);
00221 virtual int RequestInformation(vtkInformation*,
00222 vtkInformationVector**,
00223 vtkInformationVector*);
00224 virtual int RequestData(vtkInformation*,
00225 vtkInformationVector**,
00226 vtkInformationVector*);
00227
00230 int ReadLine(char result[256]);
00231
00234 int ReadBinaryLine(char result[80]);
00235
00236
00237
00238
00239 int ReadNextDataLine(char result[256]);
00240
00242
00243 vtkSetStringMacro(GeometryFileName);
00245
00247
00248 void AddVariableDescription(const char* description);
00249 void AddComplexVariableDescription(const char* description);
00251
00253
00254 void AddVariableType(int variableType);
00255 void AddComplexVariableType(int variableType);
00257
00259
00261 int ReplaceWildcards(char* fileName, int timeSet, int fileSet);
00262 void ReplaceWildcardsHelper(char* fileName, int num);
00264
00265
00266 static void SelectionModifiedCallback(vtkObject* caller, unsigned long eid,
00267 void* clientdata, void* calldata);
00268 void SelectionModified();
00269
00270
00271 char** CreateStringArray(int numStrings);
00272 void DestroyStringArray(int numStrings, char** strings);
00273
00274
00275
00276 void SetDataArraySelectionSetsFromVariables();
00277
00278
00279
00280 void SetDataArraySelectionSetsFromReader();
00281
00282
00283
00284 void SetReaderDataArraySelectionSetsFromSelf();
00285
00286 istream* IS;
00287 FILE *IFile;
00288 vtkGenericEnSightReader *Reader;
00289
00290 char* CaseFileName;
00291 char* GeometryFileName;
00292 char* FilePath;
00293
00294
00295 int* VariableTypes;
00296 int* ComplexVariableTypes;
00297
00298
00299 char** VariableDescriptions;
00300 char** ComplexVariableDescriptions;
00301
00302 int NumberOfVariables;
00303 int NumberOfComplexVariables;
00304
00305
00306 int NumberOfScalarsPerNode;
00307 int NumberOfVectorsPerNode;
00308 int NumberOfTensorsSymmPerNode;
00309 int NumberOfScalarsPerElement;
00310 int NumberOfVectorsPerElement;
00311 int NumberOfTensorsSymmPerElement;
00312 int NumberOfScalarsPerMeasuredNode;
00313 int NumberOfVectorsPerMeasuredNode;
00314 int NumberOfComplexScalarsPerNode;
00315 int NumberOfComplexVectorsPerNode;
00316 int NumberOfComplexScalarsPerElement;
00317 int NumberOfComplexVectorsPerElement;
00318
00319 float TimeValue;
00320 float MinimumTimeValue;
00321 float MaximumTimeValue;
00322
00323
00324 int TimeValueInitialized;
00325
00326 vtkDataArrayCollection *TimeSets;
00327 virtual void SetTimeSets(vtkDataArrayCollection*);
00328
00329 int ReadAllVariables;
00330
00331 int ByteOrder;
00332 int ParticleCoordinatesByIndex;
00333
00334
00335
00336 int EnSightVersion;
00337
00338
00339
00340 vtkDataArraySelection* PointDataArraySelection;
00341 vtkDataArraySelection* CellDataArraySelection;
00342
00343
00344
00345 vtkCallbackCommand* SelectionObserver;
00346
00347
00348
00349 int SelectionModifiedDoNotCallModified;
00350
00351
00352 int InsertNewPartId(int partId);
00353
00354
00355
00356 TranslationTableType *TranslationTable;
00357
00358
00359 private:
00360 vtkGenericEnSightReader(const vtkGenericEnSightReader&);
00361 void operator=(const vtkGenericEnSightReader&);
00362 };
00363
00364 #endif