Code Comments
Programming Forum and web based access to our favorite programming groups.I am trying to write a dataset in binary vtk file. The format of the vtk file should be: # vtk DataFile Version 2.0 Comment line BINARY DATASET STRUCTURED_GRID DIMENSIONS 20 20 1 POINTS 400 double <point coordinates in binary> .... POINT_DATA 400 FIELD metrics 1 area 1 400 double <"area" dataset in binary> EOF Whitespace and newlines are important. How can I write this file without closing it and re-opening to append? Another question is whether the values put by the unformatted write in the file are those that a library written in c++ (VTK) would expect to find there. I am not even sure that the size of a single value is 4 bytes, as it should be. I am using x86 linux and ifort 8.0, portability is not an issue.
Post Follow-up to this messageIn a previous article, Giorgos Momferratos <mc01627@mail.ntua.gr> wrote: >I am trying to write a dataset in binary vtk file. >The format of the vtk file should be: > ># vtk DataFile Version 2.0 >Comment line >BINARY >DATASET STRUCTURED_GRID >DIMENSIONS 20 20 1 >POINTS 400 double ><point coordinates in binary> >.... >POINT_DATA 400 >FIELD metrics 1 >area 1 400 double ><"area" dataset in binary> >EOF > >Whitespace and newlines are important. >How can I write this file without closing it and re-opening to >append? Another question is whether the values put by the >unformatted write in the file are those that a library written in >c++ (VTK) would expect to find there. I am not even sure that the >size of a single value is 4 bytes, as it should be. >I am using x86 linux and ifort 8.0, portability is not an issue. If I were doing that I would choose either unformatted - all binary - and make up your own CR LF as necessary or do all formatted and use hex for the binary part (e.g. z8 or whatever) You might have to write a translation ... but better that than mixing formatted and unf. Chris
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.