Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkEnSightReader.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkEnSightReader.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00031 #ifndef __vtkEnSightReader_h
00032 #define __vtkEnSightReader_h
00033 
00034 #include "vtkGenericEnSightReader.h"
00035 
00036 class vtkDataSetCollection;
00037 class vtkIdList;
00038 class vtkEnSightReaderCellIdsType;
00039 
00040 class VTK_IO_EXPORT vtkEnSightReader : public vtkGenericEnSightReader
00041 {
00042 public:
00043   vtkTypeRevisionMacro(vtkEnSightReader, vtkGenericEnSightReader);
00044   void PrintSelf(ostream& os, vtkIndent indent);
00045   
00046   void Update();
00047   void ExecuteInformation();
00048   
00049   //BTX
00050   enum ElementTypesList
00051   {
00052     POINT     = 0,
00053     BAR2      = 1,
00054     BAR3      = 2,
00055     NSIDED    = 3,
00056     TRIA3     = 4,
00057     TRIA6     = 5,
00058     QUAD4     = 6,
00059     QUAD8     = 7,
00060     TETRA4    = 8,
00061     TETRA10   = 9,
00062     PYRAMID5  = 10,
00063     PYRAMID13 = 11,
00064     HEXA8     = 12,
00065     HEXA20    = 13,
00066     PENTA6    = 14,
00067     PENTA15   = 15
00068   };
00069 
00070   enum VariableTypesList
00071   {
00072     SCALAR_PER_NODE            = 0,
00073     VECTOR_PER_NODE            = 1,
00074     TENSOR_SYMM_PER_NODE       = 2,
00075     SCALAR_PER_ELEMENT         = 3,
00076     VECTOR_PER_ELEMENT         = 4,
00077     TENSOR_SYMM_PER_ELEMENT    = 5,
00078     SCALAR_PER_MEASURED_NODE   = 6,
00079     VECTOR_PER_MEASURED_NODE   = 7,
00080     COMPLEX_SCALAR_PER_NODE    = 8,
00081     COMPLEX_VECTOR_PER_NODE    = 9,
00082     COMPLEX_SCALAR_PER_ELEMENT = 10,
00083     COMPLEX_VECTOR_PER_ELEMENT = 11
00084   };
00085   //ETX
00086 
00090   void ReplaceNthOutput(int n, vtkDataObject* output);
00091   
00093 
00099   vtkGetMacro(OutputsAreValid, int);
00101   
00102 protected:
00103   vtkEnSightReader();
00104   ~vtkEnSightReader();
00105   
00106   void Execute();
00107 
00110   int ReadCaseFile();
00111 
00112   // set in UpdateInformation to value returned from ReadCaseFile
00113   int CaseFileRead;
00114   
00117   virtual int ReadGeometryFile(char* fileName, int timeStep) = 0;
00118 
00121   virtual int ReadMeasuredGeometryFile(char* fileName, int timeStep) = 0;
00122 
00125   int ReadVariableFiles();
00126 
00128 
00130   virtual int ReadScalarsPerNode(char* fileName, char* description,
00131                                  int timeStep, int measured = 0,
00132                                  int numberOfComponents = 1,
00133                                  int component = 0) = 0;
00135   
00137 
00139   virtual int ReadVectorsPerNode(char* fileName, char* description,
00140                                  int timeStep, int measured = 0) = 0;
00142 
00144 
00146   virtual int ReadTensorsPerNode(char* fileName, char* description,
00147                                  int timeStep) = 0;
00149 
00151 
00153   virtual int ReadScalarsPerElement(char* fileName, char* description,
00154                                     int timeStep, int numberOfComponents = 1,
00155                                     int component = 0) = 0;
00157 
00159 
00161   virtual int ReadVectorsPerElement(char* fileName, char* description,
00162                                     int timeStep) = 0;
00164 
00166 
00168   virtual int ReadTensorsPerElement(char* fileName, char* description,
00169                                     int timeStep) = 0;
00171 
00173 
00175   virtual int CreateUnstructuredGridOutput(int partId, 
00176                                            char line[256],
00177                                            const char* name) = 0;
00179   
00181 
00183   virtual int CreateStructuredGridOutput(int partId, 
00184                                          char line[256],
00185                                          const char* name) = 0;
00187   
00189 
00190   vtkSetStringMacro(GeometryFileName);
00191   vtkGetStringMacro(GeometryFileName);
00193 
00195 
00196   vtkSetStringMacro(MeasuredFileName);
00197   vtkGetStringMacro(MeasuredFileName);
00199 
00201 
00202   vtkSetStringMacro(MatchFileName);
00203   vtkGetStringMacro(MatchFileName);
00205   
00207   void AddVariableFileName(char* fileName1, char* fileName2 = NULL);
00208   
00210   void AddVariableDescription(char* description);
00211   
00213   void AddVariableType();
00214 
00217   int GetElementType(char* line);
00218 
00220   void ReplaceWildcards(char* filename, int num);
00221   
00222   // Get the vtkIdList for the given output index and cell type.
00223   vtkIdList* GetCellIds(int index, int cellType);
00224   
00225   char* MeasuredFileName;
00226   char* MatchFileName; // may not actually be necessary to read this file
00227 
00228   // pointer to lists of vtkIdLists (cell ids per element type per part)
00229   vtkEnSightReaderCellIdsType* CellIds;
00230   
00231   // part ids of unstructured outputs
00232   vtkIdList* UnstructuredPartIds;
00233   
00234   int VariableMode;
00235   
00236   // pointers to lists of filenames
00237   char** VariableFileNames; // non-complex
00238   char** ComplexVariableFileNames;
00239   
00240   // array of time sets
00241   vtkIdList *VariableTimeSetIds;
00242   vtkIdList *ComplexVariableTimeSetIds;
00243   
00244   // array of file sets
00245   vtkIdList *VariableFileSetIds;
00246   vtkIdList *ComplexVariableFileSetIds;
00247   
00248   // collection of filename numbers per time set
00249   vtkIdListCollection *TimeSetFileNameNumbers;
00250   vtkIdList *TimeSetsWithFilenameNumbers;
00251   
00252   // collection of filename numbers per file set
00253   vtkIdListCollection *FileSetFileNameNumbers;
00254   vtkIdList *FileSetsWithFilenameNumbers;
00255   
00256   // collection of number of steps per file per file set
00257   vtkIdListCollection *FileSetNumberOfSteps;
00258   
00259   // ids of the time and file sets
00260   vtkIdList *TimeSetIds;
00261   vtkIdList *FileSets;
00262   
00263   int GeometryTimeSet;
00264   int GeometryFileSet;
00265   int MeasuredTimeSet;
00266   int MeasuredFileSet;
00267   
00268   float GeometryTimeValue;
00269   float MeasuredTimeValue;
00270   
00271   int UseTimeSets;
00272   vtkSetMacro(UseTimeSets, int);
00273   vtkGetMacro(UseTimeSets, int);
00274   vtkBooleanMacro(UseTimeSets, int);
00275   
00276   int UseFileSets;
00277   vtkSetMacro(UseFileSets, int);
00278   vtkGetMacro(UseFileSets, int);
00279   vtkBooleanMacro(UseFileSets, int);
00280   
00281   int NumberOfGeometryParts;
00282   
00283   void SetNumberOfOutputsInternal(int num);
00284 
00285   // global list of points for measured geometry
00286   int NumberOfMeasuredPoints;
00287   
00288   int NumberOfNewOutputs;
00289   int OutputsAreValid;
00290   int InitialRead;
00291   
00292   int CheckOutputConsistency();
00293   
00294 private:
00295   vtkEnSightReader(const vtkEnSightReader&);  // Not implemented.
00296   void operator=(const vtkEnSightReader&);  // Not implemented.
00297 };
00298 
00299 #endif