示例#1
0
class Triangle(ShapedComponent):
    """
    Triangle with defined base and height.
    
    Notes
    -----
    The exact angles of the triangle are undefined. The exact side lenths and angles
    are not critical to calculation of component area, so area can still be calculated.
    """

    is3D = False

    THERMAL_EXPANSION_DIMS = {"base", "height"}

    pDefs = componentParameters.getTriangleParameterDefinitions()

    def __init__(
        self,
        name,
        material,
        Tinput,
        Thot,
        base=None,
        height=None,
        mult=None,
        modArea=None,
        isotopics=None,
        mergeWith=None,
        components=None,
    ):
        ShapedComponent.__init__(
            self,
            name,
            material,
            Tinput,
            Thot,
            isotopics=isotopics,
            mergeWith=mergeWith,
            components=components,
        )
        self._linkAndStoreDimensions(components,
                                     base=base,
                                     height=height,
                                     mult=mult,
                                     modArea=modArea)

    def getComponentArea(self, cold=False):
        """Computes the area of the triangle in cm^2."""
        base = self.getDimension("base", cold=cold)
        height = self.getDimension("height", cold=cold)
        mult = self.getDimension("mult")
        area = mult * base * height / 2.0
        return area
示例#2
0
class Triangle(ShapedComponent):

    is3D = False

    THERMAL_EXPANSION_DIMS = {"base", "height"}

    pDefs = componentParameters.getTriangleParameterDefinitions()

    def __init__(
        self,
        name,
        material,
        Tinput,
        Thot,
        base=None,
        height=None,
        mult=None,
        modArea=None,
        isotopics=None,
        mergeWith=None,
        components=None,
    ):
        ShapedComponent.__init__(
            self,
            name,
            material,
            Tinput,
            Thot,
            isotopics=isotopics,
            mergeWith=mergeWith,
            components=components,
        )
        self._linkAndStoreDimensions(
            components, base=base, height=height, mult=mult, modArea=modArea
        )

    def getComponentArea(self, cold=False):
        """Computes the area of the triangle in cm^2."""
        base = self.getDimension("base", cold=cold)
        height = self.getDimension("height", cold=cold)
        mult = self.getDimension("mult")
        area = mult * base * height / 2.0
        return area