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


Python assign_type.double_or_blank函数代码示例

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


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

示例1: 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

示例2: add_card

 def add_card(cls, card, icard=0, comment=''):
     noffset = icard * 5
     pid = integer(card, 1 + noffset, 'pid')
     k = double(card, 2 + noffset, 'k')
     ge = double_or_blank(card, 3 + noffset, 'ge', 0.)
     s = double_or_blank(card, 4 + noffset, 's', 0.)
     return PELAS(pid, k, ge, s, comment=comment)
开发者ID:marcinch18,项目名称:pyNastran,代码行数:7,代码来源:springs.py

示例3: add_card

    def add_card(cls, card, comment='', sol=101):
        csid = integer(card, 1, 'csid')
        sids = []
        tids = []
        frictions = []
        min_distances = []
        max_distances = []

        nfields = card.nfields
        i = 2
        j = 1
        while i < nfields:
            sids.append(integer(card, i, 'sid%s' % j))
            tids.append(integer(card, i + 1, 'tid%s' % j))
            frictions.append(double_or_blank(card, i + 2, 'fric%s' % j, 0.0))
            if sol == 101:
                min_distances.append(double_or_blank(card, i + 3, 'mind%s' % j, 0.0))
                max_distances.append(double_or_blank(card, i + 4, 'maxd%s' % j, 0.0))
            else:
                min_distances.append(None)
                max_distances.append(None)
            i += 8
            j += 1
        return BCTSET(csid, sids, tids, frictions, min_distances,
                      max_distances, comment=comment,
                      sol=sol)
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:26,代码来源:contact.py

示例4: add_card

 def add_card(cls, card, comment=''):
     pid = integer(card, 1, 'pid')
     af = double_or_blank(card, 2, 'af')
     d1 = double_or_blank(card, 3, 'd1')
     d2 = double_or_blank(card, 4, 'd2', d1)
     assert len(card) <= 5, 'len(PHBDY card) = %i' % len(card)
     return PHBDY(pid, af, d1, d2, comment=comment)
开发者ID:marcinch18,项目名称:pyNastran,代码行数:7,代码来源:thermal.py

示例5: set_E_G_nu

    def set_E_G_nu(self, i, card):
        r"""
        \f[ G = \frac{E}{2 (1+\nu)} \f]
        """
        E = double_or_blank(card, 2, 'E')
        G = double_or_blank(card, 3, 'G')
        nu = double_or_blank(card, 4, 'nu')

        if G is None and E is None:  # no E,G
            raise RuntimeError('G=%s E=%s cannot both be None' % (G, E))
        elif E is not None and G is not None and nu is not None:
            pass
        elif E is not None and nu is not None:
            G = E / 2. / (1 + nu)
        elif G is not None and nu is not None:
            E = 2 * (1 + nu) * G
        elif G is not None and E is not None:
            nu = E / (2 * G) - 1.
        elif G is None and nu is None:
            G = 0.0
            nu = 0.0
        elif E is None and nu is None:
            E = 0.0
            nu = 0.0
        else:
            msg = 'G=%s E=%s nu=%s' % (G, E, nu)
            raise RuntimeError(msg)
        #self.model.log.debug('G = %s' % G)
        self.E[i] = E
        self.G[i] = G
        self.nu[i] = nu
开发者ID:hurlei,项目名称:pyNastran,代码行数:31,代码来源:mathp.py

示例6: add_card

 def add_card(cls, card, comment=''):
     pid = integer(card, 1, 'pid')
     mid = integer(card, 2, 'mid')
     gamma = double_or_blank(card, 3, 'gamma', 0.5)
     phi = double_or_blank(card, 4, 'gamma', 180.)
     assert len(card) <= 5, 'len(PRAC3D card) = %i' % len(card)
     return PRAC3D(pid, mid, gamma, phi, comment=comment)
开发者ID:marcinch18,项目名称:pyNastran,代码行数:7,代码来源:properties.py

