VTK  9.3.20240328
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 
108  vtkGetObjectMacro(DensityArray, vtkDataArray);
110 
112 
116  virtual void SetMassArray(vtkDataArray*);
117  vtkGetObjectMacro(MassArray, vtkDataArray);
119 
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 
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:
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
abstract class to quickly locate points in 3-space
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:154
abstract class to specify dataset behavior
Definition: vtkDataSet.h:165
dynamic, self-adjusting array of double
dynamic, self-adjusting array of float
list of point or cell ids
Definition: vtkIdList.h:132
a simple class to control print indentation
Definition: vtkIndent.h:108
base class for interpolation kernels
represent and manipulate point attribute data
Definition: vtkPointData.h:139
a family of SPH interpolation kernels
Definition: vtkSPHKernel.h:56
double DistNorm
Definition: vtkSPHKernel.h:188
virtual double ComputeDerivWeight(double d)=0
Compute weighting factor for derivative quantities given a normalized distance from a sample point.
vtkDataArray * DensityArray
Definition: vtkSPHKernel.h:180
vtkDataArray * CutoffArray
Definition: vtkSPHKernel.h:179
double CutoffFactor
Definition: vtkSPHKernel.h:185
virtual double ComputeFunctionWeight(double d)=0
Compute weighting factor given a normalized distance from a sample point.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiation, obtaining type information, and printing.
virtual void SetDensityArray(vtkDataArray *)
Specify the (optional) density array.
virtual void SetMassArray(vtkDataArray *)
Specify the (optional) mass array.
virtual vtkIdType ComputeDerivWeights(double x[3], vtkIdList *pIds, vtkDoubleArray *weights, vtkDoubleArray *gradWeights)
Given a point x, and a list of basis points pIds, compute interpolation weights, plus derivative weig...
double SpatialStep
Definition: vtkSPHKernel.h:175
void Initialize(vtkAbstractPointLocator *loc, vtkDataSet *ds, vtkPointData *pd) override
Produce the computational parameters for the kernel.
vtkIdType ComputeBasis(double x[3], vtkIdList *pIds, vtkIdType ptId=0) override
Given a point x (and optional associated ptId), determine the points around x which form an interpola...
double DefaultVolume
Definition: vtkSPHKernel.h:190
double NormFactor
Definition: vtkSPHKernel.h:189
vtkIdType ComputeWeights(double x[3], vtkIdList *pIds, vtkDoubleArray *weights) override
Given a point x, and a list of basis points pIds, compute interpolation weights associated with these...
~vtkSPHKernel() override
vtkDataArray * MassArray
Definition: vtkSPHKernel.h:181
bool UseArraysForVolume
Definition: vtkSPHKernel.h:192
virtual void SetCutoffArray(vtkDataArray *)
Specify the (optional) array defining a cutoff distance.
bool UseCutoffArray
Definition: vtkSPHKernel.h:191
int vtkIdType
Definition: vtkType.h:315
#define VTK_FLOAT_MAX
Definition: vtkType.h:152