示例#1
0
 def test_minimal_surface_volume(self, surface, threshold):
     cells = np.ones(3, dtype=int) * 64
     grid = Grid.from_minimal_surface(cells, np.ones(3), surface, threshold)
     assert np.isclose(np.count_nonzero(grid.material == 1) /
                       np.prod(grid.cells),
                       .5,
                       rtol=1e-3)
示例#2
0
 def test_minimal_surface_basic_properties(self,surface):
     cells = np.random.randint(60,100,3)
     size  = np.ones(3)+np.random.rand(3)
     threshold = 2*np.random.rand()-1.
     periods = np.random.randint(2)+1
     materials = np.random.randint(0,40,2)
     grid = Grid.from_minimal_surface(cells,size,surface,threshold,periods,materials)
     assert set(grid.material.flatten()) | set(materials) == set(materials) \
            and (grid.size == size).all() and (grid.cells == cells).all()