mymesh.mesh#
- class mymesh.mesh(NodeCoords=None, NodeConn=None, Type=None, verbose=True)[source]#
The
mesh
class stores the nodes (NodeCoords
) and elements (or node connectivity,NodeConn
) as its primary attributes.- Parameters:
NodeCoords (array_like, optional) – Node coordinates, by default None. Node coordinates should be formatted as an nx3 or nx2 array of coordinates.
NodeConn (list, array_like, optional) – Node connectivity of elements, by default None. Node connectivity is formatted as a 2D array or list of lists where each row (or inner list) is contains the node IDs of the nodes that make up the element. NodeConn can contain a uniform element type or a mix of different element types.
Type (str or None, optional) – Mesh type, ‘surf’ for surface, ‘vol’ for volume, ‘line’ for line. If not provided, it will be determined automatically (
mesh.identify_type()
), by default Noneverbose (bool, optional) – If true, some operations will print activity or other information, by default True
- NodeData#
Node data dictionary for storing scalar or vector data associated with each node in the mesh. Each entry should be an array_like with the same length as the number of nodes in the mesh. When using
mesh.write()
, this data will be transferred to the written file if supported by that file type.
- ElemData#
Element data dictionary for storing scalar or vector data associated with each element in the mesh. Each entry should be an array_like with the same length as the number of elements in the mesh. When using
mesh.write()
, this data will be transferred to the written file if supported by that file type.
- NodeSets#
Dictionary used for creating named sets of nodes. Each entry should be a set (or array_like) of node numbers.
- ElemSets#
Dictionary used for creating named sets of elements. Each entry should be a set (or array_like) of element numbers.
- FaceSets#
Dictionary used for creating named sets of faces. Each entry should be a set (or array_like) of face numbers.
- EdgeSets#
Dictionary used for creating named sets of edges. Each entry should be a set (or array_like) of edge numbers.
Properties#
Node connectivity for the boundary mesh of a surface.
Array of node IDs on the boundary of a surface.
Element centroids.
Element-edge connectivity.
Edge-element connectivity.
Element edges.
Node-Element connectivity.
Element neighbors.
Surface element normal vectors.
Topological Euler characteristic number.
Element-face connectivity.
Face-element connectivity.
Element faces.
Topological genus calculated from the Euler characteristic.
Number of spatial dimensions.
Number of edges in the mesh.
Number of elements in the mesh.
Number of faces in the mesh.
Number of nodes in the mesh.
Node neighbors.
Surface node normal vectors.
Sets the method for calculating surface node normals.
Node connectivity for the surface mesh.
Node-Element connectivity for the surface mesh.
Node neighbors for the surface mesh.
Array of node IDs on the surface of a mesh.
mesh
object representation of the surface mesh.Alias for
NodeConn
Alias for
NodeCoords
Methods#
Clip
([pt, normal])Clip the mesh along a plane.
Contour
(scalars, threshold[, ...])Contour the mesh to extract an isosurface based on nodal scalar values.
CreateBoundaryLayer
(nLayers[, FixedNodes, ...])Generate boundary layer elements.
Crop
(bounds[, method, InPlace, cleanup])Crop the mesh to specified bounds.
Mirror
([x, y, z, InPlace])Mirror the mesh across Cartesian planes.
Threshold
(scalars, threshold[, mode, ...])Threshold the mesh by scalar values at either nodes or elements.
addEdges
(NewEdges[, EdgeSet])
addElems
(NewNodeConn[, ElemSet])
addFaces
(NewFaces[, FaceSet])
addNodes
(NewNodeCoords[, NodeSet])
cleanup
([tol])
copy
()Create a copy of the mesh.
getCurvature
([metrics, nRings, SplitFeatures])
getQuality
([metrics, verbose])Evaluate mesh quality.
Classify the mesh as either a surface or volume.
imread
(voxelsize[, scalefactor, scaleorder, ...])Load an image into a voxel mesh.
merge
(Mesh2[, cleanup, tol])Merge multiple meshes together into the current mesh.
Convert a meshio mesh object to a MyMesh mesh object
plot
([show, return_fig, clim])Generate a static plot of the mesh.
read
()Read a mesh file written in any file type supported by meshio
removeElems
(ElemIds)
reset
([properties, keep])Reset some or all properties.
validate
()Check validity of the mesh.
view
(**kwargs)Generate an interactive plot of the mesh.
write
(filename[, binary])Write mesh to file.