[vtk-developers] Variable output type

Wylie, Brian bnwylie at sandia.gov
Sat May 29 11:37:45 EDT 2010


I think the trick is that it outputs the vtkGraph superclass in either case....

  Brian Wylie - Org 1424
  Sandia National Laboratories
  MS 1323 - Building CSRI/242
  (505)844-2238 FAX(505)284-2518   
       _______ __
      /_  __(_) /_____ _____
       / / / / __/ __ `/ __ \
      / / / / /_/ /_/ / / / /
     /_/ /_/\__/\__,_/_/ /_/
            Informatics Toolkit


-----Original Message-----
From: vtk-developers-bounces at vtk.org [mailto:vtk-developers-bounces at vtk.org] On Behalf Of Wylie, Brian
Sent: Saturday, May 29, 2010 9:33 AM
To: 'David Doria'; 'Karthik Krishnan'
Cc: 'VTK Developers'
Subject: Re: [vtk-developers] Variable output type

Not sure if this helps but vtkTableToGraph can either output a directed or undirected graph...

It just creates both and then conditional logic on the choice...

// Create builder for the graph
  VTK_CREATE(vtkMutableDirectedGraph, dirBuilder);
  VTK_CREATE(vtkMutableUndirectedGraph, undirBuilder);
  vtkGraph *builder = 0;
  if (this->Directed)
    {
    builder = dirBuilder;
    }
  else
    {
    builder = undirBuilder;
    }

  // Add the correct number of vertices to the graph based on the number of
  // rows in the vertex table.
  builder->GetVertexData()->PassData(vertexTable->GetRowData());
  for (vtkIdType i = 0; i < vertexTable->GetNumberOfRows(); ++i)
    {
    if (this->Directed)
      {
      dirBuilder->AddVertex();
      }
    else
      {
      undirBuilder->AddVertex();
      }
    }

  Brian Wylie - Org 1424
  Sandia National Laboratories
  MS 1323 - Building CSRI/242
  (505)844-2238 FAX(505)284-2518   
       _______ __
      /_  __(_) /_____ _____
       / / / / __/ __ `/ __ \
      / / / / /_/ /_/ / / / /
     /_/ /_/\__/\__,_/_/ /_/
            Informatics Toolkit

-----Original Message-----
From: vtk-developers-bounces at vtk.org [mailto:vtk-developers-bounces at vtk.org] On Behalf Of David Doria
Sent: Saturday, May 29, 2010 9:27 AM
To: Karthik Krishnan
Cc: VTK Developers
Subject: Re: [vtk-developers] Variable output type

> In addition to what you have, please also try adding the following method :
>
>   int vtkTestFilter::ProcessRequest(vtkInformation* request,
>                                             vtkInformationVector**
> inInfoVec,
>                                             vtkInformationVector*
> outInfoVec)
> {
>   if(request->Has(vtkDemandDrivenPipeline::REQUEST_DATA_OBJECT()))
>     {
>     return vtkAlgorithm::ProcessRequest(request, inputVector, outputVector);
>     }
>
>   return this->Superclass::ProcessRequest(request, inputVector,
> outputVector);
> }

When I added that function (changing inputVector to inInfoVec and
outputVector to outInfoVec), I now get:

vtkStreamingDemandDrivenPipeline (0x8ba81c8): Algorithm
vtkTestFilter(0x8ba73b8) did not create output for port 0 when asked
by REQUEST_DATA_OBJECT and does not specify any DATA_TYPE_NAME.

Thanks for your help - as usual I am trying not to answer just my
specific question but generate something useful enough to put on the
wiki!

Thanks,

David
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtk-developers



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtk-developers






More information about the vtk-developers mailing list