sfepy.mesh.mesh_tools module

sfepy.mesh.mesh_tools.elems_q2t(el)[source]
sfepy.mesh.mesh_tools.expand2d(mesh2d, dist, rep)[source]

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

Parameters:
mesh2dMesh

The 2D mesh.

distfloat

The elements size in the 3rd direction.

repint

The number of elements in the 3rd direction.

Returns:
mesh3dMesh

The 3D mesh.

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

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:
meshMesh

The 3D or 2D mesh.

epsfloat

The tolerance parameter of the outline edge searching algorithm.

Returns:
mesh_outtuple

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)[source]
sfepy.mesh.mesh_tools.merge_lines(mesh, eps=1e-18)[source]

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)[source]

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:
meshmesh

FE mesh.

n_iterinteger, optional

Number of iteration steps.

lamfloat, optional

Smoothing factor, see [1].

mufloat, optional

Unshrinking factor, see [1].

weightsarray, 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:
coorsarray

Coordinates of mesh nodes.

sfepy.mesh.mesh_tools.surface_components(gr_s, surf_faces)[source]

Determine surface components given surface mesh connectivity graph.

sfepy.mesh.mesh_tools.surface_graph(surf_faces, n_nod)[source]
sfepy.mesh.mesh_tools.triangulate(mesh, verbose=False)[source]

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

Parameters:
meshMesh

The input mesh.

Returns:
meshMesh

The triangulated mesh.