Embed point on line?
Hi everyone,
I am currently trying to embed point on line. I wrote the following Python code to check it:
import gmsh
gmsh.initialize()
# 3 points aligned
pA = gmsh.model.occ.addPoint(0,0,0)
pB = gmsh.model.occ.addPoint(0,1,0)
pC = gmsh.model.occ.addPoint(0,0.25,0)
# new line
lA = gmsh.model.occ.addLine(pA,pB)
# syncrhonize
gmsh.model.occ.synchronize()
# check if point on line
coord = gmsh.model.getValue(0,pC,[])
print(gmsh.model.isInside(1,lA,coord,[]))
# embed the point
gmsh.model.mesh.embed(0,[pC],1,lA)
# check if point is embed (not working??)
print(gmsh.model.mesh.getEmbedded(1,lA))
# recheck if point is embed (not working??)
gmsh.model.occ.synchronize()
print(gmsh.model.mesh.getEmbedded(1,lA))
# add surface and new point
surf = gmsh.model.occ.addRectangle(0.,0.,0.,2.,1.)
pD = gmsh.model.occ.addPoint(0.25,0.25,0)
gmsh.model.occ.synchronize()
# check if points on surface
coord = gmsh.model.getValue(0,pD,[])
print(gmsh.model.isInside(2,surf,coord,[]))
coord = gmsh.model.getValue(0,pC,[])
print(gmsh.model.isInside(2,surf,coord,[]))
# embed the point and check (working)
gmsh.model.mesh.embed(0,[pD],2,surf)
print(gmsh.model.mesh.getEmbedded(2,surf))
# embed the point and check (working)
gmsh.model.mesh.embed(0,[pC],2,surf)
print(gmsh.model.mesh.getEmbedded(2,surf))
# mesh (not working)
gmsh.model.mesh.generate(2)
# show
gmsh.fltk.run()
I observe that the points inside a surface or in the boundary of the surface are well embedded but using embed on lines seems to not working. Maybe I miss something but is this behavior expected?
Notice that if I embed the point on boundary of the surface, the generation of the 2D mesh is not working.
Thank you for your help.
Edited by Luc Laurent