# sfepy.mesh.mesh_tools module

sfepy.mesh.mesh_tools.elems_q2t(el)

sfepy.mesh.mesh_tools.expand2d(mesh2d, dist, rep)

  Expand 2D planar mesh into 3D volume, convert triangular/quad mesh to tetrahedrons/hexahedrons.

  Parameters:
    mesh2d Mesh

      The 2D mesh.

    dist float

      The elements size in the 3rd direction.

    rep int

      The number of elements in the 3rd direction.

  Returns:
    mesh3d Mesh

      The 3D mesh.

sfepy.mesh.mesh_tools.extract_edges(mesh, eps=1e-16)

  Extract outline edges of a given mesh. The outline edge is an edge for which norm(nvec_1 - nvec_2) < eps, where nvec_1 and nvec_2 are the normal vectors of the incident facets.

  Parameters:
    mesh Mesh

      The 3D or 2D mesh.

    eps float

      The tolerance parameter of the outline edge searching algorithm.

  Returns:
    mesh_out tuple

      The data of the outline mesh, Mesh.from_data() format, i.e. (coors, ngroups, ed_conns, mat_ids, descs).

sfepy.mesh.mesh_tools.get_surface_faces(domain)

sfepy.mesh.mesh_tools.merge_lines(mesh, eps=1e-18)

  Merge edges of an edge-only mesh that are in the same direction w.r.t. the tolerance eps.

sfepy.mesh.mesh_tools.smooth_mesh(mesh, n_iter=4, lam=0.6307, mu=-0.6347, weights=None, bconstr=True, volume_corr=False)

  FE mesh smoothing.

  Based on:

  [1] Steven K. Boyd, Ralph Muller, Smooth surface meshing for automated finite element model generation from 3D image data, Journal of Biomechanics, Volume 39, Issue 7, 2006, Pages 1287-1295, ISSN 0021-9290, 10.1016/j.jbiomech.2005.03.006. (http://www.sciencedirect.com/science/article/pii/S0021929005001442)

  Parameters:
    mesh mesh

      FE mesh.

    n_iter integer, optional

      Number of iteration steps.

    lam float, optional

      Smoothing factor, see [1].

    mu float, optional

      Unshrinking factor, see [1].

    weights array, optional

      Edge weights, see [1].

    bconstr: logical, optional

      Boundary constraints, if True only surface smoothing performed.

    volume_corr: logical, optional

      Correct volume after smoothing process.

  Returns:
    coors array

      Coordinates of mesh nodes.

sfepy.mesh.mesh_tools.surface_components(gr_s, surf_faces)

  Determine surface components given surface mesh connectivity graph.

sfepy.mesh.mesh_tools.surface_graph(surf_faces, n_nod)

sfepy.mesh.mesh_tools.triangulate(mesh, verbose=False)

  Triangulate a 2D or 3D tensor product mesh: quadrilaterals->triangles, hexahedrons->tetrahedrons.

  Parameters:
    mesh Mesh

      The input mesh.

  Returns:
    mesh Mesh

      The triangulated mesh.