[Paraview] mapping unstructured grid onto regular grid

Dan Lussier dan.lussier at sjc.ox.ac.uk
Tue Sep 14 23:03:41 EDT 2010


Ok - thanks John. I just pulled those changes.

I did a quick visualization using the SPHProbe(gridsource) using the
Shepard kernel and compared with the raw VTK method suggested by Jean
and the appear very similar, but still have some slight differences.

I have attached a screenshot of the viz where you can see some slight
variation in the corner.  The only other difference I can pick up is
in the range of 'datavalue'.   The SPHProbe(gridsource) has a slightly
smaller range (i.e. smaller magnitude high and low values) than I
obtained via the raw VTK method.

I'm not sure if these are expected outputs so I thought I would pass it along.

Thanks again!

Dan

On Tue, Sep 14, 2010 at 7:36 AM, Biddiscombe, John A. <biddisco at cscs.ch> wrote:
> Dan
>
> the pv-meshless plugin has a resample using a probe - as you know - but the resample algorithm can be SPH, or just a conventional shepard kernel. In the SPH manager widget, you can change it.
>
> I tried it just now and found there was some experimental code left in which gave dodgy answers. I've just fixed it (and pushed to git), so now it gives a standard shepard interpolation for arbitrary particle data. (I'm preparing material for a tutorial including some particle data demos, so timing was good there!)
>
> To compare with vtkShepard method - I don't know as I've never used it. But vtkShepardMethod only produces an imagedata as output. the stuff in pv-meshless allows you to probe with an arbitrary geometry and has a reasonably efficient particle neighbour search using a BSP tree.
>
> Using resample to grid allows you to create a box widget of arbitrary resolution and resample with that. Ought to give the same output (for matching grid spacing etc) as vtkShepardMethod. You can sample with line/box/plane, or arbitrary input (any dataset).
>
> The SPH mode of operation does the interpolation using an SPH kernel, but also outputs the Shepard coefficient, which should be 1 inside the volume and 0 outside. using a contour of 0.5 allows you to generate surfaces - but it is dependent on the 'true' particle size (kernel size). The shepard mode only interpolates. However, for general scalars is v. useful. I would prefer the meshless plugin over the vtkShepardMethod filter for general flexibility.
>
> JB
>
>
> -----Original Message-----
> From: paraview-bounces at paraview.org [mailto:paraview-bounces at paraview.org] On Behalf Of Dan Lussier
> Sent: 14 September 2010 00:02
> To: Favre Jean
> Cc: paraview at paraview.org
> Subject: Re: [Paraview] mapping unstructured grid onto regular grid
>
> Ok - that's great. I was able to see how that works with some playing
> around at the interactive prompt.
>
> How does this approach using vtkShepardMethod compare to the sampling
> probes that are included with the pv-meshless plugin ? I noticed that
> they produce an output called Shepard, but wasn't sure how broadly
> they apply outside of SPH type of work (i.e. properly defined mass,
> density, etc. fields).
>
> Thanks again.
>
> On Sat, Sep 11, 2010 at 3:51 AM, Favre  Jean <jfavre at cscs.ch> wrote:
>> _______________________________________
>> I would like to map an unstructured grid (describing particle data
>> with per particle attributes I would like interpolated onto the
>> regular grid) onto a regular mesh.  I am trying to use the 'Resample
>> With Dataset' filter but have not been having much luck.
>> ________________________________________
>>
>> As far as I understand, what you are trying to do is not possible, with the "Resample with dataset filter". The reason is that your input dataset does not seem to have 3D cells. Resampling needs 3D cells for interpolation.
>>
>> There is a method, vtkShepardMethod (http://www.vtk.org/doc/nightly/html/classvtkShepardMethod.html),  which does exactly what you need. However, Shepard is not included in ParaView. No problem, you can do it off-line:
>>
>> I have tried the following python script with my paraview compilation and my ./bin/vtkpython and it produced the required output. See if it fits your purpose.
>>
>> from vtk import *
>> numPts = 300
>>
>> ps = vtk.vtkPointSource()
>> ps.SetRadius(1)
>> ps.SetNumberOfPoints(numPts)
>> ps.Update()
>>
>> ca = vtk.vtkFloatArray()
>> ca.SetName("datavalue")
>> ca.SetNumberOfComponents(1)
>> ca.SetNumberOfTuples(numPts)
>>
>> for i in range(0, numPts):
>>  ca.SetValue(i, ps.GetOutput().GetPoint(i)[0])
>>
>> ps.GetOutput().GetPointData().AddArray(ca)
>> ps.GetOutput().GetPointData().SetScalars(ca)
>> ps.Update()
>> ps.GetOutput().GetPointData().SetScalars(ca)
>>
>> sh = vtk.vtkShepardMethod()
>> sh.SetSampleDimensions(20,20,20)
>> sh.SetInputConnection(ps.GetOutputPort())
>> sh.SetModelBounds(ps.GetOutput().GetBounds())
>>
>> wr = vtk.vtkDataSetWriter()
>> wr.SetInputConnection(sh.GetOutputPort())
>> wr.SetFileName("/tmp/foo.vtk")
>> wr.Write()
>>
>> -----------------
>> Jean M. Favre
>> Swiss National Supercomputing Center
>>
>>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: comparing_filters.jpg
Type: image/jpeg
Size: 58878 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100914/68f33cf8/attachment-0001.jpg>


More information about the ParaView mailing list