pyxfem.core.level_set_mesh_cut module

Created on Fri Dec 1 16:17:21 2023

@author: nchevaug

class pyxfem.core.level_set_mesh_cut.SimpleLevelSetFunction[source]

Bases: object

class to group basic level set function for simple geometrical object

static complement(ls)[source]

return the complement level set (opposite sign)

static disk(center, radius)[source]

return the signed distance fonction to a circle defined by center and radius (negative inside)

static halfplane(point, theta)[source]

signed distance to a ligne passing thrue point makig angle theta with x axis;

static intersection(lss)[source]

given a list of lss of levelset, return the intersection

static union(lss)[source]

given a list of lss of levelset, return the union

pyxfem.core.level_set_mesh_cut.build_interpolatecallback_default(setls)[source]

callback that st the value of the levelset to 0 at new vertices

pyxfem.core.level_set_mesh_cut.compute_face_side(tris_ls: NDArray[float64])[source]

return on which size is a tri looking at vertices values of the ls

given tris_ls an 2d array such as each line i give the value of the levelset at the nodes of an element return an array containing the side of each element (-1, 0, 1, respectivily inside, crossing o out of the iso zero of the ls)

pyxfem.core.level_set_mesh_cut.crack_iso_cut(xy, tris, lsn, lst, fit2vertices=True, absfittol=1e-12, relfittol=1e-06)[source]

cut the mesh with a crack defined by lsn and lst

pyxfem.core.level_set_mesh_cut.cutpos(e, getls)[source]

return the position of the cut on edge e

pyxfem.core.level_set_mesh_cut.docut(e, getls)[source]

return True if edge must be cut

pyxfem.core.level_set_mesh_cut.facecallback_propagate_parent(f, f0, f1)[source]

Call back that set parent on the new faces f0, f1 to be the same as f

pyxfem.core.level_set_mesh_cut.faces2cut(tris_ls: NDArray[float64])[source]

return which face need to be cut

given tris_ls an 2d array such as each line i give the value of the levelset at the nodes of an element return the indexes of the elements that needs to be cut

pyxfem.core.level_set_mesh_cut.fit_to_vertices(vls: NDArray[float64], trisv: NDArray[int64], absfittol: float, relfittol: float)[source]

fit value of the level set so that iso-zero close to a vertex is snapped to the said vertex. input : - vls is an array containing the values of the levelset at each node, - trisv is the element connectity (trisv[i,j] return node j of element i) - absfittol : absolute fit tolerance. ls is fit to 0. where abs(ls) < absfittol - relfittol : relative fit tolerance.

value of a level-set at a node is set to zero if one of it’s edges would be cut by iso-zero at parameter s < relfittol (edges are parametrized from 0 to 1)

pyxfem.core.level_set_mesh_cut.fit_to_vertices_old(vertices: Any, getls, setls, absfittol: float, relfittol: float)[source]

this is an old slow version of fit to vertices wiht too much loop.

still used for crackIsocut and multiLevelSetIsoCut … it work directly on mesh vertices of the dynamic mesh structure …. it will desapear soon

pyxfem.core.level_set_mesh_cut.levelset_isocut(xy: NDArray[float64], tris2v: NDArray[int64], vls: NDArray[float64], returnparent=True)[source]

improved version of levelSetIsoCut : only the part of the mesh that really need to be cut are loaded in a dynamic mesh. Much faster return improved data structure : meshModification

pyxfem.core.level_set_mesh_cut.lscut(m, getls, setls, fit=True, absfittol=1e-06, relfittol=0.01, interpolatecallback=None, edgecallback=<function DMesh.edge_cut_call_back_pass>, facecallback=<function DMesh.face_cut_call_back_pass>)[source]

cut the mesh m using a level set

pyxfem.core.level_set_mesh_cut.multi_levelset_isocut(xy, tris, list_of_ls_at_vertices, absfittol=1e-12, relfittol=1e-06)[source]

cut mesh with multiple level sets

pyxfem.core.level_set_mesh_cut.set_levelset(vertices: Any, ls_at_vertices: NDArray[float64], setls)[source]

an internal function

pyxfem.core.level_set_mesh_cut.test_suite(*, element_size=0.2, profile=False, popupgmsh=False)[source]

function to test the tools defined in this file