pygeo/parameterization/DVGeo.py
def update(self, ptSetName, childDelta=True, config=None):
        """
        This is the main routine for returning coordinates that have
        been updated by design variables.

        Parameters
        ----------
        ptSetName : str
            Name of point-set to return. This must match ones of the
            given in an :func:`addPointSet()` call.

        childDelta : bool
            Return updates on child as a delta. The user should not
            need to ever change this parameter.

        config : str or list
            Define what configurations this design variable will be applied to
            Use a string for a single configuration or a list for multiple
            configurations. The default value of None implies that the design
            variable appies to *ALL* configurations.

        """
        self.curPtSet = ptSetName
        # We've postponed things as long as we can...do the finialization.
        self._finalize()

        # Make sure coefficients are complex
        self._complexifyCoef()

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

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

            if self.complex:
                # 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:
            if self.complex:
                new_pts = np.zeros((self.nPtAttach, 3), "D")
            else:
                new_pts = np.zeros((self.nPtAttach, 3), "d")

            # Apply the global design variables
            self.updateCalculations(new_pts, isComplex=self.complex, config=config)

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

        # Now add in the spanwise local DVs
        for key in self.DV_listSpanwiseLocal:
            self.DV_listSpanwiseLocal[key](self.FFD.coef, config)

        # Now add in the section local DVs
        for key in self.DV_listSectionLocal:
            self.DV_listSectionLocal[key](self.FFD.coef, self.coefRotM, config)

        # Now add in the local DVs
        for key in self.DV_listLocal:
            self.DV_listLocal[key](self.FFD.coef, config)

        # Update all coef
        self.FFD._updateVolumeCoef()

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

        # Propagate the complex part through the volume artificially
        if self.complex:
            # Above, we only took the real part of the coef because
            # _updateVolumeCoef gets rid of it anyway. Here, we need to include
            # the complex part because we want to propagate it through
            tempCoef = self.FFD.coef.copy().astype("D")
            if len(self.axis) > 0:
                np.put(tempCoef[:, 0], self.ptAttachInd, new_pts[:, 0])
                np.put(tempCoef[:, 1], self.ptAttachInd, new_pts[:, 1])
                np.put(tempCoef[:, 2], self.ptAttachInd, new_pts[:, 2])

            # Apply just the complex part of the local varibales
            for key in self.DV_listSpanwiseLocal:
                self.DV_listSpanwiseLocal[key].updateComplex(tempCoef, config)
            for key in self.DV_listSectionLocal:
                self.DV_listSectionLocal[key].updateComplex(tempCoef, self.coefRotM, config)
            for key in self.DV_listLocal:
                self.DV_listLocal[key].updateComplex(tempCoef, config)

            Xfinal = Xfinal.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):
                    Xfinal[:, ii] += imag_j * dPtdCoef.dot(imag_part[:, ii])

        # Now loop over the children set the FFD and refAxis control
        # points as evaluated from the parent
        for iChild in range(len(self.children)):
            child = self.children[iChild]
            child._finalize()
            self.applyToChild(iChild)

            if self.complex:
                # need to propagate the sensitivity to the children Xfinal here to do this
                # correctly
                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(ptSetName, childDelta=True, config=config)

        self._unComplexifyCoef()

        # Finally flag this pointSet as being up to date:
        self.updated[ptSetName] = True

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

        This is the main routine for returning coordinates that have
        been updated by design variables.

        Parameters
        ----------
        ptSetName : str
            Name of point-set to return. This must match ones of the
            given in an :func:`addPointSet()` call.

        childDelta : bool
            Return updates on child as a delta. The user should not
            need to ever change this parameter.

        config : str or list
            Define what configurations this design variable will be applied to
            Use a string for a single configuration or a list for multiple
            configurations. The default value of None implies that the design
            variable appies to *ALL* configurations.

        
This is the main routine for returning coordinates that have
been updated by design variables.

Parameters

ptSetName : str
Name of point-set to return. This must match ones of the
given in an :func:`addPointSet()` call.

childDelta : bool
Return updates on child as a delta. The user should not
need to ever change this parameter.

