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 "vtkDataObject.h" // For attribute types
71 #include "vtkFiltersCoreModule.h" // For export macro
73 
74 class vtkDataSet;
75 class vtkFunctionParser;
76 
77 #ifndef VTK_LEGACY_REMOVE
78 #define VTK_ATTRIBUTE_MODE_DEFAULT 0
79 #define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
80 #define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
81 #define VTK_ATTRIBUTE_MODE_USE_VERTEX_DATA 3
82 #define VTK_ATTRIBUTE_MODE_USE_EDGE_DATA 4
83 #endif
84 
85 class VTKFILTERSCORE_EXPORT vtkArrayCalculator : public vtkPassInputTypeAlgorithm
86 {
87 public:
89  void PrintSelf(ostream& os, vtkIndent indent) override;
90 
91  static vtkArrayCalculator *New();
92 
94 
97  virtual void SetFunction(const char* function);
98  vtkGetStringMacro(Function);
100 
102 
108  void AddScalarArrayName(const char* arrayName, int component = 0);
109  void AddVectorArrayName(const char* arrayName, int component0 = 0,
110  int component1 = 1, int component2 = 2);
112 
114 
118  void AddScalarVariable(const char* variableName, const char* arrayName,
119  int component = 0);
120  void AddVectorVariable(const char* variableName, const char* arrayName,
121  int component0 = 0, int component1 = 1,
122  int component2 = 2);
124 
126 
130  void AddCoordinateScalarVariable(const char* variableName,
131  int component = 0);
132  void AddCoordinateVectorVariable(const char* variableName,
133  int component0 = 0, int component1 = 1,
134  int component2 = 2);
136 
138 
144  void SetResultArrayName(const char* name);
145  vtkGetStringMacro(ResultArrayName);
147 
149 
153  vtkGetMacro(ResultArrayType,int);
154  vtkSetMacro(ResultArrayType,int);
156 
158 
164  vtkGetMacro(CoordinateResults, vtkTypeBool);
165  vtkSetMacro(CoordinateResults, vtkTypeBool);
166  vtkBooleanMacro(CoordinateResults, vtkTypeBool);
168 
170 
175  vtkGetMacro(ResultNormals, bool);
176  vtkSetMacro(ResultNormals, bool);
177  vtkBooleanMacro(ResultNormals, bool);
179 
181 
186  vtkGetMacro(ResultTCoords, bool);
187  vtkSetMacro(ResultTCoords, bool);
188  vtkBooleanMacro(ResultTCoords, bool);
190 
192 
202 #ifndef VTK_LEGACY_REMOVE
203  VTK_LEGACY(void SetAttributeMode(int newMode);)
204  VTK_LEGACY(int GetAttributeMode();)
205  VTK_LEGACY(void SetAttributeModeToDefault())
206  {this->SetAttributeType(DEFAULT_ATTRIBUTE_TYPE);};
208  {this->SetAttributeType(vtkDataObject::POINT);};
209  VTK_LEGACY(void SetAttributeModeToUseCellData())
210  {this->SetAttributeType(vtkDataObject::CELL);};
212  {this->SetAttributeType(vtkDataObject::VERTEX);};
213  VTK_LEGACY(void SetAttributeModeToUseEdgeData())
214  {this->SetAttributeType(vtkDataObject::EDGE);};
215  VTK_LEGACY(const char *GetAttributeModeAsString());
216 #endif
217 
218 
222  const char *GetAttributeTypeAsString();
223 
224  static const int DEFAULT_ATTRIBUTE_TYPE = -1;
226 
232  vtkSetMacro(AttributeType, int);
233  vtkGetMacro(AttributeType, int);
235  {this->SetAttributeType(DEFAULT_ATTRIBUTE_TYPE);}
237  {this->SetAttributeType(vtkDataObject::POINT);}
239  {this->SetAttributeType(vtkDataObject::CELL);}
241  {this->SetAttributeType(vtkDataObject::EDGE);}
243  {this->SetAttributeType(vtkDataObject::VERTEX);}
245  {this->SetAttributeType(vtkDataObject::ROW);}
247 
251  void RemoveAllVariables();
252 
256  virtual void RemoveScalarVariables();
257 
261  virtual void RemoveVectorVariables();
262 
266  virtual void RemoveCoordinateScalarVariables();
267 
271  virtual void RemoveCoordinateVectorVariables();
272 
274 
277  char** GetScalarArrayNames() { return this->ScalarArrayNames; }
278  char* GetScalarArrayName(int i);
279  char** GetVectorArrayNames() { return this->VectorArrayNames; }
280  char* GetVectorArrayName(int i);
281  char** GetScalarVariableNames() { return this->ScalarVariableNames; }
282  char* GetScalarVariableName(int i);
283  char** GetVectorVariableNames() { return this->VectorVariableNames; }
284  char* GetVectorVariableName(int i);
285  int* GetSelectedScalarComponents() { return this->SelectedScalarComponents; }
286  int GetSelectedScalarComponent(int i);
287  int** GetSelectedVectorComponents() { return this->SelectedVectorComponents;}
288  int* GetSelectedVectorComponents(int i);
289  vtkGetMacro(NumberOfScalarArrays, int);
290  vtkGetMacro(NumberOfVectorArrays, int);
292 
294 
300  vtkSetMacro(ReplaceInvalidValues,vtkTypeBool);
301  vtkGetMacro(ReplaceInvalidValues,vtkTypeBool);
302  vtkBooleanMacro(ReplaceInvalidValues,vtkTypeBool);
303  vtkSetMacro(ReplacementValue,double);
304  vtkGetMacro(ReplacementValue,double);
306 
311  vtkDataSet* GetDataSetOutput();
312 
313 protected:
315  ~vtkArrayCalculator() override;
316 
317  int FillInputPortInformation(int, vtkInformation*) override;
318 
320 
321  char * Function;
333 
336 
346 
348 private:
349  vtkArrayCalculator(const vtkArrayCalculator&) = delete;
350  void operator=(const vtkArrayCalculator&) = delete;
351 };
352 
353 #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:62
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:39
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()