pygeo/parameterization/DVGeo.py
def addLocalDV(
        self, dvName, lower=None, upper=None, scale=1.0, axis="y", volList=None, pointSelect=None, config=None
    ):
        """
        Add one or more local design variables ot the DVGeometry
        object. Local variables are used for small shape modifications.

        Parameters
        ----------
        dvName : str
            A unique name to be given to this design variable group

        lower : float
            The lower bound for the variable(s). This will be applied to
            all shape variables

        upper : float
            The upper bound for the variable(s). This will be applied to
            all shape variables

        scale : flot
            The scaling of the variables. A good approximate scale to
            start with is approximately 1.0/(upper-lower). This gives
            variables that are of order ~1.0.

        axis : str. Default is `y`
            The coordinate directions to move. Permissible values are `x`,
            `y` and `z`. If more than one direction is required, use multiple
            calls to addLocalDV with different axis values.

        volList : list
            Use the control points on the volume indicies given in volList.
            You should use pointSelect = None, otherwise this will not work.

        pointSelect : pointSelect object. Default is None Use a
            pointSelect object to select a subset of the total number
            of control points. See the documentation for the
            pointSelect class in geo_utils. Using pointSelect discards everything in
            volList.

        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.

        Returns
        -------
        N : int
            The number of design variables added.

        Examples
        --------
        >>> # Add all variables in FFD as local shape variables
        >>> # moving in the y direction, within +/- 1.0 units
        >>> DVGeo.addLocalDV('shape_vars', lower=-1.0, upper= 1.0, axis='y')
        >>> # As above, but moving in the x and y directions.
        >>> nVar = DVGeo.addLocalDV('shape_vars_x', lower=-1.0, upper= 1.0, axis='x')
        >>> nVar = DVGeo.addLocalDV('shape_vars_y', lower=-1.0, upper= 1.0, axis='y')
        >>> # Create a point select to use: (box from (0,0,0) to (10,0,10) with
        >>> # any point projecting into the point along 'y' axis will be selected.
        >>> PS = geo_utils.PointSelect(type = 'y', pt1=[0,0,0], pt2=[10, 0, 10])
        >>> nVar = DVGeo.addLocalDV('shape_vars', lower=-1.0, upper=1.0, pointSelect=PS)
        """
        if self.name is not None:
            dvName = self.name + "_" + dvName

        if isinstance(config, str):
            config = [config]

        if pointSelect is not None:
            if pointSelect.type != "ijkBounds":
                pts, ind = pointSelect.getPoints(self.FFD.coef)
            else:
                pts, ind = pointSelect.getPoints_ijk(self)
        elif volList is not None:
            if self.FFD.symmPlane is not None:
                volListTmp = []
                for vol in volList:
                    volListTmp.append(vol)
                for vol in volList:
                    volListTmp.append(vol + self.FFD.nVol / 2)
                volList = volListTmp

            volList = np.atleast_1d(volList).astype("int")
            ind = []
            for iVol in volList:
                ind.extend(self.FFD.topo.lIndex[iVol].flatten())
            ind = geo_utils.unique(ind)
        else:
            # Just take'em all
            ind = np.arange(len(self.FFD.coef))

        self.DV_listLocal[dvName] = geoDVLocal(dvName, lower, upper, scale, axis, ind, self.masks, config)

        return self.DV_listLocal[dvName].nVal

        Add one or more local design variables ot the DVGeometry
        object. Local variables are used for small shape modifications.

        Parameters
        ----------
        dvName : str
            A unique name to be given to this design variable group

        lower : float
            The lower bound for the variable(s). This will be applied to
            all shape variables

        upper : float
            The upper bound for the variable(s). This will be applied to
            all shape variables

        scale : flot
            The scaling of the variables. A good approximate scale to
            start with is approximately 1.0/(upper-lower). This gives
            variables that are of order ~1.0.

        axis : str. Default is `y`
            The coordinate directions to move. Permissible values are `x`,
            `y` and `z`. If more than one direction is required, use multiple
            calls to addLocalDV with different axis values.

        volList : list
            Use the control points on the volume indicies given in volList.
            You should use pointSelect = None, otherwise this will not work.

        pointSelect : pointSelect object. Default is None Use a
            pointSelect object to select a subset of the total number
            of control points. See the documentation for the
            pointSelect class in geo_utils. Using pointSelect discards everything in
            volList.

        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.

        Returns
        -------
        N : int
            The number of design variables added.

        Examples
        --------
        >>> # Add all variables in FFD as local shape variables
        >>> # moving in the y direction, within +/- 1.0 units
        >>> DVGeo.addLocalDV('shape_vars', lower=-1.0, upper= 1.0, axis='y')
        >>> # As above, but moving in the x and y directions.
        >>> nVar = DVGeo.addLocalDV('shape_vars_x', lower=-1.0, upper= 1.0, axis='x')
        >>> nVar = DVGeo.addLocalDV('shape_vars_y', lower=-1.0, upper= 1.0, axis='y')
        >>> # Create a point select to use: (box from (0,0,0) to (10,0,10) with
        >>> # any point projecting into the point along 'y' axis will be selected.
        >>> PS = geo_utils.PointSelect(type = 'y', pt1=[0,0,0], pt2=[10, 0, 10])
        >>> nVar = DVGeo.addLocalDV('shape_vars', lower=-1.0, upper=1.0, pointSelect=PS)
        
