openmdao/core/total_jac.py
def single_jac_setter(self, i, mode):
        """
        Set the appropriate part of the total jacobian for a single input index.

        Parameters
        ----------
        i : int
            Total jacobian row or column index.
        mode : str
            Direction of derivative solution.
        """
        vecname, _, _ = self.in_idx_map[mode][i]

        scatter = self.jac_scatters[mode][vecname]

        # DefaultVector
        if scatter is None:
            deriv_idxs, jac_idxs = self.solvec_map[mode]
            deriv_val = self.output_vec[mode][vecname]._data
            if mode == 'fwd':
                self.J[jac_idxs[vecname], i] = deriv_val[deriv_idxs[vecname]]
            else:  # rev
                self.J[i, jac_idxs[vecname]] = deriv_val[deriv_idxs[vecname]]

        # PETScVector
        else:
            self.jac_petsc[mode].array[:] = 0.
            scatter.scatter(self.soln_petsc[mode][vecname][0],
                            self.jac_petsc[mode], addv=False, mode=False)
            if mode == 'fwd':
                self.J[:, i] = self.jac_petsc[mode].array
            else:
                self.J[i] = self.jac_petsc[mode].array

        Set the appropriate part of the total jacobian for a single input index.

        Parameters
        ----------
        i : int
            Total jacobian row or column index.
        mode : str
            Direction of derivative solution.
        
Set the appropriate part of the total jacobian for a single input index.
Parameters

i : int
Total jacobian row or column index.
mode : str
Direction of derivative solution.
Set the appropriate part of the total jacobian for a single input index . Parameters i : int Total jacobian row or column index . mode : str Direction of derivative solution .
def single_jac_setter(self, i, mode):
        vecname, _, _ = self.in_idx_map[mode][i]
        scatter = self.jac_scatters[mode][vecname]
        if scatter is None:
            deriv_idxs, jac_idxs = self.solvec_map[mode]
            deriv_val = self.output_vec[mode][vecname]._data
            if mode == 'fwd':
                self.J[jac_idxs[vecname], i] = deriv_val[deriv_idxs[vecname]]
            else:  
                self.J[i, jac_idxs[vecname]] = deriv_val[deriv_idxs[vecname]]
        else:
            self.jac_petsc[mode].array[:] = 0.
            scatter.scatter(self.soln_petsc[mode][vecname][0],
                            self.jac_petsc[mode], addv=False, mode=False)
            if mode == 'fwd':
                self.J[:, i] = self.jac_petsc[mode].array
            else:
                self.J[i] = self.jac_petsc[mode].array
def single_jac_setter ( self , i , mode ) : vecname , _ , _ = self . in_idx_map [ mode ] [ i ] scatter = self . jac_scatters [ mode ] [ vecname ] if scatter is None : deriv_idxs , jac_idxs = self . solvec_map [ mode ] deriv_val = self . output_vec [ mode ] [ vecname ] . _data if mode == 'fwd' : self . J [ jac_idxs [ vecname ] , i ] = deriv_val [ deriv_idxs [ vecname ] ] else : self . J [ i , jac_idxs [ vecname ] ] = deriv_val [ deriv_idxs [ vecname ] ] else : self . jac_petsc [ mode ] . array [ : ] = 0. scatter . scatter ( self . soln_petsc [ mode ] [ vecname ] [ 0 ] , self . jac_petsc [ mode ] , addv = False , mode = False ) if mode == 'fwd' : self . J [ : , i ] = self . jac_petsc [ mode ] . array else : self . J [ i ] = self . jac_petsc [ mode ] . array
Set the appropriate part of the total jacobian for a single input index.
Set the appropriate part of the total jacobian for a single input index .
"""
        Set the appropriate part of the total jacobian for a single input index.

        Parameters
        ----------
        i : int
            Total jacobian row or column index.
        mode : str
            Direction of derivative solution.
        """ # DefaultVector # rev # PETScVector
self
i
mode