pygeo/parameterization/DVGeo.py
def _update_deriv_cs(self, ptSetName, config=None):

        """
        A version of the update_deriv function specifically for use
        in the computeTotalJacobianCS function."""
        new_pts = np.zeros((self.nPtAttachFull, 3), "D")

        # Make sure coefficients are complex
        self._complexifyCoef()

        # Set all coef Values back to initial values
        if not self.isChild:
            self.FFD.coef = self.FFD.coef.astype("D")
            self._setInitialValues()
        else:
            # Update all coef
            self.FFD.coef = self.FFD.coef.astype("D")
            self.FFD._updateVolumeCoef()

            # Evaluate starting pointset
            Xstart = self.FFD.getAttachedPoints(ptSetName)

            # Now we have to propagate the complex part through Xstart
            tempCoef = self.FFD.coef.copy().astype("D")
            Xstart = Xstart.astype("D")
            imag_part = np.imag(tempCoef)
            imag_j = 1j

            dPtdCoef = self.FFD.embededVolumes[ptSetName].dPtdCoef
            if dPtdCoef is not None:
                for ii in range(3):
                    Xstart[:, ii] += imag_j * dPtdCoef.dot(imag_part[:, ii])

        # Step 1: Call all the design variables IFF we have ref axis:
        if len(self.axis) > 0:

            # Compute changes due to global design vars
            self.updateCalculations(new_pts, isComplex=True, config=config)

            # Put the update FFD points in their proper place
            np.put(self.FFD.coef[:, 0], self.ptAttachInd, new_pts[:, 0])
            np.put(self.FFD.coef[:, 1], self.ptAttachInd, new_pts[:, 1])
            np.put(self.FFD.coef[:, 2], self.ptAttachInd, new_pts[:, 2])

        # Apply the real and complex parts separately
        for key in self.DV_listSpanwiseLocal:
            self.DV_listSpanwiseLocal[key](self.FFD.coef, self.coefRotM, config)
            self.DV_listSpanwiseLocal[key].updateComplex(self.FFD.coef, self.coefRotM, config)

        for key in self.DV_listSectionLocal:
            self.DV_listSectionLocal[key](self.FFD.coef, self.coefRotM, config)
            self.DV_listSectionLocal[key].updateComplex(self.FFD.coef, self.coefRotM, config)

        for key in self.DV_listLocal:
            self.DV_listLocal[key](self.FFD.coef, config)
            self.DV_listLocal[key].updateComplex(self.FFD.coef, config)

        # Update all coef
        self.FFD._updateVolumeCoef()

        # Evaluate coordinates from the parent
        Xfinal = self.FFD.getAttachedPoints(ptSetName)

        # now project derivs through from the coef to the pts
        Xfinal = Xfinal.astype("D")
        imag_part = np.imag(self.FFD.coef)
        imag_j = 1j

        dPtdCoef = self.FFD.embededVolumes[ptSetName].dPtdCoef
        if dPtdCoef is not None:
            for ii in range(3):
                Xfinal[:, ii] += imag_j * dPtdCoef.dot(imag_part[:, ii])

        # now do the same for the children
        for iChild in range(len(self.children)):
            # first, update the coef. to their new locations
            child = self.children[iChild]
            child._finalize()
            self.applyToChild(iChild)

            # now cast forward the complex part of the derivative
            child._complexifyCoef()
            child.FFD.coef = child.FFD.coef.astype("D")

            dXrefdCoef = self.FFD.embededVolumes["child%d_axis" % (iChild)].dPtdCoef
            dCcdCoef = self.FFD.embededVolumes["child%d_coef" % (iChild)].dPtdCoef

            if dXrefdCoef is not None:
                for ii in range(3):
                    child.coef[:, ii] += imag_j * dXrefdCoef.dot(imag_part[:, ii])

            if dCcdCoef is not None:
                for ii in range(3):
                    child.FFD.coef[:, ii] += imag_j * dCcdCoef.dot(imag_part[:, ii])
            child.refAxis.coef = child.coef.copy()
            child.refAxis._updateCurveCoef()
            Xfinal += child._update_deriv_cs(ptSetName, config=config)
            child._unComplexifyCoef()

        self.FFD.coef = self.FFD.coef.real.astype("d")

        if self.isChild:
            return Xfinal - Xstart
        else:
            return Xfinal

        A version of the update_deriv function specifically for use
        in the computeTotalJacobianCS function.
