• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python assign_type.string函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyNastran.bdf.bdfInterface.assign_type.string函数的典型用法代码示例。如果您正苦于以下问题:Python string函数的具体用法?Python string怎么用?Python string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了string函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, card=None, data=None, comment=''):
        Table.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.tid = integer(card, 1, 'tid')
            self.Type = integer_or_blank(card, 2, 'Type', 1)
            assert self.Type in [1, 2], 'TABLES1 Type=%s' % self.Type

            nfields = len(card) - 1
            nterms = (nfields - 9) // 2
            if nterms < 0:
                raise SyntaxError('%r card is too short' % self.type)
            xy = []
            for i in range(nterms):
                n = 9 + i * 2
                if card.field(n) == 'ENDT':
                    break
                x = double_or_string(card, n, 'x' + str(i + 1))
                y = double_or_string(card, n + 1, 'y' + str(i + 1))
                if x == 'SKIP' or y == 'SKIP':
                    continue
                xy += [x, y]
            string(card, nfields, 'ENDT')
            isData = False
        else:
            self.tid = data[0]
            xy = data[1:]
            isData = True
        self.parse_fields(xy, nrepeated=2, isData=isData)
开发者ID:HibernantBear,项目名称:pyNastran,代码行数:30,代码来源:bdf_tables.py


示例2: __init__

    def __init__(self, card=None, data=None, comment=''):
        """
        +--------+-----------+------------+-------+------+--------+-------+-----+-------+
        | DRESP1 |       1S1 |    CSTRAIN | PCOMP |      |        | 1     | 1   | 10000 |
        +--------+-----------+------------+-------+------+--------+-------+-----+-------+
        """
        if comment:
            self._comment = comment
        if card:
            self.oid = integer(card, 1, 'oid')
            self.label = string(card, 2, 'label')
            self.rtype = string(card, 3, 'rtype')

            # elem, pbar, pshell, etc. (ELEM flag or Prop Name)
            self.ptype = integer_string_or_blank(card, 4, 'ptype')
            #if 1:
                ## incomplete
                #assert self.ptype in ['ELEM', 'PSHELL', 'PBAR', 'PROD', 'PCOMP',
                                      #'PSOLID', 'PELAS', 'PBARL', 'PBEAM',
                                      #'PBEAML', 'PSHEAR', 'PTUBE',
                                      #'PKNL',
                                      #None], 'DRESP1 ptype=%s' % self.ptype
            self.region = integer_or_blank(card, 5, 'region')
            self.atta = integer_double_string_or_blank(card, 6, 'atta')
            self.attb = integer_double_string_or_blank(card, 7, 'attb')

            self.atti = []
            for i in range(8, len(card)):
                atti = integer_double_string_or_blank(card, i, 'atti_%i' % (i + 1))
                self.atti.append(atti)
        else:
            raise RuntimeError(data)
开发者ID:HibernantBear,项目名称:pyNastran,代码行数:32,代码来源:optimization.py


示例3: __init__

    def __init__(self, card=None, data=None, comment=''):
        RandomTable.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.tid = integer(card, 1, 'tid')
            self.xaxis = string_or_blank(card, 2, 'xaxis', 'LINEAR')
            self.yaxis = string_or_blank(card, 3, 'yaxis', 'LINEAR')

            nfields = len(card) - 1
            nterms = (nfields - 9) // 2
            if nterms < 0:
                raise SyntaxError('%r card is too short' % self.type)
            xy = []
            for i in range(nterms):
                n = 9 + i * 2
                if card.field(n) == 'ENDT':
                    break
                x = double(card, n, 'x' + str(i + 1))
                y = double(card, n + 1, 'y' + str(i + 1))
                xy += [x, y]
            string(card, nfields, 'ENDT')
            isData = False
        else:
            self.tid = data[0]
            self.xaxis = self.map_axis(data[1])
            self.yaxis = self.map_axis(data[2])
            xy = data[3:]
            isData = True
        assert self.xaxis in ['LINEAR', 'LOG'], 'xaxis=|%s|' % (self.xaxis)
        assert self.yaxis in ['LINEAR', 'LOG'], 'yaxis=|%s|' % (self.yaxis)
        self.parse_fields(xy, nrepeated=2, isData=isData)
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:32,代码来源:bdf_tables.py


