VTK  9.3.20240424
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
48
49VTK_ABI_NAMESPACE_BEGIN
50class vtkIdList;
51class vtkDoubleArray;
52class vtkDataArray;
53class vtkFloatArray;
54
55class VTKFILTERSPOINTS_EXPORT vtkSPHKernel : public vtkInterpolationKernel
56{
57public:
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
99 vtkGetObjectMacro(CutoffArray, vtkDataArray);
101
103
108 vtkGetObjectMacro(DensityArray, vtkDataArray);
110
112
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
170protected:
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
194private:
195 vtkSPHKernel(const vtkSPHKernel&) = delete;
196 void operator=(const vtkSPHKernel&) = delete;
197};
198
199VTK_ABI_NAMESPACE_END
200#endif
abstract class to quickly locate points in 3-space
abstract superclass for arrays of numeric data
abstract class to specify dataset behavior
Definition vtkDataSet.h:166
dynamic, self-adjusting array of double
dynamic, self-adjusting array of float
list of point or cell ids
Definition vtkIdList.h:133
a simple class to control print indentation
Definition vtkIndent.h:108
base class for interpolation kernels
represent and manipulate point attribute data
a family of SPH interpolation kernels
virtual double ComputeDerivWeight(double d)=0
Compute weighting factor for derivative quantities given a normalized distance from a sample point.
vtkDataArray * DensityArray
vtkDataArray * CutoffArray
double CutoffFactor
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
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
double NormFactor
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
bool UseArraysForVolume
virtual void SetCutoffArray(vtkDataArray *)
Specify the (optional) array defining a cutoff distance.
int vtkIdType
Definition vtkType.h:315
#define VTK_FLOAT_MAX
Definition vtkType.h:152