Пример #1
0
 def test_minimal_surface_basic_properties(self,surface):
     grid = 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)
     geom = Geom.from_minimal_surface(grid,size,surface,threshold,periods,materials)
     assert set(geom.material.flatten()) | set(materials) == set(materials) \
            and (geom.size == size).all() and (geom.grid == grid).all()
Пример #2
0
 def test_minimal_surface_volume(self,surface,threshold):
     grid = np.ones(3,dtype=int)*64
     geom = Geom.from_minimal_surface(grid,np.ones(3),surface,threshold)
     assert np.isclose(np.count_nonzero(geom.material==1)/np.prod(geom.grid),.5,rtol=1e-3)