pygeo/parameterization/DVGeo.py
def addVariablesPyOpt(
        self,
        optProb,
        globalVars=True,
        localVars=True,
        sectionlocalVars=True,
        spanwiselocalVars=True,
        ignoreVars=None,
        freezeVars=None,
    ):
        """
        Add the current set of variables to the optProb object.

        Parameters
        ----------
        optProb : pyOpt_optimization class
            Optimization problem definition to which variables are added

        globalVars : bool
            Flag specifying whether global variables are to be added

        localVars : bool
            Flag specifying whether local variables are to be added

        sectionlocalVars : bool
            Flag specifying whether section local variables are to be added

        spanwiselocalVars : bool
            Flag specifying whether spanwiselocal variables are to be added

        ignoreVars : list of strings
            List of design variables the user DOESN'T want to use
            as optimization variables.

        freezeVars : list of string
            List of design variables the user WANTS to add as optimization
            variables, but to have the lower and upper bounds set at the current
            variable. This effectively eliminates the variable, but it the variable
            is still part of the optimization.
        """
        if ignoreVars is None:
            ignoreVars = set()
        if freezeVars is None:
            freezeVars = set()

        # Add design variables from the master:
        varLists = OrderedDict(
            [
                ("globalVars", self.DV_listGlobal),
                ("localVars", self.DV_listLocal),
                ("sectionlocalVars", self.DV_listSectionLocal),
                ("spanwiselocalVars", self.DV_listSpanwiseLocal),
            ]
        )
        for lst in varLists:
            if (
                lst == "globalVars"
                and globalVars
                or lst == "localVars"
                and localVars
                or lst == "sectionlocalVars"
                and sectionlocalVars
                or lst == "spanwiselocalVars"
                and spanwiselocalVars
            ):
                for key in varLists[lst]:
                    if key not in ignoreVars:
                        dv = varLists[lst][key]
                        if key not in freezeVars:
                            optProb.addVarGroup(
                                dv.name, dv.nVal, "c", value=dv.value, lower=dv.lower, upper=dv.upper, scale=dv.scale
                            )
                        else:
                            optProb.addVarGroup(
                                dv.name, dv.nVal, "c", value=dv.value, lower=dv.value, upper=dv.value, scale=dv.scale
                            )

        # Add variables from the children
        for child in self.children:
            child.addVariablesPyOpt(
                optProb, globalVars, localVars, sectionlocalVars, spanwiselocalVars, ignoreVars, freezeVars
            )

        Add the current set of variables to the optProb object.

        Parameters
        ----------
        optProb : pyOpt_optimization class
            Optimization problem definition to which variables are added

        globalVars : bool
            Flag specifying whether global variables are to be added

        localVars : bool
            Flag specifying whether local variables are to be added

        sectionlocalVars : bool
            Flag specifying whether section local variables are to be added

        spanwiselocalVars : bool
            Flag specifying whether spanwiselocal variables are to be added

        ignoreVars : list of strings
            List of design variables the user DOESN'T want to use
            as optimization variables.

        freezeVars : list of string
            List of design variables the user WANTS to add as optimization
            variables, but to have the lower and upper bounds set at the current
            variable. This effectively eliminates the variable, but it the variable
            is still part of the optimization.
        
Add the current set of variables to the optProb object.
Parameters

optProb : pyOpt_optimization class
Optimization problem definition to which variables are added

globalVars : bool
Flag specifying whether global variables are to be added

localVars : bool
Flag specifying whether local variables are to be added

sectionlocalVars : bool
Flag specifying whether section local variables are to be added

spanwiselocalVars : bool
Flag specifying whether spanwiselocal variables are to be added

ignoreVars : list of strings
List of design variables the user DOESN'T want to use
as optimization variables.

