test_tree.py 文件源码

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

项目:discretize 作者: simpeg 项目源码 文件源码
def test_counts(self):
        nc = 8
        h1 = np.random.rand(nc)*nc*0.5 + nc*0.5
        h2 = np.random.rand(nc)*nc*0.5 + nc*0.5
        h = [hi/np.sum(hi) for hi in [h1, h2]]  # normalize
        M = discretize.TreeMesh(h)
        M._refineCell([0, 0, 0])
        M._refineCell([0, 0, 1])
        M.number()
        # M.plotGrid(showIt=True)
        print(M)
        assert M.nhFx == 2
        assert M.nFx == 9

        assert np.allclose(M.vol.sum(), 1.0)

        assert np.allclose(np.r_[M._areaFxFull, M._areaFyFull], M._deflationMatrix('F') * M.area)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号