VTK  9.3.0
vtkAttributeSmoothingFilter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
93 #ifndef vtkAttributeSmoothingFilter_h
94 #define vtkAttributeSmoothingFilter_h
95 
96 #include "vtkDataSetAlgorithm.h"
97 #include "vtkFiltersGeometryModule.h" // For export macro
98 #include "vtkSmartPointer.h" // For point smoothing mask
99 #include "vtkUnsignedCharArray.h" // For point smoothing mask
100 #include <vector> //For std::vector<> - ExcludedArrays
101 
102 VTK_ABI_NAMESPACE_BEGIN
103 class VTKFILTERSGEOMETRY_EXPORT vtkAttributeSmoothingFilter : public vtkDataSetAlgorithm
104 {
105 public:
107 
113  void PrintSelf(ostream& os, vtkIndent indent) override;
115 
117 
121  vtkSetClampMacro(NumberOfIterations, int, 0, VTK_INT_MAX);
122  vtkGetMacro(NumberOfIterations, int);
124 
126 
133  vtkSetClampMacro(RelaxationFactor, double, 0.0, 1.0);
134  vtkGetMacro(RelaxationFactor, double);
136 
138  {
139  ALL_POINTS = 0,
140  ALL_BUT_BOUNDARY = 1,
141  ADJACENT_TO_BOUNDARY = 2,
142  SMOOTHING_MASK = 3
143  };
144 
146 
158  vtkSetClampMacro(SmoothingStrategy, int, ALL_POINTS, SMOOTHING_MASK);
159  vtkGetMacro(SmoothingStrategy, int);
160  void SetSmoothingStrategyToAllPoints() { this->SetSmoothingStrategy(ALL_POINTS); }
161  void SetSmoothingStrategyToAllButBoundary() { this->SetSmoothingStrategy(ALL_BUT_BOUNDARY); }
163  {
164  this->SetSmoothingStrategy(ADJACENT_TO_BOUNDARY);
165  }
166  void SetSmoothingStrategyToSmoothingMask() { this->SetSmoothingStrategy(SMOOTHING_MASK); }
168 
170 
182 
184  {
185  AVERAGE = 0,
186  DISTANCE = 1,
187  DISTANCE2 = 2
188  };
189 
191 
198  vtkSetClampMacro(WeightsType, int, AVERAGE, DISTANCE2);
199  vtkGetMacro(WeightsType, int);
200  void SetWeightsTypeToAverage() { this->SetWeightsType(AVERAGE); }
201  void SetWeightsTypeToDistance() { this->SetWeightsType(DISTANCE); }
202  void SetWeightsTypeToDistance2() { this->SetWeightsType(DISTANCE2); }
204 
206 
211  void AddExcludedArray(const std::string& excludedArray)
212  {
213  this->ExcludedArrays.push_back(excludedArray);
214  this->Modified();
215  }
217 
219 
223  {
224  this->ExcludedArrays.clear();
225  this->Modified();
226  }
228 
232  int GetNumberOfExcludedArrays() { return static_cast<int>(this->ExcludedArrays.size()); }
233 
235 
238  const char* GetExcludedArray(int i)
239  {
240  if (i < 0 || i >= static_cast<int>(this->ExcludedArrays.size()))
241  {
242  return nullptr;
243  }
244  return this->ExcludedArrays[i].c_str();
245  }
247 
248 protected:
250  ~vtkAttributeSmoothingFilter() override = default;
251 
257 
258  std::vector<std::string> ExcludedArrays;
259 
261 
262 private:
264  void operator=(const vtkAttributeSmoothingFilter&) = delete;
265 };
266 VTK_ABI_NAMESPACE_END
267 
268 #endif
smooth mesh point attribute data using distance weighted Laplacian kernel
const char * GetExcludedArray(int i)
Return the name of the ith excluded array.
vtkGetSmartPointerMacro(SmoothingMask, vtkUnsignedCharArray)
Specify the smoothing mask to use (which takes effect only when a SMOOTHING_MASK smoothing strategy i...
std::vector< std::string > ExcludedArrays
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiation, to obtain type information, and print the state of a class instan...
vtkSmartPointer< vtkUnsignedCharArray > SmoothingMask
void ClearExcludedArrays()
Clears the contents of excluded array list.
void AddExcludedArray(const std::string &excludedArray)
Adds an array to the list of arrays which are to be excluded from the interpolation process.
void SetWeightsTypeToAverage()
Indicate how to compute weights, using 1) a simple average of all connected points in the stencil; 2)...
void SetSmoothingStrategyToAdjacentToBoundary()
Indicate how to constrain smoothing of the attribute data.
vtkSetSmartPointerMacro(SmoothingMask, vtkUnsignedCharArray)
Specify the smoothing mask to use (which takes effect only when a SMOOTHING_MASK smoothing strategy i...
int GetNumberOfExcludedArrays()
Return the number of excluded arrays.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks the algorithm to do its work.
static vtkAttributeSmoothingFilter * New()
Standard methods for instantiation, to obtain type information, and print the state of a class instan...
void SetWeightsTypeToDistance()
Indicate how to compute weights, using 1) a simple average of all connected points in the stencil; 2)...
void SetWeightsTypeToDistance2()
Indicate how to compute weights, using 1) a simple average of all connected points in the stencil; 2)...
~vtkAttributeSmoothingFilter() override=default
void SetSmoothingStrategyToSmoothingMask()
Indicate how to constrain smoothing of the attribute data.
void SetSmoothingStrategyToAllPoints()
Indicate how to constrain smoothing of the attribute data.
void SetSmoothingStrategyToAllButBoundary()
Indicate how to constrain smoothing of the attribute data.
Superclass for algorithms that produce output of the same type as input.
a simple class to control print indentation
Definition: vtkIndent.h:38
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
virtual void Modified()
Update the modification time for this object.
dynamic, self-adjusting array of unsigned char
@ string
Definition: vtkX3D.h:490
#define VTK_INT_MAX
Definition: vtkType.h:144