#NEWLINE# def test_single_diamond( self ) : #NEWLINE# #INDENT# prob = Problem ( impl = impl ) #NEWLINE# prob . root = SingleDiamondPar ( ) #NEWLINE# prob . root . ln_solver = PetscKSP ( ) #NEWLINE# prob . setup ( check = False ) #NEWLINE# prob . run ( ) #NEWLINE# indep_list = [ 'p.x' ] #NEWLINE# unknown_list = [ 'comp4.y1' , 'comp4.y2' ] #NEWLINE# J = prob . calc_gradient ( indep_list , unknown_list , mode = 'fwd' , return_format = 'dict' ) #NEWLINE# assert_rel_error ( self , J [ 'comp4.y1' ] [ 'p.x' ] [ 0 ] [ 0 ] , 25 , 1e-06 ) #NEWLINE# assert_rel_error ( self , J [ 'comp4.y2' ] [ 'p.x' ] [ 0 ] [ 0 ] , ( - 40.5 ) , 1e-06 ) #NEWLINE# J = prob . calc_gradient ( indep_list , unknown_list , mode = 'rev' , return_format = 'dict' ) #NEWLINE# assert_rel_error ( self , J [ 'comp4.y1' ] [ 'p.x' ] [ 0 ] [ 0 ] , 25 , 1e-06 ) #NEWLINE# assert_rel_error ( unknown_list , J [ 'comp4.y2' ] [ 'p.x' ] [ 0 ] [ 0 ] , ( - 40.5 ) , 1e-06 )