[vtkusers] Questions about vtkDataArray::Initialize()
Berk Geveci
berk.geveci at kitware.com
Fri Sep 18 12:00:12 EDT 2009
Look at vtkDataArrayTemplate.txx. Initialize is there.
-berk
On Thu, Sep 17, 2009 at 5:58 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
> In vtkPoints.h, there is
> virtual void Initialize();
>
> In the implementation, the function looks like this:
> void vtkPoints::Initialize()
> {
> this->Data->Initialize();
> }
>
> Again, in vtkPoints.h there is a member variable:
> vtkDataArray *Data;
>
> I looked in vtkDataArray.h , but there is no Initialize() function.
> vtkDataArray is derived from vtkAbstractArray, so I looked at
> vtkAbstractArray.h. vtkAbstractArray.h has a pure virtual function
> Initialize(). So where is the Initialize() function that is getting called
> from vtkPoints?
>
> The reason I started digging into this is the following:
>
> I had a situation like this:
>
> vtkPoints* MyPoints = vtkPoints::New();
> for(i = 0; i < 1000; i++)
> {
> MyFunction(MyPoints);
> }
>
> MyPoints->Delete();
> ----------
>
> void MyFunction(vtkPoints* MyPoints)
> {
> MyPoints->Initialize();
> //fill MyPoints with points
> //do some nearest neighbor lookups using a KDTree
> }
>
> I was finding that after a few hundred iterations I was getting some bizarre
> results.
>
> I changed the process to look like this:
>
> for(i = 0; i < 1000; i++)
> MyFunction();
>
> ------
> void MyFunction()
> {
> vtkPoints* MyPoints = vtkPoints::New();
>
> //fill MyPoints with points
> //do some nearest neighbor lookups using a KDTree
> MyPoints->Delete();
> }
>
> and it works fine through the entire loop.
>
> I thought these should be identical - am I missing something?
>
> Thanks,
>
> David
>
> _______________________________________________
> 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 VTK 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