[Paraview] Calculator Filter -- Gradient

Aurélien Marsan aur.marsan at gmail.com
Mon Sep 13 05:23:44 EDT 2010


Hello,

In order to calculate a new scalar (here for a multiblockdataset)

pdi = self.GetInput()

pdo = self.GetOutput()

pdo.ShallowCopy(pdi)

for block in output[0]:

if block.GetNumberOfPoints() != 0:

array = block.PointData['Q1'] / block.PointData['Q2']

block.PointData.append(array, 'newQ')


For a new vector, I would like someone to explain a simple way to do that.
(without many transpose, ravel, etc...)
Knowing that it does not work with array =
numpy.array([block.PointData['Q1'], block.PointData['Q2'],
block.PointData['Q3']]) / block.PointData['Q4']
because of a problem of dimensions.

Regards,

A.Marsan

2010/9/10 <DParker at chromalloy.com>

> I have a couple of questions about using the Programmable Filter. I have
> imported Tecplot dataset with the following data: coordsX, coordsY, coordsZ,
> Q1, Q2, Q3, Q4, Q5.
>
> How would I create a new data array that is Q2^2+Q3^2+Q4^2?
>
> How would I create a new vector data array (similar to
> Q2*iHat+Q3*jHat+Q4*kHat in the Calculator Filter)?
>
>
>
>
> From:        David E DeMarle <dave.demarle at kitware.com>
> To:        DParker at chromalloy.com
> Cc:        paraview at paraview.org
> Date:        09/10/2010 01:24 PM
> Subject:        Re: [Paraview] Calculator Filter -- Gradient
> Sent by:        paraview-bounces at paraview.org
> ------------------------------
>
>
>
> On Fri, Sep 10, 2010 at 1:10 PM,  <DParker at chromalloy.com> wrote:
> > I have two somewhat related questions:
> >
> > 1. Is it possible to calculate a gradient vector using the calculator
> > filter?
>
> No. The calculator filter does only element wise (cell by cell or
> point by point) computations. To compute the gradient you need
> information from neighboring elements.
>
> >
> > 2. Is it possible to define a new data array using a Python script
> without
> > the calculator filter? Currently, I am using several Calculator Filters
> to
> > calculate CFD flow variables from the conservative variables. I use a
> Python
> > script to create the Calculator Filters, but I'm wondering if I can avoid
> > the Calculator Filter and directly generate new data arrays for plotting.
> >
>
> Not with a python script (under the python shell) since that runs on
> the client and can't really manipulate the data (which lives on the
> server) directly. However, the python programmable filter runs on the
> server, and with that you can create new arrays, and access
> neighboring elements as well.
> See http://www.paraview.org/Wiki/Python_Programmable_Filter for examples.
>
> > David Parker
> > _______________________________________________
> > 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
> >
> >
> _______________________________________________
> 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
>
>
> _______________________________________________
> 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 --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100913/804498ad/attachment-0001.htm>


More information about the ParaView mailing list