[vtkusers] Re: file format conversion (XML <-> simple legacy format)

Martin Baumann mailsgetlost at web.de
Mon May 22 05:03:45 EDT 2006


Hi,

I just realized, that I have the same problem using vtkUnstructuredGridReader and vtkUnstructuredGridWriter:

  // read orginal file
  vtkUnstructuredGridReader*    _grid_reader      = vtkUnstructuredGridReader::New();
  _grid_reader->SetFileName(in_file.c_str());
  _grid_reader->Update();
  cout << "#Points : " << _grid_reader->GetOutput()->GetNumberOfPoints() << endl;
  cout << "#Scalars: " << _grid_reader->GetNumberOfScalarsInFile() << endl;

  // writer new file
  vtkUnstructuredGridWriter* _grid_writer  = vtkUnstructuredGridWriter::New();
  _grid_writer->SetFileName("camembert.new.hvs");
  _grid_writer->SetInput(_grid_reader->GetOutput());
  _grid_writer->Write();

  // read new file
  _grid_reader->SetFileName("camembert.new.hvs");
  _grid_reader->Update();
  cout << "#Points : " << _grid_reader->GetOutput()->GetNumberOfPoints() << endl;
  cout << "#Scalars: " << _grid_reader->GetNumberOfScalarsInFile() << endl;


This makes the following output:

  #Points : 400
  #Scalars: 3
  #Points : 400
  #Scalars: 1

Hmmm....

Regards, M.B.
_______________________________________________________________
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192




More information about the vtkusers mailing list