#NEWLINE# def test_demote( self ) : #NEWLINE# #INDENT# logging . debug ( '' ) #NEWLINE# logging . debug ( 'test_demote' ) #NEWLINE# logger = logging . getLogger ( ) #NEWLINE# wedge = create_wedge_3d ( ( 30 , 20 , 10 ) , 5.0 , 0.5 , 2.0 , 30.0 ) #NEWLINE# ij_surface = wedge . extract ( [ ( 0 , ( - 1 ) , 0 , ( - 1 ) , 0 , 0 ) ] ) #NEWLINE# self . assertEqual ( ij_surface . shape , [ ( 30 , 20 , 1 ) ] ) #NEWLINE# ij_surface . demote ( ) #NEWLINE# self . assertEqual ( curve . shape , [ ( 30 , 20 ) ] ) #NEWLINE# jk_surface = wedge . extract ( [ ( 0 , 0 , 0 , ( - 1 ) , 0 , ( - 1 ) ) ] ) #NEWLINE# self . assertEqual ( jk_surface . shape , [ ( 1 , 20 , 10 ) ] ) #NEWLINE# jk_surface . demote ( ) #NEWLINE# self . assertEqual ( jk_surface . shape , [ ( 20 , 10 ) ] ) #NEWLINE# ik_surface = wedge . extract ( [ ( 0 , ( - 1 ) , 0 , 0 , 0 , ( - 1 ) ) ] ) #NEWLINE# self . assertEqual ( ik_surface . shape , [ ( 30 , 1 , 10 ) ] ) #NEWLINE# ik_surface . demote ( ) #NEWLINE# self . assertEqual ( ik_surface . shape , [ ( 30 , 10 ) ] ) #NEWLINE# wedge = create_wedge_3d ( ( 30 , 20 , 10 ) , 5.0 , 0.5 , 2.0 , 30.0 ) #NEWLINE# wedge . make_cylindrical ( ) #NEWLINE# ij_surface = wedge . extract ( [ ( 0 , ( - 1 ) , 0 , ( - 1 ) , 0 , 0 ) ] ) #NEWLINE# self . assertEqual ( ij_surface . shape , [ ( 30 , 20 , 1 ) ] ) #NEWLINE# ij_surface . demote ( ) #NEWLINE# self . assertEqual ( ij_surface . shape , [ ( 30 , 20 ) ] ) #NEWLINE# jk_surface = wedge . extract ( [ ( 0 , 0 , 0 , ( - 1 ) , 0 , ( - 1 ) ) ] ) #NEWLINE# self . assertEqual ( jk_surface . shape , [ ( 1 , 20 , 10 ) ] ) #NEWLINE# jk_surface . demote ( ) #NEWLINE# self . assertEqual ( jk_surface . shape , [ ( 20 , 10 ) ] ) #NEWLINE# ik_surface = wedge . extract ( [ ( 0 , ( - 1 ) , 0 , 0 , 0 , ( - 1 ) ) ] ) #NEWLINE# self . assertEqual ( ik_surface . shape , [ ( 30 , 1 , 10 ) ] ) #NEWLINE# ik_surface . demote ( ) #NEWLINE# self . assertEqual ( ik_surface . shape , [ ( 30 , 10 ) ] ) #NEWLINE# wedge = create_wedge_2d ( ( 30 , 20 ) , 0.5 , 2.0 , 30.0 ) #NEWLINE# i_curve = wedge . extract ( [ ( 0 , ( - 1 ) , 0 , 0 ) ] ) #NEWLINE# self . assertEqual ( i_curve . shape , [ ( 30 , 1 ) ] ) #NEWLINE# i_curve . demote ( ) #NEWLINE# self . assertEqual ( i_curve . shape , [ ( 30 , ) ] ) #NEWLINE# j_curve = wedge . extract ( [ ( 0 , 0 , 0 , ( - 1 ) ) ] ) #NEWLINE# self . assertEqual ( j_curve . shape , [ ( 1 , 20 ) ] ) #NEWLINE# j_curve . demote ( ) #NEWLINE# self . assertEqual ( j_curve . shape , [ ( 20 , ) ] ) #NEWLINE# wedge = create_wedge_2d ( ( 30 , 20 ) , 0.5 , 2.0 , 30.0 ) #NEWLINE# wedge . make_cylindrical ( ) #NEWLINE# i_curve = wedge . extract ( [ ( 0 , ( - 1 ) , 0 , 0 ) ] ) #NEWLINE# self . assertEqual ( i_curve . shape , [ ( 30 , 1 ) ] ) #NEWLINE# i_curve . demote ( ) #NEWLINE# self . assertEqual ( i_curve . shape , [ ( 30 , ) ] ) #NEWLINE# j_curve = wedge . extract ( [ ( 0 , 0 , 0 , ( - 1 ) ) ] ) #NEWLINE# self . assertEqual ( j_curve . shape , [ ( 1 , 20 ) ] ) #NEWLINE# j_curve . demote ( ) #NEWLINE# self . assertEqual ( j_curve . shape , [ ( 20 , ) ] ) #NEWLINE# assert_raises ( self , 'FlowSolution().demote()' , globals ( ) , locals ( ) , RuntimeError , 'FlowSolution is empty!' ) #NEWLINE# wedge = create_wedge_3d ( ( 30 , 20 , 10 ) , 5.0 , 0.5 , 2.0 , 30.0 ) #NEWLINE# assert_raises ( self , 'wedge.xyzzy.flow_solution.demote()' , globals ( ) , locals ( ) , RuntimeError , 'No i, j, or k plane to collapse' ) #NEWLINE# assert_raises ( self , 'wedge.xyzzy.grid_coordinates.demote()' , globals ( ) , locals ( ) , RuntimeError , 'No i, j, or k plane to collapse' ) #NEWLINE# wedge = create_wedge_2d ( ( 30 , 20 ) , 0.5 , 2.0 , 30.0 ) #NEWLINE# assert_raises ( self , 'wedge.xyzzy.flow_solution.demote()' , globals ( ) , locals ( ) , RuntimeError , 'No i or j plane to collapse' ) #NEWLINE# assert_raises ( self , 'wedge.xyzzy.grid_coordinates.demote()' , globals ( ) , locals ( ) , RuntimeError , 'No i or j plane to collapse' ) #NEWLINE# curve = create_curve_2d ( 20 , 0.5 , 30.0 ) #NEWLINE# assert_raises ( self , 'curve.xyzzy.flow_solution.demote()' , globals ( ) , locals ( ) , RuntimeError , 'FlowSolution is 1D' ) #NEWLINE# assert_raises ( self , 'curve.xyzzy.grid_coordinates.demote()' , globals ( ) , locals ( ) , RuntimeError , 'Vector is 1D' )