I have noticed that FoamFile is not able to handle parsing of an OF dictionary with overloaded entries (see below). Specifically, the parser seems to require uniqueness of keys and fails with a FoamFileDecodeError here.
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object autoHexMeshDict;
}
entry_1 1.0;
// ...
subdict
{
variable_1 1.0;
// ...
variable_1 2.0; // <---- Overloading. OpenFoam reads only this value in the subdictionary and overwrites the previous one
}
I know this is not a best-practice scenario, but this case is digested by OpenFOAM, while files containing such entries are now impossible to be parsed/handled with foamlib.
I think it could be useful to add the possibility to the parser to manage multiple entries (I noticed that the function already returns a MultiDict, why not exploiting it?), or at least add a way to pre-process the input and cleanup the file from these occurrences (instead of doing it by hand) so that it can be correctly parsed by foamlib.
I have noticed that
FoamFileis not able to handle parsing of an OF dictionary with overloaded entries (see below). Specifically, the parser seems to require uniqueness of keys and fails with aFoamFileDecodeErrorhere.FoamFile { version 2.0; format ascii; class dictionary; object autoHexMeshDict; } entry_1 1.0; // ... subdict { variable_1 1.0; // ... variable_1 2.0; // <---- Overloading. OpenFoam reads only this value in the subdictionary and overwrites the previous one }I know this is not a best-practice scenario, but this case is digested by OpenFOAM, while files containing such entries are now impossible to be parsed/handled with
foamlib.I think it could be useful to add the possibility to the parser to manage multiple entries (I noticed that the function already returns a
MultiDict, why not exploiting it?), or at least add a way to pre-process the input and cleanup the file from these occurrences (instead of doing it by hand) so that it can be correctly parsed byfoamlib.