mesh#

This module defines the Mesh class, which can be used to describe discrete geometrical models like those used in Finite Element models. It supports point (0D), line (1D), surface (2D) and volumetric (3D) meshes. This module contains useful functions to create, manipulate and analyse such meshes.

Constructor#

Mesh

A Mesh is a discrete geometric model defined by nodes and elements.

Important

The Mesh class inherits from Geometry, giving it access to all attributes and methods defined there. In addition, the Mesh class provides its own methods, which are listed below.

Mesh information#

These methods return information about a Mesh object.

Mesh.eltype

Return the element type of the Mesh.

Mesh.level

Return the level of the elements in the Mesh.

Mesh.plexitude

Return the plexitude of the elements in the Mesh.

Mesh.n_coords

Return the number of nodes in the Mesh.

Mesh.n_elems

Return the number of elements in the Mesh.

Mesh.shape

Return the shape of the elems array of the Mesh.

Mesh.report

Create a report on the Mesh shape and size.

Mesh.length

Return the total length of a Mesh.

Mesh.area

Return the total area of a Mesh.

Mesh.enclosed_area

Return the total enclosed area of a closed planar line Mesh.

Mesh.volume

Return the total volume of a volumetric Mesh.

Mesh.enclosed_volume

Return the total enclosed volume of a Mesh.

Mesh.check_triangle_mesh

Check whether the triangle mesh is a manifold, orientable and closed.

Mesh element information#

These methods return information for each element in a Mesh object.

Mesh.lengths

Return element or perimeter lengths for a Mesh of level 1 or 2.

Mesh.areas

Return the areas of all elements in a Mesh of level 2 or 3.

Mesh.volumes

Return the signed volume of the elements in Mesh of level 3.

Mesh.centroids

Return the centroids of all elements of the Mesh.

Mesh.bounding_boxes

Returns the bounding_boxes of all elements in the Mesh.

Mesh generation#

Mesh.replicate

Create copies at regular distances along a straight line.

Mesh.replicate_multi

Repeatedly replicate a Mesh in different directions

Mesh.rosette

Create rotational replications of a Mesh.

Mesh.connect

Connect a sequence of topologically congruent Meshes into a hypermesh.

Mesh.extrude

Extrude a Mesh along a straight line.

Mesh.revolve

Revolve a Mesh around an axis.

Mesh.sweep

Sweep a Mesh along a path, creating an extrusion.

Mesh.concatenate

Concatenate a list of Meshes of the same eltype.

Mesh.boolean

Perform a boolean operation with another tri3 Mesh.

Mesh adaption#

Mesh.convert

Convert a Mesh to another element type.

Mesh.subdivide

Subdivide the elements of a Mesh.

Mesh.renumber

Renumber the nodes of a Mesh in the specified order.

Mesh.reorder

Reorder the elements of a Mesh.

Mesh.chained

Reorder the elements of a line Mesh into connected chains.

Mesh.clip_with_plane

Clip the Mesh with a plane.

Mesh.cut_with_plane

Cut a triangular Mesh with a plane.

Mesh.smooth

Smooth the geometry of a Mesh or data defined over a Mesh.

Mesh.remesh

Remesh a triangle Mesh.

Mesh transformation#

Mesh.reverse

Reverse some or all elements of a Mesh.

Mesh.reflect

Reflect the coordinates in one of the coordinate directions.

Mesh.reflect_x

Reflect the coordinates in the X direction.

Mesh.reflect_y

Reflect the coordinates in the Y direction.

Mesh.reflect_z

Reflect the coordinates in the Z direction.

Mesh.offset

Offset a tri3 Mesh with a certain distance.

Mesh partioning#

Mesh.partition_by_connection

Detect the connected parts of a Mesh.

Mesh.split_by_connection

Split a Mesh into connected parts.

Mesh.partition_by_curve

Partition a level-2 Mesh by closed curve(s) along the edges.

Mesh.split_by_curve

Split a level-2 Mesh by closed curve(s) along the edges.

