VTK  9.0.2
vtkSPHKernel.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSPHKernel.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 =========================================================================*/
55 #ifndef vtkSPHKernel_h
56 #define vtkSPHKernel_h
57 
58 #include "vtkFiltersPointsModule.h" // For export macro
59 #include "vtkInterpolationKernel.h"
60 #include "vtkStdString.h" // For vtkStdString ivars
61 
62 class vtkIdList;
63 class vtkDoubleArray;
64 class vtkDataArray;
65 class vtkFloatArray;
66 
67 class VTKFILTERSPOINTS_EXPORT vtkSPHKernel : public vtkInterpolationKernel
68 {
69 public:
71 
75  void PrintSelf(ostream& os, vtkIndent indent) override;
77 
79 
83  vtkSetClampMacro(SpatialStep, double, 0.0, VTK_FLOAT_MAX);
84  vtkGetMacro(SpatialStep, double);
86 
88 
91  vtkSetClampMacro(Dimension, int, 1, 3);
92  vtkGetMacro(Dimension, int);
94 
96 
100  vtkGetMacro(CutoffFactor, double);
102 
104 
110  virtual void SetCutoffArray(vtkDataArray*);
111  vtkGetObjectMacro(CutoffArray, vtkDataArray);
113 
115 
120  vtkGetObjectMacro(DensityArray, vtkDataArray);
122 
124 
128  virtual void SetMassArray(vtkDataArray*);
129  vtkGetObjectMacro(MassArray, vtkDataArray);
131 
137 
146  vtkIdType ComputeBasis(double x[3], vtkIdList* pIds, vtkIdType ptId = 0) override;
147 
152  vtkIdType ComputeWeights(double x[3], vtkIdList* pIds, vtkDoubleArray* weights) override;
153 
159  double x[3], vtkIdList* pIds, vtkDoubleArray* weights, vtkDoubleArray* gradWeights);
160 
164  virtual double ComputeFunctionWeight(const double d) = 0;
165 
170  virtual double ComputeDerivWeight(const double d) = 0;
171 
173 
179  vtkGetMacro(NormFactor, double);
181 
182 protected:
184  ~vtkSPHKernel() override;
185 
186  // Instance variables
187  double SpatialStep; // also known as smoothing length h
188  int Dimension; // sptial dimension of the kernel
189 
190  // Optional arrays aid in the interpolation process (computes volume)
194 
195  // Internal data members generated during construction and initialization
196  // Terminology is spatial step = smoothing length h
197  double CutoffFactor; // varies across each kernel, e.g. cubic=2, quartic=2.5, quintic=3
198  double Cutoff; // the spatial step * cutoff factor
199  double Sigma; // normalization constant
200  double DistNorm; // distance normalization factor 1/(spatial step)
201  double NormFactor; // dimensional normalization factor sigma/(spatial step)^Dimension
202  double DefaultVolume; // if mass and density arrays not specified, use this
203  bool UseCutoffArray; // if single component cutoff array provided
204  bool UseArraysForVolume; // if both mass and density arrays are present
205 
206 private:
207  vtkSPHKernel(const vtkSPHKernel&) = delete;
208  void operator=(const vtkSPHKernel&) = delete;
209 };
210 
211 #endif
abstract class to quickly locate points in 3-space
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
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
base class for interpolation kernels
represent and manipulate point attribute data
Definition: vtkPointData.h:32
a family of SPH interpolation kernels
Definition: vtkSPHKernel.h:68
double DistNorm
Definition: vtkSPHKernel.h:200
vtkDataArray * DensityArray
Definition: vtkSPHKernel.h:192
vtkDataArray * CutoffArray
Definition: vtkSPHKernel.h:191
double CutoffFactor
Definition: vtkSPHKernel.h:197
virtual double ComputeDerivWeight(const double d)=0
Compute weighting factor for derivative quantities given a normalized distance from a sample point.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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:187
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:202
double NormFactor
Definition: vtkSPHKernel.h:201
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...
virtual double ComputeFunctionWeight(const double d)=0
Compute weighting factor given a normalized distance from a sample point.
~vtkSPHKernel() override
vtkDataArray * MassArray
Definition: vtkSPHKernel.h:193
bool UseArraysForVolume
Definition: vtkSPHKernel.h:204
virtual void SetCutoffArray(vtkDataArray *)
Specify the (optional) array defining a cutoff distance.
bool UseCutoffArray
Definition: vtkSPHKernel.h:203
int vtkIdType
Definition: vtkType.h:338
#define VTK_FLOAT_MAX
Definition: vtkType.h:163