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

graphics/vtkPLOT3DReader.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkPLOT3DReader.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 =========================================================================*/
00103 #ifndef __vtkPLOT3DReader_h
00104 #define __vtkPLOT3DReader_h
00105 
00106 #include <stdio.h>
00107 #include "vtkStructuredGridSource.h"
00108 #include "vtkScalars.h"
00109 #include "vtkVectors.h"
00110 
00111 // file formats
00112 #define VTK_WHOLE_SINGLE_GRID_NO_IBLANKING 0
00113 #define VTK_WHOLE_MULTI_GRID_NO_IBLANKING 2
00114 
00115 class VTK_EXPORT vtkPLOT3DReader : public vtkStructuredGridSource 
00116 {
00117 public:
00118   static vtkPLOT3DReader *New();
00119   vtkTypeMacro(vtkPLOT3DReader,vtkStructuredGridSource);
00120   void PrintSelf(ostream& os, vtkIndent indent);
00121 
00123   vtkSetClampMacro(FileFormat,int,0,7);
00124   vtkGetMacro(FileFormat,int);
00125 
00127   vtkSetStringMacro(XYZFileName);
00128   vtkGetStringMacro(XYZFileName);
00129 
00131   vtkSetStringMacro(QFileName);
00132   vtkGetStringMacro(QFileName);
00133 
00135   vtkSetStringMacro(FunctionFileName);
00136   vtkGetStringMacro(FunctionFileName);
00137 
00139   vtkSetStringMacro(VectorFunctionFileName);
00140   vtkGetStringMacro(VectorFunctionFileName);
00141 
00143   vtkSetMacro(GridNumber,int);
00144   vtkGetMacro(GridNumber,int);
00145 
00148   vtkSetMacro(ScalarFunctionNumber,int);
00149   vtkGetMacro(ScalarFunctionNumber,int);
00150 
00153   vtkSetMacro(VectorFunctionNumber,int);
00154   vtkGetMacro(VectorFunctionNumber,int);
00155 
00156   // these are read from PLOT3D file
00158   vtkGetMacro(Fsmach,float);
00159 
00161   vtkGetMacro(Alpha,float);
00162 
00164   vtkGetMacro(Re,float);
00165 
00167   vtkGetMacro(Time,float);
00168 
00170   vtkSetMacro(R,float);
00171   vtkGetMacro(R,float);
00172 
00174   vtkSetMacro(Gamma,float);
00175   vtkGetMacro(Gamma,float);
00176 
00178   vtkSetMacro(Uvinf,float);
00179   vtkGetMacro(Uvinf,float);
00180 
00182   vtkSetMacro(Vvinf,float);
00183   vtkGetMacro(Vvinf,float);
00184 
00186   vtkSetMacro(Wvinf,float);
00187   vtkGetMacro(Wvinf,float);
00188 
00191   vtkGetMacro(NumberOfGrids, int);
00192 
00193 protected:
00194   vtkPLOT3DReader();
00195   ~vtkPLOT3DReader();
00196   vtkPLOT3DReader(const vtkPLOT3DReader&) {};
00197   void operator=(const vtkPLOT3DReader&) {};
00198 
00199   void ExecuteInformation();
00200   void Execute();
00201   int GetFileType(FILE *fp);
00202 
00203   //plot3d FileNames
00204   int FileFormat; //various PLOT3D formats
00205   char *XYZFileName;
00206   char *QFileName;
00207   char *FunctionFileName;
00208   char *VectorFunctionFileName;
00209 
00210   //flags describing data to be read
00211   int GridNumber; //for multi-grid files, the one we're interested in
00212   int ScalarFunctionNumber;
00213   int VectorFunctionNumber;
00214   int FunctionFileFunctionNumber;
00215   void MapFunction(int fNumber,vtkPointData *outputPD);
00216 
00217   //temporary variables used during read
00218   float *TempStorage;
00219   int NumberOfPoints;
00220   int NumberOfGrids;
00221 
00222   //supplied in PLOT3D file
00223   float Fsmach;
00224   float Alpha;
00225   float Re;
00226   float Time;
00227 
00228   //parameters used in computing derived functions
00229   float R; 
00230   float Gamma;
00231   float Uvinf;
00232   float Vvinf;
00233   float Wvinf;
00234   
00235   //methods to read data
00236   int ReadBinaryGrid(FILE *fp,vtkStructuredGrid *output);
00237   int ReadBinaryGridDimensions(FILE *fp, vtkStructuredGrid *output);
00238   int ReadBinarySolution(FILE *fp, vtkStructuredGrid *output);
00239   int ReadBinaryFunctionFile(FILE *fp, vtkStructuredGrid *output);
00240   int ReadBinaryVectorFunctionFile(FILE *fp, vtkStructuredGrid *output);
00241 
00242   vtkPoints *Grid;
00243   vtkScalars *Density;
00244   vtkScalars *Energy;
00245   vtkVectors *Momentum;
00246 
00247   // derived functions from data in PLOT3D files
00248   void ComputeDensity(vtkPointData *outputPD);
00249   void ComputePressure(vtkPointData *outputPD);
00250   void ComputeTemperature(vtkPointData *outputPD);
00251   void ComputeEnthalpy(vtkPointData *outputPD);
00252   void ComputeInternalEnergy(vtkPointData *outputPD);
00253   void ComputeKineticEnergy(vtkPointData *outputPD);
00254   void ComputeVelocityMagnitude(vtkPointData *outputPD);
00255   void ComputeStagnationEnergy(vtkPointData *outputPD);
00256   void ComputeEntropy(vtkPointData *outputPD);
00257   void ComputeSwirl(vtkPointData *outputPD);
00258 
00259   void ComputeVelocity(vtkPointData *outputPD);
00260   void ComputeVorticity(vtkPointData *outputPD);
00261   void ComputeMomentum(vtkPointData *outputPD);
00262   void ComputePressureGradient(vtkPointData *outputPD);
00263 };
00264 
00265 #endif
00266 
00267 

Generated on Wed Nov 21 12:27:01 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001