Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | 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   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 =========================================================================*/
00061 #ifndef __vtkFieldDataToAttributeDataFilter_h
00062 #define __vtkFieldDataToAttributeDataFilter_h
00063 
00064 #include "vtkDataSetToDataSetFilter.h"
00065 
00066 #define VTK_DATA_OBJECT_FIELD 0
00067 #define VTK_POINT_DATA_FIELD 1
00068 #define VTK_CELL_DATA_FIELD 2
00069 
00070 #define VTK_CELL_DATA 0
00071 #define VTK_POINT_DATA 1
00072 
00073 class vtkDataArray;
00074 class vtkDataSetAttributes;
00075 class vtkFieldData;
00076 
00077 class VTK_GRAPHICS_EXPORT vtkFieldDataToAttributeDataFilter : public vtkDataSetToDataSetFilter
00078 {
00079 public:
00080   void PrintSelf(ostream& os, vtkIndent indent);
00081   vtkTypeRevisionMacro(vtkFieldDataToAttributeDataFilter,vtkDataSetToDataSetFilter);
00082 
00085   static vtkFieldDataToAttributeDataFilter *New();
00086 
00088 
00092   vtkSetMacro(InputField,int);
00093   vtkGetMacro(InputField,int);
00094   void SetInputFieldToDataObjectField() 
00095     {this->SetInputField(VTK_DATA_OBJECT_FIELD);};
00096   void SetInputFieldToPointDataField() 
00097     {this->SetInputField(VTK_POINT_DATA_FIELD);};
00098   void SetInputFieldToCellDataField() 
00099     {this->SetInputField(VTK_CELL_DATA_FIELD);};
00101   
00103 
00105   vtkSetMacro(OutputAttributeData,int);
00106   vtkGetMacro(OutputAttributeData,int);
00107   void SetOutputAttributeDataToCellData() 
00108     {this->SetOutputAttributeData(VTK_CELL_DATA);};
00109   void SetOutputAttributeDataToPointData() 
00110     {this->SetOutputAttributeData(VTK_POINT_DATA);};
00112 
00114 
00119   void SetScalarComponent(int comp, const char *arrayName, int arrayComp,
00120                           int min, int max, int normalize);
00121   void SetScalarComponent(int comp, const char *arrayName, int arrayComp)
00122     {this->SetScalarComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00123   const char *GetScalarComponentArrayName(int comp);
00124   int GetScalarComponentArrayComponent(int comp);
00125   int GetScalarComponentMinRange(int comp);
00126   int GetScalarComponentMaxRange(int comp);
00127   int GetScalarComponentNormalizeFlag(int comp);
00129   
00131 
00136   void SetVectorComponent(int comp, const char *arrayName, int arrayComp,
00137                           int min, int max, int normalize);
00138   void SetVectorComponent(int comp, const char *arrayName, int arrayComp)
00139     {this->SetVectorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00140   const char *GetVectorComponentArrayName(int comp);
00141   int GetVectorComponentArrayComponent(int comp);
00142   int GetVectorComponentMinRange(int comp);
00143   int GetVectorComponentMaxRange(int comp);
00144   int GetVectorComponentNormalizeFlag(int comp);
00146   
00148 
00153   void SetNormalComponent(int comp, const char *arrayName, int arrayComp,
00154                           int min, int max, int normalize);
00155   void SetNormalComponent(int comp, const char *arrayName, int arrayComp)
00156     {this->SetNormalComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00157   const char *GetNormalComponentArrayName(int comp);
00158   int GetNormalComponentArrayComponent(int comp);
00159   int GetNormalComponentMinRange(int comp);
00160   int GetNormalComponentMaxRange(int comp);
00161   int GetNormalComponentNormalizeFlag(int comp);
00163   
00165 
00170   void SetTensorComponent(int comp, const char *arrayName, int arrayComp,
00171                           int min, int max, int normalize);
00172   void SetTensorComponent(int comp, const char *arrayName, int arrayComp)
00173     {this->SetTensorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00174   const char *GetTensorComponentArrayName(int comp);
00175   int GetTensorComponentArrayComponent(int comp);
00176   int GetTensorComponentMinRange(int comp);
00177   int GetTensorComponentMaxRange(int comp);
00178   int GetTensorComponentNormalizeFlag(int comp);
00180   
00182 
00187   void SetTCoordComponent(int comp, const char *arrayName, int arrayComp,
00188                           int min, int max, int normalize);
00189   void SetTCoordComponent(int comp, const char *arrayName, int arrayComp)
00190     {this->SetTCoordComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00191   const char *GetTCoordComponentArrayName(int comp);
00192   int GetTCoordComponentArrayComponent(int comp);
00193   int GetTCoordComponentMinRange(int comp);
00194   int GetTCoordComponentMaxRange(int comp);
00195   int GetTCoordComponentNormalizeFlag(int comp);
00197   
00199 
00201   vtkSetMacro(DefaultNormalize,int);
00202   vtkGetMacro(DefaultNormalize,int);
00203   vtkBooleanMacro(DefaultNormalize,int);
00205 
00206   // Helper functions, made public to support other classes
00207 
00211   static int GetComponentsType(int numComp, vtkDataArray **arrays);
00212 
00214 
00218   static int ConstructArray(vtkDataArray *da, int comp, vtkDataArray *frray,
00219                             int fieldComp, vtkIdType min, vtkIdType max,
00220                             int normalize);
00222 
00225   static vtkDataArray *GetFieldArray(vtkFieldData *fd, char *name, int comp);
00226   
00228   static void SetArrayName(vtkObject *self, char* &name, const char *newName);
00229   
00230 //BTX
00233   static int UpdateComponentRange(vtkDataArray *da, vtkIdType compRange[2]);
00234 //ETX
00235 
00237   virtual void ComputeInputUpdateExtents( vtkDataObject *output );
00238 
00239 protected:
00240   vtkFieldDataToAttributeDataFilter();
00241   ~vtkFieldDataToAttributeDataFilter();
00242 
00243   void Execute(); //generate output data
00244 
00245   int InputField;
00246   int OutputAttributeData;
00247 
00248   int NumberOfScalarComponents; //the number of components to fill-in
00249   char *ScalarArrays[4]; //the name of the arrays used to construct the scalar
00250   int ScalarArrayComponents[4]; //the components of the arrays used to construct
00251   vtkIdType ScalarComponentRange[4][2]; //the range of the components to use
00252   int ScalarNormalize[4]; //flags control normalization
00253   
00254   char *VectorArrays[3]; //the name of the arrays used to construct the vectors
00255   int VectorArrayComponents[3]; //the components of the arrays used to construct
00256   vtkIdType VectorComponentRange[3][2]; //the range of the components to use
00257   int VectorNormalize[3]; //flags control normalization
00258   
00259   char *GhostLevelArray; //the name of the array used to construct the ghost levels
00260   int GhostLevelArrayComponent; //the component of the array used to construct
00261   vtkIdType GhostLevelComponentRange[2]; //the range of the components to use
00262   int GhostLevelNormalize; //flags control normalization
00263   
00264   char *NormalArrays[3]; //the name of the arrays used to construct the normals
00265   int NormalArrayComponents[3]; //the components of the arrays used to construct
00266   vtkIdType NormalComponentRange[3][2]; //the range of the components to use
00267   int NormalNormalize[3]; //flags control normalization
00268   
00269   char *TensorArrays[9]; //the name of the arrays used to construct the tensors
00270   int TensorArrayComponents[9]; //the components of the arrays used to construct
00271   vtkIdType TensorComponentRange[9][2]; //the range of the components to use
00272   int TensorNormalize[9]; //flags control normalization
00273   
00274   int NumberOfTCoordComponents; //the number of components to fill-in
00275   char *TCoordArrays[3]; //the name of the arrays used to construct the tcoords
00276   int TCoordArrayComponents[3]; //the components of the arrays used to construct
00277   vtkIdType TCoordComponentRange[3][2]; //the range of the components to use
00278   int TCoordNormalize[3]; //flags control normalization
00279   
00280   int DefaultNormalize;
00281 
00282   void ConstructScalars(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00283                         vtkIdType componentRange[4][2], char *arrays[4], 
00284                         int arrayComponents[4], int normalize[4], int numComp);
00285   void ConstructVectors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00286                         vtkIdType componentRange[3][2], char *arrays[3], 
00287                         int arrayComponents[3], int normalize[3]);
00288   void ConstructGhostLevels(int num, vtkFieldData *fd,
00289                             vtkDataSetAttributes *attr,
00290                             vtkIdType componentRange[2], 
00291                             char *array, int arrayComponent, int normalize);
00292   void ConstructNormals(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00293                         vtkIdType componentRange[3][2], char *arrays[3], 
00294                         int arrayComponents[3], int normalize[3]);
00295   void ConstructTCoords(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00296                         vtkIdType componentRange[3][2], char *arrays[3], 
00297                         int arrayComponents[3], int normalize[3], int numComp);
00298   void ConstructTensors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00299                         vtkIdType componentRange[9][2], char *arrays[9], 
00300                         int arrayComponents[9], int normalize[9]);
00301   void ConstructFieldData(int num, vtkDataSetAttributes *attr);
00302   
00303 private:
00304   vtkFieldDataToAttributeDataFilter(const vtkFieldDataToAttributeDataFilter&);  // Not implemented.
00305   void operator=(const vtkFieldDataToAttributeDataFilter&);  // Not implemented.
00306 };
00307 
00308 #endif
00309 
00310