I would like to insert some comment lines into the header of the ASCII .post.res file, such as:
GiD Post Results File 1.2
# Some comment lines
# Sat Aug 16 08:31:49 JST 2025
# Foo bar
Result “SomeValues” “SomeProblem” 1 Scalar OnNodes
Unit “degree”
Values
1 0.0000000e+002 100.0000000e+00
End Values
Could you add a new function to enable this feature in gidpost-2.13?
I think that if you add those comments to the .res ascii file, GiD accepts them. but it’s true that I think that there is not a function to write comments from C / C++.
A drawback to add this function to print comments from gidpost is that doesn’t has sense in case of write binary or HDF5 format, because these files cannot be viewed by a text editor. ASCII format is only recommended for debug, or the be written easily without gidpost.
Binary and HDF5 are more efficient options (smaller disk size and faster to be read, in particular HDF5 allow read the result headers without require to load the whole data)
In gidpost there is no function ‘per se’ to add a comment in the output files.
Instead you can use these functions to achieve (almost) the same result:
Note: for ASCII/binary output internally both functions do the same, can be called anywhere., and write a comment line like this: # attrName: attrVale
Note: for HDF5 output, these functions must be called after a GiD_fBeginMeshand GiD_fBeginResult respectively, as this UserAttribute is inserted as hdf5 ATTRIBUTE in the mesh/result block.
Check the examples/testpost.c file for their use.
In ASCII / binary output files both functions write a comment line in the mesh/results files with the pair attrName : attrValue :
Before, i mentioned that when the output is HDF5, both calls GiD_fWriteMeshUserAttribute and GiD_fWriteResultUserAttribute should be used after GiD_fBeginMesh* and GiD_fBeginResult*, but for ASCII/binary output they can be used also before these GiD_fBegin*calls.
In the next gidpost version, when using HDF5 output, both GiD_fWrite*UserAttribute calls can also be used before GiD_fBegin(thus having the same behaviour for all outputs). The UserAttributes will be inserted in the Meshes and Results group respectively:
Miguel Pasenau, thank you for your support. I think HDF5 files are very sophisticated and excellent. I haven’t used them before, but I plan to use them going forward.