VTK
vtkWindBladeReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkWindBladeReader.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
32 #ifndef __vtkWindBladeReader_h
33 #define __vtkWindBladeReader_h
34 
35 
37 
38 class vtkWindBladeReaderPiece;
40 class vtkCallbackCommand;
42 class vtkStringArray;
43 class vtkFloatArray;
44 class vtkIntArray;
45 class vtkPoints;
46 class vtkStructuredGrid;
48 class vtkMultiBlockDataSetAglorithm;
50 class WindBladeReaderInternal;
51 
53 {
54 public:
55  static vtkWindBladeReader *New();
57  void PrintSelf(ostream& os, vtkIndent indent);
58 
59  vtkSetStringMacro(Filename);
60  vtkGetStringMacro(Filename);
61 
62  vtkSetVector6Macro(WholeExtent, int);
63  vtkGetVector6Macro(WholeExtent, int);
64 
65  vtkSetVector6Macro(SubExtent, int);
66  vtkGetVector6Macro(SubExtent, int);
67 
69 
70  vtkStructuredGrid *GetFieldOutput(); // Output port 0
71  vtkUnstructuredGrid *GetBladeOutput(); // Output port 1
72  vtkStructuredGrid *GetGroundOutput(); // Output port 2
74 
76 
79  int GetNumberOfPointArrays();
80  const char* GetPointArrayName(int index);
82 
83  int GetPointArrayStatus(const char* name);
84  void SetPointArrayStatus(const char* name, int status);
85 
86  void DisableAllPointArrays();
87  void EnableAllPointArrays();
88 
90 
94  virtual int ProcessRequest(vtkInformation *request,
95  vtkInformationVector **inInfo,
96  vtkInformationVector *outInfo);
98 
99 protected:
102 
103  char* Filename; // Base file name
104 
105  int Rank; // Number of this processor
106  int TotalRank; // Number of processors
107 
108  // Extent information
109  vtkIdType NumberOfTuples; // Number of tuples in subextent
110 
111  // Field
112  int WholeExtent[6]; // Extents of entire grid
113  int SubExtent[6]; // Processor grid extent
114  int UpdateExtent[6];
115  int Dimension[3]; // Size of entire grid
116  int SubDimension[3]; // Size of processor grid
117 
118  // Ground
119  int GExtent[6]; // Extents of ground grid
120  int GSubExtent[6]; // Processor grid extent
121  int GDimension[3]; // Size of ground grid
122 
123  float Step[3]; // Spacing delta
124  int UseTopographyFile; // Topography or flat
125  vtkStdString TopographyFile; // Name of topography data file
126  vtkPoints* Points; // Structured grid geometry
127  vtkPoints* GPoints; // Structured grid geometry for ground
128  vtkPoints* BPoints; // Unstructured grid geometry
129  float Compression; // Stretching at Z surface [0,1]
130  float Fit; // Cubic or quadratic [0,1]
131 
132  // Rectilinear coordinate spacing
137  float ZMinValue;
138 
139  // Variable information
140  int NumberOfFileVariables; // Number of variables in data file
141  int NumberOfDerivedVariables; // Number of variables derived from file
142  int NumberOfVariables; // Number of variables to display
143 
144  vtkStringArray* DivideVariables; // Divide data by density at read
145  vtkStdString* VariableName; // Names of each variable
146  int* VariableStruct; // SCALAR or VECTOR
147  int* VariableCompSize; // Number of components
148  int* VariableBasicType; // FLOAT or INTEGER
149  int* VariableByteCount; // Number of bytes in basic type
150  long int* VariableOffset; // Offset into data file
151  unsigned int BlockSize; // Size of every data block
152  int GBlockSize; // Size of every data block
153 
154  vtkFloatArray** Data; // Actual data arrays
155  vtkStdString RootDirectory; // Directory where the .wind file is.
156  vtkStdString DataDirectory; // Location of actual data
157  vtkStdString DataBaseName; // Base name of files
158 
159  // Time step information
160  int NumberOfTimeSteps; // Number of time steps
161  int TimeStepFirst; // First time step
162  int TimeStepLast; // Last time step
163  int TimeStepDelta; // Delta on time steps
164  double* TimeSteps; // Actual times available for request
165 
166  // Turbine information
167  int NumberOfBladeTowers; // Number of turbines
168  int NumberOfBladePoints; // Points for drawing parts of blades
169  int NumberOfBladeCells; // Turbines * Blades * Parts
170 
171  vtkFloatArray* XPosition; // Location of tower
172  vtkFloatArray* YPosition; // Location of tower
173  vtkFloatArray* HubHeight; // Height of tower
174  vtkFloatArray* AngularVeloc; // Angular Velocity
175  vtkFloatArray* BladeLength; // Blade length
176  vtkIntArray* BladeCount; // Number of blades per tower
177 
178  int UseTurbineFile; // Turbine data available
179  vtkStdString TurbineDirectory; // Turbine unstructured data
180  vtkStdString TurbineTowerName; // Name of tower file
181  vtkStdString TurbineBladeName; // Base name of time series blade data
182  int NumberOfLinesToSkip; // New format has lines that need to be skipped in
183  // blade files
184 
185  // Selected field of interest
187 
188  // Observer to modify this object when array selections are modified
190 
191  // Controlls initializing and querrying MPI
193 
194  // Read the header file describing the dataset
195  bool ReadGlobalData();
196  void ReadDataVariables(istream& inStr);
197  bool FindVariableOffsets();
198 
199  // Turbine methods
200  void SetupBladeData();
201  void LoadBladeData(int timeStep);
202 
203  // Calculate the coordinates
204  void FillCoordinates();
205  void FillGroundCoordinates();
206  void CreateCoordinates();
207  void CreateZTopography(float* zdata);
208  float GDeform(float sigma, float sigmaMax, int flag);
209  void Spline(float* x, float* y, int n, float yp1, float ypn, float* y2);
210  void Splint(float* xa, float* ya, float* y2a, int n, float x, float* y, int);
211 
212  // Load a variable from data file
213  void LoadVariableData(int var);
214 
215  // Variables which must be divided by density after being read from file
216  void DivideByDensity(const char* name);
217 
218  // Calculate derived variables
219  void CalculateVorticity(int vort, int uvw, int density);
220  void CalculatePressure(int pres, int prespre, int tempg, int density);
221 
222  virtual int RequestData(
223  vtkInformation* request,
224  vtkInformationVector** inputVector,
225  vtkInformationVector* outputVector);
226 
227  virtual int RequestInformation(
228  vtkInformation* request,
229  vtkInformationVector** inputVector,
230  vtkInformationVector* outputVector);
231 
232  static void SelectionCallback(
233  vtkObject *caller,
234  unsigned long eid,
235  void *clientdata,
236  void *calldata);
237 
238  static void EventCallback(
239  vtkObject* caller,
240  unsigned long eid,
241  void* clientdata, void* calldata);
242 
243  virtual int FillOutputPortInformation(int, vtkInformation*);
244 
245  WindBladeReaderInternal * Internal;
246 
247 private:
248  vtkWindBladeReader(const vtkWindBladeReader&); // Not implemented.
249  void operator=(const vtkWindBladeReader&); // Not implemented.
250 };
251 #endif
252