VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkWindBladeReader.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 =========================================================================*/ 00032 #ifndef __vtkWindBladeReader_h 00033 #define __vtkWindBladeReader_h 00034 00035 00036 #include "vtkStructuredGridAlgorithm.h" 00037 00038 class vtkWindBladeReaderPiece; 00039 class vtkDataArraySelection; 00040 class vtkCallbackCommand; 00041 class vtkMultiProcessController; 00042 class vtkStringArray; 00043 class vtkFloatArray; 00044 class vtkIntArray; 00045 class vtkPoints; 00046 class vtkStructuredGrid; 00047 class vtkUnstructuredGrid; 00048 class vtkMultiBlockDataSetAglorithm; 00049 class vtkStructuredGridAlgorithm; 00050 class WindBladeReaderInternal; 00051 00052 class VTK_PARALLEL_EXPORT vtkWindBladeReader : public vtkStructuredGridAlgorithm 00053 { 00054 public: 00055 static vtkWindBladeReader *New(); 00056 vtkTypeMacro(vtkWindBladeReader,vtkStructuredGridAlgorithm); 00057 void PrintSelf(ostream& os, vtkIndent indent); 00058 00059 vtkSetStringMacro(Filename); 00060 vtkGetStringMacro(Filename); 00061 00062 vtkSetVector6Macro(WholeExtent, int); 00063 vtkGetVector6Macro(WholeExtent, int); 00064 00065 vtkSetVector6Macro(SubExtent, int); 00066 vtkGetVector6Macro(SubExtent, int); 00067 00069 00070 vtkStructuredGrid *GetFieldOutput(); // Output port 0 00071 vtkUnstructuredGrid *GetBladeOutput(); // Output port 1 00072 vtkStructuredGrid *GetGroundOutput(); // Output port 2 00074 00076 00079 int GetNumberOfPointArrays(); 00080 const char* GetPointArrayName(int index); 00082 00083 int GetPointArrayStatus(const char* name); 00084 void SetPointArrayStatus(const char* name, int status); 00085 00086 void DisableAllPointArrays(); 00087 void EnableAllPointArrays(); 00088 00090 00094 virtual int ProcessRequest(vtkInformation *request, 00095 vtkInformationVector **inInfo, 00096 vtkInformationVector *outInfo); 00098 00099 protected: 00100 vtkWindBladeReader(); 00101 ~vtkWindBladeReader(); 00102 00103 char* Filename; // Base file name 00104 00105 int Rank; // Number of this processor 00106 int TotalRank; // Number of processors 00107 00108 // Extent information 00109 vtkIdType NumberOfTuples; // Number of tuples in subextent 00110 00111 // Field 00112 int WholeExtent[6]; // Extents of entire grid 00113 int SubExtent[6]; // Processor grid extent 00114 int UpdateExtent[6]; 00115 int Dimension[3]; // Size of entire grid 00116 int SubDimension[3]; // Size of processor grid 00117 00118 // Ground 00119 int GExtent[6]; // Extents of ground grid 00120 int GSubExtent[6]; // Processor grid extent 00121 int GDimension[3]; // Size of ground grid 00122 00123 float Step[3]; // Spacing delta 00124 int UseTopographyFile; // Topography or flat 00125 vtkStdString TopographyFile; // Name of topography data file 00126 vtkPoints* Points; // Structured grid geometry 00127 vtkPoints* GPoints; // Structured grid geometry for ground 00128 vtkPoints* BPoints; // Unstructured grid geometry 00129 float Compression; // Stretching at Z surface [0,1] 00130 float Fit; // Cubic or quadratic [0,1] 00131 00132 // Rectilinear coordinate spacing 00133 vtkFloatArray* XSpacing; 00134 vtkFloatArray* YSpacing; 00135 vtkFloatArray* ZSpacing; 00136 float* ZTopographicValues; 00137 float ZMinValue; 00138 00139 // Variable information 00140 int NumberOfFileVariables; // Number of variables in data file 00141 int NumberOfDerivedVariables; // Number of variables derived from file 00142 int NumberOfVariables; // Number of variables to display 00143 00144 vtkStringArray* DivideVariables; // Divide data by density at read 00145 vtkStdString* VariableName; // Names of each variable 00146 int* VariableStruct; // SCALAR or VECTOR 00147 int* VariableCompSize; // Number of components 00148 int* VariableBasicType; // FLOAT or INTEGER 00149 int* VariableByteCount; // Number of bytes in basic type 00150 long int* VariableOffset; // Offset into data file 00151 unsigned int BlockSize; // Size of every data block 00152 int GBlockSize; // Size of every data block 00153 00154 vtkFloatArray** Data; // Actual data arrays 00155 vtkStdString RootDirectory; // Directory where the .wind file is. 00156 vtkStdString DataDirectory; // Location of actual data 00157 vtkStdString DataBaseName; // Base name of files 00158 00159 // Time step information 00160 int NumberOfTimeSteps; // Number of time steps 00161 int TimeStepFirst; // First time step 00162 int TimeStepLast; // Last time step 00163 int TimeStepDelta; // Delta on time steps 00164 double* TimeSteps; // Actual times available for request 00165 00166 // Turbine information 00167 int NumberOfBladeTowers; // Number of turbines 00168 int NumberOfBladePoints; // Points for drawing parts of blades 00169 int NumberOfBladeCells; // Turbines * Blades * Parts 00170 00171 vtkFloatArray* XPosition; // Location of tower 00172 vtkFloatArray* YPosition; // Location of tower 00173 vtkFloatArray* HubHeight; // Height of tower 00174 vtkFloatArray* AngularVeloc; // Angular Velocity 00175 vtkFloatArray* BladeLength; // Blade length 00176 vtkIntArray* BladeCount; // Number of blades per tower 00177 00178 int UseTurbineFile; // Turbine data available 00179 vtkStdString TurbineDirectory; // Turbine unstructured data 00180 vtkStdString TurbineTowerName; // Name of tower file 00181 vtkStdString TurbineBladeName; // Base name of time series blade data 00182 int NumberOfLinesToSkip; // New format has lines that need to be skipped in 00183 // blade files 00184 00185 // Selected field of interest 00186 vtkDataArraySelection* PointDataArraySelection; 00187 00188 // Observer to modify this object when array selections are modified 00189 vtkCallbackCommand* SelectionObserver; 00190 00191 // Controlls initializing and querrying MPI 00192 vtkMultiProcessController * MPIController; 00193 00194 // Read the header file describing the dataset 00195 bool ReadGlobalData(); 00196 void ReadDataVariables(istream& inStr); 00197 bool FindVariableOffsets(); 00198 00199 // Turbine methods 00200 void SetupBladeData(); 00201 void LoadBladeData(int timeStep); 00202 00203 // Calculate the coordinates 00204 void FillCoordinates(); 00205 void FillGroundCoordinates(); 00206 void CreateCoordinates(); 00207 void CreateZTopography(float* zdata); 00208 float GDeform(float sigma, float sigmaMax, int flag); 00209 void Spline(float* x, float* y, int n, float yp1, float ypn, float* y2); 00210 void Splint(float* xa, float* ya, float* y2a, int n, float x, float* y, int); 00211 00212 // Load a variable from data file 00213 void LoadVariableData(int var); 00214 00215 // Variables which must be divided by density after being read from file 00216 void DivideByDensity(const char* name); 00217 00218 // Calculate derived variables 00219 void CalculateVorticity(int vort, int uvw, int density); 00220 void CalculatePressure(int pres, int prespre, int tempg, int density); 00221 00222 virtual int RequestData( 00223 vtkInformation* request, 00224 vtkInformationVector** inputVector, 00225 vtkInformationVector* outputVector); 00226 00227 virtual int RequestInformation( 00228 vtkInformation* request, 00229 vtkInformationVector** inputVector, 00230 vtkInformationVector* outputVector); 00231 00232 static void SelectionCallback( 00233 vtkObject *caller, 00234 unsigned long eid, 00235 void *clientdata, 00236 void *calldata); 00237 00238 static void EventCallback( 00239 vtkObject* caller, 00240 unsigned long eid, 00241 void* clientdata, void* calldata); 00242 00243 virtual int FillOutputPortInformation(int, vtkInformation*); 00244 00245 WindBladeReaderInternal * Internal; 00246 00247 private: 00248 vtkWindBladeReader(const vtkWindBladeReader&); // Not implemented. 00249 void operator=(const vtkWindBladeReader&); // Not implemented. 00250 }; 00251 #endif 00252