[vtkusers] Problem with vtkUnstructuredGridWriter

Bryn Lloyd blloyd at vision.ee.ethz.ch
Wed Jun 25 09:32:37 EDT 2008


According to documentation the Write() function should return 1 if success.

But if the file cannot be opened/created, the function does not know
anything about this. This is because it calls the function:

void vtkUnstructuredGridWriter::WriteData()

which has "void" return type. Maybe this should be corrected?


bye
Bryn



Bryn Lloyd wrote:
> Hi,
> 
> 
> I have a strange problem in my program. The program runs a simulation
> and writes each iteration to scratch. After a certain number of
> iterations I start getting this message:
> 
> ERROR: In /home/blloyd/Kitware/VTK/VTK/IO/vtkDataWriter.cxx, line 198
> vtkUnstructuredGridWriter (0x8479560): Unable to open file: out-00063.vtk
> 
> 
> The simulation continues (for another 140 iterations) and seems to be
> OK. I tried to detect the error, but it does not work. This is how I tried:
> 
> 
> char buf[20];
> sprintf(buf, "-%05d", iter+1);
> writer->SetFileName((outfilename+buf+".vtk").c_str());
> writer->SetInput(mesh);
> int success = writer->Write();
> if(!success)  {
>     writer->Print(cout);
>     mesh->Print(cout);
>     exit(0);
> }
> 
> 
> So in other words, even though I get the error message, the
> vtkUnstructuredGridWriter returns success==1, which is not what the
> documentation promises:
> http://www.vtk.org/doc/nightly/html/classvtkWriter.html#667faa8d0c5e6948d456ec68976bc25b 
> 
> 
> 
> Another strange thing is, that when I resume the simulation from the 
> last saved state, it continues without any problems and writes the data 
> until the problem re-appears much later.
> 
> I am running Debian Linux.
> 
> 
> Thanks for your help,
> Bryn
> 
> 
> 


-- 
-------------------------------------------------
Bryn Lloyd
Computer Vision Laboratory
ETH Zürich, Sternwartstrasse 7
CH - 8092 Zürich, Switzerland
Tel: +41 44 63 27690
Fax: +41 44 63 21199
-------------------------------------------------




More information about the vtkusers mailing list