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();
00079
00081
00084 int GetNumberOfPointArrays();
00085 const char* GetPointArrayName(int index);
00087
00088 int GetPointArrayStatus(const char* name);
00089 void SetPointArrayStatus(const char* name, int status);
00090
00091 void DisableAllPointArrays();
00092 void EnableAllPointArrays();
00093
00094 protected:
00095 vtkWindBladeReader();
00096 ~vtkWindBladeReader();
00097
00098 char* Filename;
00099 FILE* FilePtr;
00100
00101 int Rank;
00102 int TotalRank;
00103
00104
00105 vtkIdType NumberOfTuples;
00106
00107 int WholeExtent[6];
00108 int SubExtent[6];
00109 int UpdateExtent[6];
00110 int Dimension[3];
00111 int SubDimension[3];
00112
00113 float Step[3];
00114 int UseTopographyFile;
00115 vtkStdString TopographyFile;
00116 vtkPoints* Points;
00117 vtkPoints* BPoints;
00118 float Compression;
00119 float Fit;
00120
00121
00122 vtkFloatArray* xSpacing;
00123 vtkFloatArray* ySpacing;
00124 vtkFloatArray* zSpacing;
00125 float* zTopographicValues;
00126
00127
00128 int NumberOfFileVariables;
00129 int NumberOfDerivedVariables;
00130 int NumberOfVariables;
00131
00132 vtkStringArray* DivideVariables;
00133 vtkStdString* VariableName;
00134 int* VariableStruct;
00135 int* VariableCompSize;
00136 int* VariableBasicType;
00137 int* VariableByteCount;
00138 long int* VariableOffset;
00139 int BlockSize;
00140
00141 vtkFloatArray** data;
00142 vtkStdString RootDirectory;
00143 vtkStdString DataDirectory;
00144 vtkStdString DataBaseName;
00145
00146
00147 int NumberOfTimeSteps;
00148 int TimeStepFirst;
00149 int TimeStepLast;
00150 int TimeStepDelta;
00151 double* TimeSteps;
00152
00153
00154 int NumberOfBladeTowers;
00155 int NumberOfBladePoints;
00156 int NumberOfBladeCells;
00157
00158 vtkFloatArray* XPosition;
00159 vtkFloatArray* YPosition;
00160 vtkFloatArray* HubHeight;
00161 vtkIntArray* BladeCount;
00162
00163 int UseTurbineFile;
00164 vtkStdString TurbineDirectory;
00165 vtkStdString TurbineTowerName;
00166 vtkStdString TurbineBladeName;
00167 int NumberLinesToSkip;
00168
00169
00170
00171 vtkDataArraySelection* PointDataArraySelection;
00172
00173
00174 vtkCallbackCommand* SelectionObserver;
00175
00176
00177 vtkMultiProcessController * MPIController;
00178
00179
00180 void ReadGlobalData();
00181 void ReadDataVariables(ifstream& inStr);
00182 void FindVariableOffsets();
00183
00184
00185 void SetupBladeData();
00186 void LoadBladeData(int timeStep);
00187
00188
00189 void FillCoordinates();
00190 void CreateCoordinates();
00191 void CreateZTopography(float* zdata);
00192 float GDeform(float sigma, float sigmaMax, int flag);
00193 void spline(float* x, float* y, int n, float yp1, float ypn, float* y2);
00194 void splint(float* xa, float* ya, float* y2a, int n, float x, float* y, int);
00195
00196
00197 void LoadVariableData(int var);
00198
00199
00200 void DivideByDensity(const char* name);
00201
00202
00203 void CalculateVorticity(int vort, int uvw, int density);
00204 void CalculatePressure(int pres, int prespre, int tempg, int density);
00205
00206 virtual int RequestData(
00207 vtkInformation* request,
00208 vtkInformationVector** inputVector,
00209 vtkInformationVector* outputVector);
00210
00211 virtual int RequestInformation(
00212 vtkInformation* request,
00213 vtkInformationVector** inputVector,
00214 vtkInformationVector* outputVector);
00215
00216 static void SelectionCallback(
00217 vtkObject *caller,
00218 unsigned long eid,
00219 void *clientdata,
00220 void *calldata);
00221
00222 static void EventCallback(
00223 vtkObject* caller,
00224 unsigned long eid,
00225 void* clientdata, void* calldata);
00226
00227 virtual int FillOutputPortInformation(int, vtkInformation*);
00228
00229 private:
00230 vtkWindBladeReader(const vtkWindBladeReader&);
00231 void operator=(const vtkWindBladeReader&);
00232 };
00233 #endif
00234