VTK  9.3.1
vtkSPHKernel.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
43 #ifndef vtkSPHKernel_h
44 #define vtkSPHKernel_h
45 
46 #include "vtkFiltersPointsModule.h" // For export macro
47 #include "vtkInterpolationKernel.h"
48 
49 VTK_ABI_NAMESPACE_BEGIN
50 class vtkIdList;
51 class vtkDoubleArray;
52 class vtkDataArray;
53 class vtkFloatArray;
54 
55 class VTKFILTERSPOINTS_EXPORT vtkSPHKernel : public vtkInterpolationKernel
56 {
57 public:
59 
63  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
67 
71  vtkSetClampMacro(SpatialStep, double, 0.0, VTK_FLOAT_MAX);
72  vtkGetMacro(SpatialStep, double);
74 
76 
79  vtkSetClampMacro(Dimension, int, 1, 3);
80  vtkGetMacro(Dimension, int);
82 
84 
88  vtkGetMacro(CutoffFactor, double);
90 
92 
98  virtual void SetCutoffArray(vtkDataArray*);
99  vtkGetObjectMacro(CutoffArray, vtkDataArray);
101 
103 
107  virtual void SetDensityArray(vtkDataArray*);
108  vtkGetObjectMacro(DensityArray, vtkDataArray);
110 
112 
116  virtual void SetMassArray(vtkDataArray*);
117  vtkGetObjectMacro(MassArray, vtkDataArray);
119 
124  void Initialize(vtkAbstractPointLocator* loc, vtkDataSet* ds, vtkPointData* pd) override;
125 
134  vtkIdType ComputeBasis(double x[3], vtkIdList* pIds, vtkIdType ptId = 0) override;
135 
140  vtkIdType ComputeWeights(double x[3], vtkIdList* pIds, vtkDoubleArray* weights) override;
141 
146  virtual vtkIdType ComputeDerivWeights(
147  double x[3], vtkIdList* pIds, vtkDoubleArray* weights, vtkDoubleArray* gradWeights);
148 
152  virtual double ComputeFunctionWeight(double d) = 0;
153 
158  virtual double ComputeDerivWeight(double d) = 0;
159 
161 
167  vtkGetMacro(NormFactor, double);
169 
170 protected:
171  vtkSPHKernel();
172  ~vtkSPHKernel() override;
173 
174  // Instance variables
175  double SpatialStep; // also known as smoothing length h
176  int Dimension; // sptial dimension of the kernel
177 
178  // Optional arrays aid in the interpolation process (computes volume)
182 
183  // Internal data members generated during construction and initialization
184  // Terminology is spatial step = smoothing length h
185  double CutoffFactor; // varies across each kernel, e.g. cubic=2, quartic=2.5, quintic=3
186  double Cutoff; // the spatial step * cutoff factor
187  double Sigma; // normalization constant
188  double DistNorm; // distance normalization factor 1/(spatial step)
189  double NormFactor; // dimensional normalization factor sigma/(spatial step)^Dimension
190  double DefaultVolume; // if mass and density arrays not specified, use this
191  bool UseCutoffArray; // if single component cutoff array provided
192  bool UseArraysForVolume; // if both mass and density arrays are present
193 
194 private:
195  vtkSPHKernel(const vtkSPHKernel&) = delete;
196  void operator=(const vtkSPHKernel&) = delete;
197 };
198 
199 VTK_ABI_NAMESPACE_END
200 #endif
double CutoffFactor
Definition: vtkSPHKernel.h:185
double SpatialStep
Definition: vtkSPHKernel.h:175
virtual vtkIdType ComputeBasis(double x[3], vtkIdList *pIds, vtkIdType ptId=0)=0
Given a point x (and optional associated point id), determine the points around x which form an inter...
vtkDataArray * MassArray
Definition: vtkSPHKernel.h:181
base class for interpolation kernels
represent and manipulate point attribute data
Definition: vtkPointData.h:29
abstract class to specify dataset behavior
Definition: vtkDataSet.h:52
double DefaultVolume
Definition: vtkSPHKernel.h:190
virtual vtkIdType ComputeWeights(double x[3], vtkIdList *pIds, vtkDoubleArray *weights)=0
Given a point x, and a list of basis points pIds, compute interpolation weights associated with these...
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:30
int vtkIdType
Definition: vtkType.h:315
dynamic, self-adjusting array of double
#define VTK_FLOAT_MAX
Definition: vtkType.h:152
double NormFactor
Definition: vtkSPHKernel.h:189
vtkDataArray * CutoffArray
Definition: vtkSPHKernel.h:179
a simple class to control print indentation
Definition: vtkIndent.h:28
abstract class to quickly locate points in 3-space
list of point or cell ids
Definition: vtkIdList.h:22
double DistNorm
Definition: vtkSPHKernel.h:188
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
virtual void Initialize(vtkAbstractPointLocator *loc, vtkDataSet *ds, vtkPointData *pd)
Initialize the kernel.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard method for type and printing.
bool UseCutoffArray
Definition: vtkSPHKernel.h:191
vtkDataArray * DensityArray
Definition: vtkSPHKernel.h:180
a family of SPH interpolation kernels
Definition: vtkSPHKernel.h:55
bool UseArraysForVolume
Definition: vtkSPHKernel.h:192