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 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038 
00039 =========================================================================*/
00047 #ifndef __vtkEnSightReader_h
00048 #define __vtkEnSightReader_h
00049 
00050 #include "vtkDataSetSource.h"
00051 #include "vtkCollection.h"
00052 
00053 // element types
00054 #define VTK_ENSIGHT_POINT               0
00055 #define VTK_ENSIGHT_BAR2                1
00056 #define VTK_ENSIGHT_BAR3                2
00057 #define VTK_ENSIGHT_NSIDED              3
00058 #define VTK_ENSIGHT_TRIA3               4
00059 #define VTK_ENSIGHT_TRIA6               5
00060 #define VTK_ENSIGHT_QUAD4               6
00061 #define VTK_ENSIGHT_QUAD8               7
00062 #define VTK_ENSIGHT_TETRA4              8
00063 #define VTK_ENSIGHT_TETRA10             9
00064 #define VTK_ENSIGHT_PYRAMID5           10
00065 #define VTK_ENSIGHT_PYRAMID13          11
00066 #define VTK_ENSIGHT_HEXA8              12
00067 #define VTK_ENSIGHT_HEXA20             13
00068 #define VTK_ENSIGHT_PENTA6             14
00069 #define VTK_ENSIGHT_PENTA15            15
00070 
00071 // variable types
00072 #define VTK_SCALAR_PER_NODE             0
00073 #define VTK_VECTOR_PER_NODE             1
00074 #define VTK_TENSOR_SYMM_PER_NODE        2
00075 #define VTK_SCALAR_PER_ELEMENT          3
00076 #define VTK_VECTOR_PER_ELEMENT          4
00077 #define VTK_TENSOR_SYMM_PER_ELEMENT     5
00078 #define VTK_SCALAR_PER_MEASURED_NODE    6
00079 #define VTK_VECTOR_PER_MEASURED_NODE    7
00080 #define VTK_COMPLEX_SCALAR_PER_NODE     8
00081 #define VTK_COMPLEX_VECTOR_PER_NODE     9
00082 #define VTK_COMPLEX_SCALAR_PER_ELEMENT 10
00083 #define VTK_COMPLEX_VECTOR_PER_ELEMENT 11
00084 
00085 class VTK_IO_EXPORT vtkEnSightReader : public vtkDataSetSource
00086 {
00087 public:
00088   vtkTypeMacro(vtkEnSightReader, vtkDataSetSource);
00089   void PrintSelf(ostream& os, vtkIndent indent);
00090   
00092 
00093   void SetCaseFileName(char* fileName);
00094   vtkGetStringMacro(CaseFileName);
00096   
00098 
00100   vtkSetStringMacro(FilePath);
00101   vtkGetStringMacro(FilePath);
00103   
00105 
00106   int GetNumberOfVariables() { return this->NumberOfVariables; }
00107   int GetNumberOfComplexVariables() { return this->NumberOfComplexVariables; }
00109   
00111 
00112   int GetNumberOfVariables(int type); // returns -1 if unknown type specified
00113   vtkGetMacro(NumberOfScalarsPerNode, int);
00114   vtkGetMacro(NumberOfVectorsPerNode, int);
00115   vtkGetMacro(NumberOfTensorsSymmPerNode, int);
00116   vtkGetMacro(NumberOfScalarsPerElement, int);
00117   vtkGetMacro(NumberOfVectorsPerElement, int);
00118   vtkGetMacro(NumberOfTensorsSymmPerElement, int);
00119   vtkGetMacro(NumberOfScalarsPerMeasuredNode, int);
00120   vtkGetMacro(NumberOfVectorsPerMeasuredNode, int);
00121   vtkGetMacro(NumberOfComplexScalarsPerNode, int);
00122   vtkGetMacro(NumberOfComplexVectorsPerNode, int);
00123   vtkGetMacro(NumberOfComplexScalarsPerElement, int);
00124   vtkGetMacro(NumberOfComplexVectorsPerElement, int);
00126   
00128   char* GetDescription(int n);
00129   
00131   char* GetComplexDescription(int n);
00132   
00142   char* GetDescription(int n, int type);
00143 
00145 
00146   int GetVariableType(int n);
00147   int GetComplexVariableType(int n);
00149   
00150   void Update();
00151 
00153 
00154   vtkSetMacro(TimeValue, float);
00155   vtkGetMacro(TimeValue, float);
00157   
00159 
00160   vtkGetMacro(MinimumTimeValue, float);
00161   vtkGetMacro(MaximumTimeValue, float);
00163   
00164 protected:
00165   vtkEnSightReader();
00166   ~vtkEnSightReader();
00167   
00168   void Execute();
00169 
00172   int ReadCaseFile();
00173   
00176   virtual int ReadGeometryFile(char* fileName, int timeStep) = 0;
00177 
00180   virtual int ReadMeasuredGeometryFile(char* fileName, int timeStep) = 0;
00181 
00184   int ReadVariableFiles();
00185 
00187 
00189   virtual int ReadScalarsPerNode(char* fileName, char* description,
00190                                  int timeStep, int measured = 0,
00191                                  int numberOfComponents = 1,
00192                                  int component = 0) = 0;
00194   
00196 
00198   virtual int ReadVectorsPerNode(char* fileName, char* description,
00199                                  int timeStep, int measured = 0) = 0;
00201 
00203 
00205   virtual int ReadTensorsPerNode(char* fileName, char* description,
00206                                  int timeStep) = 0;
00208 
00210 
00212   virtual int ReadScalarsPerElement(char* fileName, char* description,
00213                                     int timeStep, int numberOfComponents = 1,
00214                                     int component = 0) = 0;
00216 
00218 
00220   virtual int ReadVectorsPerElement(char* fileName, char* description,
00221                                     int timeStep) = 0;
00223 
00225 
00227   virtual int ReadTensorsPerElement(char* fileName, char* description,
00228                                     int timeStep) = 0;
00230 
00233   virtual int CreateUnstructuredGridOutput(int partId, char line[256]) = 0;
00234   
00237   virtual int CreateStructuredGridOutput(int partId, char line[256]) = 0;
00238   
00240 
00241   vtkSetStringMacro(GeometryFileName);
00242   vtkGetStringMacro(GeometryFileName);
00244 
00246 
00247   vtkSetStringMacro(MeasuredFileName);
00248   vtkGetStringMacro(MeasuredFileName);
00250 
00252 
00253   vtkSetStringMacro(MatchFileName);
00254   vtkGetStringMacro(MatchFileName);
00256   
00259   int ReadLine(char result[256]);
00260 
00261   // Internal function that skips blank lines and reads the 1st
00262   // non-blank line it finds (up to 256 characters).
00263   // Returns 0 is there was an error.
00264   int ReadNextDataLine(char result[256]);
00265   
00267   void AddVariableFileName(char* fileName1, char* fileName2 = NULL);
00268   
00270   void AddVariableDescription(char* description);
00271   
00273   void AddVariableType();
00274 
00277   int GetElementType(char* line);
00278 
00280   void ReplaceWildcards(char* filename, int num);
00281   
00282   char* FilePath;
00283   
00284   char* CaseFileName;
00285   char* GeometryFileName;
00286   char* MeasuredFileName;
00287   char* MatchFileName; // may not actually be necessary to read this file
00288 
00289   // pointer to lists of vtkIdLists (cell ids per element type per part)
00290   vtkIdList*** CellIds;
00291   
00292   // part ids of unstructured outputs
00293   vtkIdList* UnstructuredPartIds;
00294   
00295   int VariableMode;
00296   int NumberOfVariables; // non-complex
00297   int NumberOfComplexVariables;
00298   
00299   // array of types (one entry per instance of variable type in case file)
00300   int* VariableTypes; // non-complex
00301   int* ComplexVariableTypes;
00302   
00303   // pointers to lists of filenames
00304   char** VariableFileNames; // non-complex
00305   char** ComplexVariableFileNames;
00306   
00307   // pointers to lists of descriptions
00308   char** VariableDescriptions; // non-complex
00309   char** ComplexVariableDescriptions;
00310 
00311   // array of time sets
00312   vtkIdList *VariableTimeSets;
00313   vtkIdList *ComplexVariableTimeSets;
00314   
00315   // array of file sets
00316   vtkIdList *VariableFileSets;
00317   vtkIdList *ComplexVariableFileSets;
00318   
00319   // collection of filename numbers per time set
00320   vtkCollection *TimeSetFilenameNumbersCollection;
00321   vtkIdList *TimeSetsWithFilenameNumbers;
00322   
00323   // collection of time values per time set
00324   vtkCollection *TimeSetTimeValuesCollection;
00325   
00326   // collection of filename numbers per file set
00327   vtkCollection *FileSetFilenameNumbersCollection;
00328   vtkIdList *FileSetsWithFilenameNumbers;
00329   
00330   // collection of number of steps per file per file set
00331   vtkCollection *FileSetNumberOfStepsCollection;
00332   
00333   // ids of the time and file sets
00334   vtkIdList *TimeSets;
00335   vtkIdList *FileSets;
00336   
00337   int GeometryTimeSet;
00338   int GeometryFileSet;
00339   int MeasuredTimeSet;
00340   int MeasuredFileSet;
00341   
00342   float TimeValue;
00343   float GeometryTimeValue;
00344   float MeasuredTimeValue;
00345   
00346   float MinimumTimeValue;
00347   float MaximumTimeValue;
00348   
00349   // number of file names / descriptions per type
00350   int NumberOfScalarsPerNode;
00351   int NumberOfVectorsPerNode;
00352   int NumberOfTensorsSymmPerNode;
00353   int NumberOfScalarsPerElement;
00354   int NumberOfVectorsPerElement;
00355   int NumberOfTensorsSymmPerElement;
00356   int NumberOfScalarsPerMeasuredNode;
00357   int NumberOfVectorsPerMeasuredNode;
00358   int NumberOfComplexScalarsPerNode;
00359   int NumberOfComplexVectorsPerNode;  
00360   int NumberOfComplexScalarsPerElement;
00361   int NumberOfComplexVectorsPerElement;
00362   
00363   istream* IS;
00364 
00365   int UseTimeSets;
00366   vtkSetMacro(UseTimeSets, int);
00367   vtkGetMacro(UseTimeSets, int);
00368   vtkBooleanMacro(UseTimeSets, int);
00369   
00370   int UseFileSets;
00371   vtkSetMacro(UseFileSets, int);
00372   vtkGetMacro(UseFileSets, int);
00373   vtkBooleanMacro(UseFileSets, int);
00374   
00375   int NumberOfGeometryParts;
00376   
00377   // global list of points for measured geometry
00378   int NumberOfMeasuredPoints;
00379   vtkIdList *MeasuredNodeIds;
00380 private:
00381   vtkEnSightReader(const vtkEnSightReader&);  // Not implemented.
00382   void operator=(const vtkEnSightReader&);  // Not implemented.
00383 };
00384 
00385 #endif

Generated on Thu Mar 28 14:19:28 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001