def test_Refine_2D(): grid2d = RectangularGrid(3, 3, 1, 1.0, 1.0, 1.0) grid2dFine = RectangularGrid() children = grid2dFine.refine(grid2d, 2, 2) childElements = [[0, 4, 1, 5], [2, 6, 3, 7], [8, 12, 9, 13], [10, 14, 11, 15]] parent = 0 for pN, cL in children.iteritems(): ok_(parent == pN) for ci, c in enumerate(cL): ok_(childElements[pN][ci] == c.N) parent += 1
def test_Refine_1D(self): grid1d = RectangularGrid(3,1,1,1.0,1.0,1.0) grid1dFine = RectangularGrid() children = grid1dFine.refine(grid1d,2) parent=0 child=0 for pN,cL in children.iteritems(): ok_(parent == pN) for c in cL: ok_(child == c.N) child +=1 parent +=1 if GNUPLOT: grid1dFine.writeEdgesGnuplot('grid1dFine') grid1dFine.viewMeshGnuplotPipe('grid1dFine')
def test_Hexahedron(): hexGrid = RectangularGrid(3, 2, 2, 2.0, 1.0, 1.0) H0 = hexGrid.hexahedronList[0] H1 = hexGrid.hexahedronList[1] ok_(H0.nodes < H1.nodes) ok_(H0.nodes != H1.nodes) ok_(not H0.nodes > H1.nodes) ok_(not H0.hasGeometricInfo)
def test_Refine_3D(self): grid3d = RectangularGrid(3,3,3,1.0,1.0,1.0) grid3dFine = RectangularGrid() children = grid3dFine.refine(grid3d,2,2,2) childElements = [[0 ,16,4 ,20,1 ,17,5 ,21], [2 ,18,6 ,22,3 ,19,7 ,23], [8 ,24,12,28,9 ,25,13,29], [10,26,14,30,11,27,15,31], [32,48,36,52,33,49,37,53], [34,50,38,54,35,51,39,55], [40,56,44,60,41,57,45,61], [42,58,46,62,43,59,47,63]] parent = 0 for pN,cL in children.iteritems(): ok_(parent == pN) for ci,c in enumerate(cL): ok_(childElements[pN][ci] == c.N) parent += 1
def test_RectangularGrid_3D(self): grid3d = RectangularGrid(3,3,3,1.0,1.0,1.0) if GNUPLOT: grid3d.writeEdgesGnuplot('grid3d') grid3d.viewMeshGnuplotPipe('grid3d')
def test_RectangularGrid_2D(): grid2d = RectangularGrid(3, 3, 1, 1.0, 1.0, 1.0) if GNUPLOT: grid2d.writeEdgesGnuplot('grid2d') grid2d.viewMeshGnuplotPipe('grid2d')