poisson.py 文件源码

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

项目:finite-element-course 作者: finite-element 项目源码 文件源码
def boundary_nodes(fs):
    """Find the list of boundary nodes in fs. This is a
    unit-square-specific solution. A more elegant solution would employ
    the mesh topology and numbering.
    """
    eps = 1.e-10

    f = Function(fs)

    def on_boundary(x):
        """Return 1 if on the boundary, 0. otherwise."""
        if x[0] < eps or x[0] > 1 - eps or x[1] < eps or x[1] > 1 - eps:
            return 1.
        else:
            return 0.

    f.interpolate(on_boundary)

    return np.flatnonzero(f.values)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号