VTK
dox/IO/vtkEnSightReader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkEnSightReader.h
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 
00025 class vtkDataSet;
00026 class vtkDataSetCollection;
00027 class vtkEnSightReaderCellIdsType;
00028 class vtkIdList;
00029 class vtkMultiBlockDataSet;
00030 
00031 class VTK_IO_EXPORT vtkEnSightReader : public vtkGenericEnSightReader
00032 {
00033 public:
00034   vtkTypeMacro(vtkEnSightReader, vtkGenericEnSightReader);
00035   void PrintSelf(ostream& os, vtkIndent indent);
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     NFACED    = 8,
00049     TETRA4    = 9,
00050     TETRA10   = 10,
00051     PYRAMID5  = 11,
00052     PYRAMID13 = 12,
00053     HEXA8     = 13,
00054     HEXA20    = 14,
00055     PENTA6    = 15,
00056     PENTA15   = 16,
00057     NUMBER_OF_ELEMENT_TYPES  = 17
00058   };
00059 
00060   enum VariableTypesList
00061   {
00062     SCALAR_PER_NODE            = 0,
00063     VECTOR_PER_NODE            = 1,
00064     TENSOR_SYMM_PER_NODE       = 2,
00065     SCALAR_PER_ELEMENT         = 3,
00066     VECTOR_PER_ELEMENT         = 4,
00067     TENSOR_SYMM_PER_ELEMENT    = 5,
00068     SCALAR_PER_MEASURED_NODE   = 6,
00069     VECTOR_PER_MEASURED_NODE   = 7,
00070     COMPLEX_SCALAR_PER_NODE    = 8,
00071     COMPLEX_VECTOR_PER_NODE    = 9,
00072     COMPLEX_SCALAR_PER_ELEMENT = 10,
00073     COMPLEX_VECTOR_PER_ELEMENT = 11
00074   };
00075 
00076   enum SectionTypeList
00077   {
00078     COORDINATES = 0,
00079     BLOCK       = 1,
00080     ELEMENT     = 2
00081   };
00082   //ETX
00083 
00085 
00087   vtkGetStringMacro(MeasuredFileName);
00089 
00091 
00093   vtkGetStringMacro(MatchFileName);
00095 
00097 
00105   vtkSetMacro(ParticleCoordinatesByIndex, int);
00106   vtkGetMacro(ParticleCoordinatesByIndex, int);
00107   vtkBooleanMacro(ParticleCoordinatesByIndex, int);
00109 
00110 protected:
00111   vtkEnSightReader();
00112   ~vtkEnSightReader();
00113 
00114   virtual int RequestInformation(vtkInformation*,
00115                                  vtkInformationVector**,
00116                                  vtkInformationVector*);
00117   virtual int RequestData(vtkInformation*,
00118                           vtkInformationVector**,
00119                           vtkInformationVector*);
00120 
00122 
00123   vtkSetStringMacro(MeasuredFileName);
00125 
00127 
00128   vtkSetStringMacro(MatchFileName);
00130 
00132 
00134   int ReadCaseFile();
00135   int ReadCaseFileGeometry(char* line);
00136   int ReadCaseFileVariable(char* line);
00137   int ReadCaseFileTime(char* line);
00138   int ReadCaseFileFile(char* line);
00140 
00141   // set in UpdateInformation to value returned from ReadCaseFile
00142   int CaseFileRead;
00143 
00145 
00147   virtual int ReadGeometryFile(const char* fileName, int timeStep,
00148                                vtkMultiBlockDataSet *output) = 0;
00150 
00152 
00154   virtual int ReadMeasuredGeometryFile(const char* fileName, int timeStep,
00155                                        vtkMultiBlockDataSet *output) = 0;
00157 
00160   int ReadVariableFiles(vtkMultiBlockDataSet *output);
00161 
00163 
00165   virtual int ReadScalarsPerNode(const char* fileName, const char* description,
00166                                  int timeStep, vtkMultiBlockDataSet *output,
00167                                  int measured = 0, int numberOfComponents = 1,
00168                                  int component = 0) = 0;
00170 
00172 
00174   virtual int ReadVectorsPerNode(const char* fileName, const char* description,
00175                                  int timeStep, vtkMultiBlockDataSet *output,
00176                                  int measured = 0) = 0;
00178 
00180 
00182   virtual int ReadTensorsPerNode(const char* fileName, const char* description,
00183                                  int timeStep, vtkMultiBlockDataSet *output) = 0;
00185 
00187 
00189   virtual int ReadScalarsPerElement(const char* fileName, const char* description,
00190                                     int timeStep, vtkMultiBlockDataSet *output,
00191                                     int numberOfComponents = 1,
00192                                     int component = 0) = 0;
00194 
00196 
00198   virtual int ReadVectorsPerElement(const char* fileName, const char* description,
00199                                     int timeStep, vtkMultiBlockDataSet *output) = 0;
00201 
00203 
00205   virtual int ReadTensorsPerElement(const char* fileName, const char* description,
00206                                     int timeStep, vtkMultiBlockDataSet *output) = 0;
00208 
00210 
00212   virtual int CreateUnstructuredGridOutput(int partId,
00213                                            char line[80],
00214                                            const char* name,
00215                                            vtkMultiBlockDataSet *output) = 0;
00217 
00219 
00221   virtual int CreateStructuredGridOutput(int partId,
00222                                          char line[80],
00223                                          const char* name,
00224                                          vtkMultiBlockDataSet *output) = 0;
00226 
00228   void AddVariableFileName(const char* fileName1, const char* fileName2 = NULL);
00229 
00231   void AddVariableDescription(const char* description);
00232 
00234   void AddVariableType();
00235 
00238   int GetElementType(const char* line);
00239 
00242  int GetSectionType(const char *line);
00243 
00245   void ReplaceWildcards(char* filename, int num);
00246 
00248   void RemoveLeadingBlanks(char *line);
00249 
00250   // Get the vtkIdList for the given output index and cell type.
00251   vtkIdList* GetCellIds(int index, int cellType);
00252 
00254 
00256   void AddToBlock(vtkMultiBlockDataSet* output,
00257                   unsigned int blockNo,
00258                   vtkDataSet* dataset);
00260 
00262 
00264   vtkDataSet* GetDataSetFromBlock(vtkMultiBlockDataSet* output,
00265                                   unsigned int blockNo);
00267 
00269 
00270   void SetBlockName(vtkMultiBlockDataSet* output, unsigned int blockNo,
00271     const char* name);
00273 
00274   char* MeasuredFileName;
00275   char* MatchFileName; // may not actually be necessary to read this file
00276 
00277   // pointer to lists of vtkIdLists (cell ids per element type per part)
00278   vtkEnSightReaderCellIdsType* CellIds;
00279 
00280   // part ids of unstructured outputs
00281   vtkIdList* UnstructuredPartIds;
00282 
00283   int VariableMode;
00284 
00285   // pointers to lists of filenames
00286   char** VariableFileNames; // non-complex
00287   char** ComplexVariableFileNames;
00288 
00289   // array of time sets
00290   vtkIdList *VariableTimeSetIds;
00291   vtkIdList *ComplexVariableTimeSetIds;
00292 
00293   // array of file sets
00294   vtkIdList *VariableFileSetIds;
00295   vtkIdList *ComplexVariableFileSetIds;
00296 
00297   // collection of filename numbers per time set
00298   vtkIdListCollection *TimeSetFileNameNumbers;
00299   vtkIdList *TimeSetsWithFilenameNumbers;
00300 
00301   // collection of filename numbers per file set
00302   vtkIdListCollection *FileSetFileNameNumbers;
00303   vtkIdList *FileSetsWithFilenameNumbers;
00304 
00305   // collection of number of steps per file per file set
00306   vtkIdListCollection *FileSetNumberOfSteps;
00307 
00308   // ids of the time and file sets
00309   vtkIdList *TimeSetIds;
00310   vtkIdList *FileSets;
00311 
00312   int GeometryTimeSet;
00313   int GeometryFileSet;
00314   int MeasuredTimeSet;
00315   int MeasuredFileSet;
00316 
00317   float GeometryTimeValue;
00318   float MeasuredTimeValue;
00319 
00320   int UseTimeSets;
00321   vtkSetMacro(UseTimeSets, int);
00322   vtkGetMacro(UseTimeSets, int);
00323   vtkBooleanMacro(UseTimeSets, int);
00324 
00325   int UseFileSets;
00326   vtkSetMacro(UseFileSets, int);
00327   vtkGetMacro(UseFileSets, int);
00328   vtkBooleanMacro(UseFileSets, int);
00329 
00330   int NumberOfGeometryParts;
00331 
00332   // global list of points for measured geometry
00333   int NumberOfMeasuredPoints;
00334 
00335   int NumberOfNewOutputs;
00336   int InitialRead;
00337 
00338   int CheckOutputConsistency();
00339 
00340   int ParticleCoordinatesByIndex;
00341 
00342   double ActualTimeValue;
00343 
00344 private:
00345   vtkEnSightReader(const vtkEnSightReader&);  // Not implemented.
00346   void operator=(const vtkEnSightReader&);  // Not implemented.
00347 };
00348 
00349 #endif