[vtkusers] DeepCopy doesn't copy vectors?

tom fogal tfogal at apollo.sr.unh.edu
Fri Sep 3 14:53:33 EDT 2004


I have a function which returns a vtkDataSet*, but subsequent calls
will make the pointer returned in earlier calls invalid, so I want to
copy the output of the function into my own vtkDataSet. I figured
DeepCopy would do what I want, but it doesn't seem to copy (at least)
the vector data from the point data of the source dataset.

To spell it out better:

vtkDataSet* MyObj::func()
{
	this->Data = some_filter->GetOutput();
	return this->Data; //Data is a vtkDataSet*
}

void MyObj::SomeOtherFunc()
{
	vtkDataSet *my_data = vtkDataSet::New();

	my_data->DeepCopy(this->func());

	/*** CRASH HERE ***/
	my_data->GetPointData()->GetVectors();
	/*** CRASH HERE ***/
}

Psuedo-ish code, of course. Running through gdb, it seems that
GetPointData() returns a valid pointer, but when I try to GetVectors()
from the pointer returned by GetPointData(), i get a segmentation
fault.

So it looks to me as if the vector data isn't being copied. Is this
normal behavior? How / what should I set to enable a complete copy of
the vtkDataSet and all of the data it holds?

Thanks,

-tom



More information about the vtkusers mailing list