← Back to team overview

dolfin team mailing list archive

bug: VTK output

 

Hi Andres,
I found a bug in writing a mesh to a VTK file. I always received a segmentation fault while writing the file.

I solved the problem by rewriting the function within the file VTKFile.cpp:
//----------------------------------------------------------------------------
void VTKFile::operator<<(Mesh& mesh)
{


  std::string filestart;
  std::ostringstream newfilename;

  filestart.assign(filename, 0, filename.find("."));

  newfilename << filestart << ".vtu";

  vtu_filename = newfilename.str();

  // Make sure file is empty
  FILE* fp = fopen(vtu_filename.c_str(), "w");
  fclose(fp);


  // Write headers
  VTKHeaderOpen(mesh);

  // Write mesh
  MeshWrite(mesh);

  // Write headers
  VTKHeaderClose();
}
------------


Now opening a file with 
------------
File   file_mesh("out/mesh.pvd");
------------ 
produces an empty(?) file "out/mesh.pvd" and the mesh within "out/mesh.vtu"


/Haiko
______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193




Follow ups