00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00026 #ifndef __vtkWindBladeReader_h
00027 #define __vtkWindBladeReader_h
00028
00029
00030 #include "vtkStructuredGridAlgorithm.h"
00031
00032 #define VTK_USE_MPI
00033
00034 const float DRY_AIR_CONSTANT = 287.04;
00035 const int NUM_PART_SIDES = 4;
00036 const int NUM_BASE_SIDES = 5;
00037 const int LINE_SIZE = 256;
00038 const int DIMENSION = 3;
00039 const int BYTES_PER_DATA = 4;
00040 const int SCALAR = 1;
00041 const int VECTOR = 2;
00042 const int FLOAT = 1;
00043 const int INTEGER = 2;
00044
00045 class vtkWindBladeReaderPiece;
00046 class vtkDataArraySelection;
00047 class vtkCallbackCommand;
00048 class vtkMultiProcessController;
00049 class vtkStringArray;
00050 class vtkFloatArray;
00051 class vtkIntArray;
00052 class vtkPoints;
00053 class vtkStructuredGrid;
00054 class vtkUnstructuredGrid;
00055 class vtkMultiBlockDataSetAglorithm;
00056 class vtkStructuredGridAlgorithm;
00057
00058 class VTK_PARALLEL_EXPORT vtkWindBladeReader : public vtkStructuredGridAlgorithm
00059 {
00060 public:
00061 static vtkWindBladeReader *New();
00062 vtkTypeMacro(vtkWindBladeReader,vtkStructuredGridAlgorithm);
00063 void PrintSelf(ostream& os, vtkIndent indent);
00064
00065 vtkSetStringMacro(Filename);
00066 vtkGetStringMacro(Filename);
00067
00068 vtkSetVector6Macro(WholeExtent, int);
00069 vtkGetVector6Macro(WholeExtent, int);
00070
00071 vtkSetVector6Macro(SubExtent, int);
00072 vtkGetVector6Macro(SubExtent, int);
00073
00075
00076 vtkStructuredGrid *GetFieldOutput();
00077 vtkUnstructuredGrid *GetBladeOutput();
00078 vtkStructuredGrid *GetGroundOutput();
00080
00082
00085 int GetNumberOfPointArrays();
00086 const char* GetPointArrayName(int index);
00088
00089 int GetPointArrayStatus(const char* name);
00090 void SetPointArrayStatus(const char* name, int status);
00091
00092 void DisableAllPointArrays();
00093 void EnableAllPointArrays();
00094
00095 protected:
00096 vtkWindBladeReader();
00097 ~vtkWindBladeReader();
00098
00099 char* Filename;
00100 FILE* FilePtr;
00101
00102 int Rank;
00103 int TotalRank;
00104
00105
00106 vtkIdType NumberOfTuples;
00107
00108
00109 int WholeExtent[6];
00110 int SubExtent[6];
00111 int UpdateExtent[6];
00112 int Dimension[3];
00113 int SubDimension[3];
00114
00115
00116 int GExtent[6];
00117 int GSubExtent[6];
00118 int GDimension[3];
00119
00120 float Step[3];
00121 int UseTopographyFile;
00122 vtkStdString TopographyFile;
00123 vtkPoints* Points;
00124 vtkPoints* GPoints;
00125 vtkPoints* BPoints;
00126 float Compression;
00127 float Fit;
00128
00129
00130 vtkFloatArray* xSpacing;
00131 vtkFloatArray* ySpacing;
00132 vtkFloatArray* zSpacing;
00133 float* zTopographicValues;
00134 float zMinValue;
00135
00136
00137 int NumberOfFileVariables;
00138 int NumberOfDerivedVariables;
00139 int NumberOfVariables;
00140
00141 vtkStringArray* DivideVariables;
00142 vtkStdString* VariableName;
00143 int* VariableStruct;
00144 int* VariableCompSize;
00145 int* VariableBasicType;
00146 int* VariableByteCount;
00147 long int* VariableOffset;
00148 int BlockSize;
00149 int GBlockSize;
00150
00151 vtkFloatArray** data;
00152 vtkStdString RootDirectory;
00153 vtkStdString DataDirectory;
00154 vtkStdString DataBaseName;
00155
00156
00157 int NumberOfTimeSteps;
00158 int TimeStepFirst;
00159 int TimeStepLast;
00160 int TimeStepDelta;
00161 double* TimeSteps;
00162
00163
00164 int NumberOfBladeTowers;
00165 int NumberOfBladePoints;
00166 int NumberOfBladeCells;
00167
00168 vtkFloatArray* XPosition;
00169 vtkFloatArray* YPosition;
00170 vtkFloatArray* HubHeight;
00171 vtkIntArray* BladeCount;
00172
00173 int UseTurbineFile;
00174 vtkStdString TurbineDirectory;
00175 vtkStdString TurbineTowerName;
00176 vtkStdString TurbineBladeName;
00177
00178
00179 vtkDataArraySelection* PointDataArraySelection;
00180
00181
00182 vtkCallbackCommand* SelectionObserver;
00183
00184
00185 vtkMultiProcessController * MPIController;
00186
00187
00188 void ReadGlobalData();
00189 void ReadDataVariables(ifstream& inStr);
00190 void FindVariableOffsets();
00191
00192
00193 void SetupBladeData();
00194 void LoadBladeData(int timeStep);
00195
00196
00197 void FillCoordinates();
00198 void FillGroundCoordinates();
00199 void CreateCoordinates();
00200 void CreateZTopography(float* zdata);
00201 float GDeform(float sigma, float sigmaMax, int flag);
00202 void spline(float* x, float* y, int n, float yp1, float ypn, float* y2);
00203 void splint(float* xa, float* ya, float* y2a, int n, float x, float* y, int);
00204
00205
00206 void LoadVariableData(int var);
00207
00208
00209 void DivideByDensity(const char* name);
00210
00211
00212 void CalculateVorticity(int vort, int uvw, int density);
00213 void CalculatePressure(int pres, int prespre, int tempg, int density);
00214
00215 virtual int RequestData(
00216 vtkInformation* request,
00217 vtkInformationVector** inputVector,
00218 vtkInformationVector* outputVector);
00219
00220 virtual int RequestInformation(
00221 vtkInformation* request,
00222 vtkInformationVector** inputVector,
00223 vtkInformationVector* outputVector);
00224
00225 static void SelectionCallback(
00226 vtkObject *caller,
00227 unsigned long eid,
00228 void *clientdata,
00229 void *calldata);
00230
00231 static void EventCallback(
00232 vtkObject* caller,
00233 unsigned long eid,
00234 void* clientdata, void* calldata);
00235
00236 virtual int FillOutputPortInformation(int, vtkInformation*);
00237
00238 private:
00239 vtkWindBladeReader(const vtkWindBladeReader&);
00240 void operator=(const vtkWindBladeReader&);
00241 };
00242 #endif
00243