示例7: 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')
        x1_g0 = integer_double_or_blank(card, 5, 'x1_g0', 0.0)
        if isinstance(x1_g0, integer_types):
            g0 = x1_g0
            x = None
        elif isinstance(x1_g0, float):
            g0 = None
            x = np.array([double_or_blank(card, 5, 'x1', 0.0),
                          double_or_blank(card, 6, 'x2', 0.0),
                          double_or_blank(card, 7, 'x3', 0.0)], dtype='float64')
            if norm(x) == 0.0:
                msg = 'G0 vector defining plane 1 is not defined.\n'
                msg += 'G0 = %s\n' % g0
                msg += 'X  = %s\n' % x
                raise RuntimeError(msg)
        else:
            raise ValueError('invalid x1Go=%r on CBEND' % x1_g0)
        geom = integer(card, 8, 'geom')

        assert len(card) == 9, 'len(CBEND card) = %i\ncard=%s' % (len(card), card)
        return CBEND(eid, pid, ga, gb, g0, x, geom, comment=comment)
开发者ID:hurlei,项目名称:pyNastran,代码行数:25,代码来源:bars.py

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

示例9: add_card

    def add_card(cls, card, comment=''):
        eid = integer(card, 1, 'eid')
        pid = integer(card, 2, 'pid')

        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

        iViewFront = integer_or_blank(card, 4, 'iViewFront', 0)
        iViewBack = integer_or_blank(card, 5, 'iViewBack', 0)
        g1 = integer(card, 6, 'g1')

        if Type != 'POINT':
            g2 = integer(card, 7, 'g2')
        else:
            g2 = blank(card, 7, 'g2')

        g0 = integer_or_blank(card, 8, 'g0', 0)
        radMidFront = integer_or_blank(card, 9, 'radMidFront', 0)
        radMidBack = integer_or_blank(card, 10, 'radMidBack', 0)
        gmid = integer_or_blank(card, 11, 'gmid')
        ce = integer_or_blank(card, 12, 'ce', 0)
        e1 = double_or_blank(card, 13, 'e3')
        e2 = double_or_blank(card, 14, 'e3')
        e3 = double_or_blank(card, 15, 'e3')
        assert len(card) <= 16, 'len(CHBDYP card) = %i\ncard=%s' % (len(card), card)
        return CHBDYP(eid, pid, Type, g1, g2, g0=g0, gmid=gmid, ce=ce,
                      iViewFront=iViewFront, iViewBack=iViewBack,
                      radMidFront=radMidFront, radMidBack=radMidBack,
                      e1=e1, e2=e2, e3=e3, comment=comment)
开发者ID:FrankNaets,项目名称:pyNastran,代码行数:31,代码来源:thermal.py

示例10: add_card

    def add_card(self, card, comment=''):
        if comment:
            self._comment = comment
        pid = integer(card, 1, 'pid')
        k = double_or_blank(card, 2, 'k', 0.0)
        c = double_or_blank(card, 3, 'c', 0.0)
        m = double_or_blank(card, 4, 'm', 0.0)

        sa = double_or_blank(card, 6, 'sa', 0.0)
        se = double_or_blank(card, 7, 'se', 0.0)

        nfields = card.nfields
        self.vars = []
        istart = 9
        while istart < nfields:
            pname = string(card, istart, 'pname')
            if pname == 'SHOCKA':
                istart = self._read_shock(card, istart)
            elif pname == 'SPRING':
                self._read_spring(card, istart)
            elif pname == 'DAMPER':
                self._read_damper(card, istart)
            elif pname == 'GENER':
                self._read_gener(card, istart)
            else:
                break
            istart += 8

        self.pid = pid
        self.k = k
        self.c = c
        self.m = m

        self.sa = sa
        self.se = se
开发者ID:marcinch18,项目名称:pyNastran,代码行数:35,代码来源:bush.py

