pygeo/parameterization/DVGeo.py
def _sectionlocalDVJacobian(self, config=None):
        """
        Return the derivative of the coefficients wrt the local normal design
        variables
        """
        # This is relatively straight forward, since the matrix is
        # entirely one's or zeros
        nDV = self._getNDVSectionLocalSelf()
        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))

            iDVSectionLocal = self.nDVSL_count
            for key in self.DV_listSectionLocal:
                dv = self.DV_listSectionLocal[key]
                if dv.config is None or config is None or any(c0 == config for c0 in dv.config):
                    nVal = dv.nVal

                    self.DV_listSectionLocal[key](self.FFD.coef, self.coefRotM, config)

                    for j in range(nVal):
                        coef = dv.coefList[j]  # affected control point
                        T = dv.sectionTransform[dv.sectionLink[coef]]
                        inFrame = np.zeros((3, 1))
                        # Set axis that is being perturbed to 1.0
                        inFrame[dv.axis] = 1.0

                        R = np.real(self.coefRotM[coef])
                        # this is a bug fix for scipy 1.3+ related to fancy indexing
                        # the original was:
                        # rows = range(coef*3,(coef+1)*3)
                        # Jacobian[rows, iDVSectionLocal] += R.dot(T.dot(inFrame))
                        Jacobian[coef * 3 : (coef + 1) * 3, iDVSectionLocal] += R.dot(T.dot(inFrame))
                        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[coef, :] = R.dot(T.dot(inFrame)).flatten()

                            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[:, iDVSectionLocal] += dXrefdXdvl
                            self.children[iChild].dCcdXdvl[:, iDVSectionLocal] += dCcdXdvl
                        iDVSectionLocal += 1
                else:
                    iDVSectionLocal += self.DV_listSectionLocal[key].nVal

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

        return Jacobian

        Return the derivative of the coefficients wrt the local normal design
        variables
        
Return the derivative of the coefficients wrt the local normal design
variables
Return the derivative of the coefficients wrt the local normal design variables
def _sectionlocalDVJacobian(self, config=None):
        nDV = self._getNDVSectionLocalSelf()
        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))
            iDVSectionLocal = self.nDVSL_count
            for key in self.DV_listSectionLocal:
                dv = self.DV_listSectionLocal[key]
                if dv.config is None or config is None or any(c0 == config for c0 in dv.config):
                    nVal = dv.nVal
                    self.DV_listSectionLocal[key](self.FFD.coef, self.coefRotM, config)
                    for j in range(nVal):
                        coef = dv.coefList[j]  
                        T = dv.sectionTransform[dv.sectionLink[coef]]
                        inFrame = np.zeros((3, 1))
                        inFrame[dv.axis] = 1.0
                        R = np.real(self.coefRotM[coef])
                        Jacobian[coef * 3 : (coef + 1) * 3, iDVSectionLocal] += R.dot(T.dot(inFrame))
                        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[coef, :] = R.dot(T.dot(inFrame)).flatten()
                            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[:, iDVSectionLocal] += dXrefdXdvl
                            self.children[iChild].dCcdXdvl[:, iDVSectionLocal] += dCcdXdvl
                        iDVSectionLocal += 1
                else:
                    iDVSectionLocal += self.DV_listSectionLocal[key].nVal
        else:
            Jacobian = None
        return Jacobian
def _sectionlocalDVJacobian ( self , config = None ) : nDV = self . _getNDVSectionLocalSelf ( ) 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 ) ) iDVSectionLocal = self . nDVSL_count for key in self . DV_listSectionLocal : dv = self . DV_listSectionLocal [ key ] if dv . config is None or config is None or any ( c0 == config for c0 in dv . config ) : nVal = dv . nVal self . DV_listSectionLocal [ key ] ( self . FFD . coef , self . coefRotM , config ) for j in range ( nVal ) : coef = dv . coefList [ j ] T = dv . sectionTransform [ dv . sectionLink [ coef ] ] inFrame = np . zeros ( ( 3 , 1 ) ) inFrame [ dv . axis ] = 1.0 R = np . real ( self . coefRotM [ coef ] ) Jacobian [ coef * 3 : ( coef + 1 ) * 3 , iDVSectionLocal ] += R . dot ( T . dot ( inFrame ) ) 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 [ coef , : ] = R . dot ( T . dot ( inFrame ) ) . flatten ( ) 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 [ : , iDVSectionLocal ] += dXrefdXdvl self . children [ iChild ] . dCcdXdvl [ : , iDVSectionLocal ] += dCcdXdvl iDVSectionLocal += 1 else : iDVSectionLocal += self . DV_listSectionLocal [ key ] . nVal else : Jacobian = None return Jacobian
Return the derivative of the coefficients wrt the local normal design
variables
Return the derivative of the coefficients wrt the local normal design variables
"""
        Return the derivative of the coefficients wrt the local normal 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 # affected control point # Set axis that is being perturbed to 1.0 # this is a bug fix for scipy 1.3+ related to fancy indexing # the original was: # rows = range(coef*3,(coef+1)*3) # Jacobian[rows, iDVSectionLocal] += R.dot(T.dot(inFrame)) # TODO: the += here is to allow recursion check this with multiple nesting # levels # end if config check # end for
self
config