VTK: Filters/Geometry/vtkAttributeSmoothingFilter.h Source File

| 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
111 static vtkAttributeSmoothingFilter* New();
112 vtkTypeMacro(vtkAttributeSmoothingFilter, vtkDataSetAlgorithm);
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
137 enum SmoothingStrategyType
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); }
162 void SetSmoothingStrategyToAdjacentToBoundary()
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
183 enum InterpolationWeightsType
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
222 void ClearExcludedArrays()
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:
249 vtkAttributeSmoothingFilter();
250 ~vtkAttributeSmoothingFilter() override = default;
251
252 int NumberOfIterations;
253 double RelaxationFactor;
254 int SmoothingStrategy;
255 vtkSmartPointer<vtkUnsignedCharArray> SmoothingMask;
256 int WeightsType;
257
258 std::vector<std::string> ExcludedArrays;
259
260 int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
261
262 private:
263 vtkAttributeSmoothingFilter(const vtkAttributeSmoothingFilter&) = delete;
264 void operator=(const vtkAttributeSmoothingFilter&) = delete;
265 };
266 VTK_ABI_NAMESPACE_END
267
268 #endif
vtkAttributeSmoothingFilter
smooth mesh point attribute data using distance weighted Laplacian kernel
Definition: vtkAttributeSmoothingFilter.h:104
vtkAttributeSmoothingFilter::GetExcludedArray
const char * GetExcludedArray(int i)
Return the name of the ith excluded array.
Definition: vtkAttributeSmoothingFilter.h:238
vtkAttributeSmoothingFilter::vtkGetSmartPointerMacro
vtkGetSmartPointerMacro(SmoothingMask, vtkUnsignedCharArray)
Specify the smoothing mask to use (which takes effect only when a SMOOTHING_MASK smoothing strategy i...
vtkAttributeSmoothingFilter::ExcludedArrays
std::vector< std::string > ExcludedArrays
Definition: vtkAttributeSmoothingFilter.h:258
vtkAttributeSmoothingFilter::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiation, to obtain type information, and print the state of a class instan...
vtkAttributeSmoothingFilter::WeightsType
int WeightsType
Definition: vtkAttributeSmoothingFilter.h:256
vtkAttributeSmoothingFilter::SmoothingMask
vtkSmartPointer< vtkUnsignedCharArray > SmoothingMask
Definition: vtkAttributeSmoothingFilter.h:255
vtkAttributeSmoothingFilter::ClearExcludedArrays
void ClearExcludedArrays()
Clears the contents of excluded array list.
Definition: vtkAttributeSmoothingFilter.h:222
vtkAttributeSmoothingFilter::AddExcludedArray
void AddExcludedArray(const std::string &excludedArray)
Adds an array to the list of arrays which are to be excluded from the interpolation process.
Definition: vtkAttributeSmoothingFilter.h:211
vtkAttributeSmoothingFilter::SetWeightsTypeToAverage
void SetWeightsTypeToAverage()
Indicate how to compute weights, using 1) a simple average of all connected points in the stencil; 2)...
Definition: vtkAttributeSmoothingFilter.h:200
vtkAttributeSmoothingFilter::SetSmoothingStrategyToAdjacentToBoundary
void SetSmoothingStrategyToAdjacentToBoundary()
Indicate how to constrain smoothing of the attribute data.
Definition: vtkAttributeSmoothingFilter.h:162
vtkAttributeSmoothingFilter::vtkSetSmartPointerMacro
vtkSetSmartPointerMacro(SmoothingMask, vtkUnsignedCharArray)
Specify the smoothing mask to use (which takes effect only when a SMOOTHING_MASK smoothing strategy i...
vtkAttributeSmoothingFilter::SmoothingStrategyType
SmoothingStrategyType
Definition: vtkAttributeSmoothingFilter.h:138
vtkAttributeSmoothingFilter::GetNumberOfExcludedArrays
int GetNumberOfExcludedArrays()
Return the number of excluded arrays.
Definition: vtkAttributeSmoothingFilter.h:232
vtkAttributeSmoothingFilter::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks the algorithm to do its work.
vtkAttributeSmoothingFilter::New
static vtkAttributeSmoothingFilter * New()
Standard methods for instantiation, to obtain type information, and print the state of a class instan...
vtkAttributeSmoothingFilter::SetWeightsTypeToDistance
void SetWeightsTypeToDistance()
Indicate how to compute weights, using 1) a simple average of all connected points in the stencil; 2)...
Definition: vtkAttributeSmoothingFilter.h:201
vtkAttributeSmoothingFilter::RelaxationFactor
double RelaxationFactor
Definition: vtkAttributeSmoothingFilter.h:253
vtkAttributeSmoothingFilter::SmoothingStrategy
int SmoothingStrategy
Definition: vtkAttributeSmoothingFilter.h:254
vtkAttributeSmoothingFilter::InterpolationWeightsType
InterpolationWeightsType
Definition: vtkAttributeSmoothingFilter.h:184
vtkAttributeSmoothingFilter::SetWeightsTypeToDistance2
void SetWeightsTypeToDistance2()
Indicate how to compute weights, using 1) a simple average of all connected points in the stencil; 2)...
Definition: vtkAttributeSmoothingFilter.h:202
vtkAttributeSmoothingFilter::~vtkAttributeSmoothingFilter
~vtkAttributeSmoothingFilter() override=default
vtkAttributeSmoothingFilter::SetSmoothingStrategyToSmoothingMask
void SetSmoothingStrategyToSmoothingMask()
Indicate how to constrain smoothing of the attribute data.
Definition: vtkAttributeSmoothingFilter.h:166
vtkAttributeSmoothingFilter::vtkAttributeSmoothingFilter
vtkAttributeSmoothingFilter()
vtkAttributeSmoothingFilter::SetSmoothingStrategyToAllPoints
void SetSmoothingStrategyToAllPoints()
Indicate how to constrain smoothing of the attribute data.
Definition: vtkAttributeSmoothingFilter.h:160
vtkAttributeSmoothingFilter::NumberOfIterations
int NumberOfIterations
Definition: vtkAttributeSmoothingFilter.h:252
vtkAttributeSmoothingFilter::SetSmoothingStrategyToAllButBoundary
void SetSmoothingStrategyToAllButBoundary()
Indicate how to constrain smoothing of the attribute data.
Definition: vtkAttributeSmoothingFilter.h:161
vtkDataSetAlgorithm
Superclass for algorithms that produce output of the same type as input.
Definition: vtkDataSetAlgorithm.h:38
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:40
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:72
vtkObject::Modified
virtual void Modified()
Update the modification time for this object.
vtkSmartPointer< vtkUnsignedCharArray >
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:40
vtkX3D::string
@ string
Definition: vtkX3D.h:490
vtkDataSetAlgorithm.h
vtkSmartPointer.h
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:144
vtkUnsignedCharArray.h