[Paraview] choppy derivatives
Peter Brady
petertbrady at gmail.com
Fri Apr 23 17:21:12 EDT 2010
Next question,
My scalar data is written to the cell centers and I can't figure out how to
get the coordinates of the cell centers in my programmable filter.
After perusing the vtk documentation (as best as a Fortran programmer can)
it looks I need to do something along the lines of
input = self.GetInputDataObject(0, 0)
> output = self.GetOutputDataObject(0)
>
> inputBlock = input.GetBlock(0)
> # copy old data
> output.CopyStructure(input)
> outputBlock = inputBlock.NewInstance()
> outputBlock.UnRegister(None)
> outputBlock.CopyStructure(inputBlock)
> output.SetBlock(0,outputBlock)
>
> numCls = inputBlock.GetNumberOfCells()
> pc = [0.0,0.0,0.0]
> for i in range(numCls):
> cell = inputBlock.GetCell(i)
> sId = cell.GetParametricCenter(pc)
> cell.EvaluateLocation(sId,pc,coord)
> # coord should have cell center in xyz space
>
However, 'EvaluateLocation' doesn't appear to be available to me. How do I
grab the cell center in xyz coordinates?
Thanks again,
Peter.
On Thu, Apr 22, 2010 at 5:33 PM, Peter Brady <petertbrady at gmail.com> wrote:
> Fantastic! "InputBlock" is a leaf block as suspected.
>
> Until my next question,
> Peter
>
> On Thu, Apr 22, 2010 at 5:15 PM, Berk Geveci <berk.geveci at kitware.com>wrote:
>
>> You have to get the leaf nodes of the multi-block dataset first. In
>> this case, I suspect inputBlock will be a leaf block.
>>
>> -berk
>>
>> On Thu, Apr 22, 2010 at 5:01 PM, Peter Brady <petertbrady at gmail.com>
>> wrote:
>> > The location we're looking at is the interface between two fluids so
>> there
>> > may be a discontinuity in the tangential derivatives for that reason.
>> I'm
>> > trying to write my own derivative and interpolation filters in a python
>> > programmable filter which will take one-sided derivatives and use
>> one-sided
>> > interpolation. In order to do this I need to use cell data in my filter
>> and
>> > not point data to avoid the interpolation that takes place. Typically I
>> > access point data with something like:
>> >
>> >> input = self.GetInputDataObject(0, 0)
>> >> output = self.GetOutputDataObject(0)
>> >>
>> >> inputBlock = input.GetBlock(0)
>> >> # copy old data
>> >> output.CopyStructure(input)
>> >> outputBlock = inputBlock.NewInstance()
>> >> outputBlock.UnRegister(None)
>> >> outputBlock.CopyStructure(inputBlock)
>> >> output.SetBlock(0,outputBlock)
>> >>
>> >> # get number of points
>> >> numPts = input.GetNumberOfPoints()
>> >> # temperature gradient
>> >> GtArr = input.GetPointData().GetVectors('ScalarGradient')
>> >
>> > However, there doesn't seem to be an equivalent 'GetNumberOfCells()' or
>> > 'GetCellData()' for my multiblock data. How can I access the cell data?
>> >
>> > Thanks for your help,
>> >
>> > Peter.
>> >
>> > On Tue, Mar 30, 2010 at 10:15 AM, Berk Geveci <berk.geveci at kitware.com>
>> > wrote:
>> >>
>> >> I wonder if this is because of the multiple celldata -> point data
>> >> conversions. Do you have an example dataset you can share?
>> >>
>> >> On Sun, Mar 28, 2010 at 1:45 AM, Peter Brady <petertbrady at gmail.com>
>> >> wrote:
>> >> > Hello list,
>> >> >
>> >> > I have a 3D dataset with a Temperature field. My goal is to insert a
>> >> > sphere
>> >> > source and determine the tangential temperature gradient on the
>> surface
>> >> > of
>> >> > the sphere at various zenith angles. The data is output from the
>> code
>> >> > as
>> >> > cell data. Here is the way I'm doing this (through pvpython)
>> >> >
>> >> > 1. Apply CellDataToPointData
>> >> > 2. Apply ComputeDerivatives (to get the 'Scalar Gradient')
>> >> > 3. Apply another CellDataToPointData (to turn the derivatives into
>> >> > point
>> >> > data)
>> >> > 4. Resample the data from step 3 with my sphere source.
>> >> > 5. Use a programmable filter to combine the xyz derivatives
>> >> > appropriately.
>> >> >
>> >> > The data is reasonable but it's fairly choppy. When I look at dT/dx,
>> >> > dT/dy,
>> >> > and dT/dz (before I project them onto the sphere surface), and plot
>> them
>> >> > at
>> >> > a particular zenith angle around the azimuth of the drop, dTdx and
>> dTdy
>> >> > are
>> >> > very smooth but dT/dz is fairly choppy (especially above the equator
>> of
>> >> > the
>> >> > drop). If I expand my sphere to a place where there's not a lot
>> going
>> >> > on
>> >> > dT/dz seems to calm down. Is there a way to smooth dT/dz in the
>> >> > location of
>> >> > interest or should I try to write my own derivatives filter to make
>> them
>> >> > smoother? Any thoughts?
>> >> >
>> >> > Thanks,
>> >> > Peter.
>> >> >
>> >> > _______________________________________________
>> >> > 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/20100423/81e7776a/attachment.htm>
More information about the ParaView
mailing list