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 vtkTypeRevisionMacro(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 int SetSpacing;
00119 float Compression;
00120 float Fit;
00121
00122
00123 int NumberOfFileVariables;
00124 int NumberOfDerivedVariables;
00125 int NumberOfVariables;
00126
00127 vtkStringArray* DivideVariables;
00128 vtkStdString* VariableName;
00129 int* VariableStruct;
00130 int* VariableCompSize;
00131 int* VariableBasicType;
00132 int* VariableByteCount;
00133 long int* VariableOffset;
00134 int BlockSize;
00135
00136 vtkFloatArray** data;
00137 vtkStdString RootDirectory;
00138 vtkStdString DataDirectory;
00139 vtkStdString DataBaseName;
00140
00141
00142 int NumberOfTimeSteps;
00143 int TimeStepFirst;
00144 int TimeStepLast;
00145 int TimeStepDelta;
00146 double* TimeSteps;
00147
00148
00149 int NumberOfBladeTowers;
00150 int NumberOfBladePoints;
00151 int NumberOfBladeCells;
00152
00153 vtkFloatArray* XPosition;
00154 vtkFloatArray* YPosition;
00155 vtkFloatArray* HubHeight;
00156 vtkIntArray* BladeCount;
00157
00158 int UseTurbineFile;
00159 vtkStdString TurbineDirectory;
00160 vtkStdString TurbineTowerName;
00161 vtkStdString TurbineBladeName;
00162
00163 int RequestDataLoop;
00164
00165
00166 vtkDataArraySelection* PointDataArraySelection;
00167
00168
00169 vtkCallbackCommand* SelectionObserver;
00170
00171
00172 vtkMultiProcessController * MPIController;
00173
00174
00175 void ReadGlobalData();
00176 void ReadDataVariables(ifstream& inStr);
00177 void FindVariableOffsets();
00178
00179
00180 void SetupBladeData();
00181 void LoadBladeData(int timeStep);
00182
00183
00184 void CreateCoordinates();
00185 void CreateZTopography(float* zdata);
00186 float GDeform(float sigma, float sigmaMax, int flag);
00187 void spline(float* x, float* y, int n, float yp1, float ypn, float* y2);
00188 void splint(float* xa, float* ya, float* y2a, int n, float x, float* y, int);
00189
00190
00191 void LoadVariableData(int var);
00192
00193
00194 void DivideByDensity(const char* name);
00195
00196
00197 void CalculateVorticity(int vort, int uvw, int density);
00198 void CalculatePressure(int pres, int prespre, int tempg, int density);
00199
00200 virtual int RequestData(
00201 vtkInformation* request,
00202 vtkInformationVector** inputVector,
00203 vtkInformationVector* outputVector);
00204
00205 virtual int RequestInformation(
00206 vtkInformation* request,
00207 vtkInformationVector** inputVector,
00208 vtkInformationVector* outputVector);
00209
00210 virtual int RequestUpdateExtent(
00211 vtkInformation* request,
00212 vtkInformationVector** inputVector,
00213 vtkInformationVector* outputVector);
00214
00215 static void SelectionCallback(
00216 vtkObject *caller,
00217 unsigned long eid,
00218 void *clientdata,
00219 void *calldata);
00220
00221 static void EventCallback(
00222 vtkObject* caller,
00223 unsigned long eid,
00224 void* clientdata, void* calldata);
00225
00226 virtual int FillOutputPortInformation(int, vtkInformation*);
00227
00228 private:
00229 vtkWindBladeReader(const vtkWindBladeReader&);
00230 void operator=(const vtkWindBladeReader&);
00231 };
00232 #endif
00233