00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00066 #ifndef __vtkArrayCalculator_h
00067 #define __vtkArrayCalculator_h
00068
00069 #include "vtkDataSetAlgorithm.h"
00070
00071 class vtkFunctionParser;
00072
00073 #define VTK_ATTRIBUTE_MODE_DEFAULT 0
00074 #define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
00075 #define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
00076 #define VTK_ATTRIBUTE_MODE_USE_VERTEX_DATA 3
00077 #define VTK_ATTRIBUTE_MODE_USE_EDGE_DATA 4
00078
00079 class VTK_GRAPHICS_EXPORT vtkArrayCalculator : public vtkDataSetAlgorithm
00080 {
00081 public:
00082 vtkTypeMacro(vtkArrayCalculator,vtkDataSetAlgorithm);
00083 void PrintSelf(ostream& os, vtkIndent indent);
00084
00085 static vtkArrayCalculator *New();
00086
00088
00089 virtual void SetFunction(const char* function);
00090 vtkGetStringMacro(Function);
00092
00094
00099 void AddScalarArrayName(const char* arrayName, int component = 0);
00100 void AddVectorArrayName(const char* arrayName, int component0 = 0,
00101 int component1 = 1, int component2 = 2);
00103
00105
00107 void AddScalarVariable(const char* variableName, const char* arrayName,
00108 int component = 0);
00109 void AddVectorVariable(const char* variableName, const char* arrayName,
00110 int component0 = 0, int component1 = 1,
00111 int component2 = 2);
00113
00115
00117 void AddCoordinateScalarVariable(const char* variableName,
00118 int component = 0);
00119 void AddCoordinateVectorVariable(const char* variableName,
00120 int component0 = 0, int component1 = 1,
00121 int component2 = 2);
00123
00125
00129 void SetResultArrayName(const char* name);
00130 vtkGetStringMacro(ResultArrayName);
00132
00134
00136 vtkGetMacro(ResultArrayType,int);
00137 vtkSetMacro(ResultArrayType,int);
00139
00141
00145 vtkGetMacro(CoordinateResults, int);
00146 vtkSetMacro(CoordinateResults, int);
00147 vtkBooleanMacro(CoordinateResults, int);
00149
00151
00158 vtkSetMacro(AttributeMode,int);
00159 vtkGetMacro(AttributeMode,int);
00160 void SetAttributeModeToDefault()
00161 {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_DEFAULT);};
00162 void SetAttributeModeToUsePointData()
00163 {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_POINT_DATA);};
00164 void SetAttributeModeToUseCellData()
00165 {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_CELL_DATA);};
00166 void SetAttributeModeToUseVertexData()
00167 {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_VERTEX_DATA);};
00168 void SetAttributeModeToUseEdgeData()
00169 {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_EDGE_DATA);};
00170 const char *GetAttributeModeAsString();
00172
00174 void RemoveAllVariables();
00175
00178 virtual void RemoveScalarVariables();
00179
00182 virtual void RemoveVectorVariables();
00183
00185 virtual void RemoveCoordinateScalarVariables();
00186
00188 virtual void RemoveCoordinateVectorVariables();
00189
00191
00192 char** GetScalarArrayNames() { return this->ScalarArrayNames; }
00193 char* GetScalarArrayName(int i);
00194 char** GetVectorArrayNames() { return this->VectorArrayNames; }
00195 char* GetVectorArrayName(int i);
00196 char** GetScalarVariableNames() { return this->ScalarVariableNames; }
00197 char* GetScalarVariableName(int i);
00198 char** GetVectorVariableNames() { return this->VectorVariableNames; }
00199 char* GetVectorVariableName(int i);
00200 int* GetSelectedScalarComponents() { return this->SelectedScalarComponents; }
00201 int GetSelectedScalarComponent(int i);
00202 int** GetSelectedVectorComponents() { return this->SelectedVectorComponents;}
00203 int* GetSelectedVectorComponents(int i);
00204 vtkGetMacro(NumberOfScalarArrays, int);
00205 vtkGetMacro(NumberOfVectorArrays, int);
00207
00209
00213 vtkSetMacro(ReplaceInvalidValues,int);
00214 vtkGetMacro(ReplaceInvalidValues,int);
00215 vtkBooleanMacro(ReplaceInvalidValues,int);
00216 vtkSetMacro(ReplacementValue,double);
00217 vtkGetMacro(ReplacementValue,double);
00219
00220 protected:
00221 vtkArrayCalculator();
00222 ~vtkArrayCalculator();
00223
00224 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00225
00226 char * Function;
00227 char * ResultArrayName;
00228 char ** ScalarArrayNames;
00229 char ** VectorArrayNames;
00230 char ** ScalarVariableNames;
00231 char ** VectorVariableNames;
00232 int NumberOfScalarArrays;
00233 int NumberOfVectorArrays;
00234 int AttributeMode;
00235 int * SelectedScalarComponents;
00236 int ** SelectedVectorComponents;
00237 vtkFunctionParser* FunctionParser;
00238
00239 int ReplaceInvalidValues;
00240 double ReplacementValue;
00241
00242 int CoordinateResults;
00243 char ** CoordinateScalarVariableNames;
00244 char ** CoordinateVectorVariableNames;
00245 int * SelectedCoordinateScalarComponents;
00246 int ** SelectedCoordinateVectorComponents;
00247 int NumberOfCoordinateScalarArrays;
00248 int NumberOfCoordinateVectorArrays;
00249
00250 int ResultArrayType;
00251 private:
00252 vtkArrayCalculator(const vtkArrayCalculator&);
00253 void operator=(const vtkArrayCalculator&);
00254 };
00255
00256 #endif