pysdic.Mesh.compute_property_interpolation#

Mesh.compute_property_interpolation(values, integration_points, *, allow_unlocated_points=False, tolerance=0.0, default=nan)[source]#

Interpolate a property defined at the vertices of the mesh at integration points.

Shortcut for pysdic.fem.compute_property_interpolation() with the connectivity and element type of the mesh (see this function for the interpolation formula).

Parameters:
  • values (Union[str, ArrayLike]) – The property at the vertices: the name of a vertex property (see mesh.vertices) or an array of shape \((N_v, \dots)\).

  • integration_points (pysdic.IntegrationPoints) – The integration points, consistent with the mesh (see validate_integration_points()).

  • allow_unlocated_points (bool, optional (default: False)) – If True, the unlocated points (element index -1) get the value default. Otherwise, they raise an error.

  • tolerance (Real, optional (default: 0.0)) – The tolerance to decide if a point is inside the reference element.

  • default (Union[Real, ArrayLike], optional (default: numpy.nan)) – The value of the unlocated points: a scalar or an array of \(P\) values.

Returns:

An array of shape \((N_p, P)\) with the interpolated property.

Return type:

numpy.ndarray

Examples

Interpolate the coordinates of the vertices to get the global coordinates of the Gauss points.

1from pysdic import Mesh, IntegrationPoints
2
3mesh = Mesh([[0, 0, 0], [3, 0, 0], [0, 3, 0]], [[0, 1, 2]], element_type="triangle_3")
4integration_points = IntegrationPoints.from_gauss_points("triangle_3", mesh.n_elements)
5
6print(mesh.compute_property_interpolation(mesh.coordinates, integration_points))  # [[1. 1. 0.]]