示例4: __init__

    def __init__(self, card=None, data=None, comment=''):
        """
        ::

          DRESP1         1S1      CSTRAIN PCOMP                  1       1   10000
        """
        if comment:
            self._comment = comment
        self.oid = integer(card, 1, 'oid')
        self.label = string(card, 2, 'label')
        self.rtype = string(card, 3, 'rtype')

        # elem, pbar, pshell, etc. (ELEM flag or Prop Name)
        self.ptype = integer_string_or_blank(card, 4, 'ptype')
        if 0:
            assert self.ptype in ['ELEM', 'PSHELL', 'PBAR', 'PROD', 'PCOMP',
                                  'PSOLID', 'PELAS', 'PBARL', 'PBEAM',
                                  'PBEAML', 'PSHEAR', 'PTUBE',
                                  'PKNL',   #: .. todo:: is this correct?
                                  None], 'DRESP1 ptype=%s' % self.ptype
        self.region = integer_or_blank(card, 5, 'region')
        self.atta = integer_double_string_or_blank(card, 6, 'atta')
        self.attb = integer_double_string_or_blank(card, 7, 'attb')
        self.atti = integer_double_string_or_blank(card, 8, 'atti')
        self.others = [interpret_value(field) for field in card[9:] ]
开发者ID:sukhbinder,项目名称:cyNastran,代码行数:25,代码来源:optimization.py


示例5: __init__

 def __init__(self, card=None, data=None, comment=''):
     if comment:
         self._comment = comment
     if card:
         self.sid = integer(card, 1, 'sid')
         self.eid = integer(card, 2, 'eid')
         self.Type = string(card, 3, 'Type')
         self.scale = string(card, 4, 'scale')
         self.x1 = double(card, 5, 'x1')
         self.p1 = double(card, 6, 'p1')
         self.x2 = double_or_blank(card, 7, 'x2', self.x1)
         self.p2 = double_or_blank(card, 8, 'p2', self.p1)
         assert 0 <= self.x1 <= self.x2
         assert len(card) <= 9, 'len(PLOAD1 card) = %i' % len(card)
     else:
         self.sid = data[0]
         self.eid = data[1]
         self.Type = data[2]
         self.scale = data[3]
         self.x1 = data[4]
         self.p1 = data[5]
         self.x2 = data[6]
         self.p2 = data[7]
     if self.Type not in self.validTypes:
         msg = '%s is an invalid type on the PLOAD1 card' % self.Type
         raise RuntimeError(msg)
     assert self.scale in self.validScales, '%s is an invalid scale on the PLOAD1 card' % (self.scale)
开发者ID:anick107,项目名称:von_mises_rms,代码行数:27,代码来源:staticLoads.py


示例6: __init__

    def __init__(self, card=None, data=None, comment=''):
        if comment:
            self._comment = comment
        if card:
            self.name = string(card, 1, 'name')
            #zero

            #: 4-Lower Triangular; 5=Upper Triangular; 6=Symmetric; 8=Identity (m=nRows, n=m)
            self.ifo = integer(card, 3, 'ifo')
            #: 1-Real, Single Precision; 2=Real,Double Precision; 3=Complex, Single; 4=Complex, Double
            self.tin = integer(card, 4, 'tin')
            #: 0-Set by cell precision
            self.tout = integer_or_blank(card, 5, 'tout', 0)

            self.polar = integer_or_blank(card, 6, 'polar')
            if self.ifo == 9:
                self.ncol = integer(card, 8, 'ncol')
            else:
                self.ncol = blank(card, 8, 'ncol')
        else:
            raise NotImplementedError(data)

        self.GCj = []
        self.GCi = []
        self.Real = []
        if self.isComplex():
            self.Complex = []
开发者ID:anick107,项目名称:von_mises_rms,代码行数:27,代码来源:dmig.py


