pysdic.fem.compute_integration_points_neighborhood#

compute_integration_points_neighborhood(connectivity_array, element_indices, *, max_distance=1, self_neighborhood=True, skip_m1=True)[source]#

Compute, for each element of a mesh, the integration points located in the elements of its neighborhood.

Convenience function that combines pysdic.fem.compute_elements_neighborhood() and pysdic.fem.remap_integration_points_neighborhood().

Note

  • Inputs connectivity_array and element_indices will be converted to numpy.int64.

Important

With skip_m1=True, the points with element index -1 (outside the mesh) belong to no neighborhood. With skip_m1=False, negative element indices raise an IndexError.

Parameters:
  • connectivity_array (ArrayLike) – An array of shape \((N_{e}, N_{vpe})\) defining the connectivity of the elements in the mesh, where each row contains the indices of the vertices that form an element.

  • element_indices (ArrayLike) – An array of shape \((N_{p},)\) containing the indices of the element of each of the \(N_{p}\) integration points.

  • max_distance (Integral, optional (default: 1)) – The maximum distance of the elements in the neighborhood. With 1, only the elements sharing a vertex are included.

  • self_neighborhood (bool, optional (default: True)) – If True, the neighborhood of each element includes the element itself (and so its own integration points).

  • skip_m1 (bool, optional (default: True)) – If set to True, the points with element index -1 are ignored.

Returns:

points_neighborhood – A boolean sparse matrix of shape \((N_{e}, N_{p})\), where the integration points in the neighborhood of element \(i\) are points_neighborhood[i].indices (sorted).

Return type:

scipy.sparse.csr_matrix

See also

pysdic.fem.compute_elements_neighborhood

Neighborhood of each element of a mesh.

pysdic.fem.remap_integration_points_neighborhood

Remap a neighborhood of the elements to the integration points.

Examples

Create a simple 'quadrangle_4' mesh with 10 vertices and 4 elements, with two integration points per element, and compute the integration points in the neighborhood of each element.

../../_images/graph_mesh.png

'quadrangle_4' mesh.#

 1import numpy
 2from pysdic.fem import compute_integration_points_neighborhood
 3
 4connectivity_array = numpy.array([
 5    [0, 1, 4, 5],
 6    [1, 2, 5, 6],
 7    [2, 3, 6, 7],
 8    [6, 7, 8, 9]])
 9
10element_indices = numpy.array([0, 0, 1, 1, 2, 2, 3, 3])
11
12points_neighborhood = compute_integration_points_neighborhood(
13    connectivity_array, element_indices, max_distance=1
14)
15
16print(f"points neighborhood (shape={points_neighborhood.shape})")
17for element in range(points_neighborhood.shape[0]):
18    print(f"element {element}: points {points_neighborhood[element].indices}")
points neighborhood (shape=(4, 8))
element 0: points [0 1 2 3]
element 1: points [0 1 2 3 4 5 6 7]
element 2: points [2 3 4 5 6 7]
element 3: points [2 3 4 5 6 7]