Julia API, bug with model.getBoundary()
Hi,
In my case, Julia calls to gmsh.model.getBoundary() often bug and return an error :
Error : Unknown model curve with tag XXX
ERROR: LoadError: gmshModelGetBoundary returned non-zero error code: 1
The bug is not deterministic, the entity (dim,tag) for which it fails, and the returned unknown tag XXX, vary from run to run. Sometimes it executes without errors.
With the sample code bellow (spherical_surf.jl), the bug usually happens at the third or fourth call with my setup (Manjaro linux, gmsh 4.5.0-git-298fd5a6 compiled with GCC 9.1.0 in RelWithDebInfo or Debug, Julia 1.1.1).
The same code executes without issue with the Python API.
I guess there is an issue with uninitialized values or out-of-range memory read/write.
push!(LOAD_PATH,"/path/to/gmsh/build")
import gmsh
gmsh.initialize()
gmsh.model.add("sphere_cut")
R = 1
R1 = 0.95
sph = gmsh.model.occ.addSphere(0,0,0, R, -1, 0, pi/2, pi/2)
b1 = gmsh.model.occ.addBox(R1,0,0, R,R,R)
b2 = gmsh.model.occ.addBox(0,R1,0, R,R,R)
b3 = gmsh.model.occ.addBox(0,0,R1, R,R,R)
gmsh.model.occ.cut([(3,sph)], [(3,b1), (3,b2), (3,b3)])
gmsh.model.occ.synchronize()
gmsh.model.removeEntities([(3,sph)])
gmsh.model.removeEntities([(2,2), (2,4), (2,6)], true)
curves = gmsh.model.getEntities(1)
for curve in curves
println(curve)
println(gmsh.model.getBoundary(curve)) # may bug !
end