grains.geometry.TriMesh¶
-
class
grains.geometry.
TriMesh
(vertices, cells)[source]¶ Unstructured triangular mesh.
Vertices and cells are both stored as numpy arrays. This makes the simple mesh manipulations easy and provides interoperability with the whole scientific Python stack.
- Parameters
vertices (ndarray) – 2D numpy array with 2 columns, each row corresponding to a vertex, and the two columns giving the Cartesian coordinates of the vertex.
cells (ndarray) – Cell-vertex connectivities in a 2D numpy array, in which each row corresponds to a cell and the columns are the vertices of the cells. It is assumed that all the cells have the same number of vertices.
Methods
__init__
(vertices, cells)associate_field
(vertex_values[, name])Associates a scalar, vector or tensor field to the nodes.
cell_area
(cell)Computes the area of a cell.
cell_set_area
(cell_set)Computes the area of a cell set.
cell_set_to_mesh
(cell_set)Creates a mesh from a cell set.
change_vertex_numbering
(orientation[, inplace])Changes cell vertex numbering.
create_cell_set
(name, cells)Forms a group from a set of cells.
create_vertex_set
(name, vertices)Forms a group from a set of vertices.
get_boundary
()Extracts the boundary of the mesh.
get_edges
()Constructs edge-cell connectivities of the mesh.
plot
(*args, **kwargs)Plots the mesh.
plot_field
(component, *args[, show_mesh])Plots a field on the mesh.
rotate
(angle[, point, inplace])Rotates a 2D mesh about a given point by a given angle.
sample_mesh
(sample[, param])Provides sample meshes.
scale
(factor[, inplace])Scales the geometry by modifying the coordinates of the vertices.
write_inp
(filename)Writes the mesh to an Abaqus .inp file.
Attributes