示例7: __init__

    def __init__(self, card=None, data=None, comment=""):
        ThermalElement.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Surface element ID
            self.eid = integer(card, 1, "eid")

            #: PHBDY property entry identification numbers. (Integer > 0)
            self.pid = integer(card, 2, "pid")
            assert self.pid > 0

            self.Type = string(card, 3, "Type")
            # print("self.Type = %s" % self.Type)
            # msg = 'CHBDYP Type=%r' % self.Type
            # assert self.Type in ['POINT','LINE','ELCYL','FTUBE','TUBE'], msg

            #: A VIEW entry identification number for the front face.
            self.iViewFront = integer_or_blank(card, 4, "iViewFront", 0)

            #: A VIEW entry identification number for the back face.
            self.iViewBack = integer_or_blank(card, 5, "iViewBack", 0)

            #: Grid point identification numbers of grids bounding the surface.
            #: (Integer > 0)
            self.g1 = integer(card, 6, "g1")
            #: Grid point identification numbers of grids bounding the surface.
            #: (Integer > 0)
            if self.Type != "POINT":
                self.g2 = integer(card, 7, "g2")
            else:
                self.g2 = blank(card, 7, "g2")

            #: Orientation grid point. (Integer > 0; Default = 0)
            self.g0 = integer_or_blank(card, 8, "g0", 0)

            #: RADM identification number for front face of surface element.
            #: (Integer > 0)
            self.radMidFront = integer_or_blank(card, 9, "radMidFront", 0)

            #: RADM identification number for back face of surface element.
            #: (Integer > 0)
            self.radMidBack = integer_or_blank(card, 10, "radMidBack", 0)

            #: Grid point identification number of a midside node if it is used
            #: with the line type surface element.
            self.gmid = integer_or_blank(card, 11, "gmid")
            #: Coordinate system for defining orientation vector.
            #: (Integer > 0; Default = 0
            self.ce = integer_or_blank(card, 12, "ce", 0)

            #: Components of the orientation vector in coordinate system CE.
            #: The origin of the orientation vector is grid point G1.
            #: (Real or blank)
            self.e1 = double_or_blank(card, 13, "e3")
            self.e2 = double_or_blank(card, 14, "e3")
            self.e3 = double_or_blank(card, 15, "e3")
            assert len(card) <= 16, "len(CHBDYP card) = %i" % len(card)
        else:
            raise NotImplementedError(data)
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:60,代码来源:thermal.py


示例8: __init__

    def __init__(self, card=None, data=None, comment=''):
        ThermalLoad.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Load set identification number. (Integer > 0)
            self.sid = integer(card, 1, 'eid')

            self.flag = string(card, 2, 'flag')
            assert self.flag in ['POINT', 'LINE', 'REV', 'AREA3', 'AREA4',
                                 'AREA6', 'AREA8']

            #: Magnitude of thermal flux into face. Q0 is positive for heat
            #: into the surface. (Real)
            self.Q0 = double(card, 3, 'Q0')

            #: Area factor depends on type. (Real > 0.0 or blank)
            self.af = double_or_blank(card, 4, 'af')
            nfields = card.nfields

            nnodes = self.flag_to_nnodes[self.flag]

            #: Grid point identification of connected grid points.
            #: (Integer > 0 or blank)
            self.grids = []
            for i in range(nnodes):
                grid = integer(card, 5 + i, 'grid%i' % (i + 1))
                self.grids.append(grid)
        else:
            self.sid = data[0]
            self.flag = data[1]
            self.Q0 = data[2]
            self.af = data[3]
            self.grids = data[4:]
开发者ID:HibernantBear,项目名称:pyNastran,代码行数:34,代码来源:loads.py


