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

Python field_writer_8.set_blank_if_default函数代码示例

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

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



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

示例1: repr_fields

 def repr_fields(self):
     j = set_blank_if_default(self.j, 0.0)
     c = set_blank_if_default(self.c, 0.0)
     nsm = set_blank_if_default(self.nsm, 0.0)
     list_fields = [
         'CONROD', self.eid] + self.node_ids + [self.Mid(), self.A, j, c, nsm]
     return list_fields
开发者ID:marcinch18,项目名称:pyNastran,代码行数:7,代码来源:rods.py


示例2: write_card

    def write_card(self, bdf_file, size=8, element_ids=None):
        if self.n:
            if element_ids is None:
                i = arange(self.n)
            else:
                i = searchsorted(self.element_id, self.element_id)

            for (eid, pid, n, is_g0, g0, x, is_offt, offt, bit, pin, wa, wb, sa, sb) in zip(
                    self.element_id[i], self.property_id[i], self.node_ids[i],
                    self.is_g0[i], self.g0[i], self.x[i],
                    self.is_offt[i], self.offt[i], self.bit[i],
                    self.pin_flags[i], self.wa[i], self.wb[i], self.sa[i], self.sb[i]):

                x1 = g0 if is_g0 else x[0]
                x2 = 0 if is_g0 else x[1]
                x3 = 0 if is_g0 else x[2]
                offt_bit = offt if is_offt else bit
                #print('is_offt=%s offt=%s bit=%s offt_bit=%s' % (is_offt, offt, bit, offt_bit))

                pa = set_blank_if_default(pin[0], 0)
                pb = set_blank_if_default(pin[1], 0)

                w1a = set_blank_if_default(wa[0], 0.0)
                w2a = set_blank_if_default(wa[1], 0.0)
                w3a = set_blank_if_default(wa[2], 0.0)
                w1b = set_blank_if_default(wb[0], 0.0)
                w2b = set_blank_if_default(wb[1], 0.0)
                w3b = set_blank_if_default(wb[2], 0.0)

                sa = set_blank_if_default(sa, 0)
                sb = set_blank_if_default(sb, 0)
                card = ['CBEAM', eid, pid, n[0], n[1], x1, x2, x3, offt_bit,
                        pa, pb, w1a, w2a, w3a, w1b, w2b, w3b,
                        sa, sb]
                bdf_file.write(print_card_8(card))
开发者ID:hurlei,项目名称:pyNastran,代码行数:35,代码来源:cbeam.py


示例3: test_field_defaults

    def test_field_defaults(self):
        self.assertEqual(set_blank_if_default(0.0, 0.0), None,
                         set_blank_if_default(0.0, 0.0))

        self.assertEqual(set_blank_if_default(1.0, 0.0), 1.0,
                         set_blank_if_default(1.0, 0.0))

        # None
        self.assertEqual(set_default_if_blank(None, None), None,
                         set_default_if_blank(None, None))

        # floats
        self.assertEqual(set_default_if_blank(4.0, None), 4.0,
                         set_default_if_blank(4.0, None))
        self.assertEqual(set_default_if_blank(None, 4.0), 4.0,
                         set_default_if_blank(None, 4.0))

        # ints
        self.assertEqual(set_default_if_blank(4, None), 4,
                         set_default_if_blank(4, None))
        self.assertEqual(set_default_if_blank(None, 4), 4,
                         set_default_if_blank(None, 4))

        # strings
        self.assertEqual(set_default_if_blank('dummy', 'GGG'), 'dummy',
                         set_default_if_blank('dummy', 'GGG'))
        self.assertEqual(set_default_if_blank(None, 'GGG'), 'GGG',
                         set_default_if_blank(None, 'GGG'))
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:28,代码来源:test_field_writer.py


示例4: repr_fields

 def repr_fields(self):
     nodes = self.node_ids
     ge = set_blank_if_default(self.ge, 0.)
     s = set_blank_if_default(self.s, 0.)
     list_fields = ['CELAS2', self.eid, self.k, nodes[0], self.c1,
                    nodes[1], self.c2, ge, s]
     return list_fields
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:7,代码来源:springs.py


示例5: repr_fields

 def repr_fields(self):
     lid = set_blank_if_default(self.Lid(), -1e20)
     uid = set_blank_if_default(self.Uid(), 1e20)
     lowfq = set_blank_if_default(self.lowfq, 0.0)
     highfq = set_blank_if_default(self.highfq, 1e20)
     list_fields = ['DCONSTR', self.oid, self.Rid(), lid, uid, lowfq, highfq]
     return list_fields
