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 #include "vtkIOGeometryModule.h" // For export macro
37 
39 class vtkCallbackCommand;
40 class vtkStringArray;
41 class vtkFloatArray;
42 class vtkIntArray;
43 class vtkPoints;
44 class vtkStructuredGrid;
46 class vtkMultiBlockDataSetAglorithm;
48 class WindBladeReaderInternal;
49 
51 {
52 public:
53  static vtkWindBladeReader *New();
55  void PrintSelf(ostream& os, vtkIndent indent);
56 
57  vtkSetStringMacro(Filename);
58  vtkGetStringMacro(Filename);
59 
60  vtkSetVector6Macro(WholeExtent, int);
61  vtkGetVector6Macro(WholeExtent, int);
62 
63  vtkSetVector6Macro(SubExtent, int);
64  vtkGetVector6Macro(SubExtent, int);
65 
67 
68  vtkStructuredGrid *GetFieldOutput(); // Output port 0
69  vtkUnstructuredGrid *GetBladeOutput(); // Output port 1
70  vtkStructuredGrid *GetGroundOutput(); // Output port 2
72 
74 
77  int GetNumberOfPointArrays();
78  const char* GetPointArrayName(int index);
80 
81  int GetPointArrayStatus(const char* name);
82  void SetPointArrayStatus(const char* name, int status);
83 
84  void DisableAllPointArrays();
85  void EnableAllPointArrays();
86 
87 protected:
88 //BTX
89  static float DRY_AIR_CONSTANT;
90  static int NUM_PART_SIDES; // Blade parts rhombus
91  const static int NUM_BASE_SIDES; // Base pyramid
92  const static int LINE_SIZE;
93  static int DIMENSION;
94  static int BYTES_PER_DATA;
95  static int SCALAR;
96  static int VECTOR;
97  static int FLOAT;
98  static int INTEGER;
99 //ETX
100 
103 
104  char* Filename; // Base file name
105 
106  // Extent information
107  vtkIdType NumberOfTuples; // Number of tuples in subextent
108 
109  // Field
110  int WholeExtent[6]; // Extents of entire grid
111  int SubExtent[6]; // Processor grid extent
112  int UpdateExtent[6];
113  int Dimension[3]; // Size of entire grid
114  int SubDimension[3]; // Size of processor grid
115 
116  // Ground
117  int GExtent[6]; // Extents of ground grid
118  int GSubExtent[6]; // Processor grid extent
119  int GDimension[3]; // Size of ground grid
120 
121  float Step[3]; // Spacing delta
122  int UseTopographyFile; // Topography or flat
123  vtkStdString TopographyFile; // Name of topography data file
124  vtkPoints* Points; // Structured grid geometry
125  vtkPoints* GPoints; // Structured grid geometry for ground
126  vtkPoints* BPoints; // Unstructured grid geometry
127  float Compression; // Stretching at Z surface [0,1]
128  float Fit; // Cubic or quadratic [0,1]
129 
130  // Rectilinear coordinate spacing
135  float ZMinValue;
136 
137  // Variable information
138  int NumberOfFileVariables; // Number of variables in data file
139  int NumberOfDerivedVariables; // Number of variables derived from file
140  int NumberOfVariables; // Number of variables to display
141 
142  vtkStringArray* DivideVariables; // Divide data by density at read
143  vtkStdString* VariableName; // Names of each variable
144  int* VariableStruct; // SCALAR or VECTOR
145  int* VariableCompSize; // Number of components
146  int* VariableBasicType; // FLOAT or INTEGER
147  int* VariableByteCount; // Number of bytes in basic type
148  long int* VariableOffset; // Offset into data file
149  unsigned int BlockSize; // Size of every data block
150  int GBlockSize; // Size of every data block
151 
152  vtkFloatArray** Data; // Actual data arrays
153  vtkStdString RootDirectory; // Directory where the .wind file is.
154  vtkStdString DataDirectory; // Location of actual data
155  vtkStdString DataBaseName; // Base name of files
156 
157  // Time step information
158  int NumberOfTimeSteps; // Number of time steps
159  int TimeStepFirst; // First time step
160  int TimeStepLast; // Last time step
161  int TimeStepDelta; // Delta on time steps
162  double* TimeSteps; // Actual times available for request
163 
164  // Turbine information
165  int NumberOfBladeTowers; // Number of turbines
166  int NumberOfBladePoints; // Points for drawing parts of blades
167  int NumberOfBladeCells; // Turbines * Blades * Parts
168 
169  vtkFloatArray* XPosition; // Location of tower
170  vtkFloatArray* YPosition; // Location of tower
171  vtkFloatArray* HubHeight; // Height of tower
172  vtkFloatArray* AngularVeloc; // Angular Velocity
173  vtkFloatArray* BladeLength; // Blade length
174  vtkIntArray* BladeCount; // Number of blades per tower
175 
176  int UseTurbineFile; // Turbine data available
177  vtkStdString TurbineDirectory; // Turbine unstructured data
178  vtkStdString TurbineTowerName; // Name of tower file
179  vtkStdString TurbineBladeName; // Base name of time series blade data
180  int NumberOfLinesToSkip; // New format has lines that need to be skipped in
181  // blade files
182 
183  // Selected field of interest
185 
186  // Observer to modify this object when array selections are modified
188 
189 
190  // Read the header file describing the dataset
191  virtual bool ReadGlobalData();
192  void ReadDataVariables(istream& inStr);
193  virtual bool FindVariableOffsets();
194 
195  // Turbine methods
196  virtual void SetupBladeData();
197  virtual void LoadBladeData(int timeStep);
198 
199  // Calculate the coordinates
200  void FillCoordinates();
201  void FillGroundCoordinates();
202  void CreateCoordinates();
203  virtual void CreateZTopography(float* zdata);
204  float GDeform(float sigma, float sigmaMax, int flag);
205  void Spline(float* x, float* y, int n, float yp1, float ypn, float* y2);
206  void Splint(float* xa, float* ya, float* y2a, int n, float x, float* y, int);
207 
208  // Load a variable from data file
209  virtual void LoadVariableData(int var);
210 
211  // Variables which must be divided by density after being read from file
212  void DivideByDensity(const char* name);
213 
214  // Calculate derived variables
215  virtual void CalculatePressure(int pres, int prespre, int tempg, int density);
216  virtual void CalculateVorticity(int vort, int uvw, int density);
217 
218  // convenience functions shared between serial and parallel version
219  void InitFieldData(vtkInformationVector *outVector,
220  std::ostringstream &fileName,
222  void SetUpFieldVars(vtkStructuredGrid *field);
223  void InitBladeData(vtkInformationVector *outVector);
224  void SetUpGroundData(vtkInformationVector *outVector);
225  void InitPressureData(int pressure, int prespre,
226  float *&pressureData, float *&prespreData);
227  void SetUpPressureData(float* pressureData, float* prespreData,
228  const float* tempgData, const float* densityData);
229  void SetUpVorticityData(float* uData, float* vData, const float *densityData,
230  float* vortData);
231  void InitVariableData(int var, int &numberOfComponents, float *&varData,
232  int &planeSize, int &rowSize);
233  bool SetUpGlobalData(const std::string &fileName, std::stringstream& inStr);
234  void ProcessZCoords(float *topoData, float *zValues);
235  void ReadBladeHeader(const std::string &fileName, std::stringstream &inStr,
236  int &numColumns);
237  void ReadBladeData(std::stringstream &inStr);
238 
241  virtual int RequestData(
242  vtkInformation* request,
243  vtkInformationVector** inputVector,
244  vtkInformationVector* outputVector);
245 
246  static void SelectionCallback(
247  vtkObject *caller,
248  unsigned long eid,
249  void *clientdata,
250  void *calldata);
251 
252  static void EventCallback(
253  vtkObject* caller,
254  unsigned long eid,
255  void* clientdata, void* calldata);
256 
257  virtual int FillOutputPortInformation(int, vtkInformation*);
259 
263  int ProcessRequest(vtkInformation *request,
264  vtkInformationVector **inInfo,
265  vtkInformationVector *outInfo);
266 private:
267  WindBladeReaderInternal * Internal;
269 
270  vtkWindBladeReader(const vtkWindBladeReader&); // Not implemented.
271  void operator=(const vtkWindBladeReader&); // Not implemented.
272 };
273 #endif
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
vtkFloatArray ** Data
abstract base class for most VTK objects
Definition: vtkObject.h:61
static float DRY_AIR_CONSTANT
Store vtkAlgorithm input/output information.
vtkStdString TopographyFile
vtkFloatArray * XSpacing
vtkFloatArray * ZSpacing
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:45
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
a vtkAbstractArray subclass for strings
int vtkIdType
Definition: vtkType.h:247
vtkStdString RootDirectory
static const int LINE_SIZE
vtkFloatArray * HubHeight
static vtkStructuredGridAlgorithm * New()
#define VTKIOGEOMETRY_EXPORT
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:49
vtkFloatArray * BladeLength
supports function callbacks
vtkFloatArray * XPosition
vtkStdString * VariableName
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkStdString TurbineBladeName
vtkIntArray * BladeCount
Store on/off settings for data arrays for a vtkSource.
Superclass for algorithms that produce only structured grid as output.
dataset represents arbitrary combinations of all possible cell types
void PrintSelf(ostream &os, vtkIndent indent)
vtkStringArray * DivideVariables
vtkStdString TurbineTowerName
virtual int FillOutputPortInformation(int port, vtkInformation *info)
virtual int ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
vtkFloatArray * YPosition
vtkDataArraySelection * PointDataArraySelection
topologically regular array of data
vtkStdString DataDirectory
vtkStdString TurbineDirectory
Store zero or more vtkInformation instances.
vtkCallbackCommand * SelectionObserver
static const int NUM_BASE_SIDES
vtkFloatArray * YSpacing
vtkFloatArray * AngularVeloc
class for reading WindBlade data files
represent and manipulate 3D points
Definition: vtkPoints.h:38