Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkFieldDataToAttributeDataFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkFieldDataToAttributeDataFilter.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00070 #ifndef __vtkFieldDataToAttributeDataFilter_h
00071 #define __vtkFieldDataToAttributeDataFilter_h
00072 
00073 #include "vtkDataSetToDataSetFilter.h"
00074 
00075 #define VTK_DATA_OBJECT_FIELD 0
00076 #define VTK_POINT_DATA_FIELD 1
00077 #define VTK_CELL_DATA_FIELD 2
00078 
00079 #define VTK_CELL_DATA 0
00080 #define VTK_POINT_DATA 1
00081 
00082 class vtkDataArray;
00083 class vtkDataSetAttributes;
00084 class vtkFieldData;
00085 
00086 class VTK_GRAPHICS_EXPORT vtkFieldDataToAttributeDataFilter : public vtkDataSetToDataSetFilter
00087 {
00088 public:
00089   void PrintSelf(ostream& os, vtkIndent indent);
00090   vtkTypeRevisionMacro(vtkFieldDataToAttributeDataFilter,vtkDataSetToDataSetFilter);
00091 
00094   static vtkFieldDataToAttributeDataFilter *New();
00095 
00097 
00101   vtkSetMacro(InputField,int);
00102   vtkGetMacro(InputField,int);
00103   void SetInputFieldToDataObjectField() 
00104     {this->SetInputField(VTK_DATA_OBJECT_FIELD);};
00105   void SetInputFieldToPointDataField() 
00106     {this->SetInputField(VTK_POINT_DATA_FIELD);};
00107   void SetInputFieldToCellDataField() 
00108     {this->SetInputField(VTK_CELL_DATA_FIELD);};
00110   
00112 
00114   vtkSetMacro(OutputAttributeData,int);
00115   vtkGetMacro(OutputAttributeData,int);
00116   void SetOutputAttributeDataToCellData() 
00117     {this->SetOutputAttributeData(VTK_CELL_DATA);};
00118   void SetOutputAttributeDataToPointData() 
00119     {this->SetOutputAttributeData(VTK_POINT_DATA);};
00121 
00123 
00128   void SetScalarComponent(int comp, const char *arrayName, int arrayComp,
00129                           int min, int max, int normalize);
00130   void SetScalarComponent(int comp, const char *arrayName, int arrayComp)
00131     {this->SetScalarComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00132   const char *GetScalarComponentArrayName(int comp);
00133   int GetScalarComponentArrayComponent(int comp);
00134   int GetScalarComponentMinRange(int comp);
00135   int GetScalarComponentMaxRange(int comp);
00136   int GetScalarComponentNormalizeFlag(int comp);
00138   
00140 
00145   void SetVectorComponent(int comp, const char *arrayName, int arrayComp,
00146                           int min, int max, int normalize);
00147   void SetVectorComponent(int comp, const char *arrayName, int arrayComp)
00148     {this->SetVectorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00149   const char *GetVectorComponentArrayName(int comp);
00150   int GetVectorComponentArrayComponent(int comp);
00151   int GetVectorComponentMinRange(int comp);
00152   int GetVectorComponentMaxRange(int comp);
00153   int GetVectorComponentNormalizeFlag(int comp);
00155   
00157 
00162   void SetNormalComponent(int comp, const char *arrayName, int arrayComp,
00163                           int min, int max, int normalize);
00164   void SetNormalComponent(int comp, const char *arrayName, int arrayComp)
00165     {this->SetNormalComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00166   const char *GetNormalComponentArrayName(int comp);
00167   int GetNormalComponentArrayComponent(int comp);
00168   int GetNormalComponentMinRange(int comp);
00169   int GetNormalComponentMaxRange(int comp);
00170   int GetNormalComponentNormalizeFlag(int comp);
00172   
00174 
00179   void SetTensorComponent(int comp, const char *arrayName, int arrayComp,
00180                           int min, int max, int normalize);
00181   void SetTensorComponent(int comp, const char *arrayName, int arrayComp)
00182     {this->SetTensorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00183   const char *GetTensorComponentArrayName(int comp);
00184   int GetTensorComponentArrayComponent(int comp);
00185   int GetTensorComponentMinRange(int comp);
00186   int GetTensorComponentMaxRange(int comp);
00187   int GetTensorComponentNormalizeFlag(int comp);
00189   
00191 
00196   void SetTCoordComponent(int comp, const char *arrayName, int arrayComp,
00197                           int min, int max, int normalize);
00198   void SetTCoordComponent(int comp, const char *arrayName, int arrayComp)
00199     {this->SetTCoordComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00200   const char *GetTCoordComponentArrayName(int comp);
00201   int GetTCoordComponentArrayComponent(int comp);
00202   int GetTCoordComponentMinRange(int comp);
00203   int GetTCoordComponentMaxRange(int comp);
00204   int GetTCoordComponentNormalizeFlag(int comp);
00206   
00208 
00210   vtkSetMacro(DefaultNormalize,int);
00211   vtkGetMacro(DefaultNormalize,int);
00212   vtkBooleanMacro(DefaultNormalize,int);
00214 
00215   // Helper functions, made public to support other classes
00216 
00220   static int GetComponentsType(int numComp, vtkDataArray **arrays);
00221 
00223 
00227   static int ConstructArray(vtkDataArray *da, int comp, vtkDataArray *frray,
00228                             int fieldComp, vtkIdType min, vtkIdType max,
00229                             int normalize);
00231 
00234   static vtkDataArray *GetFieldArray(vtkFieldData *fd, char *name, int comp);
00235   
00237   static void SetArrayName(vtkObject *self, char* &name, const char *newName);
00238   
00239 //BTX
00242   static int UpdateComponentRange(vtkDataArray *da, vtkIdType compRange[2]);
00243 //ETX
00244 
00246   virtual void ComputeInputUpdateExtents( vtkDataObject *output );
00247 
00248 protected:
00249   vtkFieldDataToAttributeDataFilter();
00250   ~vtkFieldDataToAttributeDataFilter();
00251 
00252   void Execute(); //generate output data
00253 
00254   int InputField;
00255   int OutputAttributeData;
00256 
00257   int NumberOfScalarComponents; //the number of components to fill-in
00258   char *ScalarArrays[4]; //the name of the arrays used to construct the scalar
00259   int ScalarArrayComponents[4]; //the components of the arrays used to construct
00260   vtkIdType ScalarComponentRange[4][2]; //the range of the components to use
00261   int ScalarNormalize[4]; //flags control normalization
00262   
00263   char *VectorArrays[3]; //the name of the arrays used to construct the vectors
00264   int VectorArrayComponents[3]; //the components of the arrays used to construct
00265   vtkIdType VectorComponentRange[3][2]; //the range of the components to use
00266   int VectorNormalize[3]; //flags control normalization
00267   
00268   char *GhostLevelArray; //the name of the array used to construct the ghost levels
00269   int GhostLevelArrayComponent; //the component of the array used to construct
00270   vtkIdType GhostLevelComponentRange[2]; //the range of the components to use
00271   int GhostLevelNormalize; //flags control normalization
00272   
00273   char *NormalArrays[3]; //the name of the arrays used to construct the normals
00274   int NormalArrayComponents[3]; //the components of the arrays used to construct
00275   vtkIdType NormalComponentRange[3][2]; //the range of the components to use
00276   int NormalNormalize[3]; //flags control normalization
00277   
00278   char *TensorArrays[9]; //the name of the arrays used to construct the tensors
00279   int TensorArrayComponents[9]; //the components of the arrays used to construct
00280   vtkIdType TensorComponentRange[9][2]; //the range of the components to use
00281   int TensorNormalize[9]; //flags control normalization
00282   
00283   int NumberOfTCoordComponents; //the number of components to fill-in
00284   char *TCoordArrays[3]; //the name of the arrays used to construct the tcoords
00285   int TCoordArrayComponents[3]; //the components of the arrays used to construct
00286   vtkIdType TCoordComponentRange[3][2]; //the range of the components to use
00287   int TCoordNormalize[3]; //flags control normalization
00288   
00289   int DefaultNormalize;
00290 
00291   void ConstructScalars(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00292                         vtkIdType componentRange[4][2], char *arrays[4], 
00293                         int arrayComponents[4], int normalize[4], int numComp);
00294   void ConstructVectors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00295                         vtkIdType componentRange[3][2], char *arrays[3], 
00296                         int arrayComponents[3], int normalize[3]);
00297   void ConstructGhostLevels(int num, vtkFieldData *fd,
00298                             vtkDataSetAttributes *attr,
00299                             vtkIdType componentRange[2], 
00300                             char *array, int arrayComponent, int normalize);
00301   void ConstructNormals(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00302                         vtkIdType componentRange[3][2], char *arrays[3], 
00303                         int arrayComponents[3], int normalize[3]);
00304   void ConstructTCoords(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00305                         vtkIdType componentRange[3][2], char *arrays[3], 
00306                         int arrayComponents[3], int normalize[3], int numComp);
00307   void ConstructTensors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00308                         vtkIdType componentRange[9][2], char *arrays[9], 
00309                         int arrayComponents[9], int normalize[9]);
00310   void ConstructFieldData(int num, vtkDataSetAttributes *attr);
00311   
00312 private:
00313   vtkFieldDataToAttributeDataFilter(const vtkFieldDataToAttributeDataFilter&);  // Not implemented.
00314   void operator=(const vtkFieldDataToAttributeDataFilter&);  // Not implemented.
00315 };
00316 
00317 #endif
00318 
00319