当前位置: 首页>>代码示例>>Python>>正文


Python assign_type.integer_or_blank函数代码示例

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


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

示例1: __init__

    def __init__(self, card=None, data=None, comment=""):
        LineDamper.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.eid = integer(card, 1, "eid")
            self.pid = integer(card, 2, "pid")
            nids = [integer_or_blank(card, 3, "g1", 0), integer_or_blank(card, 5, "g2", 0)]

            #: component number
            self.c1 = integer_or_blank(card, 4, "c1", 0)
            self.c2 = integer_or_blank(card, 6, "c2", 0)
            assert len(card) <= 7, "len(CDAMP1 card) = %i" % len(card)
        else:
            self.eid = data[0]
            self.pid = data[1]
            nids = [data[2], data[4]]
            self.c1 = data[3]
            self.c2 = data[5]

        self.prepare_node_ids(nids, allow_empty_nodes=True)
        assert len(self.nodes) == 2
        msg = "on\n%s\n is invalid validComponents=[0,1,2,3,4,5,6]" % str(self)
        assert self.c1 in [0, 1, 2, 3, 4, 5, 6], "c1=|%s| %s" % (self.c1, msg)
        assert self.c2 in [0, 1, 2, 3, 4, 5, 6], "c2=|%s| %s" % (self.c2, msg)
开发者ID:HibernantBear,项目名称:pyNastran,代码行数:25,代码来源:damper.py

示例2: __init__

 def __init__(self, card=None, data=None, comment=''):
     Property.__init__(self, card, data)
     if comment:
         self._comment = comment
     if card:
         #: Property ID
         self.pid = integer(card, 1, 'pid')
         #: diameter of the fastener
         self.d = double(card, 2, 'd')
         assert self.d > 0
         #: Specifies the element stiffness coordinate system
         self.mcid = integer_or_blank(card, 3, 'mcid', -1)
         assert self.mcid >= -1
         self.mflag = integer_or_blank(card, 4, 'mflag', 0)  # 0-absolute 1-relative
         assert self.mflag in [0, 1]
         #: stiffness values in directions 1-3
         self.kt1 = double(card, 5, 'kt1')
         self.kt2 = double(card, 6, 'kt2')
         self.kt3 = double(card, 7, 'kt3')
         #: Rotational stiffness values in directions 1-3
         self.kr1 = double_or_blank(card, 8, 'kr1', 0.0)
         self.kr2 = double_or_blank(card, 9, 'kr2', 0.0)
         self.kr3 = double_or_blank(card, 10, 'kr3', 0.0)
         #: Lumped mass of fastener
         self.mass = double_or_blank(card, 11, 'mass', 0.0)
         #: Structural damping
         self.ge = double_or_blank(card, 12, 'ge', 0.0)
         assert len(card) <= 13, 'len(PFAST card) = %i' % len(card)
     else:
         raise NotImplementedError(data)
开发者ID:anick107,项目名称:von_mises_rms,代码行数:30,代码来源:properties.py

示例3: __init__

    def __init__(self, card=None, data=None, comment=''):
        SpringElement.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.eid = integer(card, 1, 'eid')

            #: property ID
            self.pid = integer_or_blank(card, 2, 'pid', self.eid)

            nids = [integer(card, 3, 'g1'), integer_or_blank(card, 5, 'g2', 0)]
            #: component number
            self.c1 = integer_or_blank(card, 4, 'c1', 0)
            self.c2 = integer_or_blank(card, 6, 'c2', 0)
            assert len(card) <= 7, 'len(CELAS1 card) = %i' % len(card)
        else:
            self.eid = data[0]
            self.pid = data[1]
            nids = [data[2], data[3]]
            self.c1 = data[4]
            self.c2 = data[5]

        msg = 'on\n%s\n is invalid validComponents=[0,1,2,3,4,5,6]' % str(self)
        assert self.c1 in [0, 1, 2, 3, 4, 5, 6], 'c1=|%s| %s' % (self.c1, msg)
        assert self.c2 in [0, 1, 2, 3, 4, 5, 6], 'c2=|%s| %s' % (self.c2, msg)
        self.prepareNodeIDs(nids, allowEmptyNodes=True)
        assert len(self.nodes) == 2
开发者ID:sukhbinder,项目名称:cyNastran,代码行数:27,代码来源:springs.py

示例4: getShockA

    def getShockA(self, card, iStart):
        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)
        else:
            raise RuntimeError('Invalid shockType=|%s| on card\n%s' %(self.shockType, card))

        iStart += 8
        return iStart
开发者ID:sukhbinder,项目名称:cyNastran,代码行数:28,代码来源:bush.py

示例5: 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]), 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:ClaesFredo,项目名称:pyNastran,代码行数:27,代码来源:test_assign_type.py

示例6: add

    def add(self, card, comment=''):
        cp0 = self.model.grdset.cp
        cd0 = self.model.grdset.cd
        ps0 = self.model.grdset.ps
        seid0 = self.model.grdset.seid

        i = self.i
        #: Node ID
        self.node_id[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)
        self.i += 1
开发者ID:umvarma,项目名称:pynastran,代码行数:28,代码来源:grid.py

