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

vtkArrayCalculator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkArrayCalculator.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 =========================================================================*/
00076 #ifndef __vtkArrayCalculator_h
00077 #define __vtkArrayCalculator_h
00078 
00079 #include "vtkDataSetToDataSetFilter.h"
00080 
00081 class vtkFunctionParser;
00082 
00083 #define VTK_ATTRIBUTE_MODE_DEFAULT 0
00084 #define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
00085 #define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
00086 
00087 class VTK_GRAPHICS_EXPORT vtkArrayCalculator : public vtkDataSetToDataSetFilter 
00088 {
00089 public:
00090   vtkTypeRevisionMacro(vtkArrayCalculator,vtkDataSetToDataSetFilter);
00091   void PrintSelf(ostream& os, vtkIndent indent);
00092 
00093   static vtkArrayCalculator *New();
00094 
00096 
00097   void SetFunction(const char* function);
00098   vtkGetStringMacro(Function);
00100   
00102 
00107   void AddScalarArrayName(const char* arrayName, int component = 0);
00108   void AddVectorArrayName(const char* arrayName, int component0 = 0,
00109                           int component1 = 1, int component2 = 2);
00111   
00113 
00115   void AddScalarVariable(const char* variableName, const char* arrayName,
00116                          int component = 0);
00117   void AddVectorVariable(const char* variableName, const char* arrayName,
00118                          int component0 = 0, int component1 = 1,
00119                          int component2 = 2);
00121   
00123 
00127   void SetResultArrayName(const char* name);
00128   vtkGetStringMacro(ResultArrayName);
00130   
00132 
00137   vtkSetMacro(AttributeMode,int);
00138   vtkGetMacro(AttributeMode,int);
00139   void SetAttributeModeToDefault() 
00140     {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_DEFAULT);};
00141   void SetAttributeModeToUsePointData() 
00142     {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_POINT_DATA);};
00143   void SetAttributeModeToUseCellData() 
00144     {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_CELL_DATA);};
00145   const char *GetAttributeModeAsString();
00147 
00149   void RemoveAllVariables();
00150 
00152 
00153   char** GetScalarArrayNames() { return this->ScalarArrayNames; }
00154   char* GetScalarArrayName(int i);
00155   char** GetVectorArrayNames() { return this->VectorArrayNames; }
00156   char* GetVectorArrayName(int i);
00157   char** GetScalarVariableNames() { return this->ScalarVariableNames; }
00158   char* GetScalarVariableName(int i);
00159   char** GetVectorVariableNames() { return this->VectorVariableNames; }
00160   char* GetVectorVariableName(int i);
00161   int* GetSelectedScalarComponents() { return this->SelectedScalarComponents; }
00162   int GetSelectedScalarComponent(int i);
00163   int** GetSelectedVectorComponents() { return this->SelectedVectorComponents;}
00164   int* GetSelectedVectorComponents(int i);
00165   vtkGetMacro(NumberOfScalarArrays, int);
00166   vtkGetMacro(NumberOfVectorArrays, int);
00168   
00169 protected:
00170   vtkArrayCalculator();
00171   ~vtkArrayCalculator();
00172 
00173   void Execute();
00174   
00175   char* Function;
00176   char* ResultArrayName;
00177   char** ScalarArrayNames;
00178   char** VectorArrayNames;
00179   char** ScalarVariableNames;
00180   char** VectorVariableNames;
00181   int NumberOfScalarArrays;
00182   int NumberOfVectorArrays;
00183   int AttributeMode;
00184   int* SelectedScalarComponents;
00185   int** SelectedVectorComponents;
00186   vtkFunctionParser* FunctionParser;
00187 private:
00188   vtkArrayCalculator(const vtkArrayCalculator&);  // Not implemented.
00189   void operator=(const vtkArrayCalculator&);  // Not implemented.
00190 };
00191 
00192 #endif