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)
评论列表
文章目录