def jigsaw(opts, geom, mesh, init=None, hfun=None): """ JIGSAW API-lib. interface to JIGSAW. JIGSAW(OPTS,GEOM,MESH,INIT=None, HFUN=None) Call the JIGSAW mesh generator using the config. options specified in the OPTS structure. OPTS is a user-defined set of meshing options. See JIG_t for details. """ #--------------------------------- set-up ctypes objects ojig = libsaw_jig_t() JLIB.jigsaw_init_jig_t(ct.byref(ojig)) put_jig_t(opts, ojig) gmsh = libsaw_msh_t() mmsh = libsaw_msh_t() imsh = libsaw_msh_t() hmsh = libsaw_msh_t() JLIB.jigsaw_init_msh_t(ct.byref(gmsh)) JLIB.jigsaw_init_msh_t(ct.byref(mmsh)) JLIB.jigsaw_init_msh_t(ct.byref(imsh)) JLIB.jigsaw_init_msh_t(ct.byref(hmsh)) put_msh_t(geom, gmsh) put_msh_t(init, imsh) put_msh_t(hfun, hmsh) iptr = ct.byref(imsh) if (init is None): iptr = 0 hptr = ct.byref(hmsh) if (hfun is None): hptr = 0 #--------------------------------- call to JIGSAW's lib. retv = JLIB.jigsaw(ct.byref(ojig), ct.byref(gmsh), iptr, hptr, ct.byref(mmsh)) if (retv != +0): raise Exception("JIGSAW returned code: " + str(retv)) #--------------------------------- copy buffers to MSH_t get_msh_t(mesh, mmsh) return
def tripod(opts, init, tria, geom=None): """ TRIPOD API-lib. interface to TRIPOD. TRIPOD(OPTS,INIT,TRIA,GEOM=None) Call the TRIPOD tessellation util. using the config. opt specified in the OPTS structure. OPTS is a user-defined set of meshing options. See JIG_t for details. """ #--------------------------------- set-up ctypes objects ojig = libsaw_jig_t() JLIB.jigsaw_init_jig_t(ct.byref(ojig)) put_jig_t(opts, ojig) imsh = libsaw_msh_t() tmsh = libsaw_msh_t() gmsh = libsaw_msh_t() JLIB.jigsaw_init_msh_t(ct.byref(imsh)) JLIB.jigsaw_init_msh_t(ct.byref(tmsh)) JLIB.jigsaw_init_msh_t(ct.byref(gmsh)) put_msh_t(init, imsh) put_msh_t(geom, gmsh) gptr = ct.byref(gmsh) if (geom is None): gptr = 0 #--------------------------------- call to JIGSAW's lib. retv = JLIB.tripod(ct.byref(ojig), ct.byref(imsh), gptr, ct.byref(tmsh)) if (retv != +0): raise Exception("TRIPOD returned code: " + str(retv)) #--------------------------------- copy buffers to MSH_t get_msh_t(tria, tmsh) return
def marche(opts, ffun): """ MARCHE API-lib. interface to MARCHE. MARCHE(OPTS,FFUN=None) Call the "fast-marching" solver MARCHE using the config. options specified in the OPTS structure. MARCHE solves the Eikonal equations MAX(||dh/dx||, g) = g, where g = g(x) is a gradient threshold applied to h. See the SAVEMSH/LOADMSH functions for a description of the HFUN output structure. OPTS is a user-defined set of meshing options. See JIG_t for details. """ #--------------------------------- set-up ctypes objects ojig = libsaw_jig_t() JLIB.jigsaw_init_jig_t(ct.byref(ojig)) put_jig_t(opts, ojig) fmsh = libsaw_msh_t() JLIB.jigsaw_init_msh_t(ct.byref(fmsh)) put_msh_t(ffun, fmsh) #--------------------------------- call to JIGSAW's lib. retv = JLIB.marche(ct.byref(ojig), ct.byref(fmsh)) if (retv != +0): raise Exception("MARCHE returned code: " + str(retv)) return