[Paraview] [EXTERNAL] Idiot's Guide to Programmable Filter

Berk Geveci berk.geveci at kitware.com
Thu Apr 30 12:51:02 EDT 2015


Hi Dennis,

Here is an example that works in 4.3:

from vtk.numpy_interface import dataset_adapter as dsa
iterator = dsa.MultiCompositeDataIterator([inputs[0], output])
for iblock, oblock in iterator:
    oblock.PointData.append(iblock.PointData['DISPL'], "DISPL")

A few points:
* MultiCompositeDataIterator() allows you to traverse the input and output
datasets together so you get matching datasets
* iblock and oblock correspond to input and output blocks
* For the API for the iblock and oblock objects, see the User's Guide or
numerous blogs that I wrote on the topic under www.kitware.com/blog
* vtkDataSet API is also available through those objects so you can call
things like GetNumberOfCells(), GetNumberOfPoints() etc.

Best,
-berk


On Wed, Apr 29, 2015 at 11:01 AM, Dennis Conklin <
dennis_conklin at goodyear.com> wrote:

>  Berk,
>
>
>
> Thanks for your reply.
>
>
>
> I am using Paraview 4.3, so hopefully that has the improvements you
> mentioned.
>
>
>
> I guess if I could figure out what objects are used for Blocks in side the
> Programmable filter I could do more on my own, but it’s clear they are
> different from in a python script, but still not clear what they are.
>
>
>
> So a typical application would be a special version of point data to cell
> data.
>
>
>
> I have some node variables.     I want to find all the nodes attached to
> each element, do some calculations on those node variables to generate a
> new element variable.   So basically like
>
>
>
> Loop over blocks
>
>      Loop over elements in block
>
>                 Find all nodes connected to element
>
>                 Perform calculations based on node variables
>
>                 Assign new element variable(s) based on calculations
>
>
>
> Thanks for any insight – Alan at Sandia has suggested I check the latest
> user guide, and I will, but I haven’t seen a good element example for the
> Programmable filter yet – I don’t have any problem doing nodal
> manipulations, but I have a good example of that.
>
>
>
> Dennis
>
>
>
> *From:* Berk Geveci [mailto:berk.geveci at kitware.com]
> *Sent:* Wednesday, April 29, 2015 10:29 AM
> *To:* Scott, W Alan
> *Cc:* Dennis Conklin; paraview at paraview.org
> *Subject:* Re: [Paraview] [EXTERNAL] Idiot's Guide to Programmable Filter
>
>
>
> Hey Dennis,
>
>
>
> Which version of ParaView are you using? We have made some significant
> improvements to the way we handle multi-block datasets (which Exodus
> produces) in the latest version.
>
>
>
> The interface in the Programmable Filter is somewhat different than what
> you would have in a ParaView Python script. This is because you actually
> have access to the full data and the objects in there are of different
> types.
>
>
>
> If you give me some examples of what you are trying to do in the
> programmable filter, I can provide code that demonstrates the use of the
> API in the programmable filter.
>
>
>
> Best,
>
> -berk
>
>
>
> On Tue, Apr 28, 2015 at 10:32 PM, Scott, W Alan <wascott at sandia.gov>
> wrote:
>
>  Dennis,
>
> The Python/ Programmable filter is a black box to me (i.e., I won’t be
> much additional help).  However, the place i would start would be the new,
> super-duper ParaView Guide.  Kitware – and especially Utkarsh – have done a
> great job on it.
>
>
>
> Rather than giving the link, here is how to find it.  It is sold in paper
> form on Amazon, and also is available as a .pdf for free (lacking 3
> chapters, not related to the python filter).
>
>
>
> paraview.org/ Resources/ ParaView Guide.  This includes the link to the
> .pdf.  You are interested in (at least) chapter 13.  It is listed under
> master section II, Reference Manual.
>
>
>
>
>
> Alan
>
>
>
> *From:* ParaView [mailto:paraview-bounces at paraview.org] *On Behalf Of *Dennis
> Conklin
> *Sent:* Tuesday, April 28, 2015 11:11 AM
> *To:* paraview at paraview.org
> *Subject:* [EXTERNAL] [Paraview] Idiot's Guide to Programmable Filter
>
>
>
> All,
>
>
>
> I’m a little confused by what objects are inside a programmable filter.
> I have a multi-block EXODUS dataset.    When I read this in it is a
> Exodus2Reader object (sp?) and I can access the blocks, pointdata,
> celldata, etc in a python script.
>
>
>
> Once I get inside the Programmable filter, the  blocks of the input[] seem
> to have different member functions than they did in a Python script.   So I
> can’t figure out  how to get connectivity,   number of cells in a block,
> generate new cell variables, etc.
>
>
>
> So, if I’m in a Programmable Filter, what object do I look at in either
> the Paraview or VTK class libraries to understand what the properties of
> the block are?
>
>
>
> Thanks very much for any insight you can give.
>
>
>
> Dennis
>
>
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20150430/e5239951/attachment.html>


More information about the ParaView mailing list