开发者ID:HibernantBear,项目名称:pyNastran,代码行数:7,代码来源:optimization.py


示例6: repr_fields

 def repr_fields(self):
     nsm = set_blank_if_default(self.nsm, 0.)
     gamma = set_blank_if_default(self.gamma, 0.5)
     phi = set_blank_if_default(self.phi, 180.)
     fields = ['PRAC2D', self.pid, self.Mid(), self.thick,
               self.iPlane, nsm, gamma, phi]
     return fields
开发者ID:abk-ShuaiHaotian,项目名称:pyNastran,代码行数:7,代码来源:properties.py


示例7: repr_fields

 def repr_fields(self):
     film_node_id = set_blank_if_default(self.film_node_id, 0)
     ta2 = set_blank_if_default(self.ta2, self.ta1)
     mdot = set_blank_if_default(self.mdot, 1.0)
     list_fields = ['CONVM', self.eid, self.pconvmID, film_node_id,
                    self.cntmdot, self.ta1, ta2, mdot]
     return list_fields
开发者ID:watkinrt,项目名称:pyNastran,代码行数:7,代码来源:thermal.py


示例8: repr_fields

 def repr_fields(self):
     form = set_blank_if_default(self.form, 0)
     flag = set_blank_if_default(self.flag, 0)
     expr = set_blank_if_default(self.expr, 0.0)
     exppi = set_blank_if_default(self.exppi, 0.0)
     exppo = set_blank_if_default(self.exppo, 0.0)
     list_fields = ["PCONVM", self.pconid, self.mid, form, flag, self.coef, expr, exppi, exppo]
     return list_fields
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:8,代码来源:thermal.py


示例9: get_offt_bit_defaults

 def get_offt_bit_defaults(self):
     """
     offt doesn't exist in NX nastran
     """
     if self.is_offt:
         field8 = field8 = set_blank_if_default(self.offt, 'GGG')
     else:
         field8 = set_blank_if_default(self.bit, 0.0)
     return field8
开发者ID:marcinch18,项目名称:pyNastran,代码行数:9,代码来源:beam.py


示例10: repr_fields

 def repr_fields(self):
     #method = set_blank_if_default(self.method,1)
     racc = set_blank_if_default(self.racc, 0.)
     mb = set_blank_if_default(self.mb, 0)
     idrf = set_blank_if_default(self.idrf, 0)
     list_fields = ['RFORCE', self.sid, self.node_id, self.Cid(), self.scale,
                    self.r1, self.r2, self.r3, self.method, racc,
                    mb, idrf]
     return list_fields
开发者ID:saullocastro,项目名称:pyNastran,代码行数:9,代码来源:loads.py


示例11: repr_fields

 def repr_fields(self):
     xy = []
     for xi, yi in zip(self.x, self.y):
         xy.extend([xi, yi])
     xaxis = set_blank_if_default(self.xaxis, 'LINEAR')
     yaxis = set_blank_if_default(self.yaxis, 'LINEAR')
     list_fields = ['TABRND1', self.tid, xaxis, yaxis, None, None,
                    None, None, None] + xy + ['ENDT']
     return list_fields
开发者ID:marcinch18,项目名称:pyNastran,代码行数:9,代码来源:bdf_tables.py


示例12: repr_fields

    def repr_fields(self):
        film_node = set_blank_if_default(self.film_node, 0)
        cntrlnd = set_blank_if_default(self.cntrlnd, 0)

        ta0 = self.ta[0]
        ta = [ta0]
        for tai in self.ta[1:]:
            ta.append(set_blank_if_default(tai, ta0))
        list_fields = ['CONV', self.eid, self.pconID, film_node, cntrlnd] + ta
        return list_fields
开发者ID:marcinch18,项目名称:pyNastran,代码行数:10,代码来源:thermal.py


示例13: repr_fields

    def repr_fields(self):
        #method = set_blank_if_default(self.method,'INV')
        nep = set_blank_if_default(self.nep, 0)
        ndp = set_blank_if_default(self.ndp, 3 * self.nep)
        ndn = set_blank_if_default(self.ndn, 3 * self.nep)

        norm = set_blank_if_default(self.norm, 'MAX')
        list_fields = ['EIGB', self.sid, self.method, self.L1, self.L2, nep, ndp,
                       ndn, None, norm, self.G, self.C]
        return list_fields
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:10,代码来源:methods.py


