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 =========================================================================*/
61 #ifndef vtkArrayCalculator_h
62 #define vtkArrayCalculator_h
63 
64 #include "vtkFiltersCoreModule.h" // For export macro
65 #include "vtkDataSetAlgorithm.h"
66 
67 class vtkFunctionParser;
68 
69 #define VTK_ATTRIBUTE_MODE_DEFAULT 0
70 #define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
71 #define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
72 #define VTK_ATTRIBUTE_MODE_USE_VERTEX_DATA 3
73 #define VTK_ATTRIBUTE_MODE_USE_EDGE_DATA 4
74 
75 class VTKFILTERSCORE_EXPORT vtkArrayCalculator : public vtkDataSetAlgorithm
76 {
77 public:
79  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
80 
81  static vtkArrayCalculator *New();
82 
84 
87  virtual void SetFunction(const char* function);
88  vtkGetStringMacro(Function);
90 
92 
98  void AddScalarArrayName(const char* arrayName, int component = 0);
99  void AddVectorArrayName(const char* arrayName, int component0 = 0,
100  int component1 = 1, int component2 = 2);
102 
104 
108  void AddScalarVariable(const char* variableName, const char* arrayName,
109  int component = 0);
110  void AddVectorVariable(const char* variableName, const char* arrayName,
111  int component0 = 0, int component1 = 1,
112  int component2 = 2);
114 
116 
120  void AddCoordinateScalarVariable(const char* variableName,
121  int component = 0);
122  void AddCoordinateVectorVariable(const char* variableName,
123  int component0 = 0, int component1 = 1,
124  int component2 = 2);
126 
128 
134  void SetResultArrayName(const char* name);
135  vtkGetStringMacro(ResultArrayName);
137 
139 
143  vtkGetMacro(ResultArrayType,int);
144  vtkSetMacro(ResultArrayType,int);
146 
148 
154  vtkGetMacro(CoordinateResults, int);
155  vtkSetMacro(CoordinateResults, int);
156  vtkBooleanMacro(CoordinateResults, int);
158 
160 
165  vtkGetMacro(ResultNormals, bool);
166  vtkSetMacro(ResultNormals, bool);
167  vtkBooleanMacro(ResultNormals, bool);
169 
171 
176  vtkGetMacro(ResultTCoords, bool);
177  vtkSetMacro(ResultTCoords, bool);
178  vtkBooleanMacro(ResultTCoords, bool);
180 
182 
190  vtkSetMacro(AttributeMode,int);
191  vtkGetMacro(AttributeMode,int);
193  {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_DEFAULT);};
195  {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_POINT_DATA);};
197  {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_CELL_DATA);};
199  {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_VERTEX_DATA);};
201  {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_EDGE_DATA);};
202  const char *GetAttributeModeAsString();
204 
208  void RemoveAllVariables();
209 
213  virtual void RemoveScalarVariables();
214 
218  virtual void RemoveVectorVariables();
219 
223  virtual void RemoveCoordinateScalarVariables();
224 
228  virtual void RemoveCoordinateVectorVariables();
229 
231 
234  char** GetScalarArrayNames() { return this->ScalarArrayNames; }
235  char* GetScalarArrayName(int i);
236  char** GetVectorArrayNames() { return this->VectorArrayNames; }
237  char* GetVectorArrayName(int i);
238  char** GetScalarVariableNames() { return this->ScalarVariableNames; }
239  char* GetScalarVariableName(int i);
240  char** GetVectorVariableNames() { return this->VectorVariableNames; }
241  char* GetVectorVariableName(int i);
242  int* GetSelectedScalarComponents() { return this->SelectedScalarComponents; }
243  int GetSelectedScalarComponent(int i);
244  int** GetSelectedVectorComponents() { return this->SelectedVectorComponents;}
245  int* GetSelectedVectorComponents(int i);
246  vtkGetMacro(NumberOfScalarArrays, int);
247  vtkGetMacro(NumberOfVectorArrays, int);
249 
251 
257  vtkSetMacro(ReplaceInvalidValues,int);
258  vtkGetMacro(ReplaceInvalidValues,int);
259  vtkBooleanMacro(ReplaceInvalidValues,int);
260  vtkSetMacro(ReplacementValue,double);
261  vtkGetMacro(ReplacementValue,double);
263 
264 protected:
266  ~vtkArrayCalculator() VTK_OVERRIDE;
267 
268  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
269 
270  char * Function;
271  char * ResultArrayName;
272  char ** ScalarArrayNames;
273  char ** VectorArrayNames;
274  char ** ScalarVariableNames;
275  char ** VectorVariableNames;
276  int NumberOfScalarArrays;
277  int NumberOfVectorArrays;
278  int AttributeMode;
279  int * SelectedScalarComponents;
280  int ** SelectedVectorComponents;
281  vtkFunctionParser* FunctionParser;
282 
283  int ReplaceInvalidValues;
284  double ReplacementValue;
285 
286  int CoordinateResults;
287  bool ResultNormals;
288  bool ResultTCoords;
289  char ** CoordinateScalarVariableNames;
290  char ** CoordinateVectorVariableNames;
291  int * SelectedCoordinateScalarComponents;
292  int ** SelectedCoordinateVectorComponents;
293  int NumberOfCoordinateScalarArrays;
294  int NumberOfCoordinateVectorArrays;
295 
296  int ResultArrayType;
297 private:
298  vtkArrayCalculator(const vtkArrayCalculator&) VTK_DELETE_FUNCTION;
299  void operator=(const vtkArrayCalculator&) VTK_DELETE_FUNCTION;
300 };
301 
302 #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:33
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.