[Paraview] Programmable Filter Help, Part 2

Andy Bauer andy.bauer at kitware.com
Fri Oct 18 09:25:09 EDT 2013


Hi,

The points and point data are considered separate for each grid in the
multiblock. Although the points can be shared it is assumed that they
aren't. Also, the Programmable filter makes a deep copy (VTK parlance for a
full memory copy) of all of its input to make it easier not to modify a
filter's input (a no-no in VTK) so at this point it means that even if the
input multiblock was sharing the point locations array as well as point
data arrays, the output will definitely not be sharing this information.

Regards,
Andy


On Fri, Oct 18, 2013 at 7:58 AM, <dennis_conklin at goodyear.com> wrote:

> Andy,
>
> A typical rookie mistake.   I was combining composite data set examples
> and non-composite examples from the wiki, and I got my output and my block
> intermixed.  It's very obvious now that you pointed it out.
>
> Thanks very much, that works fine now.
>
> One question if I may:  since Nodes (or points) are common to multiple
> blocks at block boundaries I'm surprised that something strange didn't
> happen when I assigned PointData to some points multiple times - once for
> each block they are contained in.  It also seems strange that there isn't
> some master POINTS array of all points in the composite data set that I
> could have operated on, especially as I did nothing to the cells and it
> seems the blocks are mostly a cell thing.   Am I missing something there?
>  How are points common to different blocks handled?
>
> Thanks again
>
> *Dennis Conklin**
> RDE & Q Senior Engineer *
> *Engineering Mechanics**
> *The Goodyear Tire & Rubber Company
> 200 Innovation Way, Akron, OH  44316
> phone.330-796-5701
> dennis_conklin at goodyear.com
>
>
>
>
>
> From:        Andy Bauer <andy.bauer at kitware.com>
> To:        dennis_conklin at goodyear.com
> Cc:        "paraview at paraview.org" <paraview at paraview.org>
> Date:        10/17/2013 01:19 PM
> Subject:        Re: [Paraview] Programmable Filter Help, Part 2
> ------------------------------
>
>
>
> Hi,
>
> Where did you get the example from?
>
> I think your confusion is from the difference between multiblock data sets
> and regular data sets. The regular data set has points and the Programmable
> Filter gives a shortcut to access those points by using inputs[0].Points
> and output.Points but there is no concept of a group of points in a
> multiblock data set, only in the regular data set blocks of the multiblock
> data set. So for the process_block() method you'll want to do a
> block.GetPoints() to get the points. To make it more efficient you can use
> numpy. An example is at *
> http://www.paraview.org/Wiki/Python_Programmable_Filter#Center_Data_using_numpy
> *<http://www.paraview.org/Wiki/Python_Programmable_Filter#Center_Data_using_numpy>.
>
>
> You can add print statements in the script but they'll be outputted to the
> output window (Tools->Output Window).
>
> Regards,
> Andy
>
>
> On Thu, Oct 17, 2013 at 10:35 AM, <*dennis_conklin at goodyear.com*<dennis_conklin at goodyear.com>>
> wrote:
> My original post was truncated into oblivion, so here is my Second attempt.
>
> I'm trying to put together a Programmable filter that will add arrays of
> deformed and undeformed coordinates and undeformed angles to my PointData
> in 4.0.1
>
> From all the examples online, I think either of these examples should work
> but neither does.   Any hints
> First, I am copying arrays in the PF, so I should be able to manipulate
> either input or output, but neither works
> It is also a composite (Exodus dataset)
>
> First version - error is can't find output.Points
>
> import math
>
> def process_block(block):
>    displ=block.PointData['DISPL']
>    # Coords of Points are locked into individual Point structures
>    # Assume Displacements applied (Points are deformed)
>    numPts=output.GetNumberOfPoints()
> #   for i in range(numPts):
> #      #x_coords[i], y_coords[i], z_coords[i] = output.GetPoint(i)
>
>    x_coords=output.Points[:,0]
>    y_coords=output.Points[:,1]
>    z_coords=output.Points[:,2]
>    x_undef=x_coords-displ[:,0]
>    y_undef=y_coords-displ[:,1]
>    z_undef=z_coords-displ[:,2]
>    # Undeformed scalar Coordinates
>    block.PointData.append(x_undef,"X_undef")
>    block.PointData.append(y_undef,"Y_undef")
>    block.PointData.append(z_undef,"Z_undef")
>    # Deformed scalar Coordinates
>    block.PointData.append(x_coords,"X_def")
>    block.PointData.append(y_coords,"Y_def")
>    block.PointData.append(z_coords,"Z_def")
>    # Calc angles (no atan2 in vtk)
>    Angles_undef=math.atan2(z_undef,x_undef)
>    block.PointData.append(Angles_undef,"Angle_undef")
>
> for block in output:
>    process_block(block)
>
> For second version I comment out x_coords=output.Points[;0] and use
> #   for i in range(numPts):
> #      #x_coords[i], y_coords[i], z_coords[i] = output.GetPoint(i)
>
> This error is can't find output.GetPoint
>
> Both of these are used in examples online of Programmable Filter, so what
> am I missing?
> I have substituted input for output above and no change.
> Also, output.GetNumberOfPoints works, so why doesn't output.GetPoints work?
>
> Thanks
> *
> Dennis Conklin
> RDE & Q Senior Engineer
> Engineering Mechanics*
> The Goodyear Tire & Rubber Company
> 200 Innovation Way, Akron, OH  44316
> phone.*330-796-5701* <330-796-5701>*
> **dennis_conklin at goodyear.com* <dennis_conklin at goodyear.com>
>
>
> _______________________________________________
> Powered by *www.kitware.com* <http://www.kitware.com/>
>
> Visit other Kitware open-source projects at *
> http://www.kitware.com/opensource/opensource.html*<http://www.kitware.com/opensource/opensource.html>
>
> Please keep messages on-topic and check the ParaView Wiki at: *
> http://paraview.org/Wiki/ParaView* <http://paraview.org/Wiki/ParaView>
>
> Follow this link to subscribe/unsubscribe:*
> **http://www.paraview.org/mailman/listinfo/paraview*<http://www.paraview.org/mailman/listinfo/paraview>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20131018/707c6e03/attachment-0001.htm>


More information about the ParaView mailing list