示例14: raw_method

    def raw_method(self):
        list_fields = []
        if self.method in ['HESS', 'INV']:
            for (alphaA, omegaA, alphaB, omegaB, Lj, NEj, NDj) in zip(
                    self.alphaAjs, self.omegaAjs, self.alphaBjs, self.omegaBjs,
                    self.LJs, self.NEJs, self.NDJs):
                alphaA = set_blank_if_default(alphaA, 0.0)
                omegaA = set_blank_if_default(omegaA, 0.0)
                alphaB = set_blank_if_default(alphaB, 0.0)
                omegaB = set_blank_if_default(omegaB, 0.0)
                list_fields += [alphaA, omegaA, alphaB, omegaB, Lj, NEj, NDj, None]

        elif self.method == 'CLAN':
            assert len(self.alphaAjs) == len(self.omegaAjs)
            assert len(self.alphaAjs) == len(self.mblkszs)
            assert len(self.alphaAjs) == len(self.iblkszs)
            assert len(self.alphaAjs) == len(self.ksteps)
            assert len(self.alphaAjs) == len(self.NJIs)
            for (alphaA, omegaA, mblksz, iblksz, kstep, Nj) in zip(
                    self.alphaAjs, self.omegaAjs, self.mblkszs, self.iblkszs,
                    self.ksteps, self.NJIs):
                alphaA = set_blank_if_default(alphaA, 0.0)
                omegaA = set_blank_if_default(omegaA, 0.0)
                mblksz = set_blank_if_default(mblksz, 7)
                iblksz = set_blank_if_default(iblksz, 2)
                kstep = set_blank_if_default(kstep, 5)

                list_fields += [alphaA, omegaA, mblksz, iblksz,
                                kstep, None, Nj, None]
        else:
            msg = 'invalid EIGC method...method=%r' % self.method
            raise RuntimeError(msg)
        return list_fields
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:33,代码来源:methods.py


示例15: write_card

    def write_card(self, bdf_file, material_id=None, size=8, is_double=False):
        if self.n:
            if material_id is None:
                i = np.arange(self.n)
            else:
                if isinstance(material_id, int):
                    material_id = [material_id]
                i = np.searchsorted(self.material_id, material_id)

            #print('imat1 = ', i)
            #assert material_id is None, 'i=%i' % i
            #self.model.log.debug"n = %s" % self.n)
            #self.model.log.debug"mids MAT1 %s" % self.material_id)

            Rho = ['' if rhoi == 0.0 else rhoi for rhoi in self.rho[i]]
            A = ['' if ai == 0.0 else ai for ai in self.a[i]]
            TRef = ['' if trefi == 0.0 else trefi for trefi in self.TRef[i]]
            ge = ['' if gei == 0.0 else gei for gei in self.ge[i]]
            St = ['' if st == 0.0 else st for st in self.St[i]]
            Sc = ['' if sc == 0.0 else sc for sc in self.Sc[i]]
            Ss = ['' if ss == 0.0 else ss for ss in self.Ss[i]]

            if size == 8:
                fmt_card = print_card_8
                bdf_file.write('$MAT1        mid       E       G      nu     rho       a    TRef      ge\n')
                bdf_file.write('$             st      sc      ss   mcsid\n')
            else:
                bdf_file.write('$MAT1*               mid               E               G              nu\n')
                bdf_file.write('$*                   rho               a            TRef              ge\n')
                bdf_file.write('$*                   st              sc              ss           mcsid\n')
                if is_double:
                    fmt_card = print_card_double
                else:
                    fmt_card = print_card_16


            for (mid, E, G, nu, rho, a, TRef, ge, st, sc, ss, mcsid) in zip(
                    self.material_id[i], self.E[i], self.G[i], self.nu[i], Rho, A,
                    TRef, ge, St, Sc, Ss, self.mcsid[i]):
                if mid in self._comments:
                    bdf_file.write(self._comments[mid])

                #Gdefault = self.getG_default()
                Gdefault = self._G_default(E, G, nu)
                G = set_blank_if_default(G, Gdefault)
                #rho = set_blank_if_default(rho, 0.)
                #a = set_blank_if_default(a, 0.)
                #TRef = set_blank_if_default(TRef, 0.)
                #ge = set_blank_if_default(ge, 0.)
                #st = set_blank_if_default(st, 0.)
                #sc = set_blank_if_default(sc, 0.)
                #ss = set_blank_if_default(ss, 0.)
                mcsid = set_blank_if_default(mcsid, 0)
                card = ['MAT1', mid, E, G, nu, rho, a, TRef, ge, st, sc, ss, mcsid]
                bdf_file.write(fmt_card(card))
