VTK
vtkArrayCalculator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkArrayCalculator.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
67 #ifndef vtkArrayCalculator_h
68 #define vtkArrayCalculator_h
69 
70 #include "vtkFiltersCoreModule.h" // For export macro
71 #include "vtkDataSetAlgorithm.h"
72 
73 class vtkFunctionParser;
74 
75 #define VTK_ATTRIBUTE_MODE_DEFAULT 0
76 #define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
77 #define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
78 #define VTK_ATTRIBUTE_MODE_USE_VERTEX_DATA 3
79 #define VTK_ATTRIBUTE_MODE_USE_EDGE_DATA 4
80 
81 class VTKFILTERSCORE_EXPORT vtkArrayCalculator : public vtkDataSetAlgorithm
82 {
83 public:
85  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
86 
88 
90 
93  virtual void SetFunction(const char* function);
94  vtkGetStringMacro(Function);
96 
98 
104  void AddScalarArrayName(const char* arrayName, int component = 0);
105  void AddVectorArrayName(const char* arrayName, int component0 = 0,
106  int component1 = 1, int component2 = 2);
108 
110 
114  void AddScalarVariable(const char* variableName, const char* arrayName,
115  int component = 0);
116  void AddVectorVariable(const char* variableName, const char* arrayName,
117  int component0 = 0, int component1 = 1,
118  int component2 = 2);
120 
122 
126  void AddCoordinateScalarVariable(const char* variableName,
127  int component = 0);
128  void AddCoordinateVectorVariable(const char* variableName,
129  int component0 = 0, int component1 = 1,
130  int component2 = 2);
132 
134 
140  void SetResultArrayName(const char* name);
141  vtkGetStringMacro(ResultArrayName);
143 
145 
149  vtkGetMacro(ResultArrayType,int);
150  vtkSetMacro(ResultArrayType,int);
152 
154 
160  vtkGetMacro(CoordinateResults, int);
161  vtkSetMacro(CoordinateResults, int);
162  vtkBooleanMacro(CoordinateResults, int);
164 
166 
171  vtkGetMacro(ResultNormals, bool);
172  vtkSetMacro(ResultNormals, bool);
173  vtkBooleanMacro(ResultNormals, bool);
175 
177 
182  vtkGetMacro(ResultTCoords, bool);
183  vtkSetMacro(ResultTCoords, bool);
184  vtkBooleanMacro(ResultTCoords, bool);
186 
188 
196  vtkSetMacro(AttributeMode,int);
197  vtkGetMacro(AttributeMode,int);
199  {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_DEFAULT);};
201  {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_POINT_DATA);};
203  {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_CELL_DATA);};
205  {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_VERTEX_DATA);};
207  {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_EDGE_DATA);};
210 
215 
219  virtual void RemoveScalarVariables();
220 
224  virtual void RemoveVectorVariables();
225 
230 
235 
237 
240  char** GetScalarArrayNames() { return this->ScalarArrayNames; }
241  char* GetScalarArrayName(int i);
242  char** GetVectorArrayNames() { return this->VectorArrayNames; }
243  char* GetVectorArrayName(int i);
244  char** GetScalarVariableNames() { return this->ScalarVariableNames; }
245  char* GetScalarVariableName(int i);
246  char** GetVectorVariableNames() { return this->VectorVariableNames; }
247  char* GetVectorVariableName(int i);
248  int* GetSelectedScalarComponents() { return this->SelectedScalarComponents; }
250  int** GetSelectedVectorComponents() { return this->SelectedVectorComponents;}
252  vtkGetMacro(NumberOfScalarArrays, int);
253  vtkGetMacro(NumberOfVectorArrays, int);
255 
257 
263  vtkSetMacro(ReplaceInvalidValues,int);
264  vtkGetMacro(ReplaceInvalidValues,int);
265  vtkBooleanMacro(ReplaceInvalidValues,int);
266  vtkSetMacro(ReplacementValue,double);
267  vtkGetMacro(ReplacementValue,double);
269 
270 protected:
272  ~vtkArrayCalculator() VTK_OVERRIDE;
273 
274  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
275 
276  char * Function;
277  char * ResultArrayName;
278  char ** ScalarArrayNames;
279  char ** VectorArrayNames;
280  char ** ScalarVariableNames;
281  char ** VectorVariableNames;
282  int NumberOfScalarArrays;
283  int NumberOfVectorArrays;
284  int AttributeMode;
285  int * SelectedScalarComponents;
286  int ** SelectedVectorComponents;
287  vtkFunctionParser* FunctionParser;
288 
289  int ReplaceInvalidValues;
290  double ReplacementValue;
291 
292  int CoordinateResults;
293  bool ResultNormals;
294  bool ResultTCoords;
295  char ** CoordinateScalarVariableNames;
296  char ** CoordinateVectorVariableNames;
297  int * SelectedCoordinateScalarComponents;
298  int ** SelectedCoordinateVectorComponents;
299  int NumberOfCoordinateScalarArrays;
300  int NumberOfCoordinateVectorArrays;
301 
302  int ResultArrayType;
303 private:
304  vtkArrayCalculator(const vtkArrayCalculator&) VTK_DELETE_FUNCTION;
305  void operator=(const vtkArrayCalculator&) VTK_DELETE_FUNCTION;
306 };
307 
308 #endif
perform mathematical operations on data in field data arrays
void SetResultArrayName(const char *name)
Set the name of the array in which to store the result of evaluating this function.
char * GetVectorVariableName(int i)
char ** GetScalarArrayNames()
Methods to get information about the current variables.
void RemoveAllVariables()
Remove all the variable names and their associated array names.
virtual void RemoveCoordinateVectorVariables()
Remove all the coordinate variables.
int ** GetSelectedVectorComponents()
char * GetScalarArrayName(int i)
void AddScalarVariable(const char *variableName, const char *arrayName, int component=0)
Add a variable name, a corresponding array name, and which components of the array to use.
virtual void SetFunction(const char *function)
Set/Get the function to be evaluated.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void AddVectorArrayName(const char *arrayName, int component0=0, int component1=1, int component2=2)
void AddCoordinateScalarVariable(const char *variableName, int component=0)
Add a variable name, a corresponding array name, and which components of the array to use.
int * GetSelectedVectorComponents(int i)
virtual void RemoveVectorVariables()
Remove all the scalar variable names and their associated array names.
char * GetVectorArrayName(int i)
void SetAttributeModeToUseVertexData()
void AddVectorVariable(const char *variableName, const char *arrayName, int component0=0, int component1=1, int component2=2)
char * GetScalarVariableName(int i)
char ** GetScalarVariableNames()
void AddCoordinateVectorVariable(const char *variableName, int component0=0, int component1=1, int component2=2)
int GetSelectedScalarComponent(int i)
virtual void RemoveScalarVariables()
Remove all the scalar variable names and their associated array names.
void AddScalarArrayName(const char *arrayName, int component=0)
Add an array name to the list of arrays used in the function and specify which components of the arra...
~vtkArrayCalculator() override
virtual void RemoveCoordinateScalarVariables()
Remove all the coordinate variables.
const char * GetAttributeModeAsString()
static vtkArrayCalculator * New()
char ** GetVectorVariableNames()
Superclass for algorithms that produce output of the same type as input.
Parse and evaluate a mathematical expression.
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
@ component
Definition: vtkX3D.h:175
@ name
Definition: vtkX3D.h:219
#define VTK_ATTRIBUTE_MODE_USE_VERTEX_DATA
#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA
#define VTK_ATTRIBUTE_MODE_USE_EDGE_DATA
#define VTK_ATTRIBUTE_MODE_DEFAULT
#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.