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 
87  static vtkArrayCalculator *New();
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);};
208  const char *GetAttributeModeAsString();
210 
214  void RemoveAllVariables();
215 
219  virtual void RemoveScalarVariables();
220 
224  virtual void RemoveVectorVariables();
225 
229  virtual void RemoveCoordinateScalarVariables();
230 
234  virtual void RemoveCoordinateVectorVariables();
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; }
249  int GetSelectedScalarComponent(int i);
250  int** GetSelectedVectorComponents() { return this->SelectedVectorComponents;}
251  int* GetSelectedVectorComponents(int i);
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
#define VTK_ATTRIBUTE_MODE_USE_VERTEX_DATA
Store vtkAlgorithm input/output information.
perform mathematical operations on data in field data arrays
#define VTK_ATTRIBUTE_MODE_DEFAULT
void SetAttributeModeToUseEdgeData()
Control whether the filter operates on point data or cell data.
#define VTK_ATTRIBUTE_MODE_USE_EDGE_DATA
int * GetSelectedScalarComponents()
Methods to get information about the current variables.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetAttributeModeToUseVertexData()
Control whether the filter operates on point data or cell data.
Parse and evaluate a mathematical expression.
a simple class to control print indentation
Definition: vtkIndent.h:39
char ** GetVectorVariableNames()
Methods to get information about the current variables.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
char ** GetVectorArrayNames()
Methods to get information about the current variables.
char ** GetScalarVariableNames()
Methods to get information about the current variables.
char ** GetScalarArrayNames()
Methods to get information about the current variables.
#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA
Store zero or more vtkInformation instances.
void SetAttributeModeToUseCellData()
Control whether the filter operates on point data or cell data.
Superclass for algorithms that produce output of the same type as input.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
int ** GetSelectedVectorComponents()
Methods to get information about the current variables.
static vtkDataSetAlgorithm * New()
void SetAttributeModeToUsePointData()
Control whether the filter operates on point data or cell data.
void SetAttributeModeToDefault()
Control whether the filter operates on point data or cell data.