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

Python assign_type.integer_or_blank函数代码示例

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

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



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

示例1: add_card

    def add_card(cls, card, comment=''):
        mid = integer(card, 1, 'mid')
        tid = integer_or_blank(card, 2, 'tid')
        Type = string(card, 3, 'Type')

        if Type not in ['NLELAST', 'PLASTIC']:
            raise ValueError('MATS1 Type must be [NLELAST, PLASTIC]; Type=%r' % Type)
        if Type == 'NLELAST':
            # should we even read these?
            h = None
            hr = None
            yf = None
            limit1 = None
            limit2 = None
            #h = blank(card, 4, 'h')
            #hr = blank(card, 6, 'hr')
            #yf = blank(card, 5, 'yf')
            #limit1 = blank(card, 7, 'yf')
            #limit2 = blank(card, 8, 'yf')
        else:
            h = double_or_blank(card, 4, 'H')
            yf = integer_or_blank(card, 5, 'yf', 1)
            hr = integer_or_blank(card, 6, 'hr', 1)
            limit1 = double(card, 7, 'limit1')

            if yf in [3, 4]:
                limit2 = double(card, 8, 'limit2')
            else:
                #limit2 = blank(card, 8, 'limit2')
                limit2 = None
        assert len(card) <= 9, 'len(MATS1 card) = %i\ncard=%s' % (len(card), card)
        return MATS1(mid, tid, Type, h, hr, yf, limit1, limit2, comment=comment)
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:32,代码来源:material_deps.py


示例2: add_card

 def add_card(cls, card, comment=''):
     pid = integer(card, 1, 'pid')
     tkid = integer_or_blank(card, 2, 'tkid', 0)
     tgeid = integer_or_blank(card, 3, 'tgeid', 0)
     tknid = integer_or_blank(card, 4, 'tknid', 0)
     assert len(card) <= 5, 'len(PELAST card) = %i' % len(card)
     return PELAST(pid, tkid, tgeid, tknid, comment=comment)
开发者ID:marcinch18,项目名称:pyNastran,代码行数:7,代码来源:springs.py


示例3: add_card

    def add_card(self, card, comment=''):
        pid = integer(card, 1, 'property_id')
        if comment:
            self.set_comment(pid, comment)
        i = self.i
        self.property_id[i] = pid
        self.thickness[i] = double(card, 3, 'thickness')

        self.twelveIt3[i] = double_or_blank(card, 5, '12*I/t^3', 1.0)
        self.tst[i] = double_or_blank(card, 7, 'ts/t', 0.833333)
        self.nsm[i] = double_or_blank(card, 8, 'nsm', 0.0)

        t_over_2 = self.thickness[i] / 2.
        self.z1[i] = double_or_blank(card, 9, 'z1', -t_over_2)
        self.z2[i] = double_or_blank(card, 10, 'z2', t_over_2)
        self.material_ids[i, :] = [
            integer(card, 2, 'material_id'),
            integer_or_blank(card, 4, 'material_id2', -1),
            integer_or_blank(card, 6, 'material_id3', -1),
            integer_or_blank(card, 11, 'material_id4', -1)
        ]
        #self.model.log.debug(self.material_ids[i, :])

        #ii = np.array([i])
        #file_obj = StringIO()
        #file_obj.write('<PSHELL object> n=%s\n' % self.n)
        #self.write_card_by_index(file_obj, i=ii)
        #print(file_obj.getvalue())


        assert len(card) <= 12, 'len(PSHELL card) = %i\ncard=%s' % (len(card), card)
        self.i += 1
开发者ID:hurlei,项目名称:pyNastran,代码行数:32,代码来源:pshell.py


示例4: add

 def add(self, card, comment=''):
     self._comment = comment
     self.n = 1
     self.cp = integer_or_blank(card, 2, 'cp', 0)
     self.cd = integer_or_blank(card, 6, 'cd', 0)
     self.ps = integer_or_blank(card, 7, 'ps', -1)
     self.seid = integer_or_blank(card, 8, 'seid', 0)
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:7,代码来源:grid.py


示例5: __init__

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

        #: Surface type
        self.Type = string(card, 3, 'Type')
        assert self.Type in ['REV', 'AREA3', 'AREA4', 'AREA6', 'AREA8']

        #: 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, 8, 'iViewBack', 0)

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

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

        #: Grid point IDs of grids bounding the surface (Integer > 0)
        self.nodes = []
        n = 1
        for i in range(9, len(card)):
            grid = integer_or_blank(card, i, 'grid%i' % n)
            if grid is not None:
                self.nodes.append(grid)
        assert len(self.nodes) > 0, 'card=%s' % card
