[vtkusers] How to get the input to a filter as algorithm output?
David Gobbi
david.gobbi at gmail.com
Tue Dec 15 16:09:39 EST 2009
On Tue, Dec 15, 2009 at 12:46 PM, Jérôme <jerome.velut at gmail.com> wrote:
> Quoting David G. -
> "The "ShallowCopy" method does not mean quite the same thing for
> vtkDataSet as it does for vtkCell. What I mean to say in C++ speak
> is: vtkCell and vtkDataSet do not share a common base class that
> defines a "ShallowCopy" method. Each has its own particular
> definition of ShallowCopy."
>
> You point exactly what I was surprised about: Because I thought
> that Copy are important things, I looked for a virtual function in
> vtkObject - possibly pure -, the one that is shared by every object.
> (I voluntary omit vtkObjectBase). It means that it is possible to
> create VTK objects that don't implement a Copy mechanism.
>
> This is the case for vtkDataObject: There is no Copy functions.
> However, a vtkExecutive is associated to a vtkDataObject. It
> means that generic filters working on vtkDataObject cannot
> perform Shallow/DeepCopy. I don't know if I am clear enough...
>
> Is there a reason to forbid 'abstract' copy (ie without knowing
> the exact implementation)?
There is a reason for vtkObject to not have a copy operation: copying
isn't possible for all objects. For example, vtkRenderWindow and most
vtkMappers are tied to system resources that can't be copied. Then
there's also the question of what to include in the copy, e.g. should
observers be copied? Maybe or maybe not, it depends on exactly what
you want.
In general, "copy" is a reasonable operation for container objects,
but isn't always desirable for process objects.
The vtkDataObject is a tough case because it is so abstract... it
isn't built out of points and cells and attributes the way that
vtkDataSet is. If vtkDataObject had virtual copy methods, then
someone would have to look at all the vtkDataObject subclasses and
decide exactly what things would be copied by ShallowCopy and what
things would be copied by DeepCopy.
David
More information about the vtkusers
mailing list