示例9: __init__

    def __init__(self, card=None, data=None, comment=''):
        ThermalElement.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Surface element ID
            self.eid = integer(card, 1, 'eid')

            #: PHBDY property entry identification numbers. (Integer > 0)
            self.pid = integer(card, 2, 'pid')
            assert self.pid > 0

            self.Type = string(card, 3, 'Type')
            #print "self.Type = ",self.Type
            # msg = 'CHBDYP Type=|%s|' (self.Type)
            #assert self.Type in ['POINT','LINE','ELCYL','FTUBE','TUBE'], msg

            #: A VIEW entry identification number for the front face.
            self.iViewFront = integer_or_blank(card, 4, 'iViewFront', 0)

            #: A VIEW entry identification number for the back face.
            self.iViewBack = integer_or_blank(card, 5, 'iViewBack', 0)

            #: Grid point identification numbers of grids bounding the surface.
            #: (Integer > 0)
            self.g1 = integer(card, 6, 'g1')
            #: Grid point identification numbers of grids bounding the surface.
            #: (Integer > 0)
            if self.Type != 'POINT':
                self.g2 = integer(card, 7, 'g2')
            else:
                self.g2 = blank(card, 7, 'g2')

            #: Orientation grid point. (Integer > 0; Default = 0)
            self.g0 = integer_or_blank(card, 8, 'g0', 0)

            #: RADM identification number for front face of surface element.
            #: (Integer > 0)
            self.radMidFront = integer_or_blank(card, 9, 'radMidFront', 0)

            #: RADM identification number for back face of surface element.
            #: (Integer > 0)
            self.radMidBack = integer_or_blank(card, 10, 'radMidBack', 0)

            #: Grid point identification number of a midside node if it is used
            #: with the line type surface element.
            self.gmid = integer_or_blank(card, 11, 'gmid')
            #: Coordinate system for defining orientation vector.
            #: (Integer > 0; Default = 0
            self.ce = integer_or_blank(card, 12, 'ce', 0)

            #: Components of the orientation vector in coordinate system CE.
            #: The origin of the orientation vector is grid point G1.
            #: (Real or blank)
            self.e1 = double_or_blank(card, 13, 'e3')
            self.e2 = double_or_blank(card, 14, 'e3')
            self.e3 = double_or_blank(card, 15, 'e3')
            assert len(card) <= 16, 'len(CHBDYP card) = %i' % len(card)
        else:
            raise NotImplementedError(data)
开发者ID:anick107,项目名称:von_mises_rms,代码行数:60,代码来源:thermal.py


示例10: __init__

    def __init__(self, card=None, data=None, comment=''):
        Table.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.tid = integer(card, 1, 'tid')
            self.x1 = double(card, 2, 'x1')
            self.x2 = double(card, 3, 'x2')
            assert self.x2 != 0.0
            self.x3 = double(card, 4, 'x3')
            self.x4 = double(card, 5, 'x4')
            assert self.x3 < self.x4

            nfields = len(card) - 1
            nterms = (nfields - 9) // 2
            xy = []
            for i in range(nterms):
                n = 9 + i * 2
                if card.field(n) == 'ENDT':
                    break
                x = double(card, n, 'x' + str(i + 1))
                y = double(card, n + 1, 'y' + str(i + 1))
                xy += [x, y]
            ENDT = string(card, nfields, 'ENDT')
            isData = False
        else:
            self.tid = data[0]
            self.x1 = data[1]
            self.x2 = data[2]
            self.x3 = data[3]
            self.x4 = data[4]
            xy = data[3:]
            isData = True
        self.parse_fields(xy, nrepeated=1, isData=isData)
开发者ID:anick107,项目名称:von_mises_rms,代码行数:34,代码来源:tables.py


示例11: __init__

    def __init__(self, card=None, data=None, comment=''):
        if comment:
            self._comment = comment
        if card:
            self.name = string(card, 1, 'name')
            #zero

            #: 4-Lower Triangular; 5=Upper Triangular; 6=Symmetric; 8=Identity (m=nRows, n=m)
            self.ifo = integer(card, 3, 'ifo')
            #: 1-Real, Single Precision; 2=Real,Double Precision; 3=Complex, Single; 4=Complex, Double
            self.tin = integer(card, 4, 'tin')
            #: 0-Set by cell precision
            self.tout = integer_or_blank(card, 5, 'tout', 0)

            #: Input format of Ai, Bi. (Integer=blank or 0 indicates real, imaginary format;
            #: Integer > 0 indicates amplitude, phase format.)
            self.polar = integer_or_blank(card, 6, 'polar', 0)
            if self.ifo in [6, 9]:
                self.ncol = integer(card, 8, 'ncol')
            else:  # technically right, but nulling this will fix bad decks
                self.ncol = None
                #self.ncol = blank(card, 8, 'ncol')
        else:
            raise NotImplementedError(data)

        self.GCj = []
        self.GCi = []
        self.Real = []
        if self.is_complex():
            self.Complex = []
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:30,代码来源:dmig.py


