pysdic.Mesh.compute_vertices_neighborhood#

Mesh.compute_vertices_neighborhood(max_distance=1, self_neighborhood=True, precompute=False)[source]#

Compute the neighborhood of each vertex in the mesh, where the neighborhood of a vertex is defined as the set of vertices that are within a specified distance from the vertex in the connectivity of the mesh.

Note

The function is a convenience wrapper around the pysdic.compute_vertices_neighborhood() function, which computes the neighborhood of each vertex using a breadth-first search (BFS) algorithm for each vertex in the mesh, where the BFS is limited to a maximum distance specified by max_distance.

Note

The neighborhood of a vertex is computed using a breadth-first search (BFS) algorithm for each vertex in the mesh, where the BFS is limited to a maximum distance specified by max_distance.

Warning

The same object returned by this method is stored in the precomputed properties of the mesh with the key ‘vertices_neighborhood’ if precompute is set to True. Please be cautious when modifying the returned neighborhood list, as it will affect the value stored in the precomputed properties of the mesh.

Parameters:
  • max_distance (Integral, optional) – The maximum distance to consider for the neighborhood of each vertex. The neighborhood will include all vertices that are within this distance from the vertex in the connectivity of the mesh. By default 1, which means that only directly adjacent vertices will be included in the neighborhood.

  • self_neighborhood (bool, optional) – If True, the neighborhood of each vertex will include the vertex itself (i.e., the vertex will be considered as part of its own neighborhood). If False, the neighborhood of each vertex will not include the vertex itself. By default True.

  • precompute (bool, optional) – If True, the computed vertices neighborhood will be stored in the precomputed properties of the mesh with the key ‘vertices_neighborhood’. If False, the computed vertices neighborhood will not be stored in the precomputed properties of the mesh. By default Falses.

Returns:

A list where each element is a list containing the indices of the neighboring vertices for the corresponding vertex in the mesh.

Return type:

List[List[int]]

See also

pysdic.compute_vertices_neighborhood()

For more information on the algorithm used to compute the vertices neighborhood and an example of the output format.