Segfault when using setAsBoundaryLayer
The following MWE gives a segfault on my machine. I aware that this is not the correct usage, but I think it should fail gracefully.
import gmsh
# Initialize gmsh
gmsh.initialize()
# Choose kernel
model = gmsh.model
occ = model.occ
mesh = model.mesh
element_size = 1
width = 10
length = 100
depth = 20
p = [
occ.addPoint(0.0, 0.0, 0.0, element_size),
occ.addPoint(width, 0.0, 0.0, element_size),
occ.addPoint(width, 0.0, depth, element_size),
occ.addPoint(0.0, 0.0, depth, element_size),
]
lines = [
occ.addLine(p[0], p[1]),
occ.addLine(p[1], p[2]),
occ.addLine(p[2], p[3]),
occ.addLine(p[3], p[0]),
]
curve = occ.addCurveLoop(lines)
surf = occ.addPlaneSurface([curve])
occ.synchronize()
threshold_mesh = mesh.field.add("Threshold")
mesh.field.setAsBoundaryLayer(threshold_mesh)
# Generate mesh
mesh.generate(2)
# Launch the GUI to see the results:
gmsh.fltk.run()
gmsh.finalize()
Edited by Christophe Geuzaine