Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# IO/vtkGenericEnSightReader.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program:   Visualization Toolkit
    00004   Module:    $RCSfile: vtkGenericEnSightReader.h,v $
    00005   Language:  C++
    00006
    00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
    00008   All rights reserved.
    00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
    00010
    00011      This software is distributed WITHOUT ANY WARRANTY; without even
    00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00013      PURPOSE.  See the above copyright notice for more information.
    00014
    00015 =========================================================================*/
    00040 #ifndef __vtkGenericEnSightReader_h
    00041 #define __vtkGenericEnSightReader_h
    00042
    00043 #include "vtkDataSetSource.h"
    00044
    00045 class vtkDataArrayCollection;
    00046 class vtkIdListCollection;
    00047
    00048
    00049 class VTK_IO_EXPORT vtkGenericEnSightReader : public vtkDataSetSource
    00050 {
    00051 public:
    00052   static vtkGenericEnSightReader *New();
    00053   vtkTypeRevisionMacro(vtkGenericEnSightReader, vtkDataSetSource);
    00054   void PrintSelf(ostream& os, vtkIndent indent);
    00055
    00057
    00058   void SetCaseFileName(const char* fileName);
    00059   vtkGetStringMacro(CaseFileName);
    00061
    00063
    00064   vtkSetStringMacro(FilePath);
    00065   vtkGetStringMacro(FilePath);
    00067
    00068   virtual void Update();
    00069   virtual void ExecuteInformation();
    00070
    00072
    00073   int GetNumberOfVariables() { return this->NumberOfVariables; }
    00074   int GetNumberOfComplexVariables() { return this->NumberOfComplexVariables; }
    00076
    00078
    00079   int GetNumberOfVariables(int type); // returns -1 if unknown type specified
    00080   vtkGetMacro(NumberOfScalarsPerNode, int);
    00081   vtkGetMacro(NumberOfVectorsPerNode, int);
    00082   vtkGetMacro(NumberOfTensorsSymmPerNode, int);
    00083   vtkGetMacro(NumberOfScalarsPerElement, int);
    00084   vtkGetMacro(NumberOfVectorsPerElement, int);
    00085   vtkGetMacro(NumberOfTensorsSymmPerElement, int);
    00086   vtkGetMacro(NumberOfScalarsPerMeasuredNode, int);
    00087   vtkGetMacro(NumberOfVectorsPerMeasuredNode, int);
    00088   vtkGetMacro(NumberOfComplexScalarsPerNode, int);
    00089   vtkGetMacro(NumberOfComplexVectorsPerNode, int);
    00090   vtkGetMacro(NumberOfComplexScalarsPerElement, int);
    00091   vtkGetMacro(NumberOfComplexVectorsPerElement, int);
    00093
    00095   char* GetDescription(int n);
    00096
    00098   char* GetComplexDescription(int n);
    00099
    00108   char* GetDescription(int n, int type);
    00109
    00111
    00112   int GetVariableType(int n);
    00113   int GetComplexVariableType(int n);
    00115
    00117
    00118   vtkSetMacro(TimeValue, float);
    00119   vtkGetMacro(TimeValue, float);
    00121
    00123
    00124   vtkGetMacro(MinimumTimeValue, float);
    00125   vtkGetMacro(MaximumTimeValue, float);
    00127
    00129
    00130   vtkGetObjectMacro(TimeSets, vtkDataArrayCollection);
    00132
    00137   int DetermineEnSightVersion();
    00138
    00140
    00141   vtkBooleanMacro(ReadAllVariables, int);
    00142   vtkSetMacro(ReadAllVariables, int);
    00143   vtkGetMacro(ReadAllVariables, int);
    00145
    00147
    00149   void AddVariableName(char* variableName, int attributeType);
    00150   void AddPointVariableName(char* variableName);
    00151   void AddCellVariableName(char* variableName);
    00153
    00155   void RemoveAllVariableNames();
    00156
    00158
    00159   void RemoveAllPointVariableNames();
    00160   void RemoveAllCellVariableNames();
    00162
    00165   int IsRequestedVariable(char *variableName, int attributeType);
    00166
    00168
    00169   int GetNumberOfPointArrays();
    00170   int GetNumberOfCellArrays();
    00172
    00173   //BTX
    00174   enum FileTypes
    00175   {
    00176     ENSIGHT_6             = 0,
    00177     ENSIGHT_6_BINARY      = 1,
    00178     ENSIGHT_GOLD          = 2,
    00179     ENSIGHT_GOLD_BINARY   = 3,
    00180     ENSIGHT_MASTER_SERVER = 4
    00181   };
    00182   //ETX
    00183
    00185
    00188   void SetByteOrderToBigEndian();
    00189   void SetByteOrderToLittleEndian();
    00190   vtkSetMacro(ByteOrder, int);
    00191   vtkGetMacro(ByteOrder, int);
    00192   const char *GetByteOrderAsString();
    00194
    00195 //BTX
    00196   enum
    00197   {
    00198     FILE_BIG_ENDIAN=0,
    00199     FILE_LITTLE_ENDIAN=1
    00200   };
    00201 //ETX
    00202
    00203 protected:
    00204   vtkGenericEnSightReader();
    00205   ~vtkGenericEnSightReader();
    00206
    00207   void Execute();
    00208
    00211   int ReadLine(char result[256]);
    00212
    00215   int ReadBinaryLine(char result[80]);
    00216
    00217   // Internal function that skips blank lines and reads the 1st
    00218   // non-blank line it finds (up to 256 characters).
    00219   // Returns 0 is there was an error.
    00220   int ReadNextDataLine(char result[256]);
    00221
    00223
    00224   vtkSetStringMacro(GeometryFileName);
    00225   vtkGetStringMacro(GeometryFileName);
    00227
    00229
    00230   void AddVariableDescription(char* description);
    00231   void AddComplexVariableDescription(char* description);
    00233
    00235
    00236   void AddVariableType(int variableType);
    00237   void AddComplexVariableType(int variableType);
    00239
    00241
    00243   void ReplaceWildcards(char* fileName, int timeSet, int fileSet);
    00244   void ReplaceWildcardsHelper(char* fileName, int num);
    00246
    00247   istream* IS;
    00248   FILE *IFile;
    00249   vtkGenericEnSightReader *Reader;
    00250
    00251   char* CaseFileName;
    00252   char* GeometryFileName;
    00253   char* FilePath;
    00254
    00255   // array of types (one entry per instance of variable type in case file)
    00256   int* VariableTypes;
    00257   int* ComplexVariableTypes;
    00258
    00259   // pointers to lists of descriptions
    00260   char** VariableDescriptions;
    00261   char** ComplexVariableDescriptions;
    00262
    00263   int NumberOfVariables;
    00264   int NumberOfComplexVariables;
    00265
    00266   // number of file names / descriptions per type
    00267   int NumberOfScalarsPerNode;
    00268   int NumberOfVectorsPerNode;
    00269   int NumberOfTensorsSymmPerNode;
    00270   int NumberOfScalarsPerElement;
    00271   int NumberOfVectorsPerElement;
    00272   int NumberOfTensorsSymmPerElement;
    00273   int NumberOfScalarsPerMeasuredNode;
    00274   int NumberOfVectorsPerMeasuredNode;
    00275   int NumberOfComplexScalarsPerNode;
    00276   int NumberOfComplexVectorsPerNode;
    00277   int NumberOfComplexScalarsPerElement;
    00278   int NumberOfComplexVectorsPerElement;
    00279
    00280   float TimeValue;
    00281   float MinimumTimeValue;
    00282   float MaximumTimeValue;
    00283
    00284   vtkDataArrayCollection *TimeSets;
    00285   virtual void SetTimeSets(vtkDataArrayCollection*);
    00286
    00287   int ReadAllVariables;
    00288   int NumberOfRequestedPointVariables;
    00289   int NumberOfRequestedCellVariables;
    00290   char** RequestedPointVariables;
    00291   char** RequestedCellVariables;
    00292
    00293   int ByteOrder;
    00294
    00295 private:
    00296   vtkGenericEnSightReader(const vtkGenericEnSightReader&);  // Not implemented.
    00297   void operator=(const vtkGenericEnSightReader&);  // Not implemented.
    00298 };
    00299
    00300 #endif