[vtkusers] Cell IDs in vtkUnstructuredGrid?

Dirk Fressmann dirk.fressmann at dynamore.de
Fri Oct 24 08:01:01 EDT 2008


Philippe

elems is just a dictionary, storing the topology of the elements, i.e.
elems = {1: [1,2,3,4,5,6,7,8], 2: [2,3,6,4,10,3,1,3], etc.}.
the node list pts is set within the loop for each element and the 
corresponding cell inserted into the vtkGrid object.
So the full loop would look like this

for el in elems.keys():
    pts = vtk.vtkIdList()
    for nd in elems[el]:
        pts.InsertNextId(nd)
    cellID = vtkGrid.InsertNextCell(12,pts)

as said before, cellID should contain the ID of the newly created cell, 
but is always zero

Dirk


Philippe P. Pebay wrote:
> Dirk
> 
> Where does elems become initialized?
> 
> P.
> 
> Dirk Fressmann wrote:
>> Hi guys,
>>
>> one more question to vtkUnstructuredGrid:
>>
>> I am using the vtkUnstructuredGrid class to setup an arbitrary Finite
>> Element mesh, like (python)
>>
>> vtkGrid = vtk.vtkUnstructuredGrid()
>> vtkGrid.Allocate(esize,1)
>> vtkGrid.SetPoints(vtkNodesDef)
>> for el in elems:
>>     pts = ...   # point list (vtkIdList) defining the cell
>>     cellID = vtkGrid.InsertNextCell(cellType,pts)
>>
>> following the API, InsertNextCell is supposed to return a new cell ID,
>> but I always get 0 (in Python and C++). The result is that I always get
>> 0 when using the vtkCellPicker class. Is there a way to fix this?
>>
>>
>> Cheers
>> Dirk
>> _______________________________________________
>> This is the private VTK discussion list.
>> Please keep messages on-topic. Check the FAQ at: 
>> http://www.vtk.org/Wiki/VTK_FAQ
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
> 
> 

-- 
DYNAmore - Gesellschaft fuer Ingenieurdienstleistungen mbH
Dirk Fressmann, Dr.-Ing.
Industriestrasse 2
D-70565 Stuttgart-Vaihingen
--------------------------------------------------------------------
Tel             +49 (0)711 - 45 96 00 - 23
Fax             +49 (0)711 - 45 96 00 - 29
E-Mail          dirk.fressmann at dynamore.de
Internet        www.dynamore.de



More information about the vtkusers mailing list