[vtkusers] deleting data arrays after SetXCoordinates

Amy Henderson amy.henderson at kitware.com
Tue Jun 1 14:48:28 EDT 2004


At 01:21 PM 6/1/2004, tom fogal wrote:
>Hi all, I couldn't seem to find the implementation for
>vtkRectilinearGrid::SetXCoordinates. It's declared virtual but does not force
>derived objects to implement the function, so I'm a little curious as to
>where it shows up...

The method is virtual, not pure virtual, so subclasses of 
vtkRectilinearGrid can overwrite the method, but they don't have to. The 
method is implemented with a macro at the top of vtkRectilinearGrid.cxx:

vtkCxxSetObjectMacro(vtkRectilinearGrid,XCoordinates,vtkDataArray);

The macro is defined in vtkSetGet.h.

>Anyway, my main question is if I can delete the array used in SetXCoordinates
>(and its Y, Z counterparts) after I have passed them into the function -- does
>the function copy all the data over or just save the pointer to the array
>given?

You can can call Delete on the vtkDataArray that you pass to the 
SetXCoordinates method. Because of reference-counting, the array won't 
actually go away until all references to it are removed.

- Amy 






More information about the vtkusers mailing list