Mesh.partition_by_angle

Partition a tri3 Mesh by splitting it at sharp edges.

Mesh.split_by_angle

Split a tri3 Mesh by splitting it at sharp edges.

Mesh.split_random

Split a Mesh in n parts, distributing the elements randomly.

Mesh repair & quality#

Mesh.split_degenerate

Split a Mesh in non-degenerate and degenerate elements.

Mesh.remove_degenerate

Remove the degenerate elements from a Mesh.

Mesh.remove_duplicate

Remove the duplicate elements from a Mesh.

Mesh.fix_triangle_mesh

Repair and clean a triangle mesh by performing a sequence fixes.

Mesh.fix_volumes

Reverse the elements with negative volume.

Mesh.scaled_jacobian

Compute a quality measure for volume meshes.

Mesh compaction#

Mesh.fuse

Fuse the nodes of a Mesh.

Mesh.compact

Remove unconnected nodes and renumber the Mesh.

Entity selection#

Mesh.test

Flag elements having nodal coordinates between min and max.

Mesh.test_bounding_box

Test which part of a Mesh is inside a given bounding box.

Mesh.to_lines

Convert a Mesh to a line2 Mesh.

Mesh.get_lower_entities

Get the entities of a lower dimensionality.

Mesh.get_nodes

Return the set of unique node numbers in the Mesh.

Mesh.get_points

Return the nodal coordinates of the Mesh.

Mesh.edges

Return the unique edges of all the elements in the Mesh.

Mesh.elem_edges

Defines the elements in function of its edges.

Mesh.faces

Return the unique faces of all the elements in the Mesh.

Mesh.elem_faces

Defines the elements in function of its faces.

Mesh.cells

Return the unique 3D cells of the Mesh.

Mesh.edge_mesh

Return a Mesh consisting of the unique edges of the elements.

Mesh.face_mesh

Return a Mesh consisting of the unique faces of the elements.

Mesh.get_free_entities

Return the free entities of the specified level.

Mesh.get_free_entities_mesh

Return a Mesh with lower entities.

Mesh.get_free_edges_mesh

Return a Mesh with the free edges.

Mesh.border

Return the border of the Mesh.

Mesh.border_mesh

Return a Mesh representing the border.

Mesh.border_elems

Find the elements that are touching the border of the Mesh.

Mesh.border_nodes

Find the nodes that are on the border of the Mesh.

Mesh.inner_nodes

Find the nodes that are not on the border of the Mesh.

Mesh.peel

Remove the border elements from a Mesh.

Mesh.non_manifold_nodes

Return the non-manifold nodes of a Mesh.

Mesh.non_manifold_edges

Return the non-manifold edges of a Mesh.

Mesh.select_nodes

Return a Mesh with subsets of the original nodes.

Adjacency methods#

Mesh.connected_to

Find the elements connected to specific lower entities.

Mesh.adjacent_to

Find the elements adjacent to the specified elements.

Mesh.reachable_from

Select the elements reachable from the specified elements.

Mesh.adjacency

Create an element adjacency table.

Mesh.front_walk

Visit all elements using a frontal walk.

Mesh.masked_edge_front_walk

Perform a front walk over masked edge connections.

Mesh.grow_selection

Grow a selection of a Mesh by frontal steps.

Mesh.node_connections

Find and store the elems connected to nodes.

Mesh.n_node_connected

Find the number of elems connected to nodes.

Mesh.edge_connections

Find and store the elems connected to edges.

Mesh.n_edge_connected

Find the number of elems connected to edges.

Mesh.connected_elements

Return the elements reachable from startat.

Other#

Mesh.match_coords

Match nodes of coords with nodes of self.

Mesh.match_centroids

Match elements of Mesh with elements of self.

Mesh.points_at

Compute points at parametric values.

Mesh.slice

Intersect a triangular surface mesh with a series of parallel planes.

Mesh.intersection_with_plane

Return the intersection lines with plane (p,n).