Add one or more local design variables ot the DVGeometry
object. Local variables are used for small shape modifications.

Parameters

dvName : str
A unique name to be given to this design variable group

lower : float
The lower bound for the variable(s). This will be applied to
all shape variables

upper : float
The upper bound for the variable(s). This will be applied to
all shape variables

scale : flot
The scaling of the variables. A good approximate scale to
start with is approximately 1.0/(upper-lower). This gives
variables that are of order ~1.0.

axis : str. Default is `y`
The coordinate directions to move.

volList : list
Use the control points on the volume indicies given in volList.
You should use pointSelect = None, otherwise this will not work.

pointSelect : pointSelect object. Default is None Use a
pointSelect object to select a subset of the total number
of control points. See the documentation for the
pointSelect class in geo_utils. Using pointSelect discards everything in
volList.

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.

Returns

N : int
The number of design variables added.

Examples


Add one or more local design variables ot the DVGeometry object . Local variables are used for small shape modifications . Parameters dvName : str A unique name to be given to this design variable group lower : float The lower bound for the variable ( s ) . This will be applied to all shape variables upper : float The upper bound for the variable ( s ) . This will be applied to all shape variables scale : flot The scaling of the variables . A good approximate scale to start with is approximately 1 . 0 / ( upper - lower ) . This gives variables that are of order ~1 . 0 . axis : str . Default is ` y ` The coordinate directions to move . volList : list Use the control points on the volume indicies given in volList . You should use pointSelect = None otherwise this will not work . pointSelect : pointSelect object . Default is None Use a pointSelect object to select a subset of the total number of control points . See the documentation for the pointSelect class in geo_utils . Using pointSelect discards everything in volList . 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 . Returns N : int The number of design variables added . Examples
def addLocalDV(
        self, dvName, lower=None, upper=None, scale=1.0, axis="y", volList=None, pointSelect=None, config=None
    ):
        if self.name is not None:
            dvName = self.name + "_" + dvName
        if isinstance(config, str):
            config = [config]
        if pointSelect is not None:
            if pointSelect.type != "ijkBounds":
                pts, ind = pointSelect.getPoints(self.FFD.coef)
            else:
                pts, ind = pointSelect.getPoints_ijk(self)
        elif volList is not None:
            if self.FFD.symmPlane is not None:
                volListTmp = []
                for vol in volList:
                    volListTmp.append(vol)
                for vol in volList:
                    volListTmp.append(vol + self.FFD.nVol / 2)
                volList = volListTmp
            volList = np.atleast_1d(volList).astype("int")
            ind = []
            for iVol in volList:
                ind.extend(self.FFD.topo.lIndex[iVol].flatten())
            ind = geo_utils.unique(ind)
        else:
            ind = np.arange(len(self.FFD.coef))
        self.DV_listLocal[dvName] = geoDVLocal(dvName, lower, upper, scale, axis, ind, self.masks, config)
        return self.DV_listLocal[dvName].nVal
