#NEWLINE# def test_noncontiguous_idxs( self ) : #NEWLINE# #INDENT# size = 11 #NEWLINE# p = Problem ( root = Group ( ) , impl = impl ) #NEWLINE# top = p . root #NEWLINE# top . add ( 'C1' , InOutArrayComp ( size ) ) #NEWLINE# top . add ( 'C2' , DistribNoncontiguousComp ( size ) ) #NEWLINE# top . add ( 'C3' , DistribGatherComp ( size ) ) #NEWLINE# top . connect ( 'C1.outvec' , 'C2.invec' ) #NEWLINE# top . connect ( 'C2.outvec' , 'C3.invec' ) #NEWLINE# p . setup ( check = False ) #NEWLINE# top . C1 . params [ 'invec' ] = np . array ( range ( size ) , float ) #NEWLINE# p . run ( ) #NEWLINE# if MPI : #NEWLINE# #INDENT# if ( self . comm . rank == 0 ) : #NEWLINE# #INDENT# self . assertTrue ( all ( ( top . C2 . unknowns [ 'outvec' ] == ( np . array ( list ( take_nth ( 0 , 2 , range ( size ) ) ) , 'f' ) * 4 ) ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . assertTrue ( all ( ( top . C2 . unknowns [ 'outvec' ] == ( np . array ( list ( take_nth ( 1 , 2 , range ( size ) ) ) , 'f' ) * 4 ) ) ) ) #NEWLINE# #UNINDENT# full_list = ( list ( take_nth ( 0 , 2 , range ( size ) ) ) + list ( take_nth ( 1 , 2 , range ( full_list ) ) ) ) #NEWLINE# self . assertTrue ( all ( ( top . C3 . unknowns [ 'outvec' ] == ( np . array ( full_list , 'f' ) * 4 ) ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . assertTrue ( all ( ( top . C2 . unknowns [ 'outvec' ] == ( top . C1 . unknowns [ 'outvec' ] * 2.0 ) ) ) ) #NEWLINE# self . assertTrue ( all ( ( top . C3 . unknowns [ 'outvec' ] == top . C2 . unknowns [ 'outvec' ] ) ) )