示例12: __init__

    def __init__(self, card=None, data=None, comment=''):
        ThermalLoad.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Load set identification number. (Integer > 0)
            self.sid = integer(card, 1, 'eid')

            self.flag = string(card, 2, 'flag')
            assert self.flag in ['POINT', 'LINE', 'REV', 'AREA3', 'AREA4',
                                 'AREA6', 'AREA8']

            #: Magnitude of thermal flux into face. Q0 is positive for heat
            #: into the surface. (Real)
            self.Q0 = double(card, 3, 'Q0')

            #: Area factor depends on type. (Real > 0.0 or blank)
            self.af = double_or_blank(card, 4, 'af')
            nfields = card.nFields()

            #: grids
            self.grids = fields(integer, card, 'grid', i=5, j=nfields)

            #: Grid point identification of connected grid points.
            #: (Integer > 0 or blank)
            self.grids = expand_thru_by(self.grids)
        else:
            self.sid = data[0]
            self.flag = data[1]
            self.Q0 = data[2]
            self.af = data[3]
            self.grids = data[4:]
开发者ID:anick107,项目名称:von_mises_rms,代码行数:32,代码来源:loads.py


示例13: __init__

    def __init__(self, card=None, data=None, comment=''):
        BushingProperty.__init__(self, card, data)
        if comment:
            self._comment = comment

        if card:
            self.pid = integer(card, 1, 'pid')
            nfields = len(card) - 1
            nrows = nfields // 8
            if nfields % 8 != 0:
                nrows += 1

            self.k_tables = []
            self.b_tables = []
            self.ge_tables = []
            self.kn_tables = []
            for irow in range(nrows):
                ifield = 1 + irow * 8
                param = string(card, ifield + 1, 'param_type')
                table = []
                for j in range(6):
                    table_value = integer_or_blank(card, ifield + j + 2, param + '%i' % (j+1))
                    table.append(table_value)
                if param == 'K':
                    self.k_tables = table
                elif param == 'B':
                    self.b_tables = table
                elif param == 'GE':
                    self.ge_tables = table
                elif param == 'KN':
                    self.kn_tables = table
                else:
                    raise ValueError(param)
        else:
            raise NotImplementedError()
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:35,代码来源:bush.py


示例14: __init__

    def __init__(self, card=None, data=None, comment=''):
        Table.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.tid = integer(card, 1, 'tid')
            self.Type = string_or_blank(card, 2, 'Type', 'G')
            assert self.Type in ['G', 'CRIT', 'Q'], 'Type=%r' % self.Type

            nfields = len(card) - 1
            nterms = (nfields - 9) // 2
            if nterms < 0:
                raise SyntaxError('%r card is too short' % self.type)
            xy = []
            for i in range(nterms):
                n = 9 + i * 2
                if card.field(n) == 'ENDT':
                    break
                x = double(card, n, 'x' + str(i + 1))
                y = double(card, n + 1, 'y' + str(i + 1))
                xy += [x, y]
            ENDT = string(card, nfields, 'ENDT')
            isData = False
        else:
            self.tid = data[0]
            self.x1 = data[1]
            self.Type = data[2]
            xy = data[5:]
            isData = True
        self.parse_fields(xy, nrepeated=2, isData=isData)
开发者ID:umvarma,项目名称:pynastran,代码行数:30,代码来源:bdf_tables.py


示例15: __init__

    def __init__(self, card, comment=''):
        self.pid = integer(card, 1, 'property_id')
        self.sets = []
        self.Types = []
        self.gammas = []
        self._cps = []
        #self.set = integer(card, 2, 'set_id')
        #self.Type = string(card, 3, 'Type')
        #if self.Type not in ['NEWTON','PRANDTL-MEYER', 'CP']:
        #    raise RuntimeError('Type=%r' % Type)
        #self.gamma = double_or_blank(card, 4, 'gamma', 1.4)

        i = 2
        while i < len(card):
            self.sets.append(integer(card, i, 'set_id'))
            Type = string(card, i+1, 'Type')
            self.Types.append(Type)
            #if self.Type not in ['NEWTON','PRANDTL-MEYER', 'CP']:
                #raise RuntimeError('Type=%r' % Type)
            self.gammas.append(double_or_blank(card, i+2, 'gamma', 1.4))

            _cp = None
            if Type == 'CP':
                _cp = double(card, i+3, 'Cp')
            elif Type == 'NEWTON':
                _cp = double_or_blank(card, i+3, 'Cp_nominal', 2.0)
            self._cps.append(_cp)
            i += 7
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:28,代码来源:cards.py


