pygeo/parameterization/DVGeo.py
def convertSensitivityToDict(self, dIdx, out1D=False):
        """
        This function takes the result of totalSensitivity and
        converts it to a dict for use in pyOptSparse

        Parameters
        ----------
        dIdx : array
           Flattened array of length getNDV(). Generally it comes from
           a call to totalSensitivity()

        out1D : boolean
            If true, creates a 1D array in the dictionary instead of 2D.
            This function is used in the matrix-vector product calculation.

        Returns
        -------
        dIdxDict : dictionary
           Dictionary of the same information keyed by this object's
           design variables
        """

        # compute the various DV offsets
        DVCountGlobal, DVCountLocal, DVCountSecLoc, DVCountSpanLoc = self._getDVOffsets()

        i = DVCountGlobal
        dIdxDict = {}
        for key in self.DV_listGlobal:
            dv = self.DV_listGlobal[key]
            if out1D:
                dIdxDict[dv.name] = np.ravel(dIdx[:, i : i + dv.nVal])
            else:
                dIdxDict[dv.name] = dIdx[:, i : i + dv.nVal]
            i += dv.nVal

        i = DVCountSpanLoc
        for key in self.DV_listSpanwiseLocal:
            dv = self.DV_listSpanwiseLocal[key]
            if out1D:
                dIdxDict[dv.name] = np.ravel(dIdx[:, i : i + dv.nVal])
            else:
                dIdxDict[dv.name] = dIdx[:, i : i + dv.nVal]
            i += dv.nVal

        i = DVCountSecLoc
        for key in self.DV_listSectionLocal:
            dv = self.DV_listSectionLocal[key]
            if out1D:
                dIdxDict[dv.name] = np.ravel(dIdx[:, i : i + dv.nVal])
            else:
                dIdxDict[dv.name] = dIdx[:, i : i + dv.nVal]
            i += dv.nVal

        i = DVCountLocal
        for key in self.DV_listLocal:
            dv = self.DV_listLocal[key]
            if out1D:
                dIdxDict[dv.name] = np.ravel(dIdx[:, i : i + dv.nVal])
            else:
                dIdxDict[dv.name] = dIdx[:, i : i + dv.nVal]

            i += dv.nVal

        # Add in child portion
        for iChild in range(len(self.children)):
            childdIdx = self.children[iChild].convertSensitivityToDict(dIdx, out1D=out1D)
            # update the total sensitivities with the derivatives from the child
            for key in childdIdx:
                if key in dIdxDict.keys():
                    dIdxDict[key] += childdIdx[key]
                else:
                    dIdxDict[key] = childdIdx[key]

        return dIdxDict

        This function takes the result of totalSensitivity and
        converts it to a dict for use in pyOptSparse

        Parameters
        ----------
        dIdx : array
           Flattened array of length getNDV(). Generally it comes from
           a call to totalSensitivity()

        out1D : boolean
            If true, creates a 1D array in the dictionary instead of 2D.
            This function is used in the matrix-vector product calculation.

        Returns
        -------
        dIdxDict : dictionary
           Dictionary of the same information keyed by this object's
           design variables
        
This function takes the result of totalSensitivity and
converts it to a dict for use in pyOptSparse

Parameters

dIdx : array
Flattened array of length getNDV(). Generally it comes from
a call to totalSensitivity()

out1D : boolean
If true, creates a 1D array in the dictionary instead of 2D.
This function is used in the matrix-vector product calculation.

Returns

