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

IO/vtkEnSightReader.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkEnSightReader.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 =========================================================================*/
00035 #ifndef __vtkEnSightReader_h
00036 #define __vtkEnSightReader_h
00037 
00038 #include "vtkGenericEnSightReader.h"
00039 
00040 class vtkDataSetCollection;
00041 class vtkIdList;
00042 
00043 class VTK_IO_EXPORT vtkEnSightReader : public vtkGenericEnSightReader
00044 {
00045 public:
00046   vtkTypeRevisionMacro(vtkEnSightReader, vtkGenericEnSightReader);
00047   void PrintSelf(ostream& os, vtkIndent indent);
00048   
00049   void Update();
00050   void ExecuteInformation();
00051   
00052   //BTX
00053   enum ElementTypesList
00054   {
00055     POINT     = 0,
00056     BAR2      = 1,
00057     BAR3      = 2,
00058     NSIDED    = 3,
00059     TRIA3     = 4,
00060     TRIA6     = 5,
00061     QUAD4     = 6,
00062     QUAD8     = 7,
00063     TETRA4    = 8,
00064     TETRA10   = 9,
00065     PYRAMID5  = 10,
00066     PYRAMID13 = 11,
00067     HEXA8     = 12,
00068     HEXA20    = 13,
00069     PENTA6    = 14,
00070     PENTA15   = 15
00071   };
00072 
00073   enum VariableTypesList
00074   {
00075     SCALAR_PER_NODE            = 0,
00076     VECTOR_PER_NODE            = 1,
00077     TENSOR_SYMM_PER_NODE       = 2,
00078     SCALAR_PER_ELEMENT         = 3,
00079     VECTOR_PER_ELEMENT         = 4,
00080     TENSOR_SYMM_PER_ELEMENT    = 5,
00081     SCALAR_PER_MEASURED_NODE   = 6,
00082     VECTOR_PER_MEASURED_NODE   = 7,
00083     COMPLEX_SCALAR_PER_NODE    = 8,
00084     COMPLEX_VECTOR_PER_NODE    = 9,
00085     COMPLEX_SCALAR_PER_ELEMENT = 10,
00086     COMPLEX_VECTOR_PER_ELEMENT = 11
00087   };
00088   //ETX
00089 
00093   void ReplaceNthOutput(int n, vtkDataObject* output);
00094   
00096 
00102   vtkGetMacro(OutputsAreValid, int);
00104   
00105 protected:
00106   vtkEnSightReader();
00107   ~vtkEnSightReader();
00108   
00109   void Execute();
00110 
00113   int ReadCaseFile();
00114 
00115   // set in UpdateInformation to value returned from ReadCaseFile
00116   int CaseFileRead;
00117   
00120   virtual int ReadGeometryFile(char* fileName, int timeStep) = 0;
00121 
00124   virtual int ReadMeasuredGeometryFile(char* fileName, int timeStep) = 0;
00125 
00128   int ReadVariableFiles();
00129 
00131 
00133   virtual int ReadScalarsPerNode(char* fileName, char* description,
00134                                  int timeStep, int measured = 0,
00135                                  int numberOfComponents = 1,
00136                                  int component = 0) = 0;
00138   
00140 
00142   virtual int ReadVectorsPerNode(char* fileName, char* description,
00143                                  int timeStep, int measured = 0) = 0;
00145 
00147 
00149   virtual int ReadTensorsPerNode(char* fileName, char* description,
00150                                  int timeStep) = 0;
00152 
00154 
00156   virtual int ReadScalarsPerElement(char* fileName, char* description,
00157                                     int timeStep, int numberOfComponents = 1,
00158                                     int component = 0) = 0;
00160 
00162 
00164   virtual int ReadVectorsPerElement(char* fileName, char* description,
00165                                     int timeStep) = 0;
00167 
00169 
00171   virtual int ReadTensorsPerElement(char* fileName, char* description,
00172                                     int timeStep) = 0;
00174 
00177   virtual int CreateUnstructuredGridOutput(int partId, char line[256]) = 0;
00178   
00181   virtual int CreateStructuredGridOutput(int partId, char line[256]) = 0;
00182   
00184 
00185   vtkSetStringMacro(GeometryFileName);
00186   vtkGetStringMacro(GeometryFileName);
00188 
00190 
00191   vtkSetStringMacro(MeasuredFileName);
00192   vtkGetStringMacro(MeasuredFileName);
00194 
00196 
00197   vtkSetStringMacro(MatchFileName);
00198   vtkGetStringMacro(MatchFileName);
00200   
00202   void AddVariableFileName(char* fileName1, char* fileName2 = NULL);
00203   
00205   void AddVariableDescription(char* description);
00206   
00208   void AddVariableType();
00209 
00212   int GetElementType(char* line);
00213 
00215   void ReplaceWildcards(char* filename, int num);
00216   
00217   char* MeasuredFileName;
00218   char* MatchFileName; // may not actually be necessary to read this file
00219 
00220   // pointer to lists of vtkIdLists (cell ids per element type per part)
00221   vtkIdList*** CellIds;
00222   
00223   // part ids of unstructured outputs
00224   vtkIdList* UnstructuredPartIds;
00225   
00226   int VariableMode;
00227   
00228   // pointers to lists of filenames
00229   char** VariableFileNames; // non-complex
00230   char** ComplexVariableFileNames;
00231   
00232   // array of time sets
00233   vtkIdList *VariableTimeSetIds;
00234   vtkIdList *ComplexVariableTimeSetIds;
00235   
00236   // array of file sets
00237   vtkIdList *VariableFileSetIds;
00238   vtkIdList *ComplexVariableFileSetIds;
00239   
00240   // collection of filename numbers per time set
00241   vtkIdListCollection *TimeSetFileNameNumbers;
00242   vtkIdList *TimeSetsWithFilenameNumbers;
00243   
00244   // collection of filename numbers per file set
00245   vtkIdListCollection *FileSetFileNameNumbers;
00246   vtkIdList *FileSetsWithFilenameNumbers;
00247   
00248   // collection of number of steps per file per file set
00249   vtkIdListCollection *FileSetNumberOfSteps;
00250   
00251   // ids of the time and file sets
00252   vtkIdList *TimeSetIds;
00253   vtkIdList *FileSets;
00254   
00255   int GeometryTimeSet;
00256   int GeometryFileSet;
00257   int MeasuredTimeSet;
00258   int MeasuredFileSet;
00259   
00260   float GeometryTimeValue;
00261   float MeasuredTimeValue;
00262   
00263   int UseTimeSets;
00264   vtkSetMacro(UseTimeSets, int);
00265   vtkGetMacro(UseTimeSets, int);
00266   vtkBooleanMacro(UseTimeSets, int);
00267   
00268   int UseFileSets;
00269   vtkSetMacro(UseFileSets, int);
00270   vtkGetMacro(UseFileSets, int);
00271   vtkBooleanMacro(UseFileSets, int);
00272   
00273   int NumberOfGeometryParts;
00274   
00275   void SetNumberOfOutputsInternal(int num);
00276 
00277   // global list of points for measured geometry
00278   int NumberOfMeasuredPoints;
00279   vtkIdList *MeasuredNodeIds;
00280   
00281   int NumberOfNewOutputs;
00282   int OutputsAreValid;
00283   int InitialRead;
00284   
00285   int CheckOutputConsistency();
00286   
00287 private:
00288   vtkEnSightReader(const vtkEnSightReader&);  // Not implemented.
00289   void operator=(const vtkEnSightReader&);  // Not implemented.
00290 };
00291 
00292 #endif