Commit 5056033f authored by Christophe Geuzaine's avatar Christophe Geuzaine

install Julia module + Julia exceptions on errors

parent 1f75bfa4
Pipeline #1624 canceled with stage
in 1 minute and 11 seconds
...@@ -125,6 +125,7 @@ endif(ENABLE_PRIVATE_API) ...@@ -125,6 +125,7 @@ endif(ENABLE_PRIVATE_API)
set(ONELAB_PY contrib/onelab/python/onelab.py) set(ONELAB_PY contrib/onelab/python/onelab.py)
set(GMSH_PY api/gmsh.py) set(GMSH_PY api/gmsh.py)
set(GMSH_JL api/gmsh.jl)
if(${CMAKE_MAJOR_VERSION} GREATER 2) if(${CMAKE_MAJOR_VERSION} GREATER 2)
string(TIMESTAMP DATE "%Y%m%d") string(TIMESTAMP DATE "%Y%m%d")
...@@ -1696,6 +1697,7 @@ endif(ENABLE_ONELAB) ...@@ -1696,6 +1697,7 @@ endif(ENABLE_ONELAB)
if(ENABLE_BUILD_LIB OR ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC) if(ENABLE_BUILD_LIB OR ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC)
install(FILES ${GMSH_API} DESTINATION ${GMSH_INC}) install(FILES ${GMSH_API} DESTINATION ${GMSH_INC})
install(FILES ${GMSH_PY} DESTINATION ${GMSH_LIB}) install(FILES ${GMSH_PY} DESTINATION ${GMSH_LIB})
install(FILES ${GMSH_JL} DESTINATION ${GMSH_LIB})
if(ENABLE_PRIVATE_API) if(ENABLE_PRIVATE_API)
install(FILES ${GMSH_PRIVATE_API} DESTINATION ${GMSH_INC}/gmsh) install(FILES ${GMSH_PRIVATE_API} DESTINATION ${GMSH_INC}/gmsh)
endif(ENABLE_PRIVATE_API) endif(ENABLE_PRIVATE_API)
......
...@@ -24,8 +24,8 @@ class arg: ...@@ -24,8 +24,8 @@ class arg:
self.cwrap_pre = "" self.cwrap_pre = ""
self.cwrap_post = "" self.cwrap_post = ""
self.python_value = python_value if python_value is not None else value self.python_value = python_value if python_value is not None else value
self.python_arg = "not_implemented" self.python_arg = ""
self.python_return = "not_implemented" self.python_return = ""
self.python_pre = "" self.python_pre = ""
self.julia_value = julia_value if julia_value is not None else value self.julia_value = julia_value if julia_value is not None else value
self.julia_arg = name self.julia_arg = name
...@@ -1103,9 +1103,8 @@ class API: ...@@ -1103,9 +1103,8 @@ class API:
tuple(a.julia_arg for a in args) + ("ierr",)) + ")\n") tuple(a.julia_arg for a in args) + ("ierr",)) + ")\n")
for a in args: for a in args:
if a.julia_post: f.write(" " + a.julia_post + "\n") if a.julia_post: f.write(" " + a.julia_post + "\n")
f.write(" if ierr[1] != 0\n") f.write(' ierr[1] != 0 && error("' + c_name +
f.write(" println(ierr[1])\n") ' returned non-zero error code: " * string(ierr[1]))\n')
f.write(" end\n")
r = (["api__result__"]) if rtype else [] r = (["api__result__"]) if rtype else []
r += list((o.name for o in oargs)) r += list((o.name for o in oargs))
if len(r) != 0: if len(r) != 0:
......
This diff is collapsed.
import gmsh
model = gmsh.model
factory = model.occ
gmsh.initialize(ARGS)
# creates the FLTK user interface; this could also be called after the geometry
# is created (or not at all - fltk.run() will do it automatically)
gmsh.fltk.initialize()
# Copied from boolean.py...
model.add("boolean")
gmsh.option.setNumber("Mesh.Algorithm", 6);
gmsh.option.setNumber("Mesh.CharacteristicLengthMin", 0.4);
gmsh.option.setNumber("Mesh.CharacteristicLengthMax", 0.4);
R = 1.4; Rs = R*.7; Rt = R*1.25
factory.addBox(-R,-R,-R, 2*R,2*R,2*R, 1)
factory.addSphere(0,0,0,Rt, 2)
factory.intersect([(3, 1)], [(3, 2)], 3)
factory.addCylinder(-2*R,0,0, 4*R,0,0, Rs, 4)
factory.addCylinder(0,-2*R,0, 0,4*R,0, Rs, 5)
factory.addCylinder(0,0,-2*R, 0,0,4*R, Rs, 6)
factory.fuse([(3, 4), (3, 5)], [(3, 6)], 7)
factory.cut([(3, 3)], [(3, 7)], 8)
factory.synchronize();
# ...end of copy
# this would be equivalent to gmsh.fltk.run():
#
# gmsh.graphics.draw();
# while 1:
# gmsh.fltk.wait()
# print "just treated an event in the interface"
gmsh.fltk.run()
gmsh.finalize()
...@@ -12,7 +12,7 @@ model.add("t16") ...@@ -12,7 +12,7 @@ model.add("t16")
factory.addBox(0,0,0, 1,1,1, 1) factory.addBox(0,0,0, 1,1,1, 1)
factory.addBox(0,0,0, 0.5,0.5,0.5, 2) factory.addBox(0,0,0, 0.5,0.5,0.5, 2)
factory.cut([(3,1)], [(3,2)], 3) factory.cut([(3,1)], [(3,2000)], 3)
x = 0; y = 0.75; z = 0; r = 0.09 x = 0; y = 0.75; z = 0; r = 0.09
......
...@@ -13,7 +13,7 @@ model.add("t16") ...@@ -13,7 +13,7 @@ model.add("t16")
factory.addBox(0,0,0, 1,1,1, 1) factory.addBox(0,0,0, 1,1,1, 1)
factory.addBox(0,0,0, 0.5,0.5,0.5, 2) factory.addBox(0,0,0, 0.5,0.5,0.5, 2)
factory.cut([(3,1)], [(3,2)], 3) factory.cut([(3,1)], [(3,2000)], 3)
x = 0; y = 0.75; z = 0; r = 0.09 x = 0; y = 0.75; z = 0; r = 0.09
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment