00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00084 #ifndef __vtkFieldDataToAttributeDataFilter_h
00085 #define __vtkFieldDataToAttributeDataFilter_h
00086
00087 #include "vtkDataSetToDataSetFilter.h"
00088
00089 #define VTK_DATA_OBJECT_FIELD 0
00090 #define VTK_POINT_DATA_FIELD 1
00091 #define VTK_CELL_DATA_FIELD 2
00092
00093 #define VTK_CELL_DATA 0
00094 #define VTK_POINT_DATA 1
00095
00096 class VTK_EXPORT vtkFieldDataToAttributeDataFilter : public vtkDataSetToDataSetFilter
00097 {
00098 public:
00099 void PrintSelf(ostream& os, vtkIndent indent);
00100 vtkTypeMacro(vtkFieldDataToAttributeDataFilter,vtkDataSetToDataSetFilter);
00101
00104 static vtkFieldDataToAttributeDataFilter *New();
00105
00110 vtkSetMacro(InputField,int);
00111 vtkGetMacro(InputField,int);
00112 void SetInputFieldToDataObjectField()
00113 {this->SetInputField(VTK_DATA_OBJECT_FIELD);};
00114 void SetInputFieldToPointDataField()
00115 {this->SetInputField(VTK_POINT_DATA_FIELD);};
00116 void SetInputFieldToCellDataField()
00117 {this->SetInputField(VTK_CELL_DATA_FIELD);};
00118
00121 vtkSetMacro(OutputAttributeData,int);
00122 vtkGetMacro(OutputAttributeData,int);
00123 void SetOutputAttributeDataToCellData()
00124 {this->SetOutputAttributeData(VTK_CELL_DATA);};
00125 void SetOutputAttributeDataToPointData()
00126 {this->SetOutputAttributeData(VTK_POINT_DATA);};
00127
00133 void SetScalarComponent(int comp, const char *arrayName, int arrayComp,
00134 int min, int max, int normalize);
00135 void SetScalarComponent(int comp, const char *arrayName, int arrayComp)
00136 {this->SetScalarComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00137 const char *GetScalarComponentArrayName(int comp);
00138 int GetScalarComponentArrayComponent(int comp);
00139 int GetScalarComponentMinRange(int comp);
00140 int GetScalarComponentMaxRange(int comp);
00141 int GetScalarComponentNormalizeFlag(int comp);
00142
00148 void SetVectorComponent(int comp, const char *arrayName, int arrayComp,
00149 int min, int max, int normalize);
00150 void SetVectorComponent(int comp, const char *arrayName, int arrayComp)
00151 {this->SetVectorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00152 const char *GetVectorComponentArrayName(int comp);
00153 int GetVectorComponentArrayComponent(int comp);
00154 int GetVectorComponentMinRange(int comp);
00155 int GetVectorComponentMaxRange(int comp);
00156 int GetVectorComponentNormalizeFlag(int comp);
00157
00163 void SetGhostLevelComponent(const char *arrayName, int arrayComp,
00164 int min, int max, int normalize);
00165 void SetGhostLevelComponent(const char *arrayName, int arrayComp)
00166 {this->SetGhostLevelComponent(arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00167 const char *GetGhostLevelComponentArrayName();
00168 int GetGhostLevelComponentArrayComponent();
00169 int GetGhostLevelComponentMinRange();
00170 int GetGhostLevelComponentMaxRange();
00171 int GetGhostLevelComponentNormalizeFlag();
00172
00178 void SetNormalComponent(int comp, const char *arrayName, int arrayComp,
00179 int min, int max, int normalize);
00180 void SetNormalComponent(int comp, const char *arrayName, int arrayComp)
00181 {this->SetNormalComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00182 const char *GetNormalComponentArrayName(int comp);
00183 int GetNormalComponentArrayComponent(int comp);
00184 int GetNormalComponentMinRange(int comp);
00185 int GetNormalComponentMaxRange(int comp);
00186 int GetNormalComponentNormalizeFlag(int comp);
00187
00193 void SetTensorComponent(int comp, const char *arrayName, int arrayComp,
00194 int min, int max, int normalize);
00195 void SetTensorComponent(int comp, const char *arrayName, int arrayComp)
00196 {this->SetTensorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00197 const char *GetTensorComponentArrayName(int comp);
00198 int GetTensorComponentArrayComponent(int comp);
00199 int GetTensorComponentMinRange(int comp);
00200 int GetTensorComponentMaxRange(int comp);
00201 int GetTensorComponentNormalizeFlag(int comp);
00202
00208 void SetTCoordComponent(int comp, const char *arrayName, int arrayComp,
00209 int min, int max, int normalize);
00210 void SetTCoordComponent(int comp, const char *arrayName, int arrayComp)
00211 {this->SetTCoordComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00212 const char *GetTCoordComponentArrayName(int comp);
00213 int GetTCoordComponentArrayComponent(int comp);
00214 int GetTCoordComponentMinRange(int comp);
00215 int GetTCoordComponentMaxRange(int comp);
00216 int GetTCoordComponentNormalizeFlag(int comp);
00217
00220 vtkSetMacro(DefaultNormalize,int);
00221 vtkGetMacro(DefaultNormalize,int);
00222 vtkBooleanMacro(DefaultNormalize,int);
00223
00224
00225
00229 static int GetComponentsType(int numComp, vtkDataArray **arrays);
00230
00235 static int ConstructArray(vtkDataArray *da, int comp, vtkDataArray *frray,
00236 int fieldComp, int min, int max, int normalize);
00237
00240 static vtkDataArray *GetFieldArray(vtkFieldData *fd, char *name, int comp);
00241
00243 static void SetArrayName(vtkObject *self, char* &name, const char *newName);
00244
00247 static int UpdateComponentRange(vtkDataArray *da, int compRange[2]);
00248
00249 protected:
00250 vtkFieldDataToAttributeDataFilter();
00251 ~vtkFieldDataToAttributeDataFilter();
00252 vtkFieldDataToAttributeDataFilter(const vtkFieldDataToAttributeDataFilter&) {};
00253 void operator=(const vtkFieldDataToAttributeDataFilter&) {};
00254
00255 void Execute();
00256
00257 int InputField;
00258 int OutputAttributeData;
00259
00260 int NumberOfScalarComponents;
00261 char *ScalarArrays[4];
00262 int ScalarArrayComponents[4];
00263 int ScalarComponentRange[4][2];
00264 int ScalarNormalize[4];
00265
00266 char *VectorArrays[3];
00267 int VectorArrayComponents[3];
00268 int VectorComponentRange[3][2];
00269 int VectorNormalize[3];
00270
00271 char *GhostLevelArray;
00272 int GhostLevelArrayComponent;
00273 int GhostLevelComponentRange[2];
00274 int GhostLevelNormalize;
00275
00276 char *NormalArrays[3];
00277 int NormalArrayComponents[3];
00278 int NormalComponentRange[3][2];
00279 int NormalNormalize[3];
00280
00281 char *TensorArrays[9];
00282 int TensorArrayComponents[9];
00283 int TensorComponentRange[9][2];
00284 int TensorNormalize[9];
00285
00286 int NumberOfTCoordComponents;
00287 char *TCoordArrays[3];
00288 int TCoordArrayComponents[3];
00289 int TCoordComponentRange[3][2];
00290 int TCoordNormalize[3];
00291
00292 int DefaultNormalize;
00293
00294 void ConstructScalars(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
00295 int componentRange[4][2], char *arrays[4],
00296 int arrayComponents[4], int normalize[4], int numComp);
00297 void ConstructVectors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
00298 int componentRange[3][2], char *arrays[3],
00299 int arrayComponents[3], int normalize[3]);
00300 void ConstructGhostLevels(int num, vtkFieldData *fd,
00301 vtkDataSetAttributes *attr, int componentRange[2],
00302 char *array, int arrayComponent, int normalize);
00303 void ConstructNormals(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
00304 int componentRange[3][2], char *arrays[3],
00305 int arrayComponents[3], int normalize[3]);
00306 void ConstructTCoords(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
00307 int componentRange[3][2], char *arrays[3],
00308 int arrayComponents[3], int normalize[3], int numComp);
00309 void ConstructTensors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
00310 int componentRange[9][2], char *arrays[9],
00311 int arrayComponents[9], int normalize[9]);
00312 void ConstructFieldData(int num, vtkDataSetAttributes *attr);
00313
00314 };
00315
00316 #endif
00317
00318