Skip to content
Snippets Groups Projects
Commit cabbdb3a authored by Will Schroeder's avatar Will Schroeder
Browse files

Fixed bug related to cutoff array

The cutoff array should be defined in the input point data, not in
in the source point data.
parent 9f790cb2
No related merge requests found
......@@ -32,12 +32,8 @@ output = reader.GetOutput()
scalarRange = output.GetPointData().GetArray("Rho").GetRange()
output2 = dsa.WrapDataObject(output)
# the constant value in the Cutoff array below is equal to
# the spatialStep (0.1) set below, and the CutoffFactor (3) of the QuinticKernel
Cutoff = np.ones(output.GetNumberOfPoints()) * 3.0/10.0;
Mass = np.ones(output.GetNumberOfPoints()) * 1.0;
output2.PointData.append(Mass, "Mass")
output2.PointData.append(Cutoff, "Cutoff")
# Something to sample with
center = output.GetCenter()
......@@ -53,6 +49,15 @@ plane.SetCenter(center)
plane.SetNormal(0,0,1)
plane.Push(1.15)
plane.Update()
planeOutput = plane.GetOutput()
planeOutput2 = dsa.WrapDataObject(planeOutput)
# The constant value in the Cutoff array below is equal to
# the spatialStep (0.1) set below, and the CutoffFactor (3) of the QuinticKernel.
# Note that the cutoff array should be associated with the input
# sampling points.
Cutoff = np.ones(planeOutput.GetNumberOfPoints()) * 3.0/10.0;
planeOutput2.PointData.append(Cutoff, "Cutoff")
# SPH kernel------------------------------------------------
......
......@@ -325,6 +325,7 @@ void vtkSPHInterpolator::Probe(vtkDataSet* input, vtkDataSet* source, vtkDataSet
// Set up the interpolation process
vtkIdType numPts = input->GetNumberOfPoints();
vtkPointData* inputPD = input->GetPointData();
vtkPointData* sourcePD = source->GetPointData();
vtkPointData* outPD = output->GetPointData();
......@@ -359,7 +360,7 @@ void vtkSPHInterpolator::Probe(vtkDataSet* input, vtkDataSet* source, vtkDataSet
// Initialize the SPH kernel
if (this->Kernel->GetRequiresInitialization())
{
this->Kernel->SetCutoffArray(sourcePD->GetArray(this->CutoffArrayName));
this->Kernel->SetCutoffArray(inputPD->GetArray(this->CutoffArrayName));
this->Kernel->SetDensityArray(sourcePD->GetArray(this->DensityArrayName));
this->Kernel->SetMassArray(sourcePD->GetArray(this->MassArrayName));
this->Kernel->Initialize(this->Locator, source, sourcePD);
......
......@@ -31,11 +31,11 @@
* 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. Finally, a cutoff distance array can optionally 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).
* provided (as part of the input P point data) when the local neighborhood
* around each sample 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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment