#NEWLINE# def _extend_3d( self , axis , delta , npoints ) : #NEWLINE# #INDENT# ' 3D (index space) extension. ' #NEWLINE# ( imax , jmax , kmax ) = self . real_shape #NEWLINE# if ( axis == 'i' ) : #NEWLINE# #INDENT# new_shape = ( ( imax + npoints ) , jmax , kmax ) #NEWLINE# indx = ( imax if ( delta > 0 ) else npoints ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( axis == 'j' ) : #NEWLINE# #INDENT# new_shape = ( imax , ( jmax + npoints ) , kmax ) #NEWLINE# indx = ( jmax if ( delta > 0 ) else npoints ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# new_shape = ( imax , jmax , ( kmax + npoints ) ) #NEWLINE# indx = ( kmax if ( delta > 0 ) else npoints ) #NEWLINE# #UNINDENT# #UNINDENT# flow = FlowSolution ( ) #NEWLINE# for arr in self . _arrays : #NEWLINE# #INDENT# new_arr = numpy . zeros ( new_shape ) #NEWLINE# if ( axis == 'i' ) : #NEWLINE# #INDENT# if ( delta > 0 ) : #NEWLINE# #INDENT# new_arr [ 0 : indx , : , : ] = arr #NEWLINE# for i in range ( npoints ) : #NEWLINE# #INDENT# new_arr [ ( indx + i ) , : , : ] = arr [ ( - 1 ) , : , : ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# new_arr [ indx : , : , : ] = arr #NEWLINE# for i in range ( npoints ) : #NEWLINE# #INDENT# new_arr [ i , : , : ] = arr [ 0 , : , : ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( axis == 'j' ) : #NEWLINE# #INDENT# if ( delta > 0 ) : #NEWLINE# #INDENT# new_arr [ : , 0 : indx , : ] = arr #NEWLINE# for j in range ( npoints ) : #NEWLINE# #INDENT# new_arr [ : , ( indx + j ) , : ] = arr [ : , ( - 1 ) , : ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# new_arr [ : , indx : , : ] = arr #NEWLINE# for j in range ( npoints ) : #NEWLINE# #INDENT# new_arr [ : , j , : ] = arr [ : , 0 , : ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( delta > 0 ) : #NEWLINE# #INDENT# new_arr [ : , : , 0 : indx ] = arr #NEWLINE# for k in range ( npoints ) : #NEWLINE# #INDENT# new_arr [ : , : , ( indx + k ) ] = arr [ : , : , ( - 1 ) ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# new_arr [ : , : , indx : ] = arr #NEWLINE# for k in range ( npoints ) : #NEWLINE# #INDENT# new_arr [ : , : , k ] = arr [ : , : , 0 ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# flow . add_array ( self . name_of_obj ( arr ) , new_arr ) #NEWLINE# #UNINDENT# for vector in self . _vectors : #NEWLINE# #INDENT# flow . add_vector ( self . name_of_obj ( vector ) , vector . extend ( axis , delta , npoints ) ) #NEWLINE# #UNINDENT# flow . grid_location = self . grid_location #NEWLINE# flow . ghosts = copy . copy ( self . _ghosts ) #NEWLINE# flow . _copy_scalars ( self ) #NEWLINE# return flow