def _get_surf_neighbors(surf, k):
 verts = surf['tris'][surf['neighbor_tri'][k]]
 verts = np.setdiff1d(verts, [k], assume_unique=False)
 assert np.all((verts < surf['np']))
 nneighbors = len(verts)
 nneigh_max = len(surf['neighbor_tri'][k])
 if (nneighbors > nneigh_max):
  raise RuntimeError(('Too many neighbors for vertex %d' % k))
 elif (nneighbors != nneigh_max):
  logger.info(('    Incorrect number of distinct neighbors for vertex %d (%d instead of %d) [fixed].' % (k, nneighbors, nneigh_max)))
 return verts

def _get_surf_neighbors ( surf , k ) : verts = surf [ 'tris' ] [ surf [ 'neighbor_tri' ] [ k ] ] verts = np . setdiff1d ( verts , [ k ] , assume_unique = False ) assert np . all ( ( verts < surf [ 'np' ] ) ) nneighbors = len ( verts ) nneigh_max = len ( surf [ 'neighbor_tri' ] [ k ] ) if ( nneighbors > nneigh_max ) : raise RuntimeError ( ( 'Too many neighbors for vertex %d' % k ) ) elif ( nneighbors != nneigh_max ) : logger . info ( ( '    Incorrect number of distinct neighbors for vertex %d (%d instead of %d) [fixed].' % ( k , nneighbors , nneigh_max ) ) ) return verts
calculate the surface neighbors based on triangulation .