VTK  9.1.0
vtkSPHInterpolator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSPHInterpolator.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 =========================================================================*/
77 #ifndef vtkSPHInterpolator_h
78 #define vtkSPHInterpolator_h
79 
80 #include "vtkDataSetAlgorithm.h"
81 #include "vtkFiltersPointsModule.h" // For export macro
82 #include "vtkStdString.h" // For vtkStdString ivars
83 #include <vector> //For STL vector
84 
86 class vtkIdList;
87 class vtkDoubleArray;
88 class vtkSPHKernel;
89 class vtkCharArray;
90 class vtkFloatArray;
91 
92 class VTKFILTERSPOINTS_EXPORT vtkSPHInterpolator : public vtkDataSetAlgorithm
93 {
94 public:
96 
102  void PrintSelf(ostream& os, vtkIndent indent) override;
104 
106 
116 
124 
126 
132  vtkGetObjectMacro(Locator, vtkAbstractPointLocator);
134 
136 
141  void SetKernel(vtkSPHKernel* kernel);
142  vtkGetObjectMacro(Kernel, vtkSPHKernel);
144 
146 
150  vtkSetMacro(CutoffArrayName, vtkStdString);
151  vtkGetMacro(CutoffArrayName, vtkStdString);
153 
155 
161  vtkSetMacro(DensityArrayName, vtkStdString);
162  vtkGetMacro(DensityArrayName, vtkStdString);
164 
166 
173  vtkSetMacro(MassArrayName, vtkStdString);
174  vtkGetMacro(MassArrayName, vtkStdString);
176 
178 
182  void AddExcludedArray(const vtkStdString& excludedArray)
183  {
184  this->ExcludedArrays.push_back(excludedArray);
185  this->Modified();
186  }
188 
190 
194  {
195  this->ExcludedArrays.clear();
196  this->Modified();
197  }
199 
203  int GetNumberOfExcludedArrays() { return static_cast<int>(this->ExcludedArrays.size()); }
204 
206 
209  const char* GetExcludedArray(int i)
210  {
211  if (i < 0 || i >= static_cast<int>(this->ExcludedArrays.size()))
212  {
213  return nullptr;
214  }
215  return this->ExcludedArrays[i].c_str();
216  }
218 
220 
225  void AddDerivativeArray(const vtkStdString& derivArray)
226  {
227  this->DerivArrays.push_back(derivArray);
228  this->Modified();
229  }
231 
233 
237  {
238  this->DerivArrays.clear();
239  this->Modified();
240  }
242 
246  int GetNumberOfDerivativeArrays() { return static_cast<int>(this->DerivArrays.size()); }
247 
249 
252  const char* GetDerivativeArray(int i)
253  {
254  if (i < 0 || i >= static_cast<int>(this->DerivArrays.size()))
255  {
256  return nullptr;
257  }
258  return this->DerivArrays[i].c_str();
259  }
261 
262  // How to handle NULL/empty points
264  {
265  MASK_POINTS = 0,
266  NULL_VALUE = 1
267  };
268 
270 
279  vtkSetMacro(NullPointsStrategy, int);
280  vtkGetMacro(NullPointsStrategy, int);
281  void SetNullPointsStrategyToMaskPoints() { this->SetNullPointsStrategy(MASK_POINTS); }
282  void SetNullPointsStrategyToNullValue() { this->SetNullPointsStrategy(NULL_VALUE); }
284 
286 
292  vtkSetMacro(ValidPointsMaskArrayName, vtkStdString);
293  vtkGetMacro(ValidPointsMaskArrayName, vtkStdString);
295 
297 
302  vtkSetMacro(NullValue, double);
303  vtkGetMacro(NullValue, double);
305 
307 
315  vtkSetMacro(ComputeShepardSum, vtkTypeBool);
316  vtkBooleanMacro(ComputeShepardSum, vtkTypeBool);
317  vtkGetMacro(ComputeShepardSum, vtkTypeBool);
319 
321 
327  vtkSetMacro(ShepardSumArrayName, vtkStdString);
328  vtkGetMacro(ShepardSumArrayName, vtkStdString);
330 
332 
338  vtkSetMacro(PromoteOutputArrays, vtkTypeBool);
339  vtkBooleanMacro(PromoteOutputArrays, vtkTypeBool);
340  vtkGetMacro(PromoteOutputArrays, vtkTypeBool);
342 
344 
348  vtkSetMacro(PassPointArrays, vtkTypeBool);
349  vtkBooleanMacro(PassPointArrays, vtkTypeBool);
350  vtkGetMacro(PassPointArrays, vtkTypeBool);
352 
354 
358  vtkSetMacro(PassCellArrays, vtkTypeBool);
359  vtkBooleanMacro(PassCellArrays, vtkTypeBool);
360  vtkGetMacro(PassCellArrays, vtkTypeBool);
362 
364 
368  vtkSetMacro(PassFieldArrays, vtkTypeBool);
369  vtkBooleanMacro(PassFieldArrays, vtkTypeBool);
370  vtkGetMacro(PassFieldArrays, vtkTypeBool);
372 
374 
380  vtkSetMacro(ShepardNormalization, vtkTypeBool);
381  vtkBooleanMacro(ShepardNormalization, vtkTypeBool);
382  vtkGetMacro(ShepardNormalization, vtkTypeBool);
384 
388  vtkMTimeType GetMTime() override;
389 
390 protected:
393 
396 
398 
401 
402  std::vector<vtkStdString> ExcludedArrays;
403  std::vector<vtkStdString> DerivArrays;
404 
406 
408  double NullValue;
411 
414 
416 
420 
424 
428  virtual void Probe(vtkDataSet* input, vtkDataSet* source, vtkDataSet* output);
429 
434  virtual void PassAttributeData(vtkDataSet* input, vtkDataObject* source, vtkDataSet* output);
435 
436 private:
437  vtkSPHInterpolator(const vtkSPHInterpolator&) = delete;
438  void operator=(const vtkSPHInterpolator&) = delete;
439 };
440 
441 #endif
abstract class to quickly locate points in 3-space
Proxy object to connect input/output ports.
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:49
general representation of visualization data
Definition: vtkDataObject.h:60
Superclass for algorithms that produce output of the same type as input.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:57
dynamic, self-adjusting array of double
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:36
list of point or cell ids
Definition: vtkIdList.h:31
a simple class to control print indentation
Definition: vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
virtual void Modified()
Update the modification time for this object.
interpolate over point cloud using SPH kernels
void SetSourceData(vtkDataObject *source)
Specify the dataset Pc that will be probed by the input points P.
int GetNumberOfDerivativeArrays()
Return the number of derivative arrays.
vtkTypeBool ShepardNormalization
vtkCharArray * ValidPointsMask
virtual void Probe(vtkDataSet *input, vtkDataSet *source, vtkDataSet *output)
Virtual for specialized subclass(es)
void SetLocator(vtkAbstractPointLocator *locator)
Specify a point locator.
static vtkSPHInterpolator * New()
Standard methods for instantiating, obtaining type information, and printing.
void ClearDerivativeArrays()
Clears the contents of derivative array list.
vtkStdString MassArrayName
void SetKernel(vtkSPHKernel *kernel)
Specify an interpolation kernel.
const char * GetExcludedArray(int i)
Return the name of the ith excluded array.
vtkStdString DensityArrayName
vtkTypeBool PromoteOutputArrays
void SetNullPointsStrategyToMaskPoints()
Specify a strategy to use when encountering a "null" point during the interpolation process.
vtkMTimeType GetMTime() override
Get the MTime of this object also considering the locator and kernel.
void AddDerivativeArray(const vtkStdString &derivArray)
Adds an array to the list of arrays whose derivative is to be taken.
void AddExcludedArray(const vtkStdString &excludedArray)
Adds an array to the list of arrays which are to be excluded from the interpolation process.
vtkDataObject * GetSource()
Specify the dataset Pc that will be probed by the input points P.
vtkStdString ShepardSumArrayName
void SetNullPointsStrategyToNullValue()
Specify a strategy to use when encountering a "null" point during the interpolation process.
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify the dataset Pc that will be probed by the input points P.
vtkStdString ValidPointsMaskArrayName
~vtkSPHInterpolator() override
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when each filter in the pipeline decides what portion of its inp...
std::vector< vtkStdString > ExcludedArrays
int GetNumberOfExcludedArrays()
Return the number of excluded arrays.
vtkStdString CutoffArrayName
vtkTypeBool ComputeShepardSum
vtkAbstractPointLocator * Locator
void ClearExcludedArrays()
Clears the contents of excluded array list.
const char * GetDerivativeArray(int i)
Return the name of the ith derivative array.
virtual void PassAttributeData(vtkDataSet *input, vtkDataObject *source, vtkDataSet *output)
Call at end of RequestData() to pass attribute data respecting the PassCellArrays,...
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks the algorithm to do its work.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiating, obtaining type information, and printing.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks for Information.
std::vector< vtkStdString > DerivArrays
a family of SPH interpolation kernels
Definition: vtkSPHKernel.h:68
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:36
int vtkTypeBool
Definition: vtkABI.h:69
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287