示例16: __init__

 def __init__(self, card=None, data=None, comment=''):
     if comment:
         self._comment = comment
     self.cid = integer(card, 1, 'cid')
     self.entity = string(card, 2, 'entity')
     self.gm_ids = [
         integer(card, 3, 'GM_ID1'),
         integer_or_blank(card, 4, 'GM_ID2'),
     ]
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:9,代码来源:coordinateSystems.py


示例17: __init__

    def __init__(self, card=None, data=None, comment=''):
        LineProperty.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Property ID
            self.pid = integer(card, 1, 'pid')
            #: Material ID
            self.mid = integer(card, 2, 'mid')
            self.group = string_or_blank(card, 3, 'group', 'MSCBMLO')
            #: Section Type (e.g. 'ROD', 'TUBE', 'I', 'H')
            self.Type = string(card, 4, 'Type')

            ndim = self.validTypes[self.Type]
            j = 9 + ndim + 1

            dims = []
            #dim_old = None  ## TODO: is there a default?
            for i in range(ndim):
                dim = double_or_blank(card, 9 + i, 'dim%i' % (i + 1))
                dims.append(dim)

            #: dimension list
            self.dim = dims
            assert len(dims) == ndim, 'PBARL ndim=%s len(dims)=%s' % (ndim, len(dims))
            assert len(dims) == len(self.dim), 'PBARL ndim=%s len(dims)=%s' % (ndim, len(self.dim))

            #: non-structural mass
            self.nsm = double_or_blank(card, 9 + ndim + 1, 'nsm', 0.0)

        else:
            self.pid = data[0]
            self.mid = data[1]
            self.group = data[2].strip()
            self.Type = data[3].strip()
            self.dim = list(data[4:-1])
            self.nsm = data[-1]
            #print("group = %r" % self.group)
            #print("Type  = %r" % self.Type)
            #print("dim = ",self.dim)
            #print(str(self))
            #print("*PBARL = ",data)
            #raise NotImplementedError('not finished...')
        if self.Type not in self.validTypes:
            msg = ('Invalid PBARL Type, Type=%s '
                   'validTypes=%s' % (self.Type, self.validTypes.keys()))
            raise RuntimeError(msg)

        if len(self.dim) != self.validTypes[self.Type]:
            msg = 'dim=%s len(dim)=%s Type=%s len(dimType)=%s' % (
                self.dim, len(self.dim), self.Type,
                self.validTypes[self.Type])
            raise RuntimeError(msg)

        assert None not in self.dim
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:55,代码来源:bars.py


