#NEWLINE# def _setup_data_transfer( self , my_params , var_of_interest , alloc_derivs ) : #NEWLINE# #INDENT# '\n        Create `DataTransfer` objects to handle data transfer for all of the\n        connections that involve parameters for which this `Group`\n        is responsible.\n\n        Args\n        ----\n\n        my_params : set\n            Set of pathnames for parameters that the `Group` is\n            responsible for propagating.\n\n        var_of_interest : str or None\n            The name of a variable of interest.\n\n        alloc_derivs : bool\n            If True, deriv vecs have been allocated.\n        ' #NEWLINE# relevant = self . _probdata . relevance . relevant . get ( var_of_interest , ( ) ) #NEWLINE# to_prom_name = self . _sysdata . to_prom_name #NEWLINE# uacc = self . unknowns . _dat #NEWLINE# pacc = self . params . _dat #NEWLINE# vec_unames = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# i = 0 #NEWLINE# for ( n , sz ) in self . _u_size_lists [ 0 ] : #NEWLINE# #INDENT# if ( uacc [ n ] . meta [ 'top_promoted_name' ] in relevant ) : #NEWLINE# #INDENT# vec_unames [ n ] = i #NEWLINE# i += 1 #NEWLINE# #UNINDENT# #UNINDENT# vec_pnames = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# i = 0 #NEWLINE# for ( n , sz ) in self . _p_size_lists [ 0 ] : #NEWLINE# #INDENT# if ( pacc [ n ] . meta [ 'top_promoted_name' ] in relevant ) : #NEWLINE# #INDENT# vec_pnames [ n ] = i #NEWLINE# i += 1 #NEWLINE# #UNINDENT# #UNINDENT# unknown_sizes = [ ] #NEWLINE# param_sizes = [ ] #NEWLINE# for iproc in range ( self . comm . size ) : #NEWLINE# #INDENT# unknown_sizes . append ( [ sz for ( n , sz ) in self . _u_size_lists [ iproc ] if ( n in vec_unames ) ] ) #NEWLINE# param_sizes . append ( [ sz for ( n , sz ) in self . _p_size_lists [ iproc ] if ( n in vec_pnames ) ] ) #NEWLINE# #UNINDENT# unknown_sizes = np . array ( unknown_sizes , dtype = self . _impl . idx_arr_type ) #NEWLINE# self . _local_unknown_sizes [ var_of_interest ] = unknown_sizes #NEWLINE# param_sizes = np . array ( param_sizes , dtype = self . _impl . idx_arr_type ) #NEWLINE# self . _local_param_sizes [ var_of_interest ] = param_sizes #NEWLINE# fwd = 0 #NEWLINE# rev = 1 #NEWLINE# modename = [ 'fwd' , 'rev' ] #NEWLINE# xfer_dict = OrderedDict ( ) #NEWLINE# for param in self . connections : #NEWLINE# #INDENT# if ( param not in my_params ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# ( unknown , idxs ) = self . connections [ param ] #NEWLINE# if ( self . _unknowns_dict [ unknown ] [ 'top_promoted_name' ] not in relevant ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( self . _params_dict [ param ] [ 'top_promoted_name' ] not in relevant ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# urelname = to_prom_name [ unknown ] #NEWLINE# prelname = name_relative_to ( self . pathname , param ) #NEWLINE# umeta = self . unknowns . metadata ( urelname ) #NEWLINE# tgt_sys = nearest_child ( self . pathname , param ) #NEWLINE# src_sys = nearest_child ( self . pathname , unknown ) #NEWLINE# for ( sname , mode ) in ( ( tgt_sys , fwd ) , ( src_sys , rev ) ) : #NEWLINE# #INDENT# ( src_idx_list , dest_idx_list , vec_conns , byobj_conns ) = xfer_dict . setdefault ( ( sname , mode ) , ( [ ] , [ ] , [ ] , [ ] ) ) #NEWLINE# if ( ( 'pass_by_obj' in umeta ) and umeta [ 'pass_by_obj' ] ) : #NEWLINE# #INDENT# if ( mode == fwd ) : #NEWLINE# #INDENT# byobj_conns . append ( ( prelname , urelname ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# ( sidxs , didxs ) = self . _get_global_idxs ( urelname , prelname , vec_unames , unknown_sizes , vec_pnames , param_sizes , modename [ mode ] ) #NEWLINE# vec_conns . append ( ( prelname , urelname ) ) #NEWLINE# src_idx_list . append ( sidxs ) #NEWLINE# dest_idx_list . append ( didxs ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if alloc_derivs : #NEWLINE# #INDENT# uvec = self . dumat [ var_of_interest ] #NEWLINE# pvec = self . dpmat [ var_of_interest ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# uvec = self . unknowns #NEWLINE# pvec = self . params #NEWLINE# #UNINDENT# for mode in ( fwd , rev ) : #NEWLINE# #INDENT# start = 0 #NEWLINE# full_srcs = [ ] #NEWLINE# full_tgts = [ ] #NEWLINE# full_flats = [ ] #NEWLINE# full_byobjs = [ ] #NEWLINE# for ( tup , ( srcs , tgts , flats , byobjs ) ) in iteritems ( xfer_dict ) : #NEWLINE# #INDENT# ( tgt_sys , direction ) = tup #NEWLINE# if ( mode == direction ) : #NEWLINE# #INDENT# full_srcs . extend ( srcs ) #NEWLINE# full_tgts . extend ( tgts ) #NEWLINE# full_flats . extend ( flats ) #NEWLINE# full_byobjs . extend ( byobjs ) #NEWLINE# if ( flats or byobjs ) : #NEWLINE# #INDENT# self . _data_xfer [ ( tgt_sys , modename [ mode ] , var_of_interest ) ] = self . _impl . create_data_xfer ( uvec , pvec , srcs , tgts , flats , byobjs , modename [ mode ] , self . _sysdata ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . _data_xfer [ ( '' , vec_unames [ mode ] , var_of_interest ) ] = self . _impl . create_data_xfer ( uvec , pvec , full_srcs , full_tgts , full_flats , full_byobjs , modename [ mode ] , self . _sysdata )