sfepy.discrete.fem.mesh module¶
-
class
sfepy.discrete.fem.mesh.
Mesh
(name='mesh', cmesh=None)[source]¶ The Mesh class is a light proxy to CMesh.
Input and output is handled by the MeshIO class and subclasses.
-
coors
¶
-
copy
(name=None)[source]¶ Make a deep copy of the mesh.
Parameters: name : str
Name of the copied mesh.
-
create_conn_graph
(verbose=True)[source]¶ Create a graph of mesh connectivity.
Returns: graph : csr_matrix
The mesh connectivity graph as a SciPy CSR matrix.
-
static
from_data
(name, coors, ngroups, conns, mat_ids, descs, nodal_bcs=None)[source]¶ Create a mesh from mesh IO data.
-
static
from_file
(filename=None, io='auto', prefix_dir=None, omit_facets=False)[source]¶ Read a mesh from a file.
Parameters: filename : string or function or MeshIO instance or Mesh instance
The name of file to read the mesh from. For convenience, a mesh creation function or a MeshIO instance or directly a Mesh instance can be passed in place of the file name.
io : *MeshIO instance
Passing *MeshIO instance has precedence over filename.
prefix_dir : str
If not None, the filename is relative to that directory.
omit_facets : bool
If True, do not read cells of lower dimension than the space dimension (faces and/or edges). Only some MeshIO subclasses support this!
-
static
from_region
(region, mesh_in, localize=False, is_surface=False)[source]¶ Create a mesh corresponding to cells, or, if is_surface is True, to facets, of a given region.
-
get_conn
(desc, ret_cells=False)[source]¶ Get the rectangular cell-vertex connectivity corresponding to desc. If ret_cells is True, the corresponding cells are returned as well.
-
transform_coors
(mtx_t, ref_coors=None)[source]¶ Transform coordinates of the mesh by the given transformation matrix.
Parameters: mtx_t : array
The transformation matrix T (2D array). It is applied depending on its shape:
- (dim, dim): x = T * x
- (dim, dim + 1): x = T[:, :-1] * x + T[:, -1]
ref_coors : array, optional
Alternative coordinates to use for the transformation instead of the mesh coordinates, with the same shape as self.coors.
-
write
(filename=None, io=None, out=None, float_format=None, **kwargs)[source]¶ Write mesh + optional results in out to a file.
Parameters: filename : str, optional
The file name. If None, the mesh name is used instead.
io : MeshIO instance or ‘auto’, optional
Passing ‘auto’ respects the extension of filename.
out : dict, optional
The output data attached to the mesh vertices and/or cells.
float_format : str, optional
The format string used to print floats in case of a text file format.
**kwargs : dict, optional
Additional arguments that can be passed to the MeshIO instance.
-
-
sfepy.discrete.fem.mesh.
find_map
(x1, x2, eps=1e-08, allow_double=False, join=True)[source]¶ Find a mapping between common coordinates in x1 and x2, such that x1[cmap[:,0]] == x2[cmap[:,1]]
-
sfepy.discrete.fem.mesh.
fix_double_nodes
(coor, ngroups, conns, eps)[source]¶ Detect and attempt fixing double nodes in a mesh.
The double nodes are nodes having the same coordinates w.r.t. precision given by eps.
-
sfepy.discrete.fem.mesh.
get_min_vertex_distance
(coor, guess)[source]¶ Can miss the minimum, but is enough for our purposes.