/usr/include/vtk-7.1/vtkSPHKernel.h is in libvtk7-dev 7.1.1+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkSPHKernel.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkSPHKernel
* @brief a family of SPH interpolation kernels
*
*
* vtkSPHKernel is an abstract superclass for smoothed-particle hydrodynamics
* interpolation kernels as described by D.J. Price (see full reference
* below).
*
* Note that the kernel operates over a volume in space defined by a radius
* at a sampling point. The kernel implicitly assumes that the particles
* making up the input data satisfies physical properties such as
* conservation of mass. Therefore subclasses of this kernel are not
* generally applicable for interpolation processes, and therefore operate in
* conjunction with the vthSPHInterpolator class.
*
* By default the kernel computes local particle volume from the spatial step^3.
* However, if both an optional mass and density arrays are provided then they are
* used to compute local volume.
*
* Also be default, the local neighborhood around a point to be interpolated is
* computed as the CutoffFactor * SpatialStep. (Note the CutoffFactor varies for
* each type of SPH kernel.) However, the user may specify a CutoffArray which
* enables variable cutoff distances per each point.
*
* @warning
* For more information see D.J. Price, Smoothed particle hydrodynamics and
* magnetohydrodynamics, J. Comput. Phys. 231:759-794, 2012. Especially
* equation 49.
*
* @par Acknowledgments:
* The following work has been generously supported by Altair Engineering
* and FluiDyna GmbH. Please contact Steve Cosgrove or Milos Stanic for
* more information.
*
* @sa
* vtkSPHKernel vtkSPHQuinticKernel vtkInterpolationKernel vtkGaussianKernel
* vtkShepardKernel vtkLinearKernel
*/
#ifndef vtkSPHKernel_h
#define vtkSPHKernel_h
#include "vtkFiltersPointsModule.h" // For export macro
#include "vtkInterpolationKernel.h"
#include "vtkStdString.h" // For vtkStdString ivars
class vtkIdList;
class vtkDoubleArray;
class vtkDataArray;
class vtkFloatArray;
class VTKFILTERSPOINTS_EXPORT vtkSPHKernel : public vtkInterpolationKernel
{
public:
//@{
/**
* Standard methods for instantiation, obtaining type information, and printing.
*/
vtkTypeMacro(vtkSPHKernel,vtkInterpolationKernel);
void PrintSelf(ostream& os, vtkIndent indent);
//@}
//@{
/**
* The user defined intial particle spatial step. This is also referred to as
* the smoothing length.
*/
vtkSetClampMacro(SpatialStep,double,0.0,VTK_FLOAT_MAX);
vtkGetMacro(SpatialStep,double);
//@}
//@{
/**
* The domain dimension, default to 3.
*/
vtkSetClampMacro(Dimension,int,1,3);
vtkGetMacro(Dimension,int);
//@}
//@{
/**
* Return the cutoff factor. This is hard wired into the kernel (e.g., the
* vtkSPHQuinticKernel has a cutoff factor = 3.0).
*/
vtkGetMacro(CutoffFactor,double);
//@}
//@{
/**
* Specify the (optional) array defining a cutoff distance. If provided this
* distance is used to find the interpolating points within the local
* neighborbood. Otherwise the cutoff distance is defined as the cutoff
* factor times the spatial step size.
*/
virtual void SetCutoffArray(vtkDataArray*);
vtkGetObjectMacro(CutoffArray,vtkDataArray);
//@}
//@{
/**
* Specify the (optional) density array. Used with the mass array to
* compute local particle volumes.
*/
virtual void SetDensityArray(vtkDataArray*);
vtkGetObjectMacro(DensityArray,vtkDataArray);
//@}
//@{
/**
* Specify the (optional) mass array. Used with the density array to
* compute local particle volumes.
*/
virtual void SetMassArray(vtkDataArray*);
vtkGetObjectMacro(MassArray,vtkDataArray);
//@}
/**
* Produce the computational parameters for the kernel. Invoke this method
* after setting initial values like SpatialStep.
*/
virtual void Initialize(vtkAbstractPointLocator *loc, vtkDataSet *ds,
vtkPointData *pd);
/**
* Given a point x (and optional associated ptId), determine the points
* around x which form an interpolation basis. The user must provide the
* vtkIdList pIds, which will be dynamically resized as necessary. The
* method returns the number of points in the basis. Typically this method
* is called before ComputeWeights(). Note that while ptId is optional in most
* cases, if a cutoff array is provided, then ptId must be provided.
*/
virtual vtkIdType ComputeBasis(double x[3], vtkIdList *pIds, vtkIdType ptId=0);
/**
* Given a point x, and a list of basis points pIds, compute interpolation
* weights associated with these basis points.
*/
virtual vtkIdType ComputeWeights(double x[3], vtkIdList *pIds,
vtkDoubleArray *weights);
/**
* Given a point x, and a list of basis points pIds, compute interpolation
* weights, plus derivative weights, associated with these basis points.
*/
virtual vtkIdType ComputeDerivWeights(double x[3], vtkIdList *pIds,
vtkDoubleArray *weights,
vtkDoubleArray *gradWeights);
/**
* Compute weighting factor given a normalized distance from a sample point.
*/
virtual double ComputeFunctionWeight(const double d) = 0;
/**
* Compute weighting factor for derivative quantities given a normalized
* distance from a sample point.
*/
virtual double ComputeDerivWeight(const double d) = 0;
//@{
/**
* Return the SPH normalization factor. This also includes the contribution
* of 1/h^d, where h is the smoothing length (i.e., spatial step) and d is
* the dimension of the kernel. The returned value is only valid after the
* kernel is initialized.
*/
vtkGetMacro(NormFactor,double);
//@}
protected:
vtkSPHKernel();
~vtkSPHKernel();
// Instance variables
double SpatialStep; //also known as smoothing length h
int Dimension; //sptial dimension of the kernel
// Optional arrays aid in the interpolation process (computes volume)
vtkDataArray *CutoffArray;
vtkDataArray *DensityArray;
vtkDataArray *MassArray;
// Internal data members generated during construction and initialization
// Terminology is spatial step = smoothing length h
double CutoffFactor; //varies across each kernel, e.g. cubic=2, quartic=2.5, quintic=3
double Cutoff; //the spatial step * cutoff factor
double Sigma; //normalization constant
double DistNorm; //distance normalization factor 1/(spatial step)
double NormFactor; //dimensional normalization factor sigma/(spatial step)^Dimension
double DefaultVolume; //if mass and density arrays not specified, use this
bool UseCutoffArray; //if single component cutoff array provided
bool UseArraysForVolume; //if both mass and density arrays are present
private:
vtkSPHKernel(const vtkSPHKernel&) VTK_DELETE_FUNCTION;
void operator=(const vtkSPHKernel&) VTK_DELETE_FUNCTION;
};
#endif
|