pygeo/parameterization/DVGeo.py
def _spanwiselocalDVJacobian(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._getNDVSpanwiseLocalSelf()
        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))

            iDVSpanwiseLocal = self.nDVSW_count
            for key in self.DV_listSpanwiseLocal:
                dv = self.DV_listSpanwiseLocal[key]

                # check that the dv is active for this config
                if dv.config is None or config is None or any(c0 == config for c0 in dv.config):
                    nVal = dv.nVal

                    # apply this dv to FFD
                    self.DV_listSpanwiseLocal[key](self.FFD.coef, config)

                    # loop over value of the dv
                    # (for example a single shape dv may have 20 values that
                    # control the shape of the FFD at 20 points)
                    for j in range(nVal):
                        coefs = dv.dv_to_coefs[j]  # affected control points of FFD

                        # this is map from dvs to coef
                        for coef in coefs:
                            irow = coef * 3 + dv.axis
                            # *3 because the jacobian has a row for each x,y,z of the FFD
                            # It is basically
                            # row number = coef index * n dimensions + dimension index

                            # value of FFD node location = x0 + dv_SWLocal[j]
                            # so partial(FFD node location)/partial(dv_SWLocal) = 1
                            # for each node effected by the dv_SWLocal[j]
                            Jacobian[irow, iDVSpanwiseLocal] = 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

                            # derivative of Change in the FFD coef due to DVs
                            # same as Jacobian above, but differnt ordering
                            dCoefdXdvl = np.zeros(self.FFD.coef.shape, dtype="d")

                            for coef in coefs:
                                dCoefdXdvl[coef, dv.axis] = 1.0

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

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

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

                            # TODO: the += here is to allow recursion check this with multiple nesting
                            # levels
                            self.children[iChild].dXrefdXdvl[:, iDVSpanwiseLocal] += dXrefdXdvl
                            self.children[iChild].dCcdXdvl[:, iDVSpanwiseLocal] += dCcdXdvl

                        iDVSpanwiseLocal += 1
                else:
                    iDVSpanwiseLocal += 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 _spanwiselocalDVJacobian(self, config=None):
        nDV = self._getNDVSpanwiseLocalSelf()
        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))
            iDVSpanwiseLocal = self.nDVSW_count
            for key in self.DV_listSpanwiseLocal:
                dv = self.DV_listSpanwiseLocal[key]
                if dv.config is None or config is None or any(c0 == config for c0 in dv.config):
                    nVal = dv.nVal
                    self.DV_listSpanwiseLocal[key](self.FFD.coef, config)
                    for j in range(nVal):
                        coefs = dv.dv_to_coefs[j]  
                        for coef in coefs:
                            irow = coef * 3 + dv.axis
                            Jacobian[irow, iDVSpanwiseLocal] = 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
                            dCoefdXdvl = np.zeros(self.FFD.coef.shape, dtype="d")
                            for coef in coefs:
                                dCoefdXdvl[coef, dv.axis] = 1.0
                            dXrefdXdvl = np.zeros((dXrefdCoef.shape[0] * 3), "d")
                            dCcdXdvl = np.zeros((dCcdCoef.shape[0] * 3), "d")
                            dXrefdXdvl[0::3] = dXrefdCoef.dot(dCoefdXdvl[:, 0])
                            dXrefdXdvl[1::3] = dXrefdCoef.dot(dCoefdXdvl[:, 1])
                            dXrefdXdvl[2::3] = dXrefdCoef.dot(dCoefdXdvl[:, 2])
                            dCcdXdvl[0::3] = dCcdCoef.dot(dCoefdXdvl[:, 0])
                            dCcdXdvl[1::3] = dCcdCoef.dot(dCoefdXdvl[:, 1])
                            dCcdXdvl[2::3] = dCcdCoef.dot(dCoefdXdvl[:, 2])
                            self.children[iChild].dXrefdXdvl[:, iDVSpanwiseLocal] += dXrefdXdvl
                            self.children[iChild].dCcdXdvl[:, iDVSpanwiseLocal] += dCcdXdvl
                        iDVSpanwiseLocal += 1
                else:
                    iDVSpanwiseLocal += self.DV_listSectionLocal[key].nVal
        else:
            Jacobian = None
        return Jacobian
def _spanwiselocalDVJacobian ( self , config = None ) : nDV = self . _getNDVSpanwiseLocalSelf ( ) 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 ) ) iDVSpanwiseLocal = self . nDVSW_count for key in self . DV_listSpanwiseLocal : dv = self . DV_listSpanwiseLocal [ key ] if dv . config is None or config is None or any ( c0 == config for c0 in dv . config ) : nVal = dv . nVal self . DV_listSpanwiseLocal [ key ] ( self . FFD . coef , config ) for j in range ( nVal ) : coefs = dv . dv_to_coefs [ j ] for coef in coefs : irow = coef * 3 + dv . axis Jacobian [ irow , iDVSpanwiseLocal ] = 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 dCoefdXdvl = np . zeros ( self . FFD . coef . shape , dtype = "d" ) for coef in coefs : dCoefdXdvl [ coef , dv . axis ] = 1.0 dXrefdXdvl = np . zeros ( ( dXrefdCoef . shape [ 0 ] * 3 ) , "d" ) dCcdXdvl = np . zeros ( ( dCcdCoef . shape [ 0 ] * 3 ) , "d" ) dXrefdXdvl [ 0 : : 3 ] = dXrefdCoef . dot ( dCoefdXdvl [ : , 0 ] ) dXrefdXdvl [ 1 : : 3 ] = dXrefdCoef . dot ( dCoefdXdvl [ : , 1 ] ) dXrefdXdvl [ 2 : : 3 ] = dXrefdCoef . dot ( dCoefdXdvl [ : , 2 ] ) dCcdXdvl [ 0 : : 3 ] = dCcdCoef . dot ( dCoefdXdvl [ : , 0 ] ) dCcdXdvl [ 1 : : 3 ] = dCcdCoef . dot ( dCoefdXdvl [ : , 1 ] ) dCcdXdvl [ 2 : : 3 ] = dCcdCoef . dot ( dCoefdXdvl [ : , 2 ] ) self . children [ iChild ] . dXrefdXdvl [ : , iDVSpanwiseLocal ] += dXrefdXdvl self . children [ iChild ] . dCcdXdvl [ : , iDVSpanwiseLocal ] += dCcdXdvl iDVSpanwiseLocal += 1 else : iDVSpanwiseLocal += 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 # check that the dv is active for this config # apply this dv to FFD # loop over value of the dv # (for example a single shape dv may have 20 values that # control the shape of the FFD at 20 points) # affected control points of FFD # this is map from dvs to coef # *3 because the jacobian has a row for each x,y,z of the FFD # It is basically # row number = coef index * n dimensions + dimension index # value of FFD node location = x0 + dv_SWLocal[j] # so partial(FFD node location)/partial(dv_SWLocal) = 1 # for each node effected by the dv_SWLocal[j] # Get derivatives of child ref axis and FFD control # points w.r.t. parent's FFD control points # derivative of Change in the FFD coef due to DVs # same as Jacobian above, but differnt ordering # TODO: the += here is to allow recursion check this with multiple nesting # levels # end if config check # end for
self
config