capytaine.meshes.properties module

Helper functions to compute some properties of the mesh. Based on meshmagick <https://github.com/LHEEA/meshmagick> by François Rongère.

capytaine.meshes.properties.clustering(faces: ndarray[Any, dtype[integer]]) List[ndarray[Any, dtype[integer]]][source]

Clustering of vertices per connected faces.

Parameters:

faces (NDArray[np.integer]) – Mesh faces. Expecting a numpy array of shape N_faces x N_vertices_per_face.

Returns:

Groups of connected vertices.

Return type:

list[NDArray[np.integer]]

capytaine.meshes.properties.compute_connectivity(mesh)[source]

Compute the connectivities of the mesh.

It concerns further connectivity than simple faces/vertices connectivities. It computes the vertices / vertices, vertices / faces and faces / faces connectivities.

Note

  • Note that if the mesh is not conformal, the algorithm may not perform correctly

TODO: The computation of boundaries should be in the future computed with help of VTK

capytaine.meshes.properties.compute_faces_properties(mesh)[source]

Compute the faces properties of the mesh

capytaine.meshes.properties.compute_radiuses(mesh, faces_centers)[source]

Compute the radiuses of the faces of the mesh.

The radius is defined here as the maximal distance between the center of mass of a cell and one of its points.

capytaine.meshes.properties.connected_components(mesh)[source]

Returns a list of meshes that each corresponds to the a connected component in the original mesh. Assumes the mesh is mostly conformal without duplicate vertices.

capytaine.meshes.properties.connected_components_of_waterline(mesh, z=0.0)[source]
capytaine.meshes.properties.faces_in_group(faces: ndarray[Any, dtype[integer]], group: ndarray[Any, dtype[integer]]) ndarray[Any, dtype[bool]][source]

Identification of faces with vertices within group.

Parameters:
  • faces (NDArray[np.integer]) – Mesh faces. Expecting a numpy array of shape N_faces x N_vertices_per_face.

  • group (NDArray[np.integer]) – Group of connected vertices

Returns:

Mask of faces containing vertices from the group

Return type:

NDArray[np.bool]