dIdxDict : dictionary
Dictionary of the same information keyed by this object's
design variables
This function takes the result of totalSensitivity and converts it to a dict for use in pyOptSparse Parameters dIdx : array Flattened array of length getNDV () . Generally it comes from a call to totalSensitivity () out1D : boolean If true creates a 1D array in the dictionary instead of 2D . This function is used in the matrix - vector product calculation . Returns dIdxDict : dictionary Dictionary of the same information keyed by this object ' s design variables
def convertSensitivityToDict(self, dIdx, out1D=False):
        DVCountGlobal, DVCountLocal, DVCountSecLoc, DVCountSpanLoc = self._getDVOffsets()
        i = DVCountGlobal
        dIdxDict = {}
        for key in self.DV_listGlobal:
            dv = self.DV_listGlobal[key]
            if out1D:
                dIdxDict[dv.name] = np.ravel(dIdx[:, i : i + dv.nVal])
            else:
                dIdxDict[dv.name] = dIdx[:, i : i + dv.nVal]
            i += dv.nVal
        i = DVCountSpanLoc
        for key in self.DV_listSpanwiseLocal:
            dv = self.DV_listSpanwiseLocal[key]
            if out1D:
                dIdxDict[dv.name] = np.ravel(dIdx[:, i : i + dv.nVal])
            else:
                dIdxDict[dv.name] = dIdx[:, i : i + dv.nVal]
            i += dv.nVal
        i = DVCountSecLoc
        for key in self.DV_listSectionLocal:
            dv = self.DV_listSectionLocal[key]
            if out1D:
                dIdxDict[dv.name] = np.ravel(dIdx[:, i : i + dv.nVal])
            else:
                dIdxDict[dv.name] = dIdx[:, i : i + dv.nVal]
            i += dv.nVal
        i = DVCountLocal
        for key in self.DV_listLocal:
            dv = self.DV_listLocal[key]
            if out1D:
                dIdxDict[dv.name] = np.ravel(dIdx[:, i : i + dv.nVal])
            else:
                dIdxDict[dv.name] = dIdx[:, i : i + dv.nVal]
            i += dv.nVal
        for iChild in range(len(self.children)):
            childdIdx = self.children[iChild].convertSensitivityToDict(dIdx, out1D=out1D)
            for key in childdIdx:
                if key in dIdxDict.keys():
                    dIdxDict[key] += childdIdx[key]
                else:
                    dIdxDict[key] = childdIdx[key]
        return dIdxDict
def convertSensitivityToDict ( self , dIdx , out1D = False ) : DVCountGlobal , DVCountLocal , DVCountSecLoc , DVCountSpanLoc = self . _getDVOffsets ( ) i = DVCountGlobal dIdxDict = { } for key in self . DV_listGlobal : dv = self . DV_listGlobal [ key ] if out1D : dIdxDict [ dv . name ] = np . ravel ( dIdx [ : , i : i + dv . nVal ] ) else : dIdxDict [ dv . name ] = dIdx [ : , i : i + dv . nVal ] i += dv . nVal i = DVCountSpanLoc for key in self . DV_listSpanwiseLocal : dv = self . DV_listSpanwiseLocal [ key ] if out1D : dIdxDict [ dv . name ] = np . ravel ( dIdx [ : , i : i + dv . nVal ] ) else : dIdxDict [ dv . name ] = dIdx [ : , i : i + dv . nVal ] i += dv . nVal i = DVCountSecLoc for key in self . DV_listSectionLocal : dv = self . DV_listSectionLocal [ key ] if out1D : dIdxDict [ dv . name ] = np . ravel ( dIdx [ : , i : i + dv . nVal ] ) else : dIdxDict [ dv . name ] = dIdx [ : , i : i + dv . nVal ] i += dv . nVal i = DVCountLocal for key in self . DV_listLocal : dv = self . DV_listLocal [ key ] if out1D : dIdxDict [ dv . name ] = np . ravel ( dIdx [ : , i : i + dv . nVal ] ) else : dIdxDict [ dv . name ] = dIdx [ : , i : i + dv . nVal ] i += dv . nVal for iChild in range ( len ( self . children ) ) : childdIdx = self . children [ iChild ] . convertSensitivityToDict ( dIdx , out1D = out1D ) for key in childdIdx : if key in dIdxDict . keys ( ) : dIdxDict [ key ] += childdIdx [ key ] else : dIdxDict [ key ] = childdIdx [ key ] return dIdxDict
This function takes the result of totalSensitivity and
converts it to a dict for use in pyOptSparse
This function takes the result of totalSensitivity and converts it to a dict for use in pyOptSparse
"""
        This function takes the result of totalSensitivity and
        converts it to a dict for use in pyOptSparse

        Parameters
        ----------
        dIdx : array
           Flattened array of length getNDV(). Generally it comes from
           a call to totalSensitivity()

        out1D : boolean
            If true, creates a 1D array in the dictionary instead of 2D.
            This function is used in the matrix-vector product calculation.

        Returns
        -------
        dIdxDict : dictionary
           Dictionary of the same information keyed by this object's
           design variables
        """ # compute the various DV offsets # Add in child portion # update the total sensitivities with the derivatives from the child
self
dIdx
out1D