VTK  9.3.20240424
vtkWindBladeReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
21#ifndef vtkWindBladeReader_h
22#define vtkWindBladeReader_h
23
24#include "vtkIOGeometryModule.h" // For export macro
26
27VTK_ABI_NAMESPACE_BEGIN
30class vtkStringArray;
31class vtkFloatArray;
32class vtkIntArray;
33class vtkPoints;
36class vtkMultiBlockDataSetAglorithm;
38class WindBladeReaderInternal;
39
40class VTKIOGEOMETRY_EXPORT vtkWindBladeReader : public vtkStructuredGridAlgorithm
41{
42public:
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
49
50 vtkSetVector6Macro(WholeExtent, int);
51 vtkGetVector6Macro(WholeExtent, int);
52
53 vtkSetVector6Macro(SubExtent, int);
54 vtkGetVector6Macro(SubExtent, int);
55
59 vtkStructuredGrid* GetFieldOutput(); // Output port 0
62
64
70 const char* GetPointArrayName(int index);
72
73 int GetPointArrayStatus(const char* name);
74 void SetPointArrayStatus(const char* name, int status);
75
78
79protected:
80 static float DRY_AIR_CONSTANT;
81 static int NUM_PART_SIDES; // Blade parts rhombus
82 static const int NUM_BASE_SIDES; // Base pyramid
83 static const int LINE_SIZE;
84 static int DIMENSION;
85 static int BYTES_PER_DATA;
86 static int SCALAR;
87 static int VECTOR;
88 static int FLOAT;
89 static int INTEGER;
90
93
94 char* Filename; // Base file name
95
96 // Extent information
97 vtkIdType NumberOfTuples; // Number of tuples in subextent
98
99 // Field
100 int WholeExtent[6]; // Extents of entire grid
101 int SubExtent[6]; // Processor grid extent
102 int UpdateExtent[6];
103 int Dimension[3]; // Size of entire grid
104 int SubDimension[3]; // Size of processor grid
105
106 // Ground
107 int GExtent[6]; // Extents of ground grid
108 int GSubExtent[6]; // Processor grid extent
109 int GDimension[3]; // Size of ground grid
110
111 float Step[3]; // Spacing delta
112 int UseTopographyFile; // Topography or flat
113 vtkStdString TopographyFile; // Name of topography data file
114 vtkPoints* Points; // Structured grid geometry
115 vtkPoints* GPoints; // Structured grid geometry for ground
116 vtkPoints* BPoints; // Unstructured grid geometry
117 float Compression; // Stretching at Z surface [0,1]
118 float Fit; // Cubic or quadratic [0,1]
119
120 // Rectilinear coordinate spacing
126
127 // Variable information
128 int NumberOfFileVariables; // Number of variables in data file
129 int NumberOfDerivedVariables; // Number of variables derived from file
130 int NumberOfVariables; // Number of variables to display
131
132 vtkStringArray* DivideVariables; // Divide data by density at read
133 vtkStdString* VariableName; // Names of each variable
134 int* VariableStruct; // SCALAR or VECTOR
135 int* VariableCompSize; // Number of components
136 int* VariableBasicType; // FLOAT or INTEGER
137 int* VariableByteCount; // Number of bytes in basic type
138 long int* VariableOffset; // Offset into data file
139 size_t BlockSize; // Size of every data block
140 size_t GBlockSize; // Size of every data block
141
142 vtkFloatArray** Data; // Actual data arrays
143 vtkStdString RootDirectory; // Directory where the .wind file is.
144 vtkStdString DataDirectory; // Location of actual data
145 vtkStdString DataBaseName; // Base name of files
146
147 // Time step information
148 int NumberOfTimeSteps; // Number of time steps
149 int TimeStepFirst; // First time step
150 int TimeStepLast; // Last time step
151 int TimeStepDelta; // Delta on time steps
152 double* TimeSteps; // Actual times available for request
153
154 // Turbine information
155 int NumberOfBladeTowers; // Number of turbines
156 int NumberOfBladePoints; // Points for drawing parts of blades
157 int NumberOfBladeCells; // Turbines * Blades * Parts
158
159 vtkFloatArray* XPosition; // Location of tower
160 vtkFloatArray* YPosition; // Location of tower
161 vtkFloatArray* HubHeight; // Height of tower
162 vtkFloatArray* AngularVeloc; // Angular Velocity
163 vtkFloatArray* BladeLength; // Blade length
164 vtkIntArray* BladeCount; // Number of blades per tower
165
166 int UseTurbineFile; // Turbine data available
167 vtkStdString TurbineDirectory; // Turbine unstructured data
168 vtkStdString TurbineTowerName; // Name of tower file
169 vtkStdString TurbineBladeName; // Base name of time series blade data
170 int NumberOfLinesToSkip; // New format has lines that need to be skipped in
171 // blade files
172
173 // Selected field of interest
175
176 // Observer to modify this object when array selections are modified
178
179 // Read the header file describing the dataset
180 virtual bool ReadGlobalData();
181 void ReadDataVariables(istream& inStr);
182 virtual bool FindVariableOffsets();
183
184 // Turbine methods
185 virtual void SetupBladeData();
186 virtual void LoadBladeData(int timeStep);
187
188 // Calculate the coordinates
192 virtual void CreateZTopography(float* zdata);
193 float GDeform(float sigma, float sigmaMax, int flag);
194 void Spline(float* x, float* y, int n, float yp1, float ypn, float* y2);
195 void Splint(float* xa, float* ya, float* y2a, int n, float x, float* y, int);
196
197 // Load a variable from data file
198 virtual void LoadVariableData(int var);
199
200 // Variables which must be divided by density after being read from file
201 void DivideByDensity(const char* name);
202
203 // Calculate derived variables
204 virtual void CalculatePressure(int pres, int prespre, int tempg, int density);
205 virtual void CalculateVorticity(int vort, int uvw, int density);
206
207 // convenience functions shared between serial and parallel version
209 vtkInformationVector* outVector, std::ostringstream& fileName, vtkStructuredGrid* field);
213 void InitPressureData(int pressure, int prespre, float*& pressureData, float*& prespreData);
215 float* pressureData, float* prespreData, const float* tempgData, const float* densityData);
216 void SetUpVorticityData(float* uData, float* vData, const float* densityData, float* vortData);
218 int var, int& numberOfComponents, float*& varData, int& planeSize, int& rowSize);
219 bool SetUpGlobalData(const std::string& fileName, std::stringstream& inStr);
220 void ProcessZCoords(float* topoData, float* zValues);
221 void ReadBladeHeader(const std::string& fileName, std::stringstream& inStr, int& numColumns);
222 void ReadBladeData(std::stringstream& inStr);
223
226 vtkInformationVector* outputVector) override;
227
228 static void SelectionCallback(
229 vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
230
231 static void EventCallback(vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
232
234
242 vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
243
244private:
245 WindBladeReaderInternal* Internal;
246
247 vtkWindBladeReader(const vtkWindBladeReader&) = delete;
248 void operator=(const vtkWindBladeReader&) = delete;
249};
250VTK_ABI_NAMESPACE_END
251#endif
supports function callbacks
Store on/off settings for data arrays, etc.
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
abstract base class for most VTK objects
Definition vtkObject.h:162
represent and manipulate 3D points
Definition vtkPoints.h:139
Wrapper around std::string to keep symbols short.
a vtkAbstractArray subclass for strings
Superclass for algorithms that produce only structured grid as output.
topologically regular array of data
dataset represents arbitrary combinations of all possible cell types
class for reading WindBlade data files
vtkCallbackCommand * SelectionObserver
void SetPointArrayStatus(const char *name, int status)
static void EventCallback(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)
const char * GetPointArrayName(int index)
The following methods allow selective reading of solutions fields.
int GetNumberOfPointArrays()
The following methods allow selective reading of solutions fields.
vtkFloatArray * HubHeight
vtkGetFilePathMacro(Filename)
vtkFloatArray * XSpacing
float GDeform(float sigma, float sigmaMax, int flag)
void ProcessZCoords(float *topoData, float *zValues)
void Spline(float *x, float *y, int n, float yp1, float ypn, float *y2)
virtual bool FindVariableOffsets()
void SetUpGroundData(vtkInformationVector *outVector)
void ReadDataVariables(istream &inStr)
vtkUnstructuredGrid * GetBladeOutput()
vtkFloatArray * ZSpacing
vtkFloatArray * BladeLength
vtkStdString * VariableName
vtkFloatArray * YPosition
vtkStdString TurbineTowerName
vtkFloatArray * AngularVeloc
virtual void CreateZTopography(float *zdata)
void ReadBladeData(std::stringstream &inStr)
virtual void CalculatePressure(int pres, int prespre, int tempg, int density)
void SetUpFieldVars(vtkStructuredGrid *field)
void InitBladeData(vtkInformationVector *outVector)
static const int LINE_SIZE
void EnableAllPointArrays()
int GetPointArrayStatus(const char *name)
vtkFloatArray ** Data
static void SelectionCallback(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)
static float DRY_AIR_CONSTANT
vtkStdString TurbineBladeName
vtkStringArray * DivideVariables
virtual bool ReadGlobalData()
void InitPressureData(int pressure, int prespre, float *&pressureData, float *&prespreData)
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
void Splint(float *xa, float *ya, float *y2a, int n, float x, float *y, int)
virtual void CalculateVorticity(int vort, int uvw, int density)
void InitFieldData(vtkInformationVector *outVector, std::ostringstream &fileName, vtkStructuredGrid *field)
void InitVariableData(int var, int &numberOfComponents, float *&varData, int &planeSize, int &rowSize)
virtual void LoadVariableData(int var)
vtkStructuredGrid * GetGroundOutput()
virtual void SetupBladeData()
~vtkWindBladeReader() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkFloatArray * YSpacing
vtkStdString TurbineDirectory
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
We intercept the requests to check for which port information is being requested for and if there is ...
vtkFloatArray * XPosition
virtual void LoadBladeData(int timeStep)
vtkStructuredGrid * GetFieldOutput()
Get the reader's output.
void SetUpVorticityData(float *uData, float *vData, const float *densityData, float *vortData)
static vtkWindBladeReader * New()
static const int NUM_BASE_SIDES
bool SetUpGlobalData(const std::string &fileName, std::stringstream &inStr)
void DisableAllPointArrays()
void SetUpPressureData(float *pressureData, float *prespreData, const float *tempgData, const float *densityData)
vtkDataArraySelection * PointDataArraySelection
void DivideByDensity(const char *name)
void ReadBladeHeader(const std::string &fileName, std::stringstream &inStr, int &numColumns)
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
vtkSetFilePathMacro(Filename)
int FillOutputPortInformation(int, vtkInformation *) override
Fill the output port information objects for this algorithm.
void FillGroundCoordinates()
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:315