Problems writing VTK output


I try to write out some VTI indicator masks for my geometry and dynamics type. Does anyone know what is wrong with the following simple code:

// a simple test:
// nx=2, ny=2
// write matrix [0 1; 1 2] as int8
ScalarField2D<double> playMask(2,2);
playMask[0] = 0;
playMask[1] = 1;
playMask[2] = 1;
playMask[3] = 2;
VtkImageOutput2D<double> playVtkOut("playMask", 1);
playVtkOut.writeData<char>(playMask, "playName", (char)1);

The code runs and gives no error message. The file “playMask.vti” is created but nothing is written to the file.

I tried an analogous example with VtkImageOutput3D: The result is the same, except when choosing nx=ny=nz=10 or larger. Then the vtk file is written with correct header, but the size of the stream is wrong.

It would be great if someone has an idea, since I would like to avoid getting into technical details of serializing and base64 encoding…


This is certainly a weird problem. Have you tried doing everything with float or double, instead of char?

Yes, the same happens also with “double” or “float”. Only if the array dimensions are large enough, something is written, but the result is wrong.

However, writing out simulation data as VTK (just as in bstep2d or bstep3d) works fine. Did I forget to initialize something in my ScalarFieldXd object?

Ok, this is a Windows-related problem… I found out that the problem only occurs when running my Cygwin-g++ compiled program directly under Windows. When running it in Xterm, everything is fine.

So, this problem seems solved, although I am still curious why this happens…

Thanks for helping anyway!