pygeo/parameterization/DVGeo.py
def computeTotalJacobian(self, ptSetName, config=None):
        """Return the total point jacobian in CSR format since we
        need this for TACS"""

        # Finalize the object, if not done yet
        self._finalize()
        self.curPtSet = ptSetName

        if not (self.JT[ptSetName] is None):
            return

        # compute the derivatives of the coeficients of this level wrt all of the design
        # variables at this level and all levels above
        J_temp = self.computeDVJacobian(config=config)

        # now get the derivative of the points for this level wrt the coefficients(dPtdCoef)
        if self.FFD.embededVolumes[ptSetName].dPtdCoef is not None:
            dPtdCoef = self.FFD.embededVolumes[ptSetName].dPtdCoef.tocoo()
            # We have a slight problem...dPtdCoef only has the shape
            # functions, so it size Npt x Coef. We need a matrix of
            # size 3*Npt x 3*nCoef, where each non-zero entry of
            # dPtdCoef is replaced by value * 3x3 Identity matrix.

            # Extract IJV Triplet from dPtdCoef
            row = dPtdCoef.row
            col = dPtdCoef.col
            data = dPtdCoef.data

            new_row = np.zeros(3 * len(row), "int")
            new_col = np.zeros(3 * len(row), "int")
            new_data = np.zeros(3 * len(row))

            # Loop over each entry and expand:
            for j in range(3):
                new_data[j::3] = data
                new_row[j::3] = row * 3 + j
                new_col[j::3] = col * 3 + j

            # Size of New Matrix:
            Nrow = dPtdCoef.shape[0] * 3
            Ncol = dPtdCoef.shape[1] * 3

            # Create new matrix in coo-dinate format and convert to csr
            new_dPtdCoef = sparse.coo_matrix((new_data, (new_row, new_col)), shape=(Nrow, Ncol)).tocsr()

            # Do Sparse Mat-Mat multiplication and resort indices
            if J_temp is not None:
                self.JT[ptSetName] = (J_temp.T * new_dPtdCoef.T).tocsr()
                self.JT[ptSetName].sort_indices()

            # Add in child portion
            for iChild in range(len(self.children)):

                # Reset control points on child for child link derivatives
                self.applyToChild(iChild)
                self.children[iChild].computeTotalJacobian(ptSetName, config=config)

                if self.JT[ptSetName] is not None:
                    self.JT[ptSetName] = self.JT[ptSetName] + self.children[iChild].JT[ptSetName]
                else:
                    self.JT[ptSetName] = self.children[iChild].JT[ptSetName]
        else:
            self.JT[ptSetName] = None
Return the total point jacobian in CSR format since we
        need this for TACS
Return the total point jacobian in CSR format since we
need this for TACS
Return the total point jacobian in CSR format since we need this for TACS
def computeTotalJacobian(self, ptSetName, config=None):
        self._finalize()
        self.curPtSet = ptSetName
        if not (self.JT[ptSetName] is None):
            return
        J_temp = self.computeDVJacobian(config=config)
        if self.FFD.embededVolumes[ptSetName].dPtdCoef is not None:
            dPtdCoef = self.FFD.embededVolumes[ptSetName].dPtdCoef.tocoo()
            row = dPtdCoef.row
            col = dPtdCoef.col
            data = dPtdCoef.data
            new_row = np.zeros(3 * len(row), "int")
            new_col = np.zeros(3 * len(row), "int")
            new_data = np.zeros(3 * len(row))
            for j in range(3):
                new_data[j::3] = data
                new_row[j::3] = row * 3 + j
                new_col[j::3] = col * 3 + j
            Nrow = dPtdCoef.shape[0] * 3
            Ncol = dPtdCoef.shape[1] * 3
            new_dPtdCoef = sparse.coo_matrix((new_data, (new_row, new_col)), shape=(Nrow, Ncol)).tocsr()
            if J_temp is not None:
                self.JT[ptSetName] = (J_temp.T * new_dPtdCoef.T).tocsr()
                self.JT[ptSetName].sort_indices()
            for iChild in range(len(self.children)):
                self.applyToChild(iChild)
                self.children[iChild].computeTotalJacobian(ptSetName, config=config)
                if self.JT[ptSetName] is not None:
                    self.JT[ptSetName] = self.JT[ptSetName] + self.children[iChild].JT[ptSetName]
                else:
                    self.JT[ptSetName] = self.children[iChild].JT[ptSetName]
        else:
            self.JT[ptSetName] = None
def computeTotalJacobian ( self , ptSetName , config = None ) : self . _finalize ( ) self . curPtSet = ptSetName if not ( self . JT [ ptSetName ] is None ) : return J_temp = self . computeDVJacobian ( config = config ) if self . FFD . embededVolumes [ ptSetName ] . dPtdCoef is not None : dPtdCoef = self . FFD . embededVolumes [ ptSetName ] . dPtdCoef . tocoo ( ) row = dPtdCoef . row col = dPtdCoef . col data = dPtdCoef . data new_row = np . zeros ( 3 * len ( row ) , "int" ) new_col = np . zeros ( 3 * len ( row ) , "int" ) new_data = np . zeros ( 3 * len ( row ) ) for j in range ( 3 ) : new_data [ j : : 3 ] = data new_row [ j : : 3 ] = row * 3 + j new_col [ j : : 3 ] = col * 3 + j Nrow = dPtdCoef . shape [ 0 ] * 3 Ncol = dPtdCoef . shape [ 1 ] * 3 new_dPtdCoef = sparse . coo_matrix ( ( new_data , ( new_row , new_col ) ) , shape = ( Nrow , Ncol ) ) . tocsr ( ) if J_temp is not None : self . JT [ ptSetName ] = ( J_temp . T * new_dPtdCoef . T ) . tocsr ( ) self . JT [ ptSetName ] . sort_indices ( ) for iChild in range ( len ( self . children ) ) : self . applyToChild ( iChild ) self . children [ iChild ] . computeTotalJacobian ( ptSetName , config = config ) if self . JT [ ptSetName ] is not None : self . JT [ ptSetName ] = self . JT [ ptSetName ] + self . children [ iChild ] . JT [ ptSetName ] else : self . JT [ ptSetName ] = self . children [ iChild ] . JT [ ptSetName ] else : self . JT [ ptSetName ] = None
Return the total point jacobian in CSR format since we
need this for TACS
Return the total point jacobian in CSR format since we need this for TACS
"""Return the total point jacobian in CSR format since we
        need this for TACS""" # Finalize the object, if not done yet # compute the derivatives of the coeficients of this level wrt all of the design # variables at this level and all levels above # now get the derivative of the points for this level wrt the coefficients(dPtdCoef) # We have a slight problem...dPtdCoef only has the shape # functions, so it size Npt x Coef. We need a matrix of # size 3*Npt x 3*nCoef, where each non-zero entry of # dPtdCoef is replaced by value * 3x3 Identity matrix. # Extract IJV Triplet from dPtdCoef # Loop over each entry and expand: # Size of New Matrix: # Create new matrix in coo-dinate format and convert to csr # Do Sparse Mat-Mat multiplication and resort indices # Add in child portion # Reset control points on child for child link derivatives
self
ptSetName
config