示例11: build

    def build(self):
        """
        :param cards: the list of MOMENT cards
        """
        cards = self._cards
        ncards = len(cards)
        self.n = ncards
        if ncards:
            float_fmt = self.model.float
            #: Property ID
            self.load_id = zeros(ncards, 'int32')
            self.node_id = zeros(ncards, 'int32')
            self.coord_id = zeros(ncards, 'int32')
            self.mag = zeros(ncards, float_fmt)
            self.xyz = zeros((ncards, 3), float_fmt)

            for i, card in enumerate(cards):
                self.load_id[i] = integer(card, 1, 'sid')
                self.node_id[i] = integer(card, 2, 'node')
                self.coord_id[i] = integer_or_blank(card, 3, 'cid', 0)
                self.mag[i] = double(card, 4, 'mag')
                xyz = [double_or_blank(card, 5, 'X1', 0.0),
                       double_or_blank(card, 6, 'X2', 0.0),
                       double_or_blank(card, 7, 'X3', 0.0)]
                self.xyz[i] = xyz
                assert len(card) <= 8, 'len(MOMENT card) = %i\ncard=%s' % (len(card), card)

            i = self.load_id.argsort()
            self.load_id = self.load_id[i]
            self.node_id = self.node_id[i]
            self.coord_id = self.coord_id[i]
            self.mag = self.mag[i]
            self.xyz = self.xyz[i]
            self._cards = []
            self._comments = []
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:35,代码来源:moment.py

示例12: loadHESS_INV

    def loadHESS_INV(self, nrows, card):
        alphaOmega_default = None
        LJ_default = None
        if self.method == 'INV':
            alphaOmega_default = 0.0
            LJ_default = 1.0

        for irow in range(nrows):
            NEj = integer(card, 9 + 7 * irow + 5, 'NE%s' % str(irow))
            NDJ_default = None
            if self.method == 'INV':
                NDJ_default = 3 * NEj

            i = 9 + 8 * irow
            self.alphaAjs.append(
                double_or_blank(card, i, 'alphaA' + str(irow), alphaOmega_default))
            self.omegaAjs.append(
                double_or_blank(card, i + 1, 'omegaA' + str(irow), alphaOmega_default))
            self.alphaBjs.append(
                double_or_blank(card, i + 2, 'alphaB' + str(irow), alphaOmega_default))
            self.omegaBjs.append(
                double_or_blank(card, i + 3, 'omegaB' + str(irow), alphaOmega_default))
            self.LJs.append(
                double_or_blank(card, i + 4, 'LJ' + str(irow), LJ_default))
            self.NEJs.append(
                integer(card, i + 5, 'NEJ' + str(irow)))
            self.NDJs.append(
                integer_or_blank(card, i + 6, 'NDJ' + str(irow), NDJ_default))
开发者ID:watkinrt,项目名称:pyNastran,代码行数:28,代码来源:methods.py

示例13: 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

示例14: add_card

    def add_card(cls, card, comment=''):
        conid = integer(card, 1, 'conid')
        gids = []
        constraints = []
        enforced = []

        fields = card.fields(0)
        nfields = len(fields)

        i = 1
        for ifield in range(2, nfields, 8):
            grid = integer(card, ifield, 'G%i' % i)
            component = components_or_blank(card, ifield + 1, 'constraint%i' % i, 0)  # scalar point
            if i == 1:
                enforcedi = double(card, ifield + 2, 'enforced%i' % i)
                if enforcedi == 0.0:
                    raise RuntimeError('enforced1 must be nonzero; enforcedi=%r' % enforcedi)
            else:
                enforcedi = double_or_blank(card, ifield + 2, 'enforced%i' % i, 0.0)
            gids.append(grid)
            constraints.append(component)
            enforced.append(enforcedi)
            i += 1

            if ifield + 4 > nfields and i != 2:
                # if G2 is empty (it's ifield+4 because nfields is length based and not loop friendly)
                break
            grid = integer(card, ifield + 3, 'G%i' % i)
            component = components_or_blank(card, ifield + 4, 'constraint%i' % i, 0)  # scalar point
            enforcedi = double_or_blank(card, ifield + 5, 'enforced%i' % i)
            gids.append(grid)
            constraints.append(component)
            enforced.append(enforcedi)
            i += 1
        return MPC(conid, gids, constraints, enforced, comment=comment)
开发者ID:marcinch18,项目名称:pyNastran,代码行数:35,代码来源:constraints.py

示例15: 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


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