mesh.Mesh.match_coords#

Mesh.match_coords(coords, **kargs)#

Match nodes of coords with nodes of self.

Parameters#

coords: Coords or Mesh object

The object to compare the nodes with.

**kargs: keyword arguments

Keyword arguments passed to the coords.Coords.match() method.

Returns#

1-dim int array

The array has a length equal to the number of nodes in coords. For each point in coords, it holds the index of a point in self.coords coinciding with it, or a value -1 if there is no matching point. If there are multiple matching points in self, it is undefined which one will be returned. To avoid this ambiguity, you can first fuse the points of self.

Notes#

This is a convenience function equivalent to

self.coords.match(mesh.coords,**kargs)

or

self.coords.match(coords,**kargs)

See Also#

coords.Coords.match()

Examples#

>>> M = Mesh(eltype='quad4')
>>> print(M.coords)
[[0. 0. 0.]
 [1. 0. 0.]
 [1. 1. 0.]
 [0. 1. 0.]]
>>> coords = Coords([[0.0, 0.0, 0.0],
...                  [1.0, 3.0, 0.0],
...                  [1.0, 1.0, 0.0]])
>>> print(M.match_coords(coords))
[ 0 -1  2]
>>> M2 = M.translate([1.0,0.0,0.0])
>>> print(M2.coords)
[[1. 0. 0.]
 [2. 0. 0.]
 [2. 1. 0.]
 [1. 1. 0.]]
>>> print(M.match_coords(M2))
[ 1 -1 -1  2]