sfepy.discrete.common.extmods.cmesh module¶
C Mesh data structures and functions.
- class sfepy.discrete.common.extmods.cmesh.CConnectivity¶
Notes
The memory is allocated/freed in C - this class just wraps NumPy arrays around that data without copying.
- cprint()¶
- indices¶
- n_incident¶
- num¶
- offset¶
- offsets¶
- class sfepy.discrete.common.extmods.cmesh.CMesh¶
- cell_groups¶
- cell_types¶
- conns¶
- coors¶
- cprint()¶
- create_new()¶
Create a new CMesh instance, with cells corresponding to the given entities of dimension dent.
- Parameters:
- entitiesarray, optional
The selected topological entities of the mesh to be in the new mesh. If not given, a copy of the mesh based on the cell-vertex connectivity is returned.
- dentint, optional
The topological dimension of the entities.
- localizebool
If True, strip the vertices not used in the the resulting sub-mesh cells and renumber the connectivity.
- Returns:
- cmeshCMesh
The new mesh with the cell-vertex connectivity. Other connectivities have to be created and local entities need to be set manually.
- dim¶
- edge_oris¶
- entities¶
- face_oris¶
- facet_oris¶
- free_connectivity()¶
- from_data()¶
Fill CMesh data using Python data.
- get_cell_conn()¶
- get_centroids()¶
Return the coordinates of centroids of mesh entities with dimension dim.
- get_complete()¶
Get entities of dimension dim that are completely given by entities of dimension dent listed in entities.
- get_conn()¶
- get_conn_as_graph()¶
Get d1 -> d2 connectivity as a sparse matrix graph (values = ones).
For safety, creates a copy of the connectivity arrays. The connectivity is created if necessary.
- get_facet_normals()¶
Return the normals of facets for each mesh cell. The normals can be accessed using the cell-facet connectivity.
If which is -1, two normals of each quadrilateral face are averaged. If it is 0 or 1, the corresponding normal is used.
- get_incident()¶
Get non-unique entities indices of dimension dim that are contained in entities of dimension dent listed in entities. As each of entities can be in several entities of dimension dent, offsets array is returned optionally.
- get_local_entities()¶
- get_local_ids()¶
Get local ids of entities of dimension dent in non-unique entities incident of dimension dim (with given offsets per entities) incident to entities, see mesh_get_incident().
The function searches entities in incident -> entities connectivity for each non-unique entity in incident.
- get_orientations()¶
Get orientations of entities of dimension dim. Alternatively, co-dimension can be specified using codim argument.
- get_surface_facets()¶
Get facets (edges in 2D, faces in 3D) on the mesh surface.
- get_volumes()¶
Return the volumes of mesh entities with dimension dim > 0.
- key_to_index¶
- n_coor¶
- n_el¶
- num¶
- set_local_entities()¶
- setup_connectivity()¶
- setup_entities()¶
Set up mesh edge (2D and 3D) and face connectivities (3D only) as well as their orientations.
- tdim¶
- vertex_groups¶
- sfepy.discrete.common.extmods.cmesh.cmem_statistics()¶
- sfepy.discrete.common.extmods.cmesh.create_mesh_graph()¶
Create sparse (CSR) graph corresponding to given row and column connectivities.
- Parameters:
- n_rowint
The number of row connectivity nodes.
- n_colint
The number of column connectivity nodes.
- n_grint
The number of element groups.
- rconnslist of arrays
The list of length n_gr of row connectivities.
- cconnslist of arrays
The list of length n_gr of column connectivities.
- Returns:
- nnzint
The number of graph nonzeros.
- prowarray
The array of CSR row pointers.
- icolarray
The array of CSR column indices.
- sfepy.discrete.common.extmods.cmesh.get_cmem_usage()¶
- sfepy.discrete.common.extmods.cmesh.graph_components()¶
Determine connected compoments of a compressed sparse graph.
- Returns:
- n_compint
The number of components.
- flagarray
The flag marking for each node its component.
- sfepy.discrete.common.extmods.cmesh.orient_elements()¶
Swap element nodes so that its volume is positive.