mymesh.utils.DeleteDuplicateNodes#

mymesh.utils.DeleteDuplicateNodes(NodeCoords, NodeConn, tol=1e-12, return_idx=False, return_inv=False)[source]#

Remove nodes that are duplicated in the mesh, either at exactly the same location as another node or a distance < tol apart. Nodes are renumbered and elements reconnected such that the geometry and structure of the mesh remains unchanged.

Parameters:
  • NodeCoords (list) – Contains coordinates for each node. Ex. [[x1,y1,z1],…]

  • NodeConn (list) – Nodal connectivity list.

  • tol (float, optional) – Tolerance value to be used when determining if two nodes are the same. The default is 1e-14.

  • return_idx (bool, optional) – Returns the indices of each row of NodeCoords in the order that they’re sorted place into the new array, by default False.

  • return_inv (bool, optional) – Returns the indices that reverse the operation, by default False.

Returns:

  • NewCoords (list) – Updated node coordinates without duplicates.

  • NewConn (list) – Updated node connectivity without duplicate nodes.

  • idx (np.ndarray) – Array of indices that convert from the original node coordinates to the new node coordinates (NewCoords = [NodeCoords[i] for i in idx])

  • inv (np.ndarray) – Array of indices that can reverse the operation to convert from the new node coordinates to old node coordinates (NodeCoords = [NewCoords[i] for i in inv]).

Examples

>>> NodeCoords = [[0.,0.,0.],
                  [0.,1.,0.],
                  [1.,1.,0.],
                  [0.,0.,0.],
                  [1.,1.,0.],
                  [1.,0.,0.]]
>>> NodeConn = [[0,1,2],[3,4,5]]
>>> NewCoords, NewConn, idx, inv = utils.DeleteDuplicateNodes(NodeCoords,NodeConn, return_idx=True,return_inv=True)
>>> NewConn
[[0, 1, 3], [0, 3, 2]]
>>> NewCoords == [NodeCoords[i] for i in idx]
True
>>> NodeCoords == [NewCoords[i] for i in inv]
True