示例18: add

    def add(self, card=None, comment=''):
        if comment:
            self._comment = comment
        i = self.i
        #: Identification number of a MAT1, MAT2, or MAT9 entry.
        self.material_id[i] = integer(card, 1, 'mid')
        #: Identification number of a TABLES1 or TABLEST entry. If H is
        #: given, then this field must be blank.
        self.table_id[i] = integer_or_blank(card, 2, 'tid', 0)
        #: Type of material nonlinearity. ('NLELAST' for nonlinear elastic
        #: or 'PLASTIC' for elastoplastic.)
        self.Type[i] = string(card, 3, 'Type')

        if self.Type[i] == 'NLELAST':
            self.h[i] = blank(card, 4, 'h')
            self.hr[i] = blank(card, 6, 'hr')
            self.yf[i] = blank(card, 5, 'yf')
            self.limit1[i] = blank(card, 7, 'yf')
            self.limit2[i] = blank(card, 8, 'yf')
        else:
            #: Work hardening slope (slope of stress versus plastic strain) in
            #: units of stress. For elastic-perfectly plastic cases, H=0.0.
            #: For more than a single slope in the plastic range, the
            #: stress-strain data must be supplied on a TABLES1 entry
            #: referenced by TID, and this field must be blank
            h = double_or_blank(card, 4, 'H')
            self.h[i] = h
            if h is None:
                self.hflag[i] = False
            else:
                self.hflag[i] = True

            #: Yield function criterion, selected by one of the following
            #: values (1) Von Mises (2) Tresca (3) Mohr-Coulomb
            #: (4) Drucker-Prager
            self.yf[i] = integer_or_blank(card, 5, 'yf', 1)

            #: Hardening Rule, selected by one of the following values
            #: (Integer): (1) Isotropic (Default) (2) Kinematic
            #: (3) Combined isotropic and kinematic hardening
            self.hr[i] = integer_or_blank(card, 6, 'hr', 1)
            #: Initial yield point
            self.limit1[i] = double(card, 7, 'limit1')

            if self.yf[i] == 3 or self.yf[i] == 4:
                #: Internal friction angle, measured in degrees, for the
                #: Mohr-Coulomb and Drucker-Prager yield criteria
                self.limit2[i] = double(card, 8, 'limit2')
            else:
                #self.limit2[i] = blank(card, 8, 'limit2')
                #self.limit2[i] = None
                pass
        assert len(card) <= 9, 'len(MATS1 card) = %i' % len(card)
        self.i += 1
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:54,代码来源:mats1.py


示例19: build

    def build(self):
        #if comment:
            #self._comment = comment
        cards = self._cards
        ncards = len(cards)
        
        float_fmt = self.model.float
        self.load_id = zeros(ncards, 'int32')
        self.element_id = zeros(ncards, 'int32')
        self.Type = array([''] * ncards, '|S4')
        self.scale = array([''] * ncards, '|S4')
        self.x1 = zeros(ncards, float_fmt)
        self.x2 = zeros(ncards, float_fmt)
        self.p1 = zeros(ncards, float_fmt)
        self.p2 = zeros(ncards, float_fmt)

        self.n = ncards
        for i, card in enumerate(cards):
            self.load_id[i] = integer(card, 1, 'load_id')
            self.element_id[i] = integer(card, 2, 'eid')
            Type = string(card, 3,  'Type ("%s")' % '",  "'.join(self.valid_types) )
            scale = string(card, 4, 'scale ("%s")' % '", "'.join(self.valid_scales) )
            self.x1[i] = double(card, 5, 'x1')
            self.p1[i] = double(card, 6, 'p1')
            self.x2[i] = double_or_blank(card, 7, 'x2', self.x1)
            self.p2[i] = double_or_blank(card, 8, 'p2', self.p1)
            assert len(card) <= 9, 'len(PLOAD1 card) = %i' % len(card)

            if Type not in self.valid_types:
                msg = '%r is an invalid type on the PLOAD1 card' % Type
                raise RuntimeError(msg)
            self.Type[i] = Type

            assert 0.0 <= self.x1[i] <= self.x2[i]
            if scale in ['FR', 'FRPR']:
                assert self.x1[i] <= 1.0, 'x1=%r' % self.x1[i]
                assert self.x2[i] <= 1.0, 'x2=%r' % self.x2[i]
            assert scale in self.valid_scales, '%s is an invalid scale on the PLOAD1 card' % scale
            self.scale[i] = scale
            self._cards = []
            self._comments = []
开发者ID:sukhbinder,项目名称:cyNastran,代码行数:41,代码来源:pload1.py


示例20: __init__

    def __init__(self, card=None, data=None, comment=''):
        Constraint.__init__(self, card, data)

        if comment:
            self._comment = comment
        if card:
            self.conid = integer(card, 1, 'sid')
            self.components = components(card, 2, 'components')
            self.entity = string(card, 3, 'entity')
            self.entity_id = integer(card, 4, 'entity_id')
        else:
            raise NotImplementedError('GMSPC')
开发者ID:HibernantBear,项目名称:pyNastran,代码行数:12,代码来源:constraints.py



注:本文中的pyNastran.bdf.bdfInterface.assign_type.string函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python assign_type.string_or_blank函数代码示例发布时间:2022-05-25
下一篇:
Python assign_type.integer_or_blank函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap