[Paraview] Calculator Filter -- Gradient
Berk Geveci
berk.geveci at kitware.com
Tue Sep 14 15:16:22 EDT 2010
Ah I see. Since you have NumPy enabled, it would be simplest to use
the Python Calculator with:
Q1 / Q4
Let me know if this does not work. I am not sure how functional Python
Calculator was in 3.8. This would definitely work on the development
version.
As far as the Programmable Filter, it sounds like we need to make some
improvements on iterating over blocks. The code that you use is
incorrect but the correct version is not easy to write (although
possible).
By the way, if you use the development version, you will have access
to whole lot more functions in the Python Calculator (and Programmable
Filter). See http://www.paraview.org/Wiki/Python_Calculator
-berk
2010/9/14 Aurélien Marsan <aur.marsan at gmail.com>:
> That's it.
> In the Calculator, I would set the formula : Q1/Q4*iHat + Q2/Q4*jHat +
> Q3/Q4*kHat.
>
> In the programmable filter, there is some facilities in order to use numpy
> arrays. But what should be the dimensions of the numpy array if we want to
> add a vector by doing something like "block.PointData.append(array, 'newQ')"
> ?
>
>
> Le 14 septembre 2010 17:15, Berk Geveci <berk.geveci at kitware.com> a écrit :
>>
>> I am not sure that I understand. Are Q1 and Q2 vectors? Are you trying
>> to divide the component by component?
>>
>> 2010/9/13 Aurélien Marsan <aur.marsan at gmail.com>:
>> > 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
>> >>
>> >
>> >
>> > _______________________________________________
>> > 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
>> >
>> >
>
>
More information about the ParaView
mailing list