Thanks David, I made a programmable filter and got it running. It works.<div><br></div><div>Now I have a new question, how to get a point_data array from a ex2 object?</div><div><br></div><div>For vtk object, I know I can fetch it to local, like</div>
<div><br></div><div>from paraview.simple import servermanager as sm</div><div>data=sm.Fetch(reader) </div><div><br></div><div>Then there is data.GetPointData().GetArray(). But I could not find such routines when I tried to do the same to ex2 object.</div>
<div><br></div><div>Any idea?</div><div><br>
<br><br><div class="gmail_quote">On Wed, Mar 23, 2011 at 5:01 PM, David Thompson <span dir="ltr"><<a href="mailto:dcthomp@sandia.gov">dcthomp@sandia.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks again, and I took a look on the programmable filter code. In my case the block consists of more than 1 million tetrahedrons and it will be time consuming to run iterations. Is there a way that I can export the cells and their corresponding point information to a numpy array? The ultimate goal is to calculate the volume of each tetrahedron.<br>
<br>
Your help is much appreciated!<br>
</blockquote>
<br></div>
There is a VTK-numpy bridge which is documented on the wiki. I don't recall exactly where but I'm sure a search engine will find it for you.<br><font color="#888888">
<br>
David</font><div><div></div><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Wed, Mar 23, 2011 at 4:45 PM, David Thompson <<a href="mailto:dcthomp@sandia.gov" target="_blank">dcthomp@sandia.gov</a>> wrote:<br>
<br>
I have an Exodus II type file loaded into Paraview and trying to get the point ID for a group of cells. I know for vtk type object there are functions like GetCell(), GetPoint()<br>
<br>
I assume you're talking about using Python from ParaView?<br>
<br>
Yup, that's exactly what I am doing here.<br>
<br>
There are 2 ways to use Python in ParaView: writing a programmable filter and scripting the user interface. The former is evaluated on the server where you can get access to (at least a portion of) the actual dataset. The latter is evaluated on the client, which does not have access to the datasets -- instead it has proxy objects that send messages to the servers, telling them what to do. So, you can access the points and cells from within a programmable filter, but not from within a client-side script.<br>
<br>
<br>
<br>
and just wonder if there are such kind of routines available for Exodus II files.<br>
<br>
Yes, the ExodusII reader outputs VTK objects in a multiblock dataset. You can use GetCell(), GetPoint(), and such on each individual block... you just have to decide on a particular block. The ExodusII reader separates things into blocks because each one may have different point and/or cell variables. There are actually 2 levels of blocks; the top level segregates datasets into groups that correspond to exodus blocks vs. sets. The second level breaks individual blocks or sets into separate datasets. Does that help?<br>
<br>
<br>
I am new in dealing with ex2 file, could you please be detailed? There is just one block in the dataset, so how to get the vtk object out from it so I can access the points and cells?<br>
<br>
<br>
See the section of this page<br>
<a href="http://www.vtk.org/Wiki/Python_Programmable_Filter" target="_blank">http://www.vtk.org/Wiki/Python_Programmable_Filter</a><br>
named "Dealing with Composite Datasets". It describes how to iterate over all of the blocks in the dataset and run a function (in this case, one named "flatten") on each block.<br>
<br>
David<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div>