Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Graphics/vtkFieldDataToAttributeDataFilter.h

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