pysdic.Mesh.compute_elements_neighborhood#

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

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

Note

The function is a convenience wrapper around the pysdic.compute_elements_neighborhood() function, which computes the neighborhood of each element using a breadth-first search (BFS) algorithm for each element 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 ‘elements_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 element. The neighborhood will include all elements that are within this distance from the element in the connectivity of the mesh. By default 1, which means that only directly adjacent elements will be included in the neighborhood.

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

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

Returns:

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

Return type:

List[List[int]]

See also

pysdic.compute_elements_neighborhood()

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