VTK  9.3.20240328
vtkGradientFilter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 
53 #ifndef vtkGradientFilter_h
54 #define vtkGradientFilter_h
55 
56 #include "vtkDataSetAlgorithm.h"
57 #include "vtkFiltersGeneralModule.h" // For export macro
58 
59 VTK_ABI_NAMESPACE_BEGIN
61 
62 class VTKFILTERSGENERAL_EXPORT vtkGradientFilter : public vtkDataSetAlgorithm
63 {
64 public:
66 
71  void PrintSelf(ostream& os, vtkIndent indent) override;
73 
76  {
77  All = 0,
78  Patch = 1,
79  DataSetMax = 2
80  };
81 
85  {
86  Zero = 0,
87  NaN = 1,
88  DataTypeMin = 2,
89  DataTypeMax = 3
90  };
91 
93 
99  virtual void SetInputScalars(int fieldAssociation, const char* name);
100  virtual void SetInputScalars(int fieldAssociation, int fieldAttributeType);
102 
104 
109  vtkGetStringMacro(ResultArrayName);
110  vtkSetStringMacro(ResultArrayName);
112 
114 
119  vtkGetStringMacro(DivergenceArrayName);
120  vtkSetStringMacro(DivergenceArrayName);
122 
124 
129  vtkGetStringMacro(VorticityArrayName);
130  vtkSetStringMacro(VorticityArrayName);
132 
134 
139  vtkGetStringMacro(QCriterionArrayName);
140  vtkSetStringMacro(QCriterionArrayName);
142 
144 
153  vtkGetMacro(FasterApproximation, vtkTypeBool);
154  vtkSetMacro(FasterApproximation, vtkTypeBool);
155  vtkBooleanMacro(FasterApproximation, vtkTypeBool);
157 
159 
164  vtkSetMacro(ComputeGradient, vtkTypeBool);
165  vtkGetMacro(ComputeGradient, vtkTypeBool);
166  vtkBooleanMacro(ComputeGradient, vtkTypeBool);
168 
170 
176  vtkSetMacro(ComputeDivergence, vtkTypeBool);
177  vtkGetMacro(ComputeDivergence, vtkTypeBool);
178  vtkBooleanMacro(ComputeDivergence, vtkTypeBool);
180 
182 
188  vtkSetMacro(ComputeVorticity, vtkTypeBool);
189  vtkGetMacro(ComputeVorticity, vtkTypeBool);
190  vtkBooleanMacro(ComputeVorticity, vtkTypeBool);
192 
194 
201  vtkSetMacro(ComputeQCriterion, vtkTypeBool);
202  vtkGetMacro(ComputeQCriterion, vtkTypeBool);
203  vtkBooleanMacro(ComputeQCriterion, vtkTypeBool);
205 
207 
211  vtkSetClampMacro(ContributingCellOption, int, 0, 2);
212  vtkGetMacro(ContributingCellOption, int);
214 
216 
221  vtkSetClampMacro(ReplacementValueOption, int, 0, 3);
222  vtkGetMacro(ReplacementValueOption, int);
224 
225 protected:
227  ~vtkGradientFilter() override;
228 
231 
237  virtual int ComputeUnstructuredGridGradient(vtkDataArray* Array, int fieldAssociation,
238  vtkDataSet* input, bool computeVorticity, bool computeQCriterion, bool computeDivergence,
239  vtkDataSet* output);
240 
246  virtual int ComputeRegularGridGradient(vtkDataArray* Array, int* dims, int fieldAssociation,
247  bool computeVorticity, bool computeQCriterion, bool computeDivergence, vtkDataSet* output,
248  vtkUnsignedCharArray* ghosts, unsigned char hiddenGhost);
249 
257 
263 
269 
275 
281 
292 
298 
305 
312 
319 
325 
332 
333 private:
334  vtkGradientFilter(const vtkGradientFilter&) = delete;
335  void operator=(const vtkGradientFilter&) = delete;
336 };
337 
338 VTK_ABI_NAMESPACE_END
339 #endif //_vtkGradientFilter_h
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:154
Superclass for algorithms that produce output of the same type as input.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:165
A general filter for gradient estimation.
char * QCriterionArrayName
If non-null then it contains the name of the outputted Q criterion array.
~vtkGradientFilter() override
int ReplacementValueOption
Option to specify what replacement value or entities that don't have any gradient computed over them ...
char * VorticityArrayName
If non-null then it contains the name of the outputted vorticity array.
virtual void SetInputScalars(int fieldAssociation, int fieldAttributeType)
These are basically a convenience method that calls SetInputArrayToProcess to set the array used as t...
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiation, obtaining type information, and printing.
vtkTypeBool ComputeVorticity
Flag to indicate that vorticity/curl of the input vector is to be computed.
vtkTypeBool ComputeGradient
Flag to indicate that the gradient of the input vector is to be computed.
int ContributingCellOption
Option to specify what cells to include in the gradient computation.
vtkTypeBool ComputeDivergence
Flag to indicate that the divergence of the input vector is to be computed.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks the algorithm to do its work.
char * ResultArrayName
If non-null then it contains the name of the outputted gradient array.
ContributingCellEnum
Options to choose what cells contribute to the gradient calculation.
static vtkGradientFilter * New()
Standard methods for instantiation, obtaining type information, and printing.
int GetOutputArrayType(vtkDataArray *inputArray)
Get the proper array type to compute requested derivative quantities for.
virtual int ComputeUnstructuredGridGradient(vtkDataArray *Array, int fieldAssociation, vtkDataSet *input, bool computeVorticity, bool computeQCriterion, bool computeDivergence, vtkDataSet *output)
Compute the gradients for grids that are not a vtkImageData, vtkRectilinearGrid, or vtkStructuredGrid...
char * DivergenceArrayName
If non-null then it contains the name of the outputted divergence array.
virtual int ComputeRegularGridGradient(vtkDataArray *Array, int *dims, int fieldAssociation, bool computeVorticity, bool computeQCriterion, bool computeDivergence, vtkDataSet *output, vtkUnsignedCharArray *ghosts, unsigned char hiddenGhost)
Compute the gradients for either a vtkImageData, vtkRectilinearGrid or a vtkStructuredGrid.
virtual void SetInputScalars(int fieldAssociation, const char *name)
These are basically a convenience method that calls SetInputArrayToProcess to set the array used as t...
vtkTypeBool FasterApproximation
When this flag is on (default is off), the gradient filter will provide a less accurate (but close) a...
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when each filter in the pipeline decides what portion of its inp...
ReplacementValueEnum
The replacement value or entities that don't have any gradient computed over them based on the Contri...
vtkTypeBool ComputeQCriterion
Flag to indicate that the Q-criterion of the input vector is to be computed.
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of unsigned char
@ name
Definition: vtkX3D.h:219
int vtkTypeBool
Definition: vtkABI.h:64