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 "vtkDataObject.h" // For attribute types
65 #include "vtkFiltersCoreModule.h" // For export macro
67 
68 class vtkDataSet;
69 class vtkFunctionParser;
70 
71 #ifndef VTK_LEGACY_REMOVE
72 #define VTK_ATTRIBUTE_MODE_DEFAULT 0
73 #define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
74 #define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
75 #define VTK_ATTRIBUTE_MODE_USE_VERTEX_DATA 3
76 #define VTK_ATTRIBUTE_MODE_USE_EDGE_DATA 4
77 #endif
78 
79 class VTKFILTERSCORE_EXPORT vtkArrayCalculator : public vtkPassInputTypeAlgorithm
80 {
81 public:
83  void PrintSelf(ostream& os, vtkIndent indent) override;
84 
85  static vtkArrayCalculator *New();
86 
88 
91  virtual void SetFunction(const char* function);
92  vtkGetStringMacro(Function);
94 
96 
102  void AddScalarArrayName(const char* arrayName, int component = 0);
103  void AddVectorArrayName(const char* arrayName, int component0 = 0,
104  int component1 = 1, int component2 = 2);
106 
108 
112  void AddScalarVariable(const char* variableName, const char* arrayName,
113  int component = 0);
114  void AddVectorVariable(const char* variableName, const char* arrayName,
115  int component0 = 0, int component1 = 1,
116  int component2 = 2);
118 
120 
124  void AddCoordinateScalarVariable(const char* variableName,
125  int component = 0);
126  void AddCoordinateVectorVariable(const char* variableName,
127  int component0 = 0, int component1 = 1,
128  int component2 = 2);
130 
132 
138  void SetResultArrayName(const char* name);
139  vtkGetStringMacro(ResultArrayName);
141 
143 
147  vtkGetMacro(ResultArrayType,int);
148  vtkSetMacro(ResultArrayType,int);
150 
152 
158  vtkGetMacro(CoordinateResults, vtkTypeBool);
159  vtkSetMacro(CoordinateResults, vtkTypeBool);
160  vtkBooleanMacro(CoordinateResults, vtkTypeBool);
162 
164 
169  vtkGetMacro(ResultNormals, bool);
170  vtkSetMacro(ResultNormals, bool);
171  vtkBooleanMacro(ResultNormals, bool);
173 
175 
180  vtkGetMacro(ResultTCoords, bool);
181  vtkSetMacro(ResultTCoords, bool);
182  vtkBooleanMacro(ResultTCoords, bool);
184 
186 
196 #ifndef VTK_LEGACY_REMOVE
197  VTK_LEGACY(void SetAttributeMode(int newMode);)
198  VTK_LEGACY(int GetAttributeMode();)
199  VTK_LEGACY(void SetAttributeModeToDefault())
200  {this->SetAttributeType(DEFAULT_ATTRIBUTE_TYPE);};
202  {this->SetAttributeType(vtkDataObject::POINT);};
203  VTK_LEGACY(void SetAttributeModeToUseCellData())
204  {this->SetAttributeType(vtkDataObject::CELL);};
206  {this->SetAttributeType(vtkDataObject::VERTEX);};
207  VTK_LEGACY(void SetAttributeModeToUseEdgeData())
208  {this->SetAttributeType(vtkDataObject::EDGE);};
209  VTK_LEGACY(const char *GetAttributeModeAsString());
210 #endif
211 
212 
216  const char *GetAttributeTypeAsString();
217 
218  static const int DEFAULT_ATTRIBUTE_TYPE = -1;
220 
226  vtkSetMacro(AttributeType, int);
227  vtkGetMacro(AttributeType, int);
229  {this->SetAttributeType(DEFAULT_ATTRIBUTE_TYPE);}
231  {this->SetAttributeType(vtkDataObject::POINT);}
233  {this->SetAttributeType(vtkDataObject::CELL);}
235  {this->SetAttributeType(vtkDataObject::EDGE);}
237  {this->SetAttributeType(vtkDataObject::VERTEX);}
239  {this->SetAttributeType(vtkDataObject::ROW);}
241 
245  void RemoveAllVariables();
246 
250  virtual void RemoveScalarVariables();
251 
255  virtual void RemoveVectorVariables();
256 
260  virtual void RemoveCoordinateScalarVariables();
261 
265  virtual void RemoveCoordinateVectorVariables();
266 
268 
271  char** GetScalarArrayNames() { return this->ScalarArrayNames; }
272  char* GetScalarArrayName(int i);
273  char** GetVectorArrayNames() { return this->VectorArrayNames; }
274  char* GetVectorArrayName(int i);
275  char** GetScalarVariableNames() { return this->ScalarVariableNames; }
276  char* GetScalarVariableName(int i);
277  char** GetVectorVariableNames() { return this->VectorVariableNames; }
278  char* GetVectorVariableName(int i);
279  int* GetSelectedScalarComponents() { return this->SelectedScalarComponents; }
280  int GetSelectedScalarComponent(int i);
281  int** GetSelectedVectorComponents() { return this->SelectedVectorComponents;}
282  int* GetSelectedVectorComponents(int i);
283  vtkGetMacro(NumberOfScalarArrays, int);
284  vtkGetMacro(NumberOfVectorArrays, int);
286 
288 
294  vtkSetMacro(ReplaceInvalidValues,vtkTypeBool);
295  vtkGetMacro(ReplaceInvalidValues,vtkTypeBool);
296  vtkBooleanMacro(ReplaceInvalidValues,vtkTypeBool);
297  vtkSetMacro(ReplacementValue,double);
298  vtkGetMacro(ReplacementValue,double);
300 
305  vtkDataSet* GetDataSetOutput();
306 
307 protected:
309  ~vtkArrayCalculator() override;
310 
311  int FillInputPortInformation(int, vtkInformation*) override;
312 
314 
315  char * Function;
327 
330 
340 
342 private:
343  vtkArrayCalculator(const vtkArrayCalculator&) = delete;
344  void operator=(const vtkArrayCalculator&) = delete;
345 };
346 
347 #endif
vtkTypeBool ReplaceInvalidValues
int ** SelectedCoordinateVectorComponents
Superclass for algorithms that produce output of the same type as input.
Store vtkAlgorithm input/output information.
perform mathematical operations on data in field data arrays
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
void SetAttributeTypeToVertexData()
Control which AttributeType the filter operates on (point data or cell data for vtkDataSets).
void SetAttributeTypeToDefault()
Control which AttributeType the filter operates on (point data or cell data for vtkDataSets).
void SetAttributeModeToUseEdgeData()
Control whether the filter operates on point data or cell data.
void SetAttributeTypeToPointData()
Control which AttributeType the filter operates on (point data or cell data for vtkDataSets).
void SetAttributeTypeToCellData()
Control which AttributeType the filter operates on (point data or cell data for vtkDataSets).
vtkFunctionParser * FunctionParser
int * GetSelectedScalarComponents()
Methods to get information about the current variables.
int vtkTypeBool
Definition: vtkABI.h:69
char ** CoordinateVectorVariableNames
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.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
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.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetAttributeTypeToEdgeData()
Control which AttributeType the filter operates on (point data or cell data for vtkDataSets).
Store zero or more vtkInformation instances.
void SetAttributeModeToUseCellData()
Control whether the filter operates on point data or cell data.
int * SelectedCoordinateScalarComponents
int ** GetSelectedVectorComponents()
Methods to get information about the current variables.
vtkTypeBool CoordinateResults
char ** CoordinateScalarVariableNames
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.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when a request asks the algorithm to do its work.
void SetAttributeTypeToRowData()
Control which AttributeType the filter operates on (point data or cell data for vtkDataSets).
static vtkPassInputTypeAlgorithm * New()