开发者ID:watkinrt,项目名称:pyNastran,代码行数:35,代码来源:thermal.py


示例6: test_integer_or_blank

    def test_integer_or_blank(self):
        """
        value = integer_or_blank(card, n, fieldname)
        """
        # integer
        self.check_integer(integer_or_blank)

        # float
        with self.assertRaises(SyntaxError):
            integer_or_blank(BDFCard([1.]), 0, 'field')
        with self.assertRaises(SyntaxError):
            integer_or_blank(BDFCard(['1.']), 0, 'field')

        # string
        with self.assertRaises(SyntaxError):
            integer_or_blank(BDFCard(['a']), 0, 'field')
        with self.assertRaises(SyntaxError):
            integer_or_blank(BDFCard(['1b']), 0, 'field')

        # blank
        self.assertEqual('a', integer_or_blank(BDFCard(['']), 0, 'field', 'a'))
        self.assertEqual('b', integer_or_blank(BDFCard([None]), 0, 'field', 'b'))


        card = [1, '2', '3.', 'C', None, '']
        exact = [1, 2, SyntaxError, SyntaxError, None, None]
        default = [None, None, None, None, None, None]
        self.run_function_default(integer_or_blank, card, exact, default)
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:28,代码来源:test_assign_type.py


示例7: add_card

    def add_card(cls, card, comment=''):
        name = string(card, 1, 'name')
        #zero

        #: 4-Lower Triangular; 5=Upper Triangular; 6=Symmetric; 8=Identity (m=nRows, n=m)
        ifo = integer(card, 3, 'ifo')
        #: 1-Real, Single Precision; 2=Real,Double Precision;
        #  3=Complex, Single; 4=Complex, Double
        tin = integer(card, 4, 'tin')
        #: 0-Set by cell precision
        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.)
        polar = integer_or_blank(card, 6, 'polar', 0)
        if ifo == 1: # square
            ncols = integer_or_blank(card, 8, 'ifo=%s; ncol' % (ifo))
        elif ifo == 6: # symmetric
            ncols = integer_or_blank(card, 8, 'ifo=%s; ncol' % (ifo))
        elif ifo in [2, 9]: # rectangular
            ncols = integer(card, 8, 'ifo=%s; ncol' % (ifo))
        else:
            # technically right, but nulling this will fix bad decks
            #self.ncols = blank(card, 8, 'ifo=%s; ncol' % self.ifo)
            raise NotImplementedError('ifo=%s is not supported' % ifo)

        GCj = []
        GCi = []
        Real = []
        Complex = []
        return cls(name, ifo, tin, tout, polar, ncols,
                   GCj, GCi, Real, Complex, comment=comment)
开发者ID:saullocastro,项目名称:pyNastran,代码行数:32,代码来源:dmig.py


示例8: add_card

 def add_card(cls, card, comment=''):
     eid = integer(card, 1, 'eid')
     pid = integer_or_blank(card, 2, 'pid', eid)
     nids = [integer_or_blank(card, 3, 'n1', 0),
             integer_or_blank(card, 4, 'n2', 0)]
     assert len(card) <= 5, 'len(CVISC card) = %i\ncard=%s' % (len(card), card)
     return CVISC(eid, pid, nids, comment=comment)
开发者ID:saullocastro,项目名称:pyNastran,代码行数:7,代码来源:damper.py


示例9: add_card

 def add_card(cls, card, comment=''):
     eid = integer(card, 1, 'eid')
     pid = integer_or_blank(card, 2, 'pid', eid)
     s1 = integer_or_blank(card, 3, 's1')
     s2 = integer_or_blank(card, 4, 's2')
     assert len(card) <= 5, 'len(CMASS3 card) = %i' % len(card)
     return CMASS3(eid, pid, s1, s2, comment=comment)
开发者ID:marcinch18,项目名称:pyNastran,代码行数:7,代码来源:mass.py


