예제 #1
0
    def __init__(self, dvName, lower, upper, scale, axis, coefListIn, mask,
                 config, sectionTransform, sectionLink):
        """
        Create a set of geometric design variables which change the shape
        of a surface.
        See `addLocalSectionDV` for more information
        """

        self.coefList = []
        # create a new coefficent list that excludes any values that are masked
        for i in range(len(coefListIn)):
            if not mask[coefListIn[i]]:
                self.coefList.append(coefListIn[i])

        self.nVal = len(self.coefList)
        self.value = np.zeros(self.nVal, "D")
        self.name = dvName
        self.lower = None
        self.upper = None
        self.config = config
        if lower is not None:
            self.lower = convertTo1D(lower, self.nVal)
        if upper is not None:
            self.upper = convertTo1D(upper, self.nVal)
        if scale is not None:
            self.scale = convertTo1D(scale, self.nVal)

        self.sectionTransform = sectionTransform
        self.sectionLink = sectionLink

        self.axis = axis
예제 #2
0
    def __init__(self, name, value, nVal, lower, upper, scale):
        self.name = name
        self.value = value
        self.nVal = nVal
        self.lower = self.upper = self.scale = None

        if lower is not None:
            self.lower = convertTo1D(lower, self.nVal)
        if upper is not None:
            self.upper = convertTo1D(upper, self.nVal)
        if scale is not None:
            self.scale = convertTo1D(scale, self.nVal)
예제 #3
0
    def __init__(self, dvName, lower, upper, scale, axis, vol_dv_to_coefs,
                 mask, config):
        """Create a set of geometric design variables which change the shape
        of a surface surface_id. Local design variables change the surface
        in all three axis.
        See addLocalDV for more information
        """

        self.dv_to_coefs = []

        # add all the coefs to a flat array, but check that it isn't masked first
        for ivol in range(len(vol_dv_to_coefs)):
            for loc_dv in range(len(vol_dv_to_coefs[ivol])):
                coefs = vol_dv_to_coefs[ivol][loc_dv]

                loc_dv_to_coefs = []

                # loop through each of coefs to see if it is masked
                for coef in coefs:
                    if not mask[coef]:
                        loc_dv_to_coefs.append(coef)

                self.dv_to_coefs.append(loc_dv_to_coefs)

        if "x" == axis.lower():
            self.axis = 0
        elif "y" == axis.lower():
            self.axis = 1
        elif "z" == axis.lower():
            self.axis = 2
        else:
            raise NotImplementedError

        self.nVal = len(self.dv_to_coefs)
        self.value = np.zeros(self.nVal, "D")

        self.name = dvName
        self.lower = None
        self.upper = None
        self.config = config

        if lower is not None:
            self.lower = convertTo1D(lower, self.nVal)
        if upper is not None:
            self.upper = convertTo1D(upper, self.nVal)
        if scale is not None:
            self.scale = convertTo1D(scale, self.nVal)
예제 #4
0
 def __init__(self, dv_name, value, lower, upper, scale, function, config):
     """Create a geometric design variable (or design variable group)
     See addGlobalDV in DVGeometry class for more information
     """
     self.name = dv_name
     self.value = np.atleast_1d(np.array(value)).astype("D")
     self.nVal = len(self.value)
     self.lower = None
     self.upper = None
     self.config = config
     self.function = function
     if lower is not None:
         self.lower = convertTo1D(lower, self.nVal)
     if upper is not None:
         self.upper = convertTo1D(upper, self.nVal)
     if scale is not None:
         self.scale = convertTo1D(scale, self.nVal)
예제 #5
0
    def __init__(self, dvName, lower, upper, scale, axis, coefListIn, mask,
                 config):
        """Create a set of geometric design variables which change the shape
        of a surface surface_id. Local design variables change the surface
        in all three axis.
        See addLocalDV for more information
        """

        coefList = []
        # create a new coefficent list that excludes any values that are masked
        for i in range(len(coefListIn)):
            if not mask[coefListIn[i]]:
                coefList.append(coefListIn[i])

        N = len(axis)
        self.nVal = len(coefList) * N
        self.value = np.zeros(self.nVal, "D")
        self.name = dvName
        self.lower = None
        self.upper = None
        self.config = config
        if lower is not None:
            self.lower = convertTo1D(lower, self.nVal)
        if upper is not None:
            self.upper = convertTo1D(upper, self.nVal)
        if scale is not None:
            self.scale = convertTo1D(scale, self.nVal)

        self.coefList = np.zeros((self.nVal, 2), "intc")
        j = 0

        for i in range(len(coefList)):
            if "x" in axis.lower():
                self.coefList[j] = [coefList[i], 0]
                j += 1
            elif "y" in axis.lower():
                self.coefList[j] = [coefList[i], 1]
                j += 1
            elif "z" in axis.lower():
                self.coefList[j] = [coefList[i], 2]
                j += 1
예제 #6
0
 def __init__(self, name, value, nVal, u, scale=1.0, s=None):
     """
     Create a set of design variables which are linear combinations of existing design variables.
     """
     super().__init__(name=name,
                      value=value,
                      nVal=nVal,
                      lower=None,
                      upper=None,
                      scale=convertTo1D(scale, nVal))
     self.u = u
     self.s = s