Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class 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 
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 =========================================================================*/
00019 #ifndef __vtkEnSightReader_h
00020 #define __vtkEnSightReader_h
00021 
00022 #include "vtkGenericEnSightReader.h"
00023 
00024 class vtkDataSetCollection;
00025 class vtkIdList;
00026 class vtkEnSightReaderCellIdsType;
00027 
00028 class VTK_IO_EXPORT vtkEnSightReader : public vtkGenericEnSightReader
00029 {
00030 public:
00031   vtkTypeRevisionMacro(vtkEnSightReader, vtkGenericEnSightReader);
00032   void PrintSelf(ostream& os, vtkIndent indent);
00033   
00034   void Update();
00035   void ExecuteInformation();
00036   
00037   //BTX
00038   enum ElementTypesList
00039   {
00040     POINT     = 0,
00041     BAR2      = 1,
00042     BAR3      = 2,
00043     NSIDED    = 3,
00044     TRIA3     = 4,
00045     TRIA6     = 5,
00046     QUAD4     = 6,
00047     QUAD8     = 7,
00048     TETRA4    = 8,
00049     TETRA10   = 9,
00050     PYRAMID5  = 10,
00051     PYRAMID13 = 11,
00052     HEXA8     = 12,
00053     HEXA20    = 13,
00054     PENTA6    = 14,
00055     PENTA15   = 15
00056   };
00057 
00058   enum VariableTypesList
00059   {
00060     SCALAR_PER_NODE            = 0,
00061     VECTOR_PER_NODE            = 1,
00062     TENSOR_SYMM_PER_NODE       = 2,
00063     SCALAR_PER_ELEMENT         = 3,
00064     VECTOR_PER_ELEMENT         = 4,
00065     TENSOR_SYMM_PER_ELEMENT    = 5,
00066     SCALAR_PER_MEASURED_NODE   = 6,
00067     VECTOR_PER_MEASURED_NODE   = 7,
00068     COMPLEX_SCALAR_PER_NODE    = 8,
00069     COMPLEX_VECTOR_PER_NODE    = 9,
00070     COMPLEX_SCALAR_PER_ELEMENT = 10,
00071     COMPLEX_VECTOR_PER_ELEMENT = 11
00072   };
00073   //ETX
00074 
00078   void ReplaceNthOutput(int n, vtkDataObject* output);
00079   
00081 
00087   vtkGetMacro(OutputsAreValid, int);
00089   
00090 protected:
00091   vtkEnSightReader();
00092   ~vtkEnSightReader();
00093   
00094   void Execute();
00095 
00098   int ReadCaseFile();
00099 
00100   // set in UpdateInformation to value returned from ReadCaseFile
00101   int CaseFileRead;
00102   
00105   virtual int ReadGeometryFile(char* fileName, int timeStep) = 0;
00106 
00109   virtual int ReadMeasuredGeometryFile(char* fileName, int timeStep) = 0;
00110 
00113   int ReadVariableFiles();
00114 
00116 
00118   virtual int ReadScalarsPerNode(char* fileName, char* description,
00119                                  int timeStep, int measured = 0,
00120                                  int numberOfComponents = 1,
00121                                  int component = 0) = 0;
00123   
00125 
00127   virtual int ReadVectorsPerNode(char* fileName, char* description,
00128                                  int timeStep, int measured = 0) = 0;
00130 
00132 
00134   virtual int ReadTensorsPerNode(char* fileName, char* description,
00135                                  int timeStep) = 0;
00137 
00139 
00141   virtual int ReadScalarsPerElement(char* fileName, char* description,
00142                                     int timeStep, int numberOfComponents = 1,
00143                                     int component = 0) = 0;
00145 
00147 
00149   virtual int ReadVectorsPerElement(char* fileName, char* description,
00150                                     int timeStep) = 0;
00152 
00154 
00156   virtual int ReadTensorsPerElement(char* fileName, char* description,
00157                                     int timeStep) = 0;
00159 
00161 
00163   virtual int CreateUnstructuredGridOutput(int partId, 
00164                                            char line[256],
00165                                            const char* name) = 0;
00167   
00169 
00171   virtual int CreateStructuredGridOutput(int partId, 
00172                                          char line[256],
00173                                          const char* name) = 0;
00175   
00177 
00178   vtkSetStringMacro(GeometryFileName);
00179   vtkGetStringMacro(GeometryFileName);
00181 
00183 
00184   vtkSetStringMacro(MeasuredFileName);
00185   vtkGetStringMacro(MeasuredFileName);
00187 
00189 
00190   vtkSetStringMacro(MatchFileName);
00191   vtkGetStringMacro(MatchFileName);
00193   
00195   void AddVariableFileName(char* fileName1, char* fileName2 = NULL);
00196   
00198   void AddVariableDescription(char* description);
00199   
00201   void AddVariableType();
00202 
00205   int GetElementType(char* line);
00206 
00208   void ReplaceWildcards(char* filename, int num);
00209   
00210   // Get the vtkIdList for the given output index and cell type.
00211   vtkIdList* GetCellIds(int index, int cellType);
00212   
00213   char* MeasuredFileName;
00214   char* MatchFileName; // may not actually be necessary to read this file
00215 
00216   // pointer to lists of vtkIdLists (cell ids per element type per part)
00217   vtkEnSightReaderCellIdsType* CellIds;
00218   
00219   // part ids of unstructured outputs
00220   vtkIdList* UnstructuredPartIds;
00221   
00222   int VariableMode;
00223   
00224   // pointers to lists of filenames
00225   char** VariableFileNames; // non-complex
00226   char** ComplexVariableFileNames;
00227   
00228   // array of time sets
00229   vtkIdList *VariableTimeSetIds;
00230   vtkIdList *ComplexVariableTimeSetIds;
00231   
00232   // array of file sets
00233   vtkIdList *VariableFileSetIds;
00234   vtkIdList *ComplexVariableFileSetIds;
00235   
00236   // collection of filename numbers per time set
00237   vtkIdListCollection *TimeSetFileNameNumbers;
00238   vtkIdList *TimeSetsWithFilenameNumbers;
00239   
00240   // collection of filename numbers per file set
00241   vtkIdListCollection *FileSetFileNameNumbers;
00242   vtkIdList *FileSetsWithFilenameNumbers;
00243   
00244   // collection of number of steps per file per file set
00245   vtkIdListCollection *FileSetNumberOfSteps;
00246   
00247   // ids of the time and file sets
00248   vtkIdList *TimeSetIds;
00249   vtkIdList *FileSets;
00250   
00251   int GeometryTimeSet;
00252   int GeometryFileSet;
00253   int MeasuredTimeSet;
00254   int MeasuredFileSet;
00255   
00256   float GeometryTimeValue;
00257   float MeasuredTimeValue;
00258   
00259   int UseTimeSets;
00260   vtkSetMacro(UseTimeSets, int);
00261   vtkGetMacro(UseTimeSets, int);
00262   vtkBooleanMacro(UseTimeSets, int);
00263   
00264   int UseFileSets;
00265   vtkSetMacro(UseFileSets, int);
00266   vtkGetMacro(UseFileSets, int);
00267   vtkBooleanMacro(UseFileSets, int);
00268   
00269   int NumberOfGeometryParts;
00270   
00271   void SetNumberOfOutputsInternal(int num);
00272 
00273   // global list of points for measured geometry
00274   int NumberOfMeasuredPoints;
00275   vtkIdList *MeasuredNodeIds;
00276   
00277   int NumberOfNewOutputs;
00278   int OutputsAreValid;
00279   int InitialRead;
00280   
00281   int CheckOutputConsistency();
00282   
00283 private:
00284   vtkEnSightReader(const vtkEnSightReader&);  // Not implemented.
00285   void operator=(const vtkEnSightReader&);  // Not implemented.
00286 };
00287 
00288 #endif