示例10: add_card

    def add_card(cls, card, comment=''):
        sid = integer(card, 1, 'sid')
        method = string_or_blank(card, 2, 'method', 'LAN')

        f1 = double_or_blank(card, 3, 'f1')
        f2 = double_or_blank(card, 4, 'f2')
        ne = integer_or_blank(card, 5, 'ne')

        if method not in cls.allowed_methods:
            msg = 'method=%s; allowed_methods=[%s]' % (
                method, ', '.join(cls.allowed_methods))
            raise ValueError(msg)

        if method == 'SINV':
            nd = integer_or_blank(card, 6, 'nd', 600)
        if method == 'INV':
            nd = integer_or_blank(card, 6, 'nd', 3 * ne)
        elif method in ['GIV', 'MGIV', 'HOU', 'MHOU']:
            nd = integer_or_blank(card, 6, 'nd', 0)
        else:
            nd = integer(card, 6, 'nd')
        norm = string_or_blank(card, 9, 'norm', 'MASS')

        if method == 'POINT':
            G = integer(card, 10, 'G')
            C = components(card, 11, 'C')
        else:
            G = blank(card, 10, 'G')
            C = blank(card, 11, 'C')
        assert len(card) <= 12, 'len(EIGR card) = %i\ncard=%s' % (len(card), card)
        return EIGR(sid, method, f1, f2, ne, nd, norm, G, C, comment=comment)
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:31,代码来源:methods.py


示例11: add

    def add(self, card, comment=''):
        i = self.i
        self.element_id[i] = integer(card, 1, 'element_id')
        self.property_id[i] = integer(card, 2, 'property_id')
        self.coord_id[i] = integer_or_blank(card, 3, 'cp', 0)

        self.nspan[i] = integer_or_blank(card, 4, 'nspan', 0)
        self.nchord[i] = integer_or_blank(card, 5, 'nchord', 0)

        #if self.nspan==0:
        self.lspan[i] = integer_or_blank(card, 6, 'lspan', 0)

        #if self.nchord==0:
        self.lchord[i] = integer_or_blank(card, 7, 'lchord', 0)

        self.igid[i] = integer(card, 8, 'igid')

        self.p1[i, :] = [double_or_blank(card, 9, 'x1', 0.0),
                         double_or_blank(card, 10, 'y1', 0.0),
                         double_or_blank(card, 11, 'z1', 0.0)]
        self.x12[i] = double_or_blank(card, 12, 'x12', 0.)

        self.p4[i, :] = [double_or_blank(card, 13, 'x4', 0.0),
                         double_or_blank(card, 14, 'y4', 0.0),
                         double_or_blank(card, 15, 'z4', 0.0)]
        self.x43[i] = double_or_blank(card, 16, 'x43', 0.)
        assert len(card) <= 17, 'len(CAERO1 card) = %i\ncard=%s' % (len(card), card)
        self.i += 1
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:28,代码来源:caero1.py


示例12: add_card

    def add_card(cls, card, comment=''):
        pid = integer(card, 1, 'pid')
        mid1 = integer_or_blank(card, 2, 'mid1')
        t = double_or_blank(card, 3, 't')

        mid2 = integer_or_blank(card, 4, 'mid2')
        twelveIt3 = double_or_blank(card, 5, '12*I/t^3', 1.0)  # poor name
        mid3 = integer_or_blank(card, 6, 'mid3')
        tst = double_or_blank(card, 7, 'ts/t', 0.833333)
        nsm = double_or_blank(card, 8, 'nsm', 0.0)

        if t is not None:
            t_over_2 = t / 2.
            z1 = double_or_blank(card, 9, 'z1', -t_over_2)
            z2 = double_or_blank(card, 10, 'z2', t_over_2)
        else:
            z1 = double_or_blank(card, 9, 'z1')
            z2 = double_or_blank(card, 10, 'z2')
        mid4 = integer_or_blank(card, 11, 'mid4')

        #if self.mid2 is None:
        #    assert self.mid3 is None
        #else: # mid2 is defined
        #    #print (self.mid2 = ", self.mid2)
        #    assert self.mid2 >= -1
        #    #assert self.mid3 >  0

        #if self.mid1 is not None and self.mid2 is not None:
        #    assert self.mid4 == None
        assert len(card) <= 12, 'len(PSHELL card) = %i' % len(card)
        return PSHELL(pid, mid1, t, mid2, twelveIt3,
                      mid3, tst, nsm,
                      z1, z2, mid4, comment=comment)
开发者ID:watkinrt,项目名称:pyNastran,代码行数:33,代码来源:shell.py


示例13: add_card

 def add_card(cls, card, comment=''):
     eid = integer(card, 1, 'eid')
     k = double(card, 2, 'k')
     s1 = integer_or_blank(card, 3, 's1', 0)
     s2 = integer_or_blank(card, 4, 's2', 0)
     assert len(card) <= 5, 'len(CELAS4 card) = %i\ncard=%s' % (len(card), card)
     return CELAS4(eid, k, s1, s2, comment=comment)
