00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00057 #ifndef __vtkFieldDataToAttributeDataFilter_h
00058 #define __vtkFieldDataToAttributeDataFilter_h
00059
00060 #include "vtkDataSetAlgorithm.h"
00061
00062 #define VTK_DATA_OBJECT_FIELD 0
00063 #define VTK_POINT_DATA_FIELD 1
00064 #define VTK_CELL_DATA_FIELD 2
00065
00066 #define VTK_CELL_DATA 0
00067 #define VTK_POINT_DATA 1
00068
00069 class vtkDataArray;
00070 class vtkDataSetAttributes;
00071 class vtkFieldData;
00072
00073 class VTK_GRAPHICS_EXPORT vtkFieldDataToAttributeDataFilter : public vtkDataSetAlgorithm
00074 {
00075 public:
00076 void PrintSelf(ostream& os, vtkIndent indent);
00077 vtkTypeRevisionMacro(vtkFieldDataToAttributeDataFilter,vtkDataSetAlgorithm);
00078
00081 static vtkFieldDataToAttributeDataFilter *New();
00082
00084
00088 vtkSetMacro(InputField,int);
00089 vtkGetMacro(InputField,int);
00090 void SetInputFieldToDataObjectField()
00091 {this->SetInputField(VTK_DATA_OBJECT_FIELD);};
00092 void SetInputFieldToPointDataField()
00093 {this->SetInputField(VTK_POINT_DATA_FIELD);};
00094 void SetInputFieldToCellDataField()
00095 {this->SetInputField(VTK_CELL_DATA_FIELD);};
00097
00099
00101 vtkSetMacro(OutputAttributeData,int);
00102 vtkGetMacro(OutputAttributeData,int);
00103 void SetOutputAttributeDataToCellData()
00104 {this->SetOutputAttributeData(VTK_CELL_DATA);};
00105 void SetOutputAttributeDataToPointData()
00106 {this->SetOutputAttributeData(VTK_POINT_DATA);};
00108
00110
00115 void SetScalarComponent(int comp, const char *arrayName, int arrayComp,
00116 int min, int max, int normalize);
00117 void SetScalarComponent(int comp, const char *arrayName, int arrayComp)
00118 {this->SetScalarComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00119 const char *GetScalarComponentArrayName(int comp);
00120 int GetScalarComponentArrayComponent(int comp);
00121 int GetScalarComponentMinRange(int comp);
00122 int GetScalarComponentMaxRange(int comp);
00123 int GetScalarComponentNormalizeFlag(int comp);
00125
00127
00132 void SetVectorComponent(int comp, const char *arrayName, int arrayComp,
00133 int min, int max, int normalize);
00134 void SetVectorComponent(int comp, const char *arrayName, int arrayComp)
00135 {this->SetVectorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00136 const char *GetVectorComponentArrayName(int comp);
00137 int GetVectorComponentArrayComponent(int comp);
00138 int GetVectorComponentMinRange(int comp);
00139 int GetVectorComponentMaxRange(int comp);
00140 int GetVectorComponentNormalizeFlag(int comp);
00142
00144
00149 void SetNormalComponent(int comp, const char *arrayName, int arrayComp,
00150 int min, int max, int normalize);
00151 void SetNormalComponent(int comp, const char *arrayName, int arrayComp)
00152 {this->SetNormalComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00153 const char *GetNormalComponentArrayName(int comp);
00154 int GetNormalComponentArrayComponent(int comp);
00155 int GetNormalComponentMinRange(int comp);
00156 int GetNormalComponentMaxRange(int comp);
00157 int GetNormalComponentNormalizeFlag(int comp);
00159
00161
00166 void SetTensorComponent(int comp, const char *arrayName, int arrayComp,
00167 int min, int max, int normalize);
00168 void SetTensorComponent(int comp, const char *arrayName, int arrayComp)
00169 {this->SetTensorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00170 const char *GetTensorComponentArrayName(int comp);
00171 int GetTensorComponentArrayComponent(int comp);
00172 int GetTensorComponentMinRange(int comp);
00173 int GetTensorComponentMaxRange(int comp);
00174 int GetTensorComponentNormalizeFlag(int comp);
00176
00178
00183 void SetTCoordComponent(int comp, const char *arrayName, int arrayComp,
00184 int min, int max, int normalize);
00185 void SetTCoordComponent(int comp, const char *arrayName, int arrayComp)
00186 {this->SetTCoordComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00187 const char *GetTCoordComponentArrayName(int comp);
00188 int GetTCoordComponentArrayComponent(int comp);
00189 int GetTCoordComponentMinRange(int comp);
00190 int GetTCoordComponentMaxRange(int comp);
00191 int GetTCoordComponentNormalizeFlag(int comp);
00193
00195
00197 vtkSetMacro(DefaultNormalize,int);
00198 vtkGetMacro(DefaultNormalize,int);
00199 vtkBooleanMacro(DefaultNormalize,int);
00201
00202
00203
00207 static int GetComponentsType(int numComp, vtkDataArray **arrays);
00208
00210
00214 static int ConstructArray(vtkDataArray *da, int comp, vtkDataArray *frray,
00215 int fieldComp, vtkIdType min, vtkIdType max,
00216 int normalize);
00218
00221 static vtkDataArray *GetFieldArray(vtkFieldData *fd, char *name, int comp);
00222
00224 static void SetArrayName(vtkObject *self, char* &name, const char *newName);
00225
00226
00229 static int UpdateComponentRange(vtkDataArray *da, vtkIdType compRange[2]);
00230
00231
00233 virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00234
00235 protected:
00236 vtkFieldDataToAttributeDataFilter();
00237 ~vtkFieldDataToAttributeDataFilter();
00238
00239 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00240
00241 int InputField;
00242 int OutputAttributeData;
00243
00244 int NumberOfScalarComponents;
00245 char *ScalarArrays[4];
00246 int ScalarArrayComponents[4];
00247 vtkIdType ScalarComponentRange[4][2];
00248 int ScalarNormalize[4];
00249
00250 char *VectorArrays[3];
00251 int VectorArrayComponents[3];
00252 vtkIdType VectorComponentRange[3][2];
00253 int VectorNormalize[3];
00254
00255 char *GhostLevelArray;
00256 int GhostLevelArrayComponent;
00257 vtkIdType GhostLevelComponentRange[2];
00258 int GhostLevelNormalize;
00259
00260 char *NormalArrays[3];
00261 int NormalArrayComponents[3];
00262 vtkIdType NormalComponentRange[3][2];
00263 int NormalNormalize[3];
00264
00265 char *TensorArrays[9];
00266 int TensorArrayComponents[9];
00267 vtkIdType TensorComponentRange[9][2];
00268 int TensorNormalize[9];
00269
00270 int NumberOfTCoordComponents;
00271 char *TCoordArrays[3];
00272 int TCoordArrayComponents[3];
00273 vtkIdType TCoordComponentRange[3][2];
00274 int TCoordNormalize[3];
00275
00276 int DefaultNormalize;
00277
00278 void ConstructScalars(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
00279 vtkIdType componentRange[4][2], char *arrays[4],
00280 int arrayComponents[4], int normalize[4], int numComp);
00281 void ConstructVectors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
00282 vtkIdType componentRange[3][2], char *arrays[3],
00283 int arrayComponents[3], int normalize[3]);
00284 void ConstructGhostLevels(int num, vtkFieldData *fd,
00285 vtkDataSetAttributes *attr,
00286 vtkIdType componentRange[2],
00287 char *array, int arrayComponent, int normalize);
00288 void ConstructNormals(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
00289 vtkIdType componentRange[3][2], char *arrays[3],
00290 int arrayComponents[3], int normalize[3]);
00291 void ConstructTCoords(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
00292 vtkIdType componentRange[3][2], char *arrays[3],
00293 int arrayComponents[3], int normalize[3], int numComp);
00294 void ConstructTensors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
00295 vtkIdType componentRange[9][2], char *arrays[9],
00296 int arrayComponents[9], int normalize[9]);
00297 void ConstructFieldData(int num, vtkDataSetAttributes *attr);
00298
00299 private:
00300 vtkFieldDataToAttributeDataFilter(const vtkFieldDataToAttributeDataFilter&);
00301 void operator=(const vtkFieldDataToAttributeDataFilter&);
00302 };
00303
00304 #endif
00305
00306