Volume meshes
VolumeMesh
Bases: Mesh
boundary_mesh
property
The boundary of the VolumeMesh as a SurfaceMesh. Shortcut for `self.boundary_connectivity.mesh
Returns:
Name | Type | Description |
---|---|---|
None |
if the boundary connectivity is not enabled (mesh was not built). See |
|
SurfaceMesh |
the boundary mesh otherwise |
id_cells
property
Shortcut for range(len(self.cells))
id_corners
property
Shortcut for range(len(self.face_corners))
id_edges
property
Shortcut for range(len(self.edges))
id_faces
property
Shortcut for range(len(self.faces))
id_vertices
property
Shortcut for range(len(self.vertices))
enable_boundary_connectivity()
Builds the indirection maps to the boundary surface mesh, which then can be accessed via the self.boundary_connectivity
attribute.
See documentation for VolumeMesh._BoundaryConnectivity for more details.
is_cell_tet(ic)
Returns True if the cell given by id
ic` is a tetrahedron (i.e. has 4 vertices)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ic
|
int
|
cell index |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
len(self.cells[ic])==4 |
is_edge_on_border(*args)
Simple test to determine if a given edge is on the boundary of the mesh.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Either an integer index representing an edge, or two integer indices representing two (adjacent) vertices |
()
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Returns True if the given edge is on the boundary of the mesh. |
is_face_on_border(*args)
Simple test to determine if a given face is on the boundary of the mesh.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Either an integer index representing a face, or n integer indices representing the vertices |
()
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Returns True is the given face exists and is on the boundary of the mesh |
is_tetrahedral()
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the mesh is tetrahedral (all cells are tetrahedra) |
Volume Connectivity
Warning
Volume connectivity is a work in progress and will be available soon.
BoundaryConnectivity
In some applications, you may need to access the boundary surface mesh of a volume mesh in a self-contained way while keeping links to the original volume. It allows requests like "return the list of all vertices adjacent to boundary vertex i that are on the boundary"
It implements the same methods as the Connectivity class of surface meshes for the boundary mesh, as well as indirection arrays to move from volume indices to surface indices. Returned indices of connectivity queries are indices with relation to the volume mesh.
To save time and memory, the boundary indirections are not computed by default. Use the enable_boundary_connectivity()
method of the VolumeMesh
to explicitly generate a BoundaryConnectivity
object, stored in the .boundary_connectivity
attribute.
Example
import mouette as M
m = M.mesh.load("my_volume_mesh.tet")
# if enable_boundary_connectivity is not called, `m.boundary_connectivity` is None
m.enable_boundary_connectivity() # builds the indirection
bnd_m = m.boundary_mesh # access the boundary mesh as an independent surface mesh
boundary_neighbors = m.boundary_connectivity.vertex_to_vertices(4) # query connectivity
Bases: _Connectivity
Attributes:
Name | Type | Description |
---|---|---|
m2b_vertex |
dict
|
volume mesh -> boundary indirection for vertices |
m2b_edge |
dict
|
volume mesh -> boundary indirection for edges |
m2b_face |
dict
|
volume mesh -> boundary indirection for faces |
b2m_vertex |
dict
|
boundary -> volume mesh indirection for vertices |
b2m_edge |
dict
|
boundary -> volume mesh indirection for edges |
b2m_face |
dict
|
boundary -> volume mesh indirection for faces |
clear()
Resets connectivity. The next query in the code will regenerate internal arrays.