[vtkusers] allocate in vtkUnstructuredGrid

Amy Squillacote amylists at gmail.com
Tue Dec 5 09:09:35 EST 2006


Hi Amitesh,

If you know what size you expect your unstructured grid to be, go ahead 
and provide that information to the Allocate method. extSize specifies 
the amount by which to extend the underlying arrays when more cells need 
to be added than will fit in the currently allocated arrays. However, 
InsertNextCell will do allocation for you, keeping you from writing into 
uninitialized memory. In VTK, methods names starting with Insert (such 
as your example, InsertNextCell) memory allocation is performed as 
necessary. In corresponding method names starting with Set, no such 
allocation is performed; the necessary arrays are assumed to be large 
enough. This is done to avoid the time overhead necessary to perform 
memory checking.

- Amy

Amitesh Agarwal wrote:
> Hi all,
>
> I have a small question.
>
> What does extSize in Allocate 
> <http://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#aeee14c44136d7e7e50a62837eb01598> 
> (vtkIdType 
> <http://www.vtk.org/doc/nightly/html/vtkType_8h.html#20bd6b6dedfe1bbb096c50354d52cc7e> 
> numCells, int extSize) does while creating a vtkUnstructured Grid? Do 
> we have to explicitly declare numCells and extSize while allocating or 
> will InsertNextCell 
> <http://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#c2052de346ce05d14aea6f01330ab4bb> 
> will take care of it??
>
> Thanks
>
> Amitesh
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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
>   



More information about the vtkusers mailing list