开发者ID:hurlei,项目名称:pyNastran,代码行数:7,代码来源:springs.py


示例14: add_card

    def add_card(cls, card, comment=''):
        eid = integer(card, 1, 'eid')
        pid = integer_or_blank(card, 2, 'pid', eid)
        ga = integer(card, 3, 'ga')
        gb = integer(card, 4, 'gb')
        gc = integer(card, 5, 'gc')

        x, g0 = cls._init_x_g0(card, eid)

        wa = np.array([double_or_blank(card, 9, 'w1a', 0.0),
                       double_or_blank(card, 10, 'w2a', 0.0),
                       double_or_blank(card, 11, 'w3a', 0.0)], dtype='float64')

        wb = np.array([double_or_blank(card, 12, 'w1b', 0.0),
                       double_or_blank(card, 13, 'w2b', 0.0),
                       double_or_blank(card, 14, 'w3b', 0.0)], dtype='float64')

        wc = np.array([double_or_blank(card, 15, 'w1c', 0.0),
                       double_or_blank(card, 16, 'w2c', 0.0),
                       double_or_blank(card, 17, 'w3c', 0.0)], dtype='float64')

        tw = np.array([double_or_blank(card, 18, 0., 'twa'),
                       double_or_blank(card, 19, 0., 'twb'),
                       double_or_blank(card, 20, 0., 'twc')], dtype='float64')

        s = np.array([integer_or_blank(card, 21, 'sa'),
                      integer_or_blank(card, 22, 'sb'),
                      integer_or_blank(card, 23, 'sc')], dtype='float64')
        assert len(card) <= 24, 'len(CBEAM3 card) = %i\ncard=%s' % (len(card), card)
        return CBEAM3(eid, pid, ga, gb, gc, x, g0,
                      wa, wb, wc, tw, s, comment='')
开发者ID:hurlei,项目名称:pyNastran,代码行数:31,代码来源:bars.py


示例15: add_card

 def add_card(cls, card, comment=''):
     eid = integer(card, 1, 'eid')
     pid = integer(card, 2, 'pid')
     nids = [integer_or_blank(card, 3, 'n1', 0),
             integer_or_blank(card, 4, 'n2', 0)]
     assert len(card) <= 5, 'len(CDAMP5 card) = %i' % len(card)
     return CDAMP5(eid, pid, nids, comment=comment)
开发者ID:marcinch18,项目名称:pyNastran,代码行数:7,代码来源:damper.py


示例16: build

    def build(self):
        cards = self._cards
        ncards = len(cards)

        self.n = ncards
        if ncards:
            float_fmt = self.model.float_fmt
            self.nid = zeros(ncards, 'int32')
            self.temp = zeros(ncards, float_fmt)

            for i, card in enumerate(cards):
                #: Node ID
                self.nid[i] = integer(card, 1, 'nid')

                #: Grid point coordinate system
                self.cp[i] = integer_or_blank(card, 2, 'cp', cp0)

                x = double_or_blank(card, 3, 'x1', 0.)
                y = double_or_blank(card, 4, 'x2', 0.)
                z = double_or_blank(card, 5, 'x3', 0.)
                #: node location in local frame
                self.xyz[i] = [x, y, z]

                #: Analysis coordinate system
                self.cd[i] = integer_or_blank(card, 6, 'cd', cd0)

                #: SPC constraint
                self.ps[i] = integer_or_blank(card, 7, 'ps', ps0)

                #: Superelement ID
                self.seid[i] = integer_or_blank(card, 8, 'seid', seid0)
开发者ID:saullocastro,项目名称:pyNastran,代码行数:31,代码来源:temp.py


示例17: add_card

    def add_card(cls, card, comment=''):
        #: Property ID
        pid = integer(card, 1, 'pid')
        #: Material ID
        mid1 = integer_or_blank(card, 2, 'mid1', 0)
        t1 = double_or_blank(card, 3, 't1')

        mid2 = integer_or_blank(card, 4, 'mid2', 0)
        if mid2 > 0:
            i = double(card, 5, 'i')
            assert i > 0.0
        else:
            i = blank(card, 5, 'i')

        mid3 = integer(card, 6, 0)
        if mid3 > 0:
            t2 = double(card, 7, 't3')
            assert t2 > 0.0
        else:
            t2 = blank(card, 7, 't3')

        nsm = double(card, 8, 'nsm')
        z1 = double(card, 9, 'z1')
        z2 = double(card, 10, 'z2')

        j = 1
        phi = []
        for i in range(11, len(card)):
            phii = double(card, i, 'phi' % j)
            phi.append(phii)
            j += 1
        return PCONEAX(pid, mid1, t1, mid2, i, mid3, t2, nsm, z1, z2, phi,
                       comment=comment)
