mesh.Mesh.generate_quad_mesh#

Mesh.generate_quad_mesh(holes=None, project=False)#

Generate a quad surface mesh inside a closed line2 mesh.

The current mesh must be a closed, unbranched line2 loop. Optional holes can be provided as closed line2 meshes.

Important

An additional node is inserted at the midpoint of every boundary element. Consequently, the boundary of the resulting quad mesh will contain twice as many edges as the input line2 mesh. For curved boundaries, inserting midpoint nodes on boundary elements may lead to a geometric approximation error. This can be avoided by setting project=True.

Warning

Enabling project=True relies on tracking localized nodal angle variations. As a result, it exhibits the following geometric limitations:

  • Feature Resolution: Straight geometric features must consist of at least two elements. An isolated, single-element straight segment bounded by curves cannot be reliably detected and will be incorrectly smoothed.

  • Curvature Transitions: Tangent transitions between curves of different radii (e.g., direct arc-to-arc transitions) may fail to be identified. This can cause the boundary to be smoothed as a single continuous spline, distorting the geometric transition zone.

Parameters#

holeslist of Mesh, optional

List of closed line2 meshes representing holes.

projectbool, default False

If True, projects the boundary nodes onto smooth splines in curved regions to recover geometric fidelity after midpoint insertion.

Returns#

Mesh

Quad surface mesh (quad4) filling the area inside this mesh.

Examples#

Midpoint insertion on boundary edges:

>>> cir = shapes.circle(div=8) # 8 elements
>>> quad = cir.generate_quad_mesh(project=True)
>>> print(quad.border_mesh().n_elems())
16