VTK  9.3.1
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 
179  vtkSetSmartPointerMacro(SmoothingMask, vtkUnsignedCharArray);
180  vtkGetSmartPointerMacro(SmoothingMask, vtkUnsignedCharArray);
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
void SetWeightsTypeToDistance2()
Indicate how to compute weights, using 1) a simple average of all connected points in the stencil; 2)...
Store vtkAlgorithm input/output information.
#define VTK_INT_MAX
Definition: vtkType.h:144
void SetSmoothingStrategyToAdjacentToBoundary()
Indicate how to constrain smoothing of the attribute data.
void AddExcludedArray(const std::string &excludedArray)
Adds an array to the list of arrays which are to be excluded from the interpolation process...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetWeightsTypeToAverage()
Indicate how to compute weights, using 1) a simple average of all connected points in the stencil; 2)...
a simple class to control print indentation
Definition: vtkIndent.h:28
smooth mesh point attribute data using distance weighted Laplacian kernel
void SetSmoothingStrategyToSmoothingMask()
Indicate how to constrain smoothing of the attribute data.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when a request asks the algorithm to do its work.
virtual void Modified()
Update the modification time for this object.
void ClearExcludedArrays()
Clears the contents of excluded array list.
dynamic, self-adjusting array of unsigned char
std::vector< std::string > ExcludedArrays
void SetSmoothingStrategyToAllPoints()
Indicate how to constrain smoothing of the attribute data.
int GetNumberOfExcludedArrays()
Return the number of excluded arrays.
Store zero or more vtkInformation instances.
Superclass for algorithms that produce output of the same type as input.
static vtkDataSetAlgorithm * New()
const char * GetExcludedArray(int i)
Return the name of the ith excluded array.
vtkSmartPointer< vtkUnsignedCharArray > SmoothingMask
void SetWeightsTypeToDistance()
Indicate how to compute weights, using 1) a simple average of all connected points in the stencil; 2)...
void SetSmoothingStrategyToAllButBoundary()
Indicate how to constrain smoothing of the attribute data.