[vtkusers] Lack of Memory to Insert Millions of Cells

Elizabeth Nitao enitao at craft-tech.com
Wed Jun 21 14:36:45 EDT 2006


Hi,
Is there an efficient way to construct two million tetrahedrals and 1 
million prisms?  I am inserting over 900,000 pts into an unstructuredgrid.
vtkPoints points
points SetNumberOfPoints [llength $coordx]
   foreach x $coordx \
   y $coordy \
   z $coordz {
       points SetPoint $count $x $y $z
       incr count
   }

 From here I construct the tetrahedrals and prisms which reference the 
point ids in the unstructuredgrid and then add each tet and prism cell 
to the unstructuredgrid.
   vtkUnstructuredGrid volumeCells
   set cell_typeid [list 10 14 13 12]
   set cell_dim [list 4 5 6 8]
   set cell_obj [list vtkTetra vtkPyramid vtkWedge vtkHexahedron]
   set id 0
   # loop through the type of cells
   while {[llength $cell_nodes] != 0} {
   set num_cells [lindex $cell_nodes 0]
   set num_points [lindex $cell_nodes 1]
   set list_points [lrange $cell_nodes \
                2 [expr {1+($num_cells*$num_points)}]]
   # loop through each individual cell
         for {set i 0; set count 0} {$i < $num_cells} {incr i; incr id} {
       eval [lindex $cell_obj [lsearch $cell_dim $num_points]] cell$id
       # loop through each point in a cell
       for {set j 0} {$j < $num_points} {incr j; incr count} {
       set node_id [expr {[lindex $list_points $count] - 1}]
       [cell$id GetPointIds] SetId $j $node_id              }
       volumeCells InsertNextCell [cell$id GetCellType] [cell$id 
GetPointIds]
   }
   set cell_nodes [lrange $cell_nodes \
           [expr {2+($num_cells*$num_points)}] end]
   puts [lindex $cell_obj [lsearch $cell_dim $num_points]]
   }
   volumeCells SetPoints points

However, too much memory is being consumed and the program exits 
prematurely.  Also, the program is very slow. Setting 
GlobalImmediateModeRenderingOn does not appear to help.  I have not 
tried ReleaseDataFlag since the program is very interactive and will 
need the info of the unstructured grid.  I would appreciate any help you 
can give.  Thanks so much!

Elizabeth




More information about the vtkusers mailing list