示例7: __init__

    def __init__(self, card=None, data=None, comment=''):
        LineDamper.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.eid = integer(card, 1, 'eid')
            self.pid = integer(card, 2, 'pid')
            nids = [integer_or_blank(card, 3, 'g1', 0),
                    integer_or_blank(card, 5, 'g2', 0)]

            #: component number
            self.c1 = integer_or_blank(card, 4, 'c1', 0)
            self.c2 = integer_or_blank(card, 6, 'c2', 0)
            assert len(card) <= 7, 'len(CDAMP1 card) = %i' % len(card)
        else:
            self.eid = data[0]
            self.pid = data[1]
            nids = [data[2], data[4]]
            self.c1 = data[3]
            self.c2 = data[5]

        self.prepare_node_ids(nids, allow_empty_nodes=True)
        assert len(self.nodes) == 2
        msg = 'on\n%s\n is invalid validComponents=[0,1,2,3,4,5,6]' % str(self)
        assert self.c1 in [0, 1, 2, 3, 4, 5, 6], 'c1=|%s| %s' % (self.c1, msg)
        assert self.c2 in [0, 1, 2, 3, 4, 5, 6], 'c2=|%s| %s' % (self.c2, msg)
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:26,代码来源:damper.py

示例8: __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

示例9: __init__

    def __init__(self, card=None, data=None, comment=''):
        Property.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Property ID
            self.pid = integer(card, 1, 'pid')
            #: Material ID
            self.mid1 = integer_or_blank(card, 2, 'mid1', 0)
            self.t1 = double_or_blank(card, 3, 't1')

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

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

            self.nsm = double(card, 8, 'nsm')
            self.z1 = double(card, 9, 'z1')
            self.z2 = double(card, 10, 'z2')
            self.phi = fields(double, card, 'phi', i=11, j=len(card))
        else:
            raise NotImplementedError(data)
开发者ID:sukhbinder,项目名称:cyNastran,代码行数:31,代码来源:properties.py

示例10: 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.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.thetaMcid[i] = integer_double_or_blank(card, 15, 'thetaMcid', 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:umvarma,项目名称:pynastran,代码行数:26,代码来源:cquad8.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' % len(card)
        self.i += 1
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:28,代码来源:caero1.py

示例12: __init__

    def __init__(self, card=None, data=None, comment=''):
        if comment:
            self._comment = comment
        if card:
            #: Set identification number
            self.sid = integer(card, 1, 'sid')
            #: Coordinate system identification number.
            self.cid = integer_or_blank(card, 2, 'cid', 0)
            #: scale factor
            self.scale = double(card, 3, 'scale')
            #: Acceleration vector components measured in coordinate system CID
            self.N = array([double_or_blank(card, 4, 'N1', 0.0),
                            double_or_blank(card, 5, 'N2', 0.0),
                            double_or_blank(card, 6, 'N3', 0.0)])
            #: Indicates whether the CID coordinate system is defined in the
            #: main Bulk Data Section (MB = -1) or the partitioned superelement
            #: Bulk Data Section (MB = 0). Coordinate systems referenced in the
            #: main Bulk Data Section are considered stationary with respect to
            #: the assembly basic coordinate system. See Remark 10.
            #: (Integer; Default = 0)
            self.mb = integer_or_blank(card, 7, 'mb', 0)
            assert len(card) <= 8, 'len(GRAV card) = %i' % len(card)
        else:
            self.sid = data[0]
            self.cid = data[1]
            self.a = data[2]
            self.N = array(data[3:6])
            self.mb = data[6]
            self.scale = 1.
            assert len(data) == 7

        assert not allclose(max(abs(self.N)), 0.), ('GRAV N is a zero vector, '
                                                   'N=%s' % (str(self.N)))
开发者ID:anick107,项目名称:von_mises_rms,代码行数:33,代码来源:staticLoads.py

示例13: __init__

    def __init__(self, card=None, data=None, comment=''):
        LineElement.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.eid = integer(card, 1, 'eid')
            self.pid = integer_or_blank(card, 2, 'pid', self.eid)
            self.ga = integer(card, 3, 'ga')
            self.gb = integer(card, 4, 'gb')
            self.gc = integer(card, 5, 'gc')

            self.initX_G0(card)

            self.wa = 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')

            self.wb = 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')

            self.wc = 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')

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

            self.s = 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' % len(card)
        else:
            raise NotImplementedError(data)
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:35,代码来源:bars.py

示例14: __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

示例15: __init__

    def __init__(self, card=None, data=None, comment=""):
        ThermalElement.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Surface element ID number for a side of an
            #: element. (0 < Integer < 100,000,000)
            self.eid = integer(card, 1, "eid")

            #: A heat conduction element identification
            self.eid2 = integer(card, 2, "eid2")

            #: A consistent element side identification number
            #: (1 < Integer < 6)
            self.side = integer(card, 3, "side")
            assert 0 < self.side < 7

            #: 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)

            #: 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)
            assert len(card) <= 8, "len(CHBDYE card) = %i" % len(card)
        else:
            raise NotImplementedError(data)
        self.grids = []
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:32,代码来源:thermal.py


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