A version of the update_deriv function specifically for use
in the computeTotalJacobianCS function.
A version of the update_deriv function specifically for use in the computeTotalJacobianCS function .
def _update_deriv_cs(self, ptSetName, config=None):
        new_pts = np.zeros((self.nPtAttachFull, 3), "D")
        self._complexifyCoef()
        if not self.isChild:
            self.FFD.coef = self.FFD.coef.astype("D")
            self._setInitialValues()
        else:
            self.FFD.coef = self.FFD.coef.astype("D")
            self.FFD._updateVolumeCoef()
            Xstart = self.FFD.getAttachedPoints(ptSetName)
            tempCoef = self.FFD.coef.copy().astype("D")
            Xstart = Xstart.astype("D")
            imag_part = np.imag(tempCoef)
            imag_j = 1j
            dPtdCoef = self.FFD.embededVolumes[ptSetName].dPtdCoef
            if dPtdCoef is not None:
                for ii in range(3):
                    Xstart[:, ii] += imag_j * dPtdCoef.dot(imag_part[:, ii])
        if len(self.axis) > 0:
            self.updateCalculations(new_pts, isComplex=True, config=config)
            np.put(self.FFD.coef[:, 0], self.ptAttachInd, new_pts[:, 0])
            np.put(self.FFD.coef[:, 1], self.ptAttachInd, new_pts[:, 1])
            np.put(self.FFD.coef[:, 2], self.ptAttachInd, new_pts[:, 2])
        for key in self.DV_listSpanwiseLocal:
            self.DV_listSpanwiseLocal[key](self.FFD.coef, self.coefRotM, config)
            self.DV_listSpanwiseLocal[key].updateComplex(self.FFD.coef, self.coefRotM, config)
        for key in self.DV_listSectionLocal:
            self.DV_listSectionLocal[key](self.FFD.coef, self.coefRotM, config)
            self.DV_listSectionLocal[key].updateComplex(self.FFD.coef, self.coefRotM, config)
        for key in self.DV_listLocal:
            self.DV_listLocal[key](self.FFD.coef, config)
            self.DV_listLocal[key].updateComplex(self.FFD.coef, config)
        self.FFD._updateVolumeCoef()
        Xfinal = self.FFD.getAttachedPoints(ptSetName)
        Xfinal = Xfinal.astype("D")
        imag_part = np.imag(self.FFD.coef)
        imag_j = 1j
        dPtdCoef = self.FFD.embededVolumes[ptSetName].dPtdCoef
        if dPtdCoef is not None:
            for ii in range(3):
                Xfinal[:, ii] += imag_j * dPtdCoef.dot(imag_part[:, ii])
        for iChild in range(len(self.children)):
            child = self.children[iChild]
            child._finalize()
            self.applyToChild(iChild)
            child._complexifyCoef()
            child.FFD.coef = child.FFD.coef.astype("D")
            dXrefdCoef = self.FFD.embededVolumes["child%d_axis" % (iChild)].dPtdCoef
            dCcdCoef = self.FFD.embededVolumes["child%d_coef" % (iChild)].dPtdCoef
            if dXrefdCoef is not None:
                for ii in range(3):
                    child.coef[:, ii] += imag_j * dXrefdCoef.dot(imag_part[:, ii])
            if dCcdCoef is not None:
                for ii in range(3):
                    child.FFD.coef[:, ii] += imag_j * dCcdCoef.dot(imag_part[:, ii])
            child.refAxis.coef = child.coef.copy()
            child.refAxis._updateCurveCoef()
            Xfinal += child._update_deriv_cs(ptSetName, config=config)
            child._unComplexifyCoef()
        self.FFD.coef = self.FFD.coef.real.astype("d")
        if self.isChild:
            return Xfinal - Xstart
        else:
            return Xfinal
