pygeo/parameterization/DVGeo.py
def _localDVJacobian(self, config=None):
        """
        Return the derivative of the coefficients wrt the local design
        variables
        """

        # This is relatively straight forward, since the matrix is
        # entirely one's or zeros
        nDV = self._getNDVLocalSelf()
        self._getDVOffsets()

        if nDV != 0:
            Jacobian = sparse.lil_matrix((self.nPtAttachFull * 3, self.nDV_T))

            # Create the storage arrays for the information that must be
            # passed to the children
            for iChild in range(len(self.children)):
                N = self.FFD.embededVolumes["child%d_axis" % (iChild)].N
                self.children[iChild].dXrefdXdvl = np.zeros((N * 3, self.nDV_T))

                N = self.FFD.embededVolumes["child%d_coef" % (iChild)].N
                self.children[iChild].dCcdXdvl = np.zeros((N * 3, self.nDV_T))

            iDVLocal = self.nDVL_count
            for key in self.DV_listLocal:
                if (
                    self.DV_listLocal[key].config is None
                    or config is None
                    or any(c0 == config for c0 in self.DV_listLocal[key].config)
                ):

                    self.DV_listLocal[key](self.FFD.coef, config)

                    nVal = self.DV_listLocal[key].nVal
                    for j in range(nVal):
                        pt_dv = self.DV_listLocal[key].coefList[j]
                        irow = pt_dv[0] * 3 + pt_dv[1]
                        Jacobian[irow, iDVLocal] = 1.0

                        for iChild in range(len(self.children)):
                            # Get derivatives of child ref axis and FFD control
                            # points w.r.t. parent's FFD control points
                            dXrefdCoef = self.FFD.embededVolumes["child%d_axis" % (iChild)].dPtdCoef
                            dCcdCoef = self.FFD.embededVolumes["child%d_coef" % (iChild)].dPtdCoef

                            tmp = np.zeros(self.FFD.coef.shape, dtype="d")

                            tmp[pt_dv[0], pt_dv[1]] = 1.0

                            dXrefdXdvl = np.zeros((dXrefdCoef.shape[0] * 3), "d")
                            dCcdXdvl = np.zeros((dCcdCoef.shape[0] * 3), "d")

                            dXrefdXdvl[0::3] = dXrefdCoef.dot(tmp[:, 0])
                            dXrefdXdvl[1::3] = dXrefdCoef.dot(tmp[:, 1])
                            dXrefdXdvl[2::3] = dXrefdCoef.dot(tmp[:, 2])

                            dCcdXdvl[0::3] = dCcdCoef.dot(tmp[:, 0])
                            dCcdXdvl[1::3] = dCcdCoef.dot(tmp[:, 1])
                            dCcdXdvl[2::3] = dCcdCoef.dot(tmp[:, 2])

                            # TODO: the += here is to allow recursion check this with multiple nesting
                            # levels
                            self.children[iChild].dXrefdXdvl[:, iDVLocal] += dXrefdXdvl
                            self.children[iChild].dCcdXdvl[:, iDVLocal] += dCcdXdvl
                        iDVLocal += 1
                else:
                    iDVLocal += self.DV_listLocal[key].nVal

                # end if config check
            # end for
        else:
            Jacobian = None

        return Jacobian

        Return the derivative of the coefficients wrt the local design
        variables
        
Return the derivative of the coefficients wrt the local design
variables
Return the derivative of the coefficients wrt the local design variables
def _localDVJacobian(self, config=None):
        nDV = self._getNDVLocalSelf()
        self._getDVOffsets()
        if nDV != 0:
            Jacobian = sparse.lil_matrix((self.nPtAttachFull * 3, self.nDV_T))
            for iChild in range(len(self.children)):
                N = self.FFD.embededVolumes["child%d_axis" % (iChild)].N
                self.children[iChild].dXrefdXdvl = np.zeros((N * 3, self.nDV_T))
                N = self.FFD.embededVolumes["child%d_coef" % (iChild)].N
                self.children[iChild].dCcdXdvl = np.zeros((N * 3, self.nDV_T))
            iDVLocal = self.nDVL_count
            for key in self.DV_listLocal:
                if (
                    self.DV_listLocal[key].config is None
                    or config is None
                    or any(c0 == config for c0 in self.DV_listLocal[key].config)
                ):
                    self.DV_listLocal[key](self.FFD.coef, config)
                    nVal = self.DV_listLocal[key].nVal
                    for j in range(nVal):
                        pt_dv = self.DV_listLocal[key].coefList[j]
                        irow = pt_dv[0] * 3 + pt_dv[1]
                        Jacobian[irow, iDVLocal] = 1.0
                        for iChild in range(len(self.children)):
                            dXrefdCoef = self.FFD.embededVolumes["child%d_axis" % (iChild)].dPtdCoef
                            dCcdCoef = self.FFD.embededVolumes["child%d_coef" % (iChild)].dPtdCoef
                            tmp = np.zeros(self.FFD.coef.shape, dtype="d")
                            tmp[pt_dv[0], pt_dv[1]] = 1.0
                            dXrefdXdvl = np.zeros((dXrefdCoef.shape[0] * 3), "d")
                            dCcdXdvl = np.zeros((dCcdCoef.shape[0] * 3), "d")
                            dXrefdXdvl[0::3] = dXrefdCoef.dot(tmp[:, 0])
                            dXrefdXdvl[1::3] = dXrefdCoef.dot(tmp[:, 1])
                            dXrefdXdvl[2::3] = dXrefdCoef.dot(tmp[:, 2])
                            dCcdXdvl[0::3] = dCcdCoef.dot(tmp[:, 0])
                            dCcdXdvl[1::3] = dCcdCoef.dot(tmp[:, 1])
                            dCcdXdvl[2::3] = dCcdCoef.dot(tmp[:, 2])
                            self.children[iChild].dXrefdXdvl[:, iDVLocal] += dXrefdXdvl
                            self.children[iChild].dCcdXdvl[:, iDVLocal] += dCcdXdvl
                        iDVLocal += 1
                else:
                    iDVLocal += self.DV_listLocal[key].nVal
        else:
            Jacobian = None
        return Jacobian
