Commit 5c8c06a5 authored by Will Schroeder's avatar Will Schroeder

Support cutoff mass/density arrays; 2D kernels

Proper support for 2D SPH kernels is provided. Also, support for
an optional user-provided cutoff array; and local volume calculations
using optionally provided mass and density arrays.

New test for 2D SPH interpolation

Added a new test and regression image in support of 2D SPH
interpolation.

Dashboard warnings fixed

Address dashboard warnings

New regression test image
parent 50bbfcbc
Pipeline #17061 passed with stage
......@@ -1406,6 +1406,7 @@ void vtkStaticPointLocator::BuildLocator()
// hopefully it is cached or otherwise accelerated.
//
bounds = this->DataSet->GetBounds();
int numNonZeroWidths = 3;
for (i=0; i<3; i++)
{
this->Bounds[2*i] = bounds[2*i];
......@@ -1413,19 +1414,34 @@ void vtkStaticPointLocator::BuildLocator()
if ( this->Bounds[2*i+1] <= this->Bounds[2*i] ) //prevent zero width
{
this->Bounds[2*i+1] = this->Bounds[2*i] + 1.0;
numNonZeroWidths--;
}
}
if ( this->Automatic )
{
level = static_cast<double>(numPts) / this->NumberOfPointsPerBucket;
level = ceil( pow(static_cast<double>(level),
static_cast<double>(0.33333333)));
if ( numNonZeroWidths > 0 )
{
level = static_cast<double>(numPts) / this->NumberOfPointsPerBucket;
level = ceil( pow(static_cast<double>(level),
static_cast<double>(1.0/static_cast<double>(numNonZeroWidths))));
}
else
{
level = 1; //all points end up in thesame bucket and are concident!
}
for (i=0; i<3; i++)
{
ndivs[i] = static_cast<int>(level);
if ( bounds[2*i+1] > bounds[2*i] )
{
ndivs[i] = static_cast<int>(level);
}
else
{
ndivs[i] = 1;
}
}
}
}//automatic
else
{
for (i=0; i<3; i++)
......
......@@ -5,4 +5,5 @@ vtk_add_test_python(
TestPointInterpolator2D.py
TestPointInterpolator2D2.py
TestSPHInterpolator.py
TestSPHInterpolator2D.py
)
#!/usr/bin/env python
import vtk
import vtk.test.Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Parameters for testing
res = 250
# Graphics stuff
ren0 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren0)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# create pipeline
#
reader = vtk.vtkXMLUnstructuredGridReader()
reader.SetFileName(VTK_DATA_ROOT + "/Data/SPH_Points2D.vtu")
reader.Update()
output = reader.GetOutput()
scalarRange = output.GetPointData().GetArray("Rho").GetRange()
# Something to sample with
center = output.GetCenter()
bounds = output.GetBounds()
length = output.GetLength()
plane = vtk.vtkPlaneSource()
plane.SetResolution(res,res)
plane.SetOrigin(bounds[0],bounds[2],bounds[4])
plane.SetPoint1(bounds[1],bounds[2],bounds[4])
plane.SetPoint2(bounds[0],bounds[3],bounds[4])
plane.SetCenter(center)
plane.SetNormal(0,0,1)
plane.Update()
timer = vtk.vtkTimerLog()
# SPH kernel------------------------------------------------
sphKernel = vtk.vtkSPHQuinticKernel()
sphKernel.SetSpatialStep(0.00002)
sphKernel.SetDimension(2)
interpolator = vtk.vtkSPHInterpolator()
interpolator.SetInputConnection(plane.GetOutputPort())
interpolator.SetSourceConnection(reader.GetOutputPort())
interpolator.SetKernel(sphKernel)
interpolator.Update()
# Time execution
timer.StartTimer()
interpolator.Update()
timer.StopTimer()
time = timer.GetElapsedTime()
print("Interpolate Points (SPH): {0}".format(time))
intMapper = vtk.vtkPolyDataMapper()
intMapper.SetInputConnection(interpolator.GetOutputPort())
intMapper.SetScalarModeToUsePointFieldData()
intMapper.SelectColorArray("Rho")
intMapper.SetScalarRange(750,1050)
intActor = vtk.vtkActor()
intActor.SetMapper(intMapper)
# Create an outline
outline = vtk.vtkOutlineFilter()
outline.SetInputData(output)
outlineMapper = vtk.vtkPolyDataMapper()
outlineMapper.SetInputConnection(outline.GetOutputPort())
outlineActor = vtk.vtkActor()
outlineActor.SetMapper(outlineMapper)
ren0.AddActor(intActor)
ren0.AddActor(outlineActor)
ren0.SetBackground(0.1, 0.2, 0.4)
iren.Initialize()
renWin.Render()
#iren.Start()
......@@ -38,7 +38,7 @@ vtkGeneralizedKernel::~vtkGeneralizedKernel()
//----------------------------------------------------------------------------
vtkIdType vtkGeneralizedKernel::
ComputeBasis(double x[3], vtkIdList *pIds)
ComputeBasis(double x[3], vtkIdList *pIds, vtkIdType)
{
if ( this->KernelFootprint == vtkGeneralizedKernel::RADIUS )
{
......
......@@ -74,9 +74,15 @@ public:
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Based on the kernel style, invoke the appropriate locator method to obtain
// the points making up the basis.
virtual vtkIdType ComputeBasis(double x[3], vtkIdList *pIds);
// Based on the kernel style, invoke the appropriate locator method to
// obtain the points making up the basis. Given a point x (and optional
// associated point id), 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 ptId is optional in most cases, although in
// some kernels it is used to facilitate basis computation.
virtual vtkIdType ComputeBasis(double x[3], vtkIdList *pIds, vtkIdType ptId=0);
// Description:
// Given a point x, a list of basis points pIds, and a probability
......
......@@ -88,12 +88,14 @@ public:
vtkBooleanMacro(RequiresInitialization, bool);
// Description:
// Given a point x, 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().
virtual vtkIdType ComputeBasis(double x[3], vtkIdList *pIds) = 0;
// Given a point x (and optional associated point id), 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 ptId is optional in most
// cases, although in some kernels it is used to facilitate basis
// computation.
virtual vtkIdType ComputeBasis(double x[3], vtkIdList *pIds, vtkIdType ptId=0) = 0;
// Description:
// Given a point x, and a list of basis points pIds, compute interpolation
......
......@@ -43,6 +43,29 @@ vtkSPHCubicKernel::~vtkSPHCubicKernel()
{
}
//----------------------------------------------------------------------------
// At this point, the spatial step, the dimension of the kernel, and the cutoff
// factor should be known.
void vtkSPHCubicKernel::
Initialize(vtkAbstractPointLocator *loc, vtkDataSet *ds, vtkPointData *attr)
{
if ( this->Dimension == 1 )
{
this->Sigma = 2.0 / 3.0;
}
else if ( this->Dimension == 2 )
{
this->Sigma = 10.0 / (7.0*vtkMath::Pi());
}
else //if ( this->Dimension == 3 )
{
this->Sigma = 1.0 / vtkMath::Pi();
}
// Sigma must be set before vtkSPHKernel::Initialize is invoked
this->Superclass::Initialize(loc, ds, attr);
}
//----------------------------------------------------------------------------
void vtkSPHCubicKernel::PrintSelf(ostream& os, vtkIndent indent)
{
......
......@@ -25,7 +25,7 @@
// .SECTION Acknowledgments
// The following work has been generously supported by Altair Engineering
// and FluiDyna GmbH, Please contact Steve Cosgrove or Milos Stanic for
// and FluiDyna GmbH. Please contact Steve Cosgrove or Milos Stanic for
// more information.
// .SECTION See Also
......@@ -52,6 +52,12 @@ public:
vtkTypeMacro(vtkSPHCubicKernel,vtkSPHKernel);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// 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);
// Description:
// Compute weighting factor given a normalized distance from a sample point.
virtual double ComputeFunctionWeight(const double d)
......
......@@ -136,7 +136,7 @@ struct ProbePoints
{
this->Input->GetPoint(ptId,x);
if ( (numWeights=this->Kernel->ComputeBasis(x, pIds)) > 0 )
if ( (numWeights=this->Kernel->ComputeBasis(x, pIds, ptId)) > 0 )
{
if ( ! this->ComputeDerivArrays )
{
......@@ -227,7 +227,7 @@ struct ImageProbePoints : public ProbePoints
x[0] = origin[0] + i*spacing[0];
ptId = i + jOffset + kOffset;
if ( (numWeights=this->Kernel->ComputeBasis(x, pIds)) > 0 )
if ( (numWeights=this->Kernel->ComputeBasis(x, pIds, ptId)) > 0 )
{
if ( ! this->ComputeDerivArrays )
{
......@@ -280,6 +280,8 @@ vtkSPHInterpolator::vtkSPHInterpolator()
this->Kernel = vtkSPHQuinticKernel::New();
this->CutoffArrayName = "";
this->DensityArrayName = "Rho";
this->MassArrayName = "";
......@@ -362,9 +364,10 @@ Probe(vtkDataSet *input, vtkDataSet *source, vtkDataSet *output)
// Set up the interpolation process
vtkIdType numPts = input->GetNumberOfPoints();
vtkPointData *inPD = source->GetPointData();
vtkPointData *inPD = input->GetPointData();
vtkPointData *sourcePD = source->GetPointData();
vtkPointData *outPD = output->GetPointData();
outPD->InterpolateAllocate(inPD,numPts);
outPD->InterpolateAllocate(sourcePD,numPts);
// Masking if requested
char *mask=NULL;
......@@ -388,9 +391,10 @@ Probe(vtkDataSet *input, vtkDataSet *source, vtkDataSet *output)
// Initialize the SPH kernel
if ( this->Kernel->GetRequiresInitialization() )
{
this->Kernel->SetDensityArray(inPD->GetArray(this->DensityArrayName));
this->Kernel->SetMassArray(inPD->GetArray(this->MassArrayName));
this->Kernel->Initialize(this->Locator, source, inPD);
this->Kernel->SetCutoffArray(inPD->GetArray(this->CutoffArrayName));
this->Kernel->SetDensityArray(sourcePD->GetArray(this->DensityArrayName));
this->Kernel->SetMassArray(sourcePD->GetArray(this->MassArrayName));
this->Kernel->Initialize(this->Locator, source, sourcePD);
}
// Now loop over input points, finding closest points and invoking kernel.
......@@ -402,12 +406,12 @@ Probe(vtkDataSet *input, vtkDataSet *source, vtkDataSet *output)
double origin[3], spacing[3];
this->ExtractImageDescription(imgInput,dims,origin,spacing);
ImageProbePoints imageProbe(this, imgInput, dims, origin,
spacing, inPD, outPD, mask, shepardArray);
spacing, sourcePD, outPD, mask, shepardArray);
vtkSMPTools::For(0, dims[2], imageProbe);//over slices
}
else
{
ProbePoints probe(this, input, inPD, outPD, mask, shepardArray);
ProbePoints probe(this, input, sourcePD, outPD, mask, shepardArray);
vtkSMPTools::For(0, numPts, probe);
}
......@@ -599,6 +603,8 @@ void vtkSPHInterpolator::PrintSelf(ostream& os, vtkIndent indent)
os << indent << "Locator: " << this->Locator << "\n";
os << indent << "Kernel: " << this->Kernel << "\n";
os << indent << "Cutoff Array Name: " << this->CutoffArrayName << "\n";
os << indent << "Density Array Name: " << this->DensityArrayName << "\n";
os << indent << "Mass Array Name: " << this->MassArrayName << "\n";
......
......@@ -23,12 +23,17 @@
// can then be visualized using classical visualization techniques such as
// isocontouring, slicing, heat maps and so on.
//
// To use this filter, besides setting the input and source, specify a point
// locator (which accelerates queries about points and their neighbors) and
// an interpolation kernel (a subclass of vtkSPHKernel). In addition, the
// To use this filter, besides setting the input P and source Pc, specify a
// point locator (which accelerates queries about points and their neighbors)
// and an interpolation kernel (a subclass of vtkSPHKernel). In addition, the
// name of the source's density and mass arrays can optionally be provided;
// however if not provided then the local volume is computed from the kernel's
// spatial step.
// however if not provided then the local volume is computed from the
// kernel's spatial step. Finally, a cutoff distance array can optionall be
// provided when the local neighborhood around each point varies. The cutoff
// distance defines a local neighborhood in which the points in that
// neighborhood are used to interpolate values. If not provided, then the
// cutoff distance is computed from the spatial step size times the cutoff
// factor (see vtkSPHKernel).
//
// Other options to the filter include specifying which data attributes to
// interpolate from the source. By default, all data attributes contained in
......@@ -58,7 +63,7 @@
// .SECTION Acknowledgments
// The following work has been generously supported by Altair Engineering
// and FluiDyna GmbH, Please contact Steve Cosgrove or Milos Stanic for
// and FluiDyna GmbH. Please contact Steve Cosgrove or Milos Stanic for
// more information.
// .SECTION See Also
......@@ -120,15 +125,26 @@ public:
void SetKernel(vtkSPHKernel *kernel);
vtkGetObjectMacro(Kernel,vtkSPHKernel);
// Description:
// Specify an (optional) cutoff distance for each point in the input P. If
// not specified, then the kernel cutoff is used.
vtkSetMacro(CutoffArrayName,vtkStdString);
vtkGetMacro(CutoffArrayName,vtkStdString);
// Description:
// Specify the density array name. This is optional. Typically both the density
// and mass arrays are specified together (in order to compute the local volume).
// Both the mass and density arrays must consist of tuples of 1-component. (Note that
// the density array name specifies a point array found in the Pc source.)
vtkSetMacro(DensityArrayName,vtkStdString);
vtkGetMacro(DensityArrayName,vtkStdString);
// Description:
// Specify the mass array name. This is optional. Typically both the density
// and mass arrays are specified together (in order to compute the local volume).
// Specify the mass array name. This is optional. Typically both the
// density and mass arrays are specified together (in order to compute the
// local volume). Both the mass and density arrays must consist of tuples
// of 1-component. (Note that the mass array name specifies a point
// array found in the Pc source.)
vtkSetMacro(MassArrayName,vtkStdString);
vtkGetMacro(MassArrayName,vtkStdString);
......@@ -296,6 +312,8 @@ protected:
vtkAbstractPointLocator *Locator;
vtkSPHKernel *Kernel;
vtkStdString CutoffArrayName;
vtkStdString DensityArrayName;
vtkStdString MassArrayName;
......
......@@ -22,6 +22,7 @@
#include "vtkDataSet.h"
#include "vtkMath.h"
vtkCxxSetObjectMacro(vtkSPHKernel,CutoffArray,vtkDataArray);
vtkCxxSetObjectMacro(vtkSPHKernel,DensityArray,vtkDataArray);
vtkCxxSetObjectMacro(vtkSPHKernel,MassArray,vtkDataArray);
......@@ -31,6 +32,7 @@ vtkSPHKernel::vtkSPHKernel()
this->RequiresInitialization = true;
this->SpatialStep = 0.001;
this->Dimension = 3;
this->CutoffArray = NULL;
this->DensityArray = NULL;
this->MassArray = NULL;
}
......@@ -38,6 +40,7 @@ vtkSPHKernel::vtkSPHKernel()
//----------------------------------------------------------------------------
vtkSPHKernel::~vtkSPHKernel()
{
this->SetCutoffArray(NULL);
this->SetDensityArray(NULL);
this->SetMassArray(NULL);
}
......@@ -54,18 +57,48 @@ Initialize(vtkAbstractPointLocator *loc, vtkDataSet *ds, vtkPointData *attr)
this->Cutoff = this->CutoffFactor * this->SpatialStep;
this->DistNorm = 1.0 / this->SpatialStep;
this->DimNorm = this->Sigma * pow(this->DistNorm,this->Dimension);
this->DefaultVolume = this->SpatialStep * this->SpatialStep * this->SpatialStep;
this->DefaultVolume = pow(this->SpatialStep,this->Dimension);
// See if cutoff array is provided.
if ( this->CutoffArray && this->CutoffArray->GetNumberOfComponents() == 1 )
{
this->UseCutoffArray = true;
}
else
{
this->UseCutoffArray = false;
}
// See if local mass and density information is provided
this->UseArraysForVolume = ((this->DensityArray && this->MassArray) ? true : false);
if ( this->DensityArray && this->MassArray &&
this->DensityArray->GetNumberOfComponents() == 1 &&
this->MassArray->GetNumberOfComponents() == 1 )
{
this->UseArraysForVolume = true;
}
else
{
this->UseArraysForVolume = false;
}
}
//----------------------------------------------------------------------------
// Radius around point is 3 * smoothing length
// Radius around point is cutoff factor * smoothing length. That is unless
// cutoff array is provided.
vtkIdType vtkSPHKernel::
ComputeBasis(double x[3], vtkIdList *pIds)
ComputeBasis(double x[3], vtkIdList *pIds, vtkIdType ptId)
{
this->Locator->FindPointsWithinRadius(this->Cutoff, x, pIds);
double cutoff;
if ( this->UseCutoffArray )
{
this->CutoffArray->GetTuple(ptId,&cutoff);
}
else
{
cutoff = this->Cutoff;
}
this->Locator->FindPointsWithinRadius(cutoff, x, pIds);
return pIds->GetNumberOfIds();
}
......@@ -79,7 +112,7 @@ ComputeWeights(double x[3], vtkIdList *pIds, vtkDoubleArray *weights)
double d, y[3];
weights->SetNumberOfTuples(numPts);
double *w = weights->GetPointer(0);
double KW, volume=this->DefaultVolume;
double KW, mass, density, volume;
// Compute SPH coefficients.
for (i=0; i<numPts; ++i)
......@@ -90,6 +123,17 @@ ComputeWeights(double x[3], vtkIdList *pIds, vtkDoubleArray *weights)
KW = this->ComputeFunctionWeight(d*this->DistNorm);
if ( this->UseArraysForVolume )
{
this->MassArray->GetTuple(id,&mass);
this->DensityArray->GetTuple(id,&density);
volume = mass /density;
}
else
{
volume = this->DefaultVolume;
}
w[i] = this->DimNorm * KW * volume;
}//over all neighbor points
......@@ -137,4 +181,8 @@ void vtkSPHKernel::PrintSelf(ostream& os, vtkIndent indent)
os << indent << "Dimension: " << this->Dimension << "\n";
os << indent << "Cutoff Factor: " << this->CutoffFactor << "\n";
os << indent << "Sigma: " << this->Sigma << "\n";
os << indent << "Cutoff Array: " << this->CutoffArray<< "\n";
os << indent << "Density Array: " << this->DensityArray << "\n";
os << indent << "Mass Array: " << this->MassArray << "\n";
}
......@@ -29,6 +29,11 @@
// 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.
// .SECTION Caveats
// For more information see D.J. Price, Smoothed particle hydrodynamics and
......@@ -37,7 +42,7 @@
// .SECTION Acknowledgments
// The following work has been generously supported by Altair Engineering
// and FluiDyna GmbH, Please contact Steve Cosgrove or Milos Stanic for
// and FluiDyna GmbH. Please contact Steve Cosgrove or Milos Stanic for
// more information.
// .SECTION See Also
......@@ -78,14 +83,27 @@ public:
vtkGetMacro(Dimension,int);
// Description:
// Specify the density array. Used with the mass array to compute local particle
// volumes.
// Return the cutoff factor. This is hard wired into the kernel (e.g., the
// vtkSPHQuinticKernel has a cutoff factor = 3.0).
vtkGetMacro(CutoffFactor,double);
// Description:
// 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);
// Description:
// Specify the (optional) density array. Used with the mass array to
// compute local particle volumes.
virtual void SetDensityArray(vtkDataArray*);
vtkGetObjectMacro(DensityArray,vtkDataArray);
// Description:
// Specify the mass array. Used with the density array to compute local particle
// volumes.
// Specify the (optional) mass array. Used with the density array to
// compute local particle volumes.
virtual void SetMassArray(vtkDataArray*);
vtkGetObjectMacro(MassArray,vtkDataArray);
......@@ -96,13 +114,13 @@ public:
vtkPointData *pd);
// Description:
// Given a point x, 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(). In SPH interpolation, the basis consists of points
// found in the sphere located within the cutoff radius.
virtual vtkIdType ComputeBasis(double x[3], vtkIdList *pIds);
// 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);
// Description:
// Given a point x, and a list of basis points pIds, compute interpolation
......@@ -135,6 +153,7 @@ protected:
int Dimension; //sptial dimension of the kernel
// Optional arrays aid in the interpolation process (computes volume)
vtkDataArray *CutoffArray;
vtkDataArray *DensityArray;
vtkDataArray *MassArray;
......@@ -146,6 +165,7 @@ protected:
double DistNorm; //distance normalization factor 1/(spatial step)
double DimNorm; //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:
......
......@@ -43,6 +43,29 @@ vtkSPHQuarticKernel::~vtkSPHQuarticKernel()
{
}
//----------------------------------------------------------------------------
// At this point, the spatial step, the dimension of the kernel, and the cutoff
// factor should be known.
void vtkSPHQuarticKernel::
Initialize(vtkAbstractPointLocator *loc, vtkDataSet *ds, vtkPointData *attr)
{
if ( this->Dimension == 1 )
{
this->Sigma = 1.0 / 24.0;
}
else if ( this->Dimension == 2 )
{
this->Sigma = 96.0 / (1199.0*vtkMath::Pi());
}
else //if ( this->Dimension == 3 )
{
this->Sigma = 1.0 / (20.0*vtkMath::Pi());
}
// Sigma must be set before vtkSPHKernel::Initialize is invoked
this->Superclass::Initialize(loc, ds, attr);
}
//----------------------------------------------------------------------------
void vtkSPHQuarticKernel::PrintSelf(ostream& os, vtkIndent indent)
{
......
......@@ -25,7 +25,7 @@
// .SECTION Acknowledgments
// The following work has been generously supported by Altair Engineering
// and FluiDyna GmbH, Please contact Steve Cosgrove or Milos Stanic for
// and FluiDyna GmbH. Please contact Steve Cosgrove or Milos Stanic for
// more information.
// .SECTION See Also
......@@ -52,6 +52,12 @@ public:
vtkTypeMacro(vtkSPHQuarticKernel,vtkSPHKernel);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// 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);
// Description:
// Compute weighting factor given a normalized distance from a sample point.
virtual double ComputeFunctionWeight(const double d)
......
......@@ -23,27 +23,36 @@ vtkStandardNewMacro(vtkSPHQuinticKernel);
vtkSPHQuinticKernel::vtkSPHQuinticKernel()
{
this->CutoffFactor = 3.0;
}
//----------------------------------------------------------------------------
vtkSPHQuinticKernel::~vtkSPHQuinticKernel()
{
}
//----------------------------------------------------------------------------
// At this point, the spatial step, the dimension of the kernel, and the cutoff
// factor should be known.
void vtkSPHQuinticKernel::
Initialize(vtkAbstractPointLocator *loc, vtkDataSet *ds, vtkPointData *attr)
{
if ( this->Dimension == 1 )
{
this->Sigma = 1.0 / 120.0;
}
else if ( this->Dimension == 2 )
{
this->Sigma = 7.0/(478.0*vtkMath::Pi());
this->Sigma = 7.0 / (478.0*vtkMath::Pi());
}
else //if ( this->Dimension == 3 )
{
this->Sigma = 1.0/(120.0*vtkMath::Pi());
this->Sigma = 1.0 / (120.0*vtkMath::Pi());
}
}
//----------------------------------------------------------------------------
vtkSPHQuinticKernel::~vtkSPHQuinticKernel()
{
// Sigma must be set before vtkSPHKernel::Initialize is invoked
this->Superclass::Initialize(loc, ds, attr);
}
//----------------------------------------------------------------------------
void vtkSPHQuinticKernel::PrintSelf(ostream& os, vtkIndent indent)
{
......
......@@ -25,7 +25,7 @@
// .SECTION Acknowledgments
// The following work has been generously supported by Altair Engineering
// and FluiDyna GmbH, Please contact Steve Cosgrove or Milos Stanic for
// and FluiDyna GmbH. Please contact Steve Cosgrove or Milos Stanic for
// more information.
// .SECTION See Also
......@@ -52,6 +52,12 @@ public:
vtkTypeMacro(vtkSPHQuinticKernel,vtkSPHKernel);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// 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);
// Description:
// Compute weighting factor given a normalized distance from a sample point.
virtual double ComputeFunctionWeight(const double d)
......
......@@ -33,7 +33,7 @@ vtkVoronoiKernel::~vtkVoronoiKernel()
//----------------------------------------------------------------------------
vtkIdType vtkVoronoiKernel::
ComputeBasis(double x[3], vtkIdList *pIds)
ComputeBasis(double x[3], vtkIdList *pIds, vtkIdType)
{