VTK  9.0.1
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(
104  const char* arrayName, int component0 = 0, int component1 = 1, int component2 = 2);
106 
108 
112  void AddScalarVariable(const char* variableName, const char* arrayName, int component = 0);
113  void AddVectorVariable(const char* variableName, const char* arrayName, int component0 = 0,
114  int component1 = 1, int component2 = 2);
116 
118 
122  void AddCoordinateScalarVariable(const char* variableName, int component = 0);
123  void AddCoordinateVectorVariable(
124  const char* variableName, int component0 = 0, int component1 = 1, 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, vtkTypeBool);
155  vtkSetMacro(CoordinateResults, vtkTypeBool);
156  vtkBooleanMacro(CoordinateResults, vtkTypeBool);
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 
192 #ifndef VTK_LEGACY_REMOVE
193  VTK_LEGACY(void SetAttributeMode(int newMode);)
194  VTK_LEGACY(int GetAttributeMode();)
195  VTK_LEGACY(void SetAttributeModeToDefault()) { this->SetAttributeType(DEFAULT_ATTRIBUTE_TYPE); }
197  {
198  this->SetAttributeType(vtkDataObject::POINT);
199  }
200  VTK_LEGACY(void SetAttributeModeToUseCellData()) { this->SetAttributeType(vtkDataObject::CELL); }
202  {
203  this->SetAttributeType(vtkDataObject::VERTEX);
204  }
205  VTK_LEGACY(void SetAttributeModeToUseEdgeData()) { this->SetAttributeType(vtkDataObject::EDGE); }
206  VTK_LEGACY(const char* GetAttributeModeAsString());
207 #endif
208 
209 
213  const char* GetAttributeTypeAsString();
214 
215  static const int DEFAULT_ATTRIBUTE_TYPE = -1;
217 
223  vtkSetMacro(AttributeType, int);
224  vtkGetMacro(AttributeType, int);
225  void SetAttributeTypeToDefault() { this->SetAttributeType(DEFAULT_ATTRIBUTE_TYPE); }
226  void SetAttributeTypeToPointData() { this->SetAttributeType(vtkDataObject::POINT); }
227  void SetAttributeTypeToCellData() { this->SetAttributeType(vtkDataObject::CELL); }
228  void SetAttributeTypeToEdgeData() { this->SetAttributeType(vtkDataObject::EDGE); }
229  void SetAttributeTypeToVertexData() { this->SetAttributeType(vtkDataObject::VERTEX); }
230  void SetAttributeTypeToRowData() { this->SetAttributeType(vtkDataObject::ROW); }
232 
236  void RemoveAllVariables();
237 
241  virtual void RemoveScalarVariables();
242 
246  virtual void RemoveVectorVariables();
247 
251  virtual void RemoveCoordinateScalarVariables();
252 
256  virtual void RemoveCoordinateVectorVariables();
257 
259 
262  char** GetScalarArrayNames() { return this->ScalarArrayNames; }
263  char* GetScalarArrayName(int i);
264  char** GetVectorArrayNames() { return this->VectorArrayNames; }
265  char* GetVectorArrayName(int i);
266  char** GetScalarVariableNames() { return this->ScalarVariableNames; }
267  char* GetScalarVariableName(int i);
268  char** GetVectorVariableNames() { return this->VectorVariableNames; }
269  char* GetVectorVariableName(int i);
270  int* GetSelectedScalarComponents() { return this->SelectedScalarComponents; }
271  int GetSelectedScalarComponent(int i);
272  int** GetSelectedVectorComponents() { return this->SelectedVectorComponents; }
273  int* GetSelectedVectorComponents(int i);
274  vtkGetMacro(NumberOfScalarArrays, int);
275  vtkGetMacro(NumberOfVectorArrays, int);
277 
279 
285  vtkSetMacro(ReplaceInvalidValues, vtkTypeBool);
286  vtkGetMacro(ReplaceInvalidValues, vtkTypeBool);
287  vtkBooleanMacro(ReplaceInvalidValues, vtkTypeBool);
288  vtkSetMacro(ReplacementValue, double);
289  vtkGetMacro(ReplacementValue, double);
291 
293 
299  vtkSetMacro(IgnoreMissingArrays, bool);
300  vtkGetMacro(IgnoreMissingArrays, bool);
301  vtkBooleanMacro(IgnoreMissingArrays, bool);
302 
307  vtkDataSet* GetDataSetOutput();
308 
309 protected:
311  ~vtkArrayCalculator() override;
312 
313  int FillInputPortInformation(int, vtkInformation*) override;
314 
315  // Do the bulk of the work
316  int ProcessDataObject(vtkDataObject* input, vtkDataObject* output);
317 
319 
323  int GetAttributeTypeFromInput(vtkDataObject* input);
324 
325  char* Function;
337 
341 
351 
353 
354 private:
355  vtkArrayCalculator(const vtkArrayCalculator&) = delete;
356  void operator=(const vtkArrayCalculator&) = delete;
357 };
358 
359 #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
general representation of visualization data
Definition: vtkDataObject.h:59
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()