[Paraview] Do the GetCellEdgeNeighbors / GetCellNeighbors methods in vtkPolyData not work for polygons?
Cory Quammen
cory.quammen at kitware.com
Mon Jan 4 16:30:55 EST 2016
Evan,
I played with your example in ParaView 5.0 RC2 and could not reproduce the
crash when setting the celIId to one of the end caps. Do you have a stack
trace where the crash occurs, by chance?
Thanks,
Cory
On Fri, Dec 11, 2015 at 2:27 PM, Evan Kao <tossin at gmail.com> wrote:
> Hey all,
>
> It seems the issue might be something else other than the the neighbor
> cell type. After applying the Triangulate Filter, the GetCellNeighbors
> method still results in the same behavior: For cell neighbors on the side
> of the cylinder, the scripts works, but for cell neighbors that make up the
> cap, Paraview crashes. So now I have no idea what's happening.
>
> - Evan
>
> On Fri, Dec 11, 2015 at 11:16 AM, Evan Kao <tossin at gmail.com> wrote:
>
>> Hi all,
>>
>> I've been playing around with the GetCellEdgeNeighbors and
>> GetCellNeighbors methods in the vtkPolyData class and testing them on a
>> cylinder source in Paraview 4.3.1, which generates a surface made of
>> vtkQuads for the sides and vtkPolygons for caps. I've applied the Clean
>> filter to the cylinder since the caps generate duplicate points.
>>
>> [image: Inline image 1]
>>
>> Within a programmable filter, I've tested the following script:
>>
>> import numpy as np
>>
>> in1 = self.GetPolyDataInput()
>> surface = self.GetOutput()
>> surface.DeepCopy(in1)
>> surface.BuildCells()
>> surface.BuildLinks()
>>
>> cellId = 0 # a vtkQuad
>> cellPtIds = vtk.vtkIdList()
>> surface.GetCellPoints(cellId, cellPtIds)
>> cellPtIds = [cellPtIds.GetId(i) for i in
>> xrange(cellPtIds.GetNumberOfIds())]
>> cellPtIds = np.array(cellPtIds).astype(np.int64)
>> cellEdges = [[id0, id1] for id0, id1 in zip(cellPtIds[:-1],
>> cellPtIds[1:])]
>> cellEdges.append( [cellPtIds[-1], cellPtIds[0]] )
>>
>> edgeId = 0 # or 1,2,3
>> edge = cellEdges[edgeId]
>>
>> edgeIdList = vtk.vtkIdList()
>> for i in xrange(2):
>> edgeIdList.InsertNextId(edge[i])
>> singleCellEdgeNeighborIds = vtk.vtkIdList()
>> #surface.GetCellEdgeNeighbors(cellId, edge[0], edge[1],
>> singleCellEdgeNeighborIds)
>> surface.GetCellNeighbors(cellId, edgeIdList, singleCellEdgeNeighborIds)
>>
>> If the edge neighbor cell is a vtkQuad, the script works. But if the
>> edge neighbor cell corresponds to one of the caps, Paraview will crash. Is
>> there a way to get this to work?
>>
>> Thanks,
>> Evan Kao
>>
>
>
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview
>
>
--
Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20160104/e5b58b91/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 34858 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/paraview/attachments/20160104/e5b58b91/attachment.png>
More information about the ParaView
mailing list