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

IO/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 =========================================================================*/
00111 #ifndef __vtkPLOT3DReader_h
00112 #define __vtkPLOT3DReader_h
00113 
00114 #include <stdio.h>
00115 #include "vtkStructuredGridSource.h"
00116 #include "vtkIntArray.h"
00117 
00118 class vtkFloatArray;
00119 
00120 // file formats
00121 #define VTK_WHOLE_SINGLE_GRID_NO_IBLANKING 0
00122 #define VTK_WHOLE_MULTI_GRID_NO_IBLANKING 2
00123 
00124 class VTK_IO_EXPORT vtkPLOT3DReader : public vtkStructuredGridSource 
00125 {
00126 public:
00127   static vtkPLOT3DReader *New();
00128   vtkTypeMacro(vtkPLOT3DReader,vtkStructuredGridSource);
00129   void PrintSelf(ostream& os, vtkIndent indent);
00130 
00132 
00133   vtkSetClampMacro(FileFormat,int,0,7);
00134   vtkGetMacro(FileFormat,int);
00136 
00138 
00139   vtkSetStringMacro(XYZFileName);
00140   vtkGetStringMacro(XYZFileName);
00142 
00144 
00145   vtkSetStringMacro(QFileName);
00146   vtkGetStringMacro(QFileName);
00148 
00150 
00151   vtkSetStringMacro(FunctionFileName);
00152   vtkGetStringMacro(FunctionFileName);
00154 
00156 
00157   vtkSetStringMacro(VectorFunctionFileName);
00158   vtkGetStringMacro(VectorFunctionFileName);
00160 
00162 
00163   vtkSetMacro(GridNumber,int);
00164   vtkGetMacro(GridNumber,int);
00166 
00168 
00170   vtkSetMacro(ScalarFunctionNumber,int);
00171   vtkGetMacro(ScalarFunctionNumber,int);
00173 
00175 
00177   vtkSetMacro(VectorFunctionNumber,int);
00178   vtkGetMacro(VectorFunctionNumber,int);
00180 
00182 
00185   void AddFunction(int functionNumber)
00186     {this->FunctionList->InsertNextValue(functionNumber);}
00187   void RemoveFunction(int);
00188   void RemoveAllFunctions()
00189     {this->FunctionList->Reset();}
00191 
00192   // these are read from PLOT3D file
00194   /*! Get the free-stream mach number. */
00195   vtkGetMacro(Fsmach,float);
00197 
00199 
00200   vtkGetMacro(Alpha,float);
00202 
00204 
00205   vtkGetMacro(Re,float);
00207 
00209 
00210   vtkGetMacro(Time,float);
00212 
00214 
00215   vtkSetMacro(R,float);
00216   vtkGetMacro(R,float);
00218 
00220 
00221   vtkSetMacro(Gamma,float);
00222   vtkGetMacro(Gamma,float);
00224 
00226 
00227   vtkSetMacro(Uvinf,float);
00228   vtkGetMacro(Uvinf,float);
00230 
00232 
00233   vtkSetMacro(Vvinf,float);
00234   vtkGetMacro(Vvinf,float);
00236 
00238 
00239   vtkSetMacro(Wvinf,float);
00240   vtkGetMacro(Wvinf,float);
00242 
00244 
00246   vtkGetMacro(NumberOfGrids, int);
00248 
00249 protected:
00250   vtkPLOT3DReader();
00251   ~vtkPLOT3DReader();
00252 
00253   void ExecuteInformation();
00254   void Execute();
00255   int GetFileType(FILE *fp);
00256 
00257   //plot3d FileNames
00258   int FileFormat; //various PLOT3D formats
00259   char *XYZFileName;
00260   char *QFileName;
00261   char *FunctionFileName;
00262   char *VectorFunctionFileName;
00263 
00264   //flags describing data to be read
00265   int GridNumber; //for multi-grid files, the one we're interested in
00266   int ScalarFunctionNumber;
00267   int VectorFunctionNumber;
00268   int FunctionFileFunctionNumber;
00269   void MapFunction(int fNumber,vtkPointData *outputPD);
00270 
00271   //functions to read that are not scalars or vectors
00272   vtkIntArray *FunctionList;
00273 
00274   //temporary variables used during read
00275   float *TempStorage;
00276   int NumberOfPoints;
00277   int NumberOfGrids;
00278 
00279   //supplied in PLOT3D file
00280   float Fsmach;
00281   float Alpha;
00282   float Re;
00283   float Time;
00284 
00285   //parameters used in computing derived functions
00286   float R; 
00287   float Gamma;
00288   float Uvinf;
00289   float Vvinf;
00290   float Wvinf;
00291   
00292   //methods to read data
00293   int ReadBinaryGrid(FILE *fp,vtkStructuredGrid *output);
00294   int ReadBinaryGridDimensions(FILE *fp, vtkStructuredGrid *output);
00295   int ReadBinarySolution(FILE *fp, vtkStructuredGrid *output);
00296   int ReadBinaryFunctionFile(FILE *fp, vtkStructuredGrid *output);
00297   int ReadBinaryVectorFunctionFile(FILE *fp, vtkStructuredGrid *output);
00298 
00299   vtkPoints *Grid;
00300   vtkFloatArray *Density;
00301   vtkFloatArray *Energy;
00302   vtkFloatArray *Momentum;
00303 
00304   // derived functions from data in PLOT3D files
00305   void ComputeDensity(vtkPointData *outputPD);
00306   void ComputePressure(vtkPointData *outputPD);
00307   void ComputeTemperature(vtkPointData *outputPD);
00308   void ComputeEnthalpy(vtkPointData *outputPD);
00309   void ComputeInternalEnergy(vtkPointData *outputPD);
00310   void ComputeKineticEnergy(vtkPointData *outputPD);
00311   void ComputeVelocityMagnitude(vtkPointData *outputPD);
00312   void ComputeStagnationEnergy(vtkPointData *outputPD);
00313   void ComputeEntropy(vtkPointData *outputPD);
00314   void ComputeSwirl(vtkPointData *outputPD);
00315 
00316   void ComputeVelocity(vtkPointData *outputPD);
00317   void ComputeVorticity(vtkPointData *outputPD);
00318   void ComputeMomentum(vtkPointData *outputPD);
00319   void ComputePressureGradient(vtkPointData *outputPD);
00320 
00321 private:
00322   vtkPLOT3DReader(const vtkPLOT3DReader&);  // Not implemented.
00323   void operator=(const vtkPLOT3DReader&);  // Not implemented.
00324 };
00325 
00326 #endif
00327 
00328 

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