#NEWLINE# def get_view( self , system , comm , varmap ) : #NEWLINE# #INDENT# '\n        Return a new `VecWrapper` that is a view into this one.\n\n        Args\n        ----\n        system : `System`\n            System for which the view is being created.\n\n        comm : an MPI communicator (real or fake)\n            A communicator that is used in the creation of the view.\n\n        varmap : dict\n            Mapping of variable names in the old `VecWrapper` to the names\n            they will have in the new `VecWrapper`.\n\n        Returns\n        -------\n        `VecWrapper`\n            A new `VecWrapper` that is a view into this one.\n        ' #NEWLINE# view = self . __class__ ( system . _sysdata , system . _probdata , comm ) #NEWLINE# view . alloc_complex = self . alloc_complex #NEWLINE# view_size = 0 #NEWLINE# start = ( - 1 ) #NEWLINE# alloc_complex = self . alloc_complex #NEWLINE# for ( name , pname ) in iteritems ( varmap ) : #NEWLINE# #INDENT# if ( name in self . _dat ) : #NEWLINE# #INDENT# acc = self . _dat [ name ] #NEWLINE# if ( acc . pbo or acc . remote ) : #NEWLINE# #INDENT# view . _dat [ pname ] = Accessor ( view , None , acc . val , acc . meta , view . _probdata , alloc_complex ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( pstart , pend ) = acc . slice #NEWLINE# if ( start == ( - 1 ) ) : #NEWLINE# #INDENT# start = pstart #NEWLINE# end = pend #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# assert ( pstart == end ) , ( '%s not contiguous in block containing %s' % ( name , varmap . keys ( ) ) ) #NEWLINE# #UNINDENT# end = pend #NEWLINE# meta = acc . meta #NEWLINE# if alloc_complex : #NEWLINE# #INDENT# imag_val = acc . imag_val #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# imag_val = None #NEWLINE# #UNINDENT# view . _dat [ pname ] = Accessor ( view , ( view_size , ( view_size + meta [ 'size' ] ) ) , acc . val , meta , self . _probdata , alloc_complex , imag_val = imag_val ) #NEWLINE# view_size += meta [ 'size' ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( start == ( - 1 ) ) : #NEWLINE# #INDENT# view . vec = self . vec [ 0 : 0 ] #NEWLINE# if alloc_complex : #NEWLINE# #INDENT# view . imag_vec = self . imag_vec [ 0 : 0 ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# view . vec = self . vec [ start : end ] #NEWLINE# if alloc_complex : #NEWLINE# #INDENT# view . imag_vec = self . imag_vec [ start : end ] #NEWLINE# #UNINDENT# #UNINDENT# return view