开发者ID:marcinch18,项目名称:pyNastran,代码行数:33,代码来源:properties.py


示例18: _read_shock

    def _read_shock(self, card, istart):
        """
        F(u, v) = Cv * S(u) * sign(v) * |v|^ev
        """
        self.shockType = string_or_blank(card, istart + 1, 'shockType')
        self.shockCVT = double(card, istart + 2, 'shockCVT')
        self.shockCVC = double_or_blank(card, istart + 3, 'shockCVC')
        self.shockExpVT = double_or_blank(card, istart + 4, 'shockExpVT', 1.0)
        self.shockExpVC = double_or_blank(card, istart + 5,
                                          'shockExpVC', self.shockExpVT)

        if self.shockType == 'TABLE':
            pass
            # self.shockIDTS = integer(card, istart + 6, 'shockIDTS')
            # self.shockIDETS = blank(card, istart + 9, 'shockIDETS')
            # self.shockIDECS = blank(card, istart + 10, 'shockIDECS')
            # self.shockIDETSD = blank(card, istart + 11, 'shockIDETSD')
            # self.shockIDECSD = blank(card, istart + 12, 'shockIDECSD')
        elif self.shockType == 'EQUAT':
            self.shockIDTS = blank(card, istart + 6, 'shockIDTS')
            self.shockIDETS = integer(card, istart + 9, 'shockIDETS')
            self.shockIDECS = integer_or_blank(card, istart + 10,
                                               'shockIDECS', self.shockIDETS)
            self.shockIDETSD = integer(card, istart + 11, 'shockIDETSD')
            self.shockIDECSD = integer_or_blank(card, istart + 11,
                                                'shockIDECSD', self.shockIDETSD)

            #def DEquation(self):
                #if isinstance(self.dequation, int):
                    #return self.dequation
                #return self.dequation.equation_id
        else:
            raise RuntimeError('Invalid shockType=%r on card\n%s' %(self.shockType, card))
        istart += 8
        return istart
开发者ID:marcinch18,项目名称:pyNastran,代码行数:35,代码来源:bush.py


示例19: add_card

    def add_card(self, card, comment=''):
        i = self.i
        self.element_id[i] = integer(card, 1, 'element_id')
        self.property_id[i] = integer(card, 2, 'property_id')

        print(card)
        self.node_ids[i, :] = [
            integer(card, 3, 'n1'),
            integer(card, 4, 'n2'),
            integer(card, 5, 'n3'),
            integer(card, 6, 'n4'),
            integer_or_blank(card, 7, 'n5', 0),
            integer_or_blank(card, 8, 'n6', 0),
            integer_or_blank(card, 9, 'n7', 0),
            integer_or_blank(card, 10, 'n8', 0)]

        self.thickness[i, :] = [
            double_or_blank(card, 11, 'T1', 1.0),
            double_or_blank(card, 12, 'T2', 1.0),
            double_or_blank(card, 13, 'T3', 1.0),
            double_or_blank(card, 14, 'T4', 1.0), ]

        #self.theta_mcid[i] = integer_double_or_blank(card, 15, 'theta_mcid', 0.0)
        self.zoffset[i] = double_or_blank(card, 16, 'zoffset', 0.0)
        self.t_flag[i] = integer_or_blank(card, 17, 'TFlag', 0)
        self.i += 1
开发者ID:saullocastro,项目名称:pyNastran,代码行数:26,代码来源:cquad8.py


示例20: add_card

 def add_card(self, card, comment=""):
     i = self.i
     self.element_id[i] = integer(card, 1, "eid")
     self.property_id[i] = integer_or_blank(card, 2, "pid", self.element_id[i])
     self.node_ids[i, :] = [integer(card, 3, "n1"), integer(card, 5, "n2")]
     self.components[i, :] = [integer_or_blank(card, 4, "c1", 0), integer_or_blank(card, 6, "c2", 0)]
     assert len(card) <= 7, "len(CELAS1 card) = %i\ncard=%s" % (len(card), card)
     self.i += 1
开发者ID:hurlei,项目名称:pyNastran,代码行数:8,代码来源:celas1.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python assign_type.string函数代码示例发布时间:2022-05-25
下一篇:
Python assign_type.integer函数代码示例发布时间: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