Skip to content

Fill in mesh field script output

Max Orok requested to merge scripting into master

Fill in some non-geo script output strings (mostly mesh fields).

Here is some sample output:

py: gmsh.model.geo.addPoint(0.9, 0.9, 1, 1.0)
py: gmsh.model.mesh.field.setAsBackgroundMesh(3)
py: gmsh.model.mesh.field.setString(2, "F", "F2 + Sin(z) + Cos(z)")
py: gmsh.model.mesh.field.setNumbers(1, "ExcludedSurfacesList", [1, 2, 3])
py: gmsh.model.mesh.field.remove(3)

About gmsh.model.mesh.field.add, for non-geo scripts, it will segfault after printing the output string. I believe this comes from not actually adding the Field in scriptAddCommand but then attempting to access it afterwards here: https://gitlab.onelab.info/gmsh/gmsh/-/blob/45013d06bf8d7fdc631ad2b3b50a746ba0a3cb4b/Fltk/fieldWindow.cpp#L52. I don't think this can be fixed until scriptAddCommand is adjusted for non-geo files.

I had a general question: when should synchronize calls be emitted? As I understand it there is an implicit synchronize between every geo file command (https://gitlab.onelab.info/gmsh/gmsh/-/blob/45013d06bf8d7fdc631ad2b3b50a746ba0a3cb4b/Geo/scriptStringInterface.cpp#L105-109), but this would be very verbose. However I can't think of another way that guarantees the script will be correct (e.g. if you only synchronize when changing between modules, how do you ensure the final synchronize is correct?).

Merge request reports