pysdic.IntegrationPoints.remove_points#

IntegrationPoints.remove_points(indices, inplace=False)[source]#

Remove specific integration points by their indices.

Parameters:
  • indices (ArrayLike) – The indices of the integration points to remove as a numpy ndarray with shape \((R,)\), where \(R\) is the number of points to remove.

  • inplace (bool, optional) – If True, modify the current instance in place, and return itself. If False, return a new IntegrationPoints instance (default is False).

Returns:

A new IntegrationPoints instance with the specified points removed or the modified current instance if inplace is True.

Return type:

IntegrationPoints

Raises:

IndexError – If any index is out of bounds.

Examples

 1import numpy
 2from pysdic import IntegrationPoints
 3natural_coordinates = numpy.array([[0.5, 0.5], [0.5, 0.0], [0.0, 0.5], [1/3, 1/3]])
 4element_indices = numpy.array([0, 0, 0, 1])
 5weights = numpy.array([1.0, 1.0, 1.0, 1.0])
 6
 7integration_points = IntegrationPoints(natural_coordinates, element_indices, weights)
 8print(integration_points.n_points)  # Output: 4
 9
10# Remove points at indices 1 and 2
11new_integration_points = integration_points.remove_points(numpy.array([1, 2]))
12print(new_integration_points.n_points)  # Output: 2
13
14# Remove points at indices 0 and 1 in place
15integration_points.remove_points(numpy.array([0, 1]), inplace=True)
16print(integration_points.n_points)  # Output: 2