#NEWLINE# def _extract_1d( self , imin , imax , new_ghosts ) : #NEWLINE# #INDENT# ' 1D (index space) extraction. ' #NEWLINE# ( imn , imx ) = ( imin , imax ) #NEWLINE# ghosts = self . _ghosts #NEWLINE# ( flow_imax , ) = self . shape #NEWLINE# if ( imin < 0 ) : #NEWLINE# #INDENT# imin += flow_imax #NEWLINE# #UNINDENT# imin += ghosts [ 0 ] #NEWLINE# if ( imax < 0 ) : #NEWLINE# #INDENT# imax += flow_imax #NEWLINE# #UNINDENT# imax += ghosts [ 0 ] #NEWLINE# imin -= new_ghosts [ 0 ] #NEWLINE# imax += new_ghosts [ 1 ] #NEWLINE# if ( ( imin < 0 ) or ( imax > ( flow_imax + ghosts [ 1 ] ) ) ) : #NEWLINE# #INDENT# region = ( imin , imax ) #NEWLINE# original = ( 0 , ( flow_imax + imx [ 1 ] ) ) #NEWLINE# raise ValueError ( ( 'Extraction region %s exceeds original %s' % ( region , original ) ) ) #NEWLINE# #UNINDENT# flow = FlowSolution ( ) #NEWLINE# for arr in self . _arrays : #NEWLINE# #INDENT# flow . add_array ( self . name_of_obj ( arr ) , arr [ imin : ( imax + 1 ) ] ) #NEWLINE# #UNINDENT# for vector in self . _vectors : #NEWLINE# #INDENT# flow . add_vector ( self . name_of_obj ( vector ) , vector . extract ( imn , imx , ghosts = new_ghosts ) ) #NEWLINE# #UNINDENT# flow . grid_location = self . grid_location #NEWLINE# flow . ghosts = new_ghosts #NEWLINE# flow . _copy_scalars ( self ) #NEWLINE# return flow