config : str or list
Define what configurations this design variable will be applied to
Use a string for a single configuration or a list for multiple
configurations. The default value of None implies that the design
variable appies to *ALL* configurations.
This is the main routine for returning coordinates that have been updated by design variables . Parameters ptSetName : str Name of point - set to return . This must match ones of the given in an : func : ` addPointSet () ` call . childDelta : bool Return updates on child as a delta . The user should not need to ever change this parameter . config : str or list Define what configurations this design variable will be applied to Use a string for a single configuration or a list for multiple configurations . The default value of None implies that the design variable appies to * ALL * configurations .
def update(self, ptSetName, childDelta=True, config=None):
        self.curPtSet = ptSetName
        self._finalize()
        self._complexifyCoef()
        if not self.isChild:
            self.FFD.coef = self.origFFDCoef.copy()
            self._setInitialValues()
        else:
            self.FFD._updateVolumeCoef()
            Xstart = self.FFD.getAttachedPoints(ptSetName)
            if self.complex:
                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:
            if self.complex:
                new_pts = np.zeros((self.nPtAttach, 3), "D")
            else:
                new_pts = np.zeros((self.nPtAttach, 3), "d")
            self.updateCalculations(new_pts, isComplex=self.complex, config=config)
            temp = np.real(new_pts)
            np.put(self.FFD.coef[:, 0], self.ptAttachInd, temp[:, 0])
            np.put(self.FFD.coef[:, 1], self.ptAttachInd, temp[:, 1])
            np.put(self.FFD.coef[:, 2], self.ptAttachInd, temp[:, 2])
        for key in self.DV_listSpanwiseLocal:
            self.DV_listSpanwiseLocal[key](self.FFD.coef, config)
        for key in self.DV_listSectionLocal:
            self.DV_listSectionLocal[key](self.FFD.coef, self.coefRotM, config)
        for key in self.DV_listLocal:
            self.DV_listLocal[key](self.FFD.coef, config)
        self.FFD._updateVolumeCoef()
        Xfinal = self.FFD.getAttachedPoints(ptSetName)
        if self.complex:
            tempCoef = self.FFD.coef.copy().astype("D")
            if len(self.axis) > 0:
                np.put(tempCoef[:, 0], self.ptAttachInd, new_pts[:, 0])
                np.put(tempCoef[:, 1], self.ptAttachInd, new_pts[:, 1])
                np.put(tempCoef[:, 2], self.ptAttachInd, new_pts[:, 2])
            for key in self.DV_listSpanwiseLocal:
                self.DV_listSpanwiseLocal[key].updateComplex(tempCoef, config)
            for key in self.DV_listSectionLocal:
                self.DV_listSectionLocal[key].updateComplex(tempCoef, self.coefRotM, config)
            for key in self.DV_listLocal:
                self.DV_listLocal[key].updateComplex(tempCoef, config)
            Xfinal = Xfinal.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):
                    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)
            if self.complex:
                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(ptSetName, childDelta=True, config=config)
        self._unComplexifyCoef()
        self.updated[ptSetName] = True
        if self.isChild and childDelta:
            return Xfinal - Xstart
        else:
            return Xfinal
def update ( self , ptSetName , childDelta = True , config = None ) : self . curPtSet = ptSetName self . _finalize ( ) self . _complexifyCoef ( ) if not self . isChild : self . FFD . coef = self . origFFDCoef . copy ( ) self . _setInitialValues ( ) else : self . FFD . _updateVolumeCoef ( ) Xstart = self . FFD . getAttachedPoints ( ptSetName ) if self . complex : 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 : if self . complex : new_pts = np . zeros ( ( self . nPtAttach , 3 ) , "D" ) else : new_pts = np . zeros ( ( self . nPtAttach , 3 ) , "d" ) self . updateCalculations ( new_pts , isComplex = self . complex , config = config ) temp = np . real ( new_pts ) np . put ( self . FFD . coef [ : , 0 ] , self . ptAttachInd , temp [ : , 0 ] ) np . put ( self . FFD . coef [ : , 1 ] , self . ptAttachInd , temp [ : , 1 ] ) np . put ( self . FFD . coef [ : , 2 ] , self . ptAttachInd , temp [ : , 2 ] ) for key in self . DV_listSpanwiseLocal : self . DV_listSpanwiseLocal [ key ] ( self . FFD . coef , config ) for key in self . DV_listSectionLocal : self . DV_listSectionLocal [ key ] ( self . FFD . coef , self . coefRotM , config ) for key in self . DV_listLocal : self . DV_listLocal [ key ] ( self . FFD . coef , config ) self . FFD . _updateVolumeCoef ( ) Xfinal = self . FFD . getAttachedPoints ( ptSetName ) if self . complex : tempCoef = self . FFD . coef . copy ( ) . astype ( "D" ) if len ( self . axis ) > 0 : np . put ( tempCoef [ : , 0 ] , self . ptAttachInd , new_pts [ : , 0 ] ) np . put ( tempCoef [ : , 1 ] , self . ptAttachInd , new_pts [ : , 1 ] ) np . put ( tempCoef [ : , 2 ] , self . ptAttachInd , new_pts [ : , 2 ] ) for key in self . DV_listSpanwiseLocal : self . DV_listSpanwiseLocal [ key ] . updateComplex ( tempCoef , config ) for key in self . DV_listSectionLocal : self . DV_listSectionLocal [ key ] . updateComplex ( tempCoef , self . coefRotM , config ) for key in self . DV_listLocal : self . DV_listLocal [ key ] . updateComplex ( tempCoef , config ) Xfinal = Xfinal . 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 ) : 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 ) if self . complex : 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 ( ptSetName , childDelta = True , config = config ) self . _unComplexifyCoef ( ) self . updated [ ptSetName ] = True if self . isChild and childDelta : return Xfinal - Xstart else : return Xfinal
This is the main routine for returning coordinates that have
been updated by design variables.
This is the main routine for returning coordinates that have been updated by design variables .
"""
        This is the main routine for returning coordinates that have
        been updated by design variables.

        Parameters
        ----------
        ptSetName : str
            Name of point-set to return. This must match ones of the
            given in an :func:`addPointSet()` call.

        childDelta : bool
            Return updates on child as a delta. The user should not
            need to ever change this parameter.

        config : str or list
            Define what configurations this design variable will be applied to
            Use a string for a single configuration or a list for multiple
            configurations. The default value of None implies that the design
            variable appies to *ALL* configurations.

        """ # We've postponed things as long as we can...do the finialization. # 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: # Apply the global design variables # Put the update FFD points in their proper place # Now add in the spanwise local DVs # Now add in the section local DVs # Now add in the local DVs # Update all coef # Evaluate coordinates from the parent # Propagate the complex part through the volume artificially # Above, we only took the real part of the coef because # _updateVolumeCoef gets rid of it anyway. Here, we need to include # the complex part because we want to propagate it through # Apply just the complex part of the local varibales # Now loop over the children set the FFD and refAxis control # points as evaluated from the parent # need to propagate the sensitivity to the children Xfinal here to do this # correctly # Finally flag this pointSet as being up to date:
self
ptSetName
childDelta
config