def _update_deriv_cs ( self , ptSetName , config = None ) : new_pts = np . zeros ( ( self . nPtAttachFull , 3 ) , "D" ) self . _complexifyCoef ( ) if not self . isChild : self . FFD . coef = self . FFD . coef . astype ( "D" ) self . _setInitialValues ( ) else : self . FFD . coef = self . FFD . coef . astype ( "D" ) self . FFD . _updateVolumeCoef ( ) Xstart = self . FFD . getAttachedPoints ( ptSetName ) tempCoef = self . FFD . coef . copy ( ) . astype ( "D" ) Xstart = Xstart . astype ( "D" ) imag_part = np . imag ( tempCoef ) imag_j = 1j dPtdCoef = self . FFD . embededVolumes [ ptSetName ] . dPtdCoef if dPtdCoef is not None : for ii in range ( 3 ) : Xstart [ : , ii ] += imag_j * dPtdCoef . dot ( imag_part [ : , ii ] ) if len ( self . axis ) > 0 : self . updateCalculations ( new_pts , isComplex = True , config = config ) np . put ( self . FFD . coef [ : , 0 ] , self . ptAttachInd , new_pts [ : , 0 ] ) np . put ( self . FFD . coef [ : , 1 ] , self . ptAttachInd , new_pts [ : , 1 ] ) np . put ( self . FFD . coef [ : , 2 ] , self . ptAttachInd , new_pts [ : , 2 ] ) for key in self . DV_listSpanwiseLocal : self . DV_listSpanwiseLocal [ key ] ( self . FFD . coef , self . coefRotM , config ) self . DV_listSpanwiseLocal [ key ] . updateComplex ( self . FFD . coef , self . coefRotM , config ) for key in self . DV_listSectionLocal : self . DV_listSectionLocal [ key ] ( self . FFD . coef , self . coefRotM , config ) self . DV_listSectionLocal [ key ] . updateComplex ( self . FFD . coef , self . coefRotM , config ) for key in self . DV_listLocal : self . DV_listLocal [ key ] ( self . FFD . coef , config ) self . DV_listLocal [ key ] . updateComplex ( self . FFD . coef , config ) self . FFD . _updateVolumeCoef ( ) Xfinal = self . FFD . getAttachedPoints ( ptSetName ) Xfinal = Xfinal . astype ( "D" ) imag_part = np . imag ( self . FFD . coef ) imag_j = 1j dPtdCoef = self . FFD . embededVolumes [ ptSetName ] . dPtdCoef if dPtdCoef is not None : for ii in range ( 3 ) : Xfinal [ : , ii ] += imag_j * dPtdCoef . dot ( imag_part [ : , ii ] ) for iChild in range ( len ( self . children ) ) : child = self . children [ iChild ] child . _finalize ( ) self . applyToChild ( iChild ) child . _complexifyCoef ( ) child . FFD . coef = child . FFD . coef . astype ( "D" ) dXrefdCoef = self . FFD . embededVolumes [ "child%d_axis" % ( iChild ) ] . dPtdCoef dCcdCoef = self . FFD . embededVolumes [ "child%d_coef" % ( iChild ) ] . dPtdCoef if dXrefdCoef is not None : for ii in range ( 3 ) : child . coef [ : , ii ] += imag_j * dXrefdCoef . dot ( imag_part [ : , ii ] ) if dCcdCoef is not None : for ii in range ( 3 ) : child . FFD . coef [ : , ii ] += imag_j * dCcdCoef . dot ( imag_part [ : , ii ] ) child . refAxis . coef = child . coef . copy ( ) child . refAxis . _updateCurveCoef ( ) Xfinal += child . _update_deriv_cs ( ptSetName , config = config ) child . _unComplexifyCoef ( ) self . FFD . coef = self . FFD . coef . real . astype ( "d" ) if self . isChild : return Xfinal - Xstart else : return Xfinal
A version of the update_deriv function specifically for use
in the computeTotalJacobianCS function.
A version of the update_deriv function specifically for use in the computeTotalJacobianCS function .
"""
        A version of the update_deriv function specifically for use
        in the computeTotalJacobianCS function.""" # Make sure coefficients are complex # Set all coef Values back to initial values # Update all coef # Evaluate starting pointset # Now we have to propagate the complex part through Xstart # Step 1: Call all the design variables IFF we have ref axis: # Compute changes due to global design vars # Put the update FFD points in their proper place # Apply the real and complex parts separately # Update all coef # Evaluate coordinates from the parent # now project derivs through from the coef to the pts # now do the same for the children # first, update the coef. to their new locations # now cast forward the complex part of the derivative
self
ptSetName
config