[vtkusers] How to make a filter operate on either mutable directed or mutable undirected graph
David Doria
daviddoria+vtk at gmail.com
Wed Mar 31 16:16:45 EDT 2010
On Wed, Mar 31, 2010 at 2:13 PM, Jeff Baumes <jeff.baumes at kitware.com> wrote:
> I see. Yes, in this case you need to specify the output type (directed
> or undirected graph) since the input is not a graph. I think you
> should override FillOutputPortInformation() to specify this, rather
> than overriding RequestDataObject(), although perhaps you should
> override both in this case.
>
> Jeff
Hi Jeff,
Yes, I forgot to mention that the input isn't always a vtkGraph to my
vtkGraphAlgorith m filters.
Case 1: The input IS a graph
You are right. In the case that FillInputInformation is not
re-implemented (the input is a vtkGraph) then you are correct, it
works as expected out of the box.
Case 2: The input is not a vtkGraph
I tried NOT re-implementing RequestData object and only
re-implementing FillOutputPortInformation as:
int vtkMeshToGraph::FillOutputPortInformation(
int vtkNotUsed(port), vtkInformation* info)
{
// now add our info
info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkMutableUndirectedGraph");
return 1;
}
but got the error:
vtkStreamingDemandDrivenPipeline (0x8a22a80): Algorithm
vtkMeshToGraph(0x8a229e8) returned failure for request: vtkInformation
(0x8a25e38)
With both FillOutputPortInformation AND RequestDataObject
re-implement, it worked fine. But it also worked fine with ONLY
RequestDataObject re-implemented.
Oh, the mysteries of the pipeline... haha
Thanks,
David
More information about the vtkusers
mailing list