quad.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:CADO 作者: BGCECSE2015 项目源码 文件源码
def find_neighbors(self,_quadlist):
        import numpy as np

        neighbors = np.array([])

        edges = [self.vertex_ids[[0,1]],
                 self.vertex_ids[[1,2]],
                 self.vertex_ids[[2,3]],
                 self.vertex_ids[[3,0]]]

        for e in edges:
            has_vertex1 = np.where(_quadlist == e[0])[0]
            has_vertex2 = np.where(_quadlist == e[1])[0]
            same_edge = np.intersect1d(has_vertex1, has_vertex2)
            neighbor = same_edge[same_edge != self.quad_id]
            neighbors = np.append(neighbors, neighbor)

        return neighbors.astype(int)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号