[Paraview] Getting the coordinates of the point with max temperature

Tibi Chelcea tchelcea at transim.com
Thu Sep 8 09:48:11 EDT 2011


I figured out the issue with fetching, I wasn't applying it to the correct
object. However, I still can't get the Threshold filter to filter by
temperatures, and not other scalars (i.e. "pressure"). 

Here's what I have
th = filters.Threshold(Input = reader)
# this I don't understand, I've tried all sorts of combinations of the first
4 parameters
th.SelectInputScalars = ['0','0','0','1','temperature']       
th.ThresholdBetween = [0,1e+22]         # set it to a very large interval,
normally it should be [temp_max*0.55,temp_max*1.05]
th.UpdatePipeline()

thdata = Fetch(th)
pts = thdata.GetPoints()
print pts
pts_data = thdata.GetPointData()
print pts_data

And here's the relevant output:
.....
  Number Of Arrays: 5
  Array 0 name = pressure
  Array 1 name = temperature
  Array 2 name = kinetic energy
  Array 3 name = kinetic dissipation
  Array 4 name = velocity
  Number Of Components: 7
  Number Of Tuples: 39197
  Copy Tuple Flags: ( 1 1 1 1 1 1 1 )
  Interpolate Flags: ( 1 1 1 1 1 1 0 )
  Pass Through Flags: ( 1 1 1 1 1 1 1 )
  Scalars:
    Debug: Off
    Modified Time: 115283
    Reference Count: 4
    Registered Events: (none)
    Name: pressure
    Data type: double
    Size: 39197
    MaxId: 39196
    NumberOfComponents: 1
    Information: 00000000049EF180
    MetaData: 0000000000000000
      Debug: Off
      Modified Time: 115285
      Reference Count: 1
      Registered Events: (none)
      PER_COMPONENT: vtkInformationVector(00000000049EF1C0)
    Name: pressure
    Number Of Components: 1
    Number Of Tuples: 39197
    Size: 39197
    MaxId: 39196
    LookupTable: (none)
    Array: 0000000004DDF710
  Vectors:
....

It seems that the filter is returning the 'pressure' scalars, which I don't
need. If I set the threshold range to temp_max +/- 5%, nothing is returned.
What is the meaning of the parameters to SelectInputScalars? I've tried all
sorts of combinations, and nothing happened.

Thanks,
Tibi




-----Original Message-----
From: David E DeMarle [mailto:dave.demarle at kitware.com] 
Sent: Wednesday, September 07, 2011 1:03 PM
To: Tibi Chelcea
Cc: paraview at paraview.org
Subject: Re: [Paraview] Getting the coordinates of the point with max
temperature

vtkPVDataInformation is _only_ lightweight meta information. It describes
some dataset that lives on the server but doesn't give you access to the
actual data.

Fetch should return to you a vtkDataSet. You should be able to get the
points/cells and arrays directly out of that.

David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909



