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 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038 
00039 =========================================================================*/
00085 #ifndef __vtkFieldDataToAttributeDataFilter_h
00086 #define __vtkFieldDataToAttributeDataFilter_h
00087 
00088 #include "vtkDataSetToDataSetFilter.h"
00089 
00090 #define VTK_DATA_OBJECT_FIELD 0
00091 #define VTK_POINT_DATA_FIELD 1
00092 #define VTK_CELL_DATA_FIELD 2
00093 
00094 #define VTK_CELL_DATA 0
00095 #define VTK_POINT_DATA 1
00096 
00097 class VTK_GRAPHICS_EXPORT vtkFieldDataToAttributeDataFilter : public vtkDataSetToDataSetFilter
00098 {
00099 public:
00100   void PrintSelf(ostream& os, vtkIndent indent);
00101   vtkTypeMacro(vtkFieldDataToAttributeDataFilter,vtkDataSetToDataSetFilter);
00102 
00105   static vtkFieldDataToAttributeDataFilter *New();
00106 
00108 
00112   vtkSetMacro(InputField,int);
00113   vtkGetMacro(InputField,int);
00114   void SetInputFieldToDataObjectField() 
00115     {this->SetInputField(VTK_DATA_OBJECT_FIELD);};
00116   void SetInputFieldToPointDataField() 
00117     {this->SetInputField(VTK_POINT_DATA_FIELD);};
00118   void SetInputFieldToCellDataField() 
00119     {this->SetInputField(VTK_CELL_DATA_FIELD);};
00121   
00123 
00125   vtkSetMacro(OutputAttributeData,int);
00126   vtkGetMacro(OutputAttributeData,int);
00127   void SetOutputAttributeDataToCellData() 
00128     {this->SetOutputAttributeData(VTK_CELL_DATA);};
00129   void SetOutputAttributeDataToPointData() 
00130     {this->SetOutputAttributeData(VTK_POINT_DATA);};
00132 
00134 
00139   void SetScalarComponent(int comp, const char *arrayName, int arrayComp,
00140                           int min, int max, int normalize);
00141   void SetScalarComponent(int comp, const char *arrayName, int arrayComp)
00142     {this->SetScalarComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00143   const char *GetScalarComponentArrayName(int comp);
00144   int GetScalarComponentArrayComponent(int comp);
00145   int GetScalarComponentMinRange(int comp);
00146   int GetScalarComponentMaxRange(int comp);
00147   int GetScalarComponentNormalizeFlag(int comp);
00149   
00151 
00156   void SetVectorComponent(int comp, const char *arrayName, int arrayComp,
00157                           int min, int max, int normalize);
00158   void SetVectorComponent(int comp, const char *arrayName, int arrayComp)
00159     {this->SetVectorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00160   const char *GetVectorComponentArrayName(int comp);
00161   int GetVectorComponentArrayComponent(int comp);
00162   int GetVectorComponentMinRange(int comp);
00163   int GetVectorComponentMaxRange(int comp);
00164   int GetVectorComponentNormalizeFlag(int comp);
00166   
00168 
00173   void SetNormalComponent(int comp, const char *arrayName, int arrayComp,
00174                           int min, int max, int normalize);
00175   void SetNormalComponent(int comp, const char *arrayName, int arrayComp)
00176     {this->SetNormalComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00177   const char *GetNormalComponentArrayName(int comp);
00178   int GetNormalComponentArrayComponent(int comp);
00179   int GetNormalComponentMinRange(int comp);
00180   int GetNormalComponentMaxRange(int comp);
00181   int GetNormalComponentNormalizeFlag(int comp);
00183   
00185 
00190   void SetTensorComponent(int comp, const char *arrayName, int arrayComp,
00191                           int min, int max, int normalize);
00192   void SetTensorComponent(int comp, const char *arrayName, int arrayComp)
00193     {this->SetTensorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00194   const char *GetTensorComponentArrayName(int comp);
00195   int GetTensorComponentArrayComponent(int comp);
00196   int GetTensorComponentMinRange(int comp);
00197   int GetTensorComponentMaxRange(int comp);
00198   int GetTensorComponentNormalizeFlag(int comp);
00200   
00202 
00207   void SetTCoordComponent(int comp, const char *arrayName, int arrayComp,
00208                           int min, int max, int normalize);
00209   void SetTCoordComponent(int comp, const char *arrayName, int arrayComp)
00210     {this->SetTCoordComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00211   const char *GetTCoordComponentArrayName(int comp);
00212   int GetTCoordComponentArrayComponent(int comp);
00213   int GetTCoordComponentMinRange(int comp);
00214   int GetTCoordComponentMaxRange(int comp);
00215   int GetTCoordComponentNormalizeFlag(int comp);
00217   
00219 
00221   vtkSetMacro(DefaultNormalize,int);
00222   vtkGetMacro(DefaultNormalize,int);
00223   vtkBooleanMacro(DefaultNormalize,int);
00225 
00226   // Helper functions, made public to support other classes
00227 
00231   static int GetComponentsType(int numComp, vtkDataArray **arrays);
00232 
00234 
00238   static int ConstructArray(vtkDataArray *da, int comp, vtkDataArray *frray,
00239                             int fieldComp, vtkIdType min, vtkIdType max,
00240                             int normalize);
00242 
00245   static vtkDataArray *GetFieldArray(vtkFieldData *fd, char *name, int comp);
00246   
00248   static void SetArrayName(vtkObject *self, char* &name, const char *newName);
00249   
00250 //BTX
00253   static int UpdateComponentRange(vtkDataArray *da, vtkIdType compRange[2]);
00254 //ETX
00255 
00257   virtual void ComputeInputUpdateExtents( vtkDataObject *output );
00258 
00259 protected:
00260   vtkFieldDataToAttributeDataFilter();
00261   ~vtkFieldDataToAttributeDataFilter();
00262 
00263   void Execute(); //generate output data
00264 
00265   int InputField;
00266   int OutputAttributeData;
00267 
00268   int NumberOfScalarComponents; //the number of components to fill-in
00269   char *ScalarArrays[4]; //the name of the arrays used to construct the scalar
00270   int ScalarArrayComponents[4]; //the components of the arrays used to construct
00271   vtkIdType ScalarComponentRange[4][2]; //the range of the components to use
00272   int ScalarNormalize[4]; //flags control normalization
00273   
00274   char *VectorArrays[3]; //the name of the arrays used to construct the vectors
00275   int VectorArrayComponents[3]; //the components of the arrays used to construct
00276   vtkIdType VectorComponentRange[3][2]; //the range of the components to use
00277   int VectorNormalize[3]; //flags control normalization
00278   
00279   char *GhostLevelArray; //the name of the array used to construct the ghost levels
00280   int GhostLevelArrayComponent; //the component of the array used to construct
00281   vtkIdType GhostLevelComponentRange[2]; //the range of the components to use
00282   int GhostLevelNormalize; //flags control normalization
00283   
00284   char *NormalArrays[3]; //the name of the arrays used to construct the normals
00285   int NormalArrayComponents[3]; //the components of the arrays used to construct
00286   vtkIdType NormalComponentRange[3][2]; //the range of the components to use
00287   int NormalNormalize[3]; //flags control normalization
00288   
00289   char *TensorArrays[9]; //the name of the arrays used to construct the tensors
00290   int TensorArrayComponents[9]; //the components of the arrays used to construct
00291   vtkIdType TensorComponentRange[9][2]; //the range of the components to use
00292   int TensorNormalize[9]; //flags control normalization
00293   
00294   int NumberOfTCoordComponents; //the number of components to fill-in
00295   char *TCoordArrays[3]; //the name of the arrays used to construct the tcoords
00296   int TCoordArrayComponents[3]; //the components of the arrays used to construct
00297   vtkIdType TCoordComponentRange[3][2]; //the range of the components to use
00298   int TCoordNormalize[3]; //flags control normalization
00299   
00300   int DefaultNormalize;
00301 
00302   void ConstructScalars(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00303                         vtkIdType componentRange[4][2], char *arrays[4], 
00304                         int arrayComponents[4], int normalize[4], int numComp);
00305   void ConstructVectors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00306                         vtkIdType componentRange[3][2], char *arrays[3], 
00307                         int arrayComponents[3], int normalize[3]);
00308   void ConstructGhostLevels(int num, vtkFieldData *fd,
00309                             vtkDataSetAttributes *attr,
00310                             vtkIdType componentRange[2], 
00311                             char *array, int arrayComponent, int normalize);
00312   void ConstructNormals(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00313                         vtkIdType componentRange[3][2], char *arrays[3], 
00314                         int arrayComponents[3], int normalize[3]);
00315   void ConstructTCoords(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00316                         vtkIdType componentRange[3][2], char *arrays[3], 
00317                         int arrayComponents[3], int normalize[3], int numComp);
00318   void ConstructTensors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00319                         vtkIdType componentRange[9][2], char *arrays[9], 
00320                         int arrayComponents[9], int normalize[9]);
00321   void ConstructFieldData(int num, vtkDataSetAttributes *attr);
00322   
00323 private:
00324   vtkFieldDataToAttributeDataFilter(const vtkFieldDataToAttributeDataFilter&);  // Not implemented.
00325   void operator=(const vtkFieldDataToAttributeDataFilter&);  // Not implemented.
00326 };
00327 
00328 #endif
00329 
00330 

Generated on Thu Mar 28 14:19:20 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001