开发者ID:hurlei,项目名称:pyNastran,代码行数:55,代码来源:mat1.py


示例16: repr_fields

    def repr_fields(self):
        if self.g0 is not None:
            x = [self.g0, None, None]
        else:
            x = self.x

        ocid = set_blank_if_default(self.OCid(), -1)
        s = set_blank_if_default(self.s, 0.5)
        list_fields = (['CBUSH', self.eid, self.Pid(), self.Ga(), self.Gb()] +
                       x + [self.Cid(), s, ocid] + self.si)
        return list_fields
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:11,代码来源:bush.py


示例17: repr_fields

    def repr_fields(self):
        twelveIt3 = set_blank_if_default(self.twelveIt3, 1.0)
        tst = set_blank_if_default(self.tst, 0.833333)
        nsm = set_blank_if_default(self.nsm, 0.0)

        tOver2 = self.t / 2.
        z1 = set_blank_if_default(self.z1, -tOver2)
        z2 = set_blank_if_default(self.z2, tOver2)

        list_fields = ['PSHELL', self.pid, self.Mid1(), self.t, self.Mid2(),
                       twelveIt3, self.Mid3(), tst, nsm, z1, z2, self.Mid4()]
        return list_fields
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:12,代码来源:shell.py


示例18: write_card

    def write_card(self, f, size=8, element_ids=None):
        if self.n:
            if element_ids is None:
                i = arange(self.n)
            else:
                i = searchsorted(self.element_id, self.element_id)

            for (eid, pid, n, is_g0, g0, x, offt, pin, wa, wb) in zip(
                self.element_id[i], self.property_id[i], self.node_ids[i],
                self.is_g0[i], self.g0[i], self.x[i],
                self.offt[i],
                self.pin_flags[i], self.wa[i], self.wb[i]):

                pa = set_blank_if_default(pin[0], 0)
                pb = set_blank_if_default(pin[1], 0)

                w1a = set_blank_if_default(wa[0], 0.0)
                w2a = set_blank_if_default(wa[1], 0.0)
                w3a = set_blank_if_default(wa[2], 0.0)
                w1b = set_blank_if_default(wb[0], 0.0)
                w2b = set_blank_if_default(wb[1], 0.0)
                w3b = set_blank_if_default(wb[2], 0.0)
                x1 = g0 if is_g0 else x[0]
                x2 = 0 if is_g0 else x[1]
                x3 = 0 if is_g0 else x[2]

                offt = set_string8_blank_if_default(offt, 'GGG')
                card = ['CBAR', eid, pid, n[0], n[1], x1, x2, x3, offt,
                        pa, pb, w1a, w2a, w3a, w1b, w2b, w3b]
                if size == 8:
                    f.write(print_card_8(card))
                else:
                    f.write(print_card_16(card))
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:33,代码来源:cbar.py


示例19: write_card

    def write_card(self, bdf_file, size=8, property_id=None):
        if self.n:
            #print("PSOLID.property_id =", self.property_id)
            for(pid, mid, cordm, integ, stress, isop, fctn) in zip(
                self.property_id, self.material_id, self.cordm,
                self.integ, self.stress, self.isop, self.fctn):
                if pid in self._comments:
                    bdf_file.write(self._comments[pid])

                cordm = set_blank_if_default(cordm, 0)
                fctn = set_blank_if_default(fctn, 'SMECH')
                card = ['PSOLID', pid, mid, cordm, integ,
                        stress, isop, fctn]
                bdf_file.write(print_card_8(card))
开发者ID:hurlei,项目名称:pyNastran,代码行数:14,代码来源:psolid.py


示例20: repr_fields

    def repr_fields(self):
        """
        Gets the fields in their simplified form

        Returns
        -------
        fields : List[int/float/str]
            the fields that define the card
        """
        cp = set_blank_if_default(self.Cp(), 0)
        cd = set_blank_if_default(self.Cd(), 0)
        seid = set_blank_if_default(self.SEid(), 0)
        list_fields = ['GRID', self.nid, cp] + list(self.xyz) + [cd, self.ps,
                                                                 seid]
        return list_fields
开发者ID:hurlei,项目名称:pyNastran,代码行数:15,代码来源:nodes.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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