On Wed, Sep 7, 2011 at 1:45 PM, Tibi Chelcea <tchelcea at transim.com> wrote:
> Hi David,
>
> Thank you very much for the hint. I'm still not entirely sure I'm 
> getting it right, though. Here's what I've done:
>
> reader = sources.XMLUnstructuredGridReader(FileName =
> 'C:\\mypath\\output0020.vtu')
> reader.UpdatePipeline()
>
> info_base = reader.GetDataInformation().DataInformation
> pointDataInfo = info_base.GetPointDataInformation()
>
> temp_max = 0
> # here I get the max temperature across all points for i in 
> range(pointDataInfo.GetNumberOfArrays()):
>        ai = pointDataInfo.GetArrayInformation(i)
>        if ai.GetName().lower() == 'temperature':
>                temp_max = ai.GetComponentRange(0)[1]
>
> # temp_max is computed correctly at this point, declare the threshold 
> to be 95% to 105% of the max temperature th = filters.Threshold(Input 
> = reader) th.SelectInputScalars = ['0', '0', '0', '1', 'temperature'] 
> th.ThresholdBetween = [temp_max*0.95,temp_max*1.05]
> th.UpdatePipeline()
> Fetch(th)
>
> pdi = th.GetDataInformation().DataInformation
> print pdi
>
> At this point, 'print pdi' produces this:
>
> vtkPVDataInformation (0000000004089090)
>  Debug: Off
>  Modified Time: 116455
>  Reference Count: 2
>  Registered Events: (none)
>  RootOnly: 0
>  DataSetType: 4
>  CompositeDataSetType: -1
>  NumberOfPoints: 0
>  NumberOfRows: 0
>  NumberOfCells: 0
>  NumberOfDataSets: 1
>  MemorySize: 0
>  PolygonCount: 0
>  Bounds: 1e+299, -1e+299, 1e+299, -1e+299, 1e+299, -1e+299
>  Extent: 2147483647, -2147483647, 2147483647, -2147483647, 2147483647,
> -2147483647
> .......
>
>
> It seems that there are no points selected. I'm wondering whether the 
> th.SelectInputScalars does what's it's supposed to do (I've copied 
> that from some examples in the mailing list). I'm using Paraview 3.4.0 
> (the latest Paraview 3.10.1 works only in GUI, but fails to execute 
> any script in pvbatch).
>
> Thanks,
> Tibi
>
>
> -----Original Message-----
> From: David E DeMarle [mailto:dave.demarle at kitware.com]
> Sent: Wednesday, September 07, 2011 10:41 AM
> To: Tibi Chelcea
> Cc: paraview at paraview.org
> Subject: Re: [Paraview] Getting the coordinates of the point with max 
> temperature
>
> The arrays themselves may be extremely large, thus they live on the 
> server, not the client and you can't get them directly as you are trying
to do.
> You can however use servermanager.Fetch to bring them over, but you 
> should only do so once you have filtered them down in size a bit.
> Try using the threshold filter, picking out only those cells/points 
> near the maximum, then fetching that.
>
> David E DeMarle
> Kitware, Inc.
> R&D Engineer
> 21 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-881-4909
>
>
>
> On Wed, Sep 7, 2011 at 9:57 AM, Tibi Chelcea <tchelcea at transim.com> wrote:
>> Hi,
>>
>>
>>
>> I’m extremely new to Paraview scripting and Python programming, so 
>> the question that I’m asking might have a totally obvious answer, but 
>> I can’t figure it out. I need to write a script to analyze the 
>> results of a transient analysis simulation. For that, the script 
>> needs to read the last .vtu file, figure out the coordinates (or 
>> index) of the point with the largest temperature, and then pick the 
>> temperatures at that point from all the other simulation steps and 
>> then do some computations based on those values.
>>
>>
>>
>> I got stuck at figuring out the coordinates of the point with the max 
>> temperature. This is what I got so far:
>>
>>
>>
>> reader = sources.XMLUnstructuredGridReader(FileName =
>> 'C:\\mypath\\output0020.vtu')
>>
>> reader.UpdatePipeline()
>>
>> info_base = reader.GetDataInformation().DataInformation
>>
>> pointArray = info_base.GetPointArrayInformation()
>>
>>
>>
>> I don’t know how to get from pointArray to a list of points (I assume 
>> that the info in pointArray is the list of coordinates). Then, I can 
>> go through the temperature array obtained with
>> info_base.GetPointDataInformation().GetArrayInformation(..) and get 
>> the max temperature and match it with the coordinates.  But, I’m lost 
>> at this step on how to get from the reader to the actual array of 
>> coordinates and temperature values.
>>
>>
>>
>> I’ve seen posts with some calls to GetPoints, but GetPoints is not a 
>> member of pointArray (or any other of the classes used above, for 
>> that
> matter).
>>
>>
>>
>> Thanks,
>>
>> Tibi
>>
>>
>>
>> _______________________________________________
>> 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