vtkDataSet reader again

John Biddiscombe j.biddiscombe at rl.ac.uk
Wed Dec 8 06:46:59 EST 1999


Delving more deeply into vtkDataSetReader it seems that Update() does
correctly stamp the executetime, but

vtkDataSet * vtkDataSetReader::GetOutput() 

calls execute (once) to generate a valid output (and doesn't stamp the output)

then 

void vtkDataSetReader::Update()
{
  if (this->GetOutput())
    {
    this->GetOutput()->Update();
    }
  else
    {
    // execute creates an output
    this->InternalUpdate(NULL);
    }
}

Calls it twice more and this time does successfully stamp the output.

If you yourself call
if (reader->GetOutput()) reader->Update()

you get a bonus execute thrown in!

When your data is 20MB, this translates to a (very) long wait.

One solution would be to use the Outputs[0] array for a check

void vtkDataSetReader::Update()
{
  if (this->Outputs[0])
    {
    this->GetOutput()->Update();
    }
  else
    {
    // execute creates an output
    this->InternalUpdate(NULL);
    }
}

and in GetOutput() instead of doing a full (wasted) execute to simply call

vtkDataSet * vtkDataSetReader::GetOutput() 
{ 
this->Update()
return this->GetOutput();
}

Not sure if this is any good though if you want to just call
GetOutput() and pass the pointer on at program start. 
(Seems my suggestion of a callback on Output set would be useful here -
hint hint)

It looks very messy as it is currently implemented. 

ttfn

John B



-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------




More information about the vtkusers mailing list