def addLocalDV ( self , dvName , lower = None , upper = None , scale = 1.0 , axis = "y" , volList = None , pointSelect = None , config = None ) : if self . name is not None : dvName = self . name + "_" + dvName if isinstance ( config , str ) : config = [ config ] if pointSelect is not None : if pointSelect . type != "ijkBounds" : pts , ind = pointSelect . getPoints ( self . FFD . coef ) else : pts , ind = pointSelect . getPoints_ijk ( self ) elif volList is not None : if self . FFD . symmPlane is not None : volListTmp = [ ] for vol in volList : volListTmp . append ( vol ) for vol in volList : volListTmp . append ( vol + self . FFD . nVol / 2 ) volList = volListTmp volList = np . atleast_1d ( volList ) . astype ( "int" ) ind = [ ] for iVol in volList : ind . extend ( self . FFD . topo . lIndex [ iVol ] . flatten ( ) ) ind = geo_utils . unique ( ind ) else : ind = np . arange ( len ( self . FFD . coef ) ) self . DV_listLocal [ dvName ] = geoDVLocal ( dvName , lower , upper , scale , axis , ind , self . masks , config ) return self . DV_listLocal [ dvName ] . nVal
Add one or more local design variables ot the DVGeometry
object.
Add one or more local design variables ot the DVGeometry object .
"""
        Add one or more local design variables ot the DVGeometry
        object. Local variables are used for small shape modifications.

        Parameters
        ----------
        dvName : str
            A unique name to be given to this design variable group

        lower : float
            The lower bound for the variable(s). This will be applied to
            all shape variables

        upper : float
            The upper bound for the variable(s). This will be applied to
            all shape variables

        scale : flot
            The scaling of the variables. A good approximate scale to
            start with is approximately 1.0/(upper-lower). This gives
            variables that are of order ~1.0.

        axis : str. Default is `y`
            The coordinate directions to move. Permissible values are `x`,
            `y` and `z`. If more than one direction is required, use multiple
            calls to addLocalDV with different axis values.

        volList : list
            Use the control points on the volume indicies given in volList.
            You should use pointSelect = None, otherwise this will not work.

        pointSelect : pointSelect object. Default is None Use a
            pointSelect object to select a subset of the total number
            of control points. See the documentation for the
            pointSelect class in geo_utils. Using pointSelect discards everything in
            volList.

        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.

        Returns
        -------
        N : int
            The number of design variables added.

        Examples
        --------
        >>> # Add all variables in FFD as local shape variables
        >>> # moving in the y direction, within +/- 1.0 units
        >>> DVGeo.addLocalDV('shape_vars', lower=-1.0, upper= 1.0, axis='y')
        >>> # As above, but moving in the x and y directions.
        >>> nVar = DVGeo.addLocalDV('shape_vars_x', lower=-1.0, upper= 1.0, axis='x')
        >>> nVar = DVGeo.addLocalDV('shape_vars_y', lower=-1.0, upper= 1.0, axis='y')
        >>> # Create a point select to use: (box from (0,0,0) to (10,0,10) with
        >>> # any point projecting into the point along 'y' axis will be selected.
        >>> PS = geo_utils.PointSelect(type = 'y', pt1=[0,0,0], pt2=[10, 0, 10])
        >>> nVar = DVGeo.addLocalDV('shape_vars', lower=-1.0, upper=1.0, pointSelect=PS)
        """ # Just take'em all
self
dvName
lower
upper
scale
axis
volList
pointSelect
config