def _localDVJacobian ( self , config = None ) : nDV = self . _getNDVLocalSelf ( ) self . _getDVOffsets ( ) if nDV != 0 : Jacobian = sparse . lil_matrix ( ( self . nPtAttachFull * 3 , self . nDV_T ) ) for iChild in range ( len ( self . children ) ) : N = self . FFD . embededVolumes [ "child%d_axis" % ( iChild ) ] . N self . children [ iChild ] . dXrefdXdvl = np . zeros ( ( N * 3 , self . nDV_T ) ) N = self . FFD . embededVolumes [ "child%d_coef" % ( iChild ) ] . N self . children [ iChild ] . dCcdXdvl = np . zeros ( ( N * 3 , self . nDV_T ) ) iDVLocal = self . nDVL_count for key in self . DV_listLocal : if ( self . DV_listLocal [ key ] . config is None or config is None or any ( c0 == config for c0 in self . DV_listLocal [ key ] . config ) ) : self . DV_listLocal [ key ] ( self . FFD . coef , config ) nVal = self . DV_listLocal [ key ] . nVal for j in range ( nVal ) : pt_dv = self . DV_listLocal [ key ] . coefList [ j ] irow = pt_dv [ 0 ] * 3 + pt_dv [ 1 ] Jacobian [ irow , iDVLocal ] = 1.0 for iChild in range ( len ( self . children ) ) : dXrefdCoef = self . FFD . embededVolumes [ "child%d_axis" % ( iChild ) ] . dPtdCoef dCcdCoef = self . FFD . embededVolumes [ "child%d_coef" % ( iChild ) ] . dPtdCoef tmp = np . zeros ( self . FFD . coef . shape , dtype = "d" ) tmp [ pt_dv [ 0 ] , pt_dv [ 1 ] ] = 1.0 dXrefdXdvl = np . zeros ( ( dXrefdCoef . shape [ 0 ] * 3 ) , "d" ) dCcdXdvl = np . zeros ( ( dCcdCoef . shape [ 0 ] * 3 ) , "d" ) dXrefdXdvl [ 0 : : 3 ] = dXrefdCoef . dot ( tmp [ : , 0 ] ) dXrefdXdvl [ 1 : : 3 ] = dXrefdCoef . dot ( tmp [ : , 1 ] ) dXrefdXdvl [ 2 : : 3 ] = dXrefdCoef . dot ( tmp [ : , 2 ] ) dCcdXdvl [ 0 : : 3 ] = dCcdCoef . dot ( tmp [ : , 0 ] ) dCcdXdvl [ 1 : : 3 ] = dCcdCoef . dot ( tmp [ : , 1 ] ) dCcdXdvl [ 2 : : 3 ] = dCcdCoef . dot ( tmp [ : , 2 ] ) self . children [ iChild ] . dXrefdXdvl [ : , iDVLocal ] += dXrefdXdvl self . children [ iChild ] . dCcdXdvl [ : , iDVLocal ] += dCcdXdvl iDVLocal += 1 else : iDVLocal += self . DV_listLocal [ key ] . nVal else : Jacobian = None return Jacobian
Return the derivative of the coefficients wrt the local design
variables
Return the derivative of the coefficients wrt the local design variables
"""
        Return the derivative of the coefficients wrt the local design
        variables
        """ # This is relatively straight forward, since the matrix is # entirely one's or zeros # Create the storage arrays for the information that must be # passed to the children # Get derivatives of child ref axis and FFD control # points w.r.t. parent's FFD control points # TODO: the += here is to allow recursion check this with multiple nesting # levels # end if config check # end for
self
config