freezeVars : list of string
List of design variables the user WANTS to add as optimization
variables, but to have the lower and upper bounds set at the current
variable. This effectively eliminates the variable, but it the variable
is still part of the optimization.
Add the current set of variables to the optProb object . Parameters optProb : pyOpt_optimization class Optimization problem definition to which variables are added globalVars : bool Flag specifying whether global variables are to be added localVars : bool Flag specifying whether local variables are to be added sectionlocalVars : bool Flag specifying whether section local variables are to be added spanwiselocalVars : bool Flag specifying whether spanwiselocal variables are to be added ignoreVars : list of strings List of design variables the user DOESN ' T want to use as optimization variables . freezeVars : list of string List of design variables the user WANTS to add as optimization variables but to have the lower and upper bounds set at the current variable . This effectively eliminates the variable but it the variable is still part of the optimization .
def addVariablesPyOpt(
        self,
        optProb,
        globalVars=True,
        localVars=True,
        sectionlocalVars=True,
        spanwiselocalVars=True,
        ignoreVars=None,
        freezeVars=None,
    ):
        if ignoreVars is None:
            ignoreVars = set()
        if freezeVars is None:
            freezeVars = set()
        varLists = OrderedDict(
            [
                ("globalVars", self.DV_listGlobal),
                ("localVars", self.DV_listLocal),
                ("sectionlocalVars", self.DV_listSectionLocal),
                ("spanwiselocalVars", self.DV_listSpanwiseLocal),
            ]
        )
        for lst in varLists:
            if (
                lst == "globalVars"
                and globalVars
                or lst == "localVars"
                and localVars
                or lst == "sectionlocalVars"
                and sectionlocalVars
                or lst == "spanwiselocalVars"
                and spanwiselocalVars
            ):
                for key in varLists[lst]:
                    if key not in ignoreVars:
                        dv = varLists[lst][key]
                        if key not in freezeVars:
                            optProb.addVarGroup(
                                dv.name, dv.nVal, "c", value=dv.value, lower=dv.lower, upper=dv.upper, scale=dv.scale
                            )
                        else:
                            optProb.addVarGroup(
                                dv.name, dv.nVal, "c", value=dv.value, lower=dv.value, upper=dv.value, scale=dv.scale
                            )
        for child in self.children:
            child.addVariablesPyOpt(
                optProb, globalVars, localVars, sectionlocalVars, spanwiselocalVars, ignoreVars, freezeVars
            )
def addVariablesPyOpt ( self , optProb , globalVars = True , localVars = True , sectionlocalVars = True , spanwiselocalVars = True , ignoreVars = None , freezeVars = None , ) : if ignoreVars is None : ignoreVars = set ( ) if freezeVars is None : freezeVars = set ( ) varLists = OrderedDict ( [ ( "globalVars" , self . DV_listGlobal ) , ( "localVars" , self . DV_listLocal ) , ( "sectionlocalVars" , self . DV_listSectionLocal ) , ( "spanwiselocalVars" , self . DV_listSpanwiseLocal ) , ] ) for lst in varLists : if ( lst == "globalVars" and globalVars or lst == "localVars" and localVars or lst == "sectionlocalVars" and sectionlocalVars or lst == "spanwiselocalVars" and spanwiselocalVars ) : for key in varLists [ lst ] : if key not in ignoreVars : dv = varLists [ lst ] [ key ] if key not in freezeVars : optProb . addVarGroup ( dv . name , dv . nVal , "c" , value = dv . value , lower = dv . lower , upper = dv . upper , scale = dv . scale ) else : optProb . addVarGroup ( dv . name , dv . nVal , "c" , value = dv . value , lower = dv . value , upper = dv . value , scale = dv . scale ) for child in self . children : child . addVariablesPyOpt ( optProb , globalVars , localVars , sectionlocalVars , spanwiselocalVars , ignoreVars , freezeVars )
Add the current set of variables to the optProb object.
Add the current set of variables to the optProb object .
"""
        Add the current set of variables to the optProb object.

        Parameters
        ----------
        optProb : pyOpt_optimization class
            Optimization problem definition to which variables are added

        globalVars : bool
            Flag specifying whether global variables are to be added

        localVars : bool
            Flag specifying whether local variables are to be added

        sectionlocalVars : bool
            Flag specifying whether section local variables are to be added

        spanwiselocalVars : bool
            Flag specifying whether spanwiselocal variables are to be added

        ignoreVars : list of strings
            List of design variables the user DOESN'T want to use
            as optimization variables.

        freezeVars : list of string
            List of design variables the user WANTS to add as optimization
            variables, but to have the lower and upper bounds set at the current
            variable. This effectively eliminates the variable, but it the variable
            is still part of the optimization.
        """ # Add design variables from the master: # Add variables from the children
self
optProb
globalVars
localVars
sectionlocalVars
spanwiselocalVars
ignoreVars
freezeVars