mymesh.utils.SurfMapping#
- mymesh.utils.SurfMapping(NodeCoords1, SurfConn1, NodeCoords2, SurfConn2, tol=inf, verbose=False, Octree='generate', return_octree=False, npts=inf)[source]#
Generate a mapping matrix from to map data from one surface to another using barycentric interpolation. Each row of the mapping matrix contains an element ID followed by barycentric coordinates alpha, beta, gamma that define the position of the nodes of surface 1 (NodeCoords1) relative to the specified surface element of surface 2 (SurfConn2). An element ID of -1 indicates a failed mapping. NOTE: Only triangular surface meshes are supported.
- Parameters:
NodeCoords1 (list) – List of nodal coordinates.
SurfConn1 (list) – List of nodal connectivities.
NodeCoords2 (list) – List of nodal coordinates.
SurfConn2 (list) – List of nodal connectivities.
tol (float, optional) – Tolerance value, if the projection distance is greater than tol, the projection will be exculded, default is np.inf
verbose (bool, optional) – If true, will print mapping statistics, by default False.
Octree (str (or octree.OctreeNode), optional) – octree options. An octree representation of surface 2 can significantly improve mapping speeds, by default ‘generate’. ‘generate’ - Will generate an octree for use in surface mapping. ‘none’ or None - Won’t generate an octree and will use a brute force approach. octree.OctreeNode - Provide a precompute octree structure corresponding to surface 2. Should be created by octree.Surface2Octree(NodeCoords2,SurfConn2)
return_octree (bool, optional) – If true, will return the generated or provided octree, by default False.
npts (int, optional) – Number of points to map. A random sample of min(npts, len(NodeCoords1)) from Surface 1 will be mapped , by default np.inf (all points).
- Returns:
MappingMatrix (list) – min(npts, len(NodeCoords1))x4 matrix of of barycentric coordinates, defining NodeCoords1 in terms of the triangular surface elements of Surface 2.
Octree (octree.OctreeNode, optional) – The generated or provided octree structure corresponding to Surface 2.