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

Python field_writer_16.print_card_16函数代码示例

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

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



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

示例1: write_card

    def write_card(self, size=8, is_double=False):
        msg = '\n$' + '-' * 80
        msg += '\n$ %s Matrix %s\n' % ('DMI', self.name)
        list_fields = ['DMI', self.name, 0, self.form, self.tin,
                       self.tout, None, self.nRows, self.nCols]
        if size == 8:
            msg += print_card_8(list_fields)
        #elif is_double:
            #msg += print_card_double(list_fields)
        else:
            msg += print_card_16(list_fields)
        #msg += self.print_card(list_fields,size=16,isD=False)

        if self.is_complex():
            for (gci, gcj, reali, imagi) in zip(self.GCi, self.GCj, self.Real, self.Complex):
                list_fields = ['DMI', self.name, gcj, gci, reali, imagi]
                if size == 8:
                    msg += print_card_8(list_fields)
                elif is_double:
                    msg += print_card_double(list_fields)
                else:
                    msg += print_card_16(list_fields)
        else:
            for (gci, gcj, reali) in zip(self.GCi, self.GCj, self.Real):
                list_fields = ['DMI', self.name, gcj, gci, reali]
                if size == 8:
                    msg += print_card_8(list_fields)
                elif is_double:
                    msg += print_card_double(list_fields)
                else:
                    msg += print_card_16(list_fields)
        return msg
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:32,代码来源:dmig.py


示例2: write_card

    def write_card(self, size=8, is_double=False):
        """
        .. todo:: support double precision
        """
        msg = '\n$' + '-' * 80
        msg += '\n$ %s Matrix %s\n' % (self.type, self.name)
        list_fields = [self.type, self.name, 0, self.ifo, self.tin,
                       self.tout, self.polar, None, self.ncols]
        if size == 8:
            msg += print_card_8(list_fields)
        else:
            msg += print_card_16(list_fields)

        if self.is_complex():
            if self.is_polar():
                for (GCi, GCj, reali, complexi) in zip(self.GCi, self.GCj, self.Real, self.Complex):
                    magi = sqrt(reali**2 + complexi**2)
                    if reali == 0.0:
                        phasei = 0.0
                    else:
                        phasei = degrees(atan2(complexi, reali))
                    list_fields = [self.type, self.name, GCj[0], GCj[1],
                                   None, GCi[0], GCi[1], magi, phasei]
                    if size == 8:
                        msg += print_card_8(list_fields)
                    elif is_double:
                        msg += print_card_double(list_fields)
                    else:
                        msg += print_card_16(list_fields)
            else:
                for (GCi, GCj, reali, complexi) in zip(self.GCi, self.GCj, self.Real, self.Complex):
                    list_fields = [self.type, self.name, GCj[0], GCj[1],
                                   None, GCi[0], GCi[1], reali, complexi]
                    if size == 8:
                        msg += print_card_8(list_fields)
                    elif is_double:
                        msg += print_card_double(list_fields)
                    else:
                        msg += print_card_16(list_fields)
        else:
            for (GCi, GCj, reali) in zip(self.GCi, self.GCj, self.Real):
                list_fields = [self.type, self.name, GCj[0], GCj[1],
                               None, GCi[0], GCi[1], reali, None]
                if size == 8:
                    msg += print_card_8(list_fields)
                elif is_double:
                    msg += print_card_double(list_fields)
                else:
                    msg += print_card_16(list_fields)
        return msg
开发者ID:FrankNaets,项目名称:pyNastran,代码行数:50,代码来源:dmig.py


示例3: cogsg_bc_to_nastran

def cogsg_bc_to_nastran(cogsg_filename, bc_filename, nastran_filename,
                        include_shells=True, include_solids=False):
    """
    converts a *.cogsg and a *.bc file to a *.bdf file
    """
    model = Usm3d(log=None, debug=None)
    nodes, tets = model.read_cogsg(cogsg_filename, stop_after_header=False)
    assert tets.min() == 0, tets.min()

    if not include_shells or include_solids:
        msg = 'include_shells=%r include_solids=%r; one/both must be True' % (
            include_shells, include_solids)
        raise RuntimeError(msg)

    bcs = [0]
    if include_shells:
        header, tris, bcs = model.read_bc(bc_filename)

    with open(nastran_filename, 'w') as bdf_file:
        bdf_file.write('$ pyNastran : punch=True\n')

        if include_solids:
            for nid, (x, y, z) in zip(count(), nodes):
                bdf_file.write(print_card_16(['GRID', nid + 1, '', x, y, z]))
        else:
            nids = np.unique(tris.ravel())
            for nid in nids:
                x, y, z = nodes[nid, :]
                bdf_file.write(print_card_16(['GRID', nid + 1, '', x, y, z]))

        if include_shells:
            for itri, tri, bc in zip(count(), tris + 1, bcs):
                bdf_file.write(
                    print_card_8(['CTRIA3', itri + 1, bc] + list(tri))
                )

            mid = 1
            for bc in np.unique(bcs):
                bdf_file.write(print_card_8(['PSHELL', bc, mid, 0.1]))
            bdf_file.write(print_card_8(['MAT1', mid, 3.0e7, None, 0.3]))

        if include_solids:
            pid = max(bcs) + 1
            mid = 2
            for itet, tet in zip(count(), tets + 1):
                print_card_8(['CTETRA', itet + 1, pid] + list(tet))
            bdf_file.write(print_card_8(['PSOLID', pid, mid]))
            bdf_file.write(print_card_8(['MAT1', mid, 3.0e7, None, 0.3]))
开发者ID:saullocastro,项目名称:pyNastran,代码行数:48,代码来源:bc_to_nastran.py


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


示例5: print_card

def print_card(fields, size=8, is_double=False):
    """
    Prints a card in 8-character of 16-character Nastran format.

    Parameters
    ----------
    fields : List[int/float/str/None]
        all the fields in the BDF card (no trailing Nones)
    size : int; default=8
        the size of the field (8/16)
    is_double : bool; default=False
        is the card double precision?
        Double precision applies to specific cards and turns
        1.234E+5 into 1.234D+5.  Applies to GRID, CORDx only?

    Returns
    -------
    card : str
        string representation of the card

    .. note:: be careful of using is_double on cards that aren't
              GRID or CORDx
    """
    if size == 8:
        return print_card_8(fields)
    elif is_double:
        return print_card_double(fields)
    return print_card_16(fields)
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:28,代码来源:field_writer.py


示例6: write_card

 def write_card(self, size=8, is_double=False):
     card = self.raw_fields()
     if size == 8:
         return self.comment + print_card_8(card)
     if is_double:
         return self.comment + print_card_double(card)
     return self.comment + print_card_16(card)
开发者ID:saullocastro,项目名称:pyNastran,代码行数:7,代码来源:loads.py


示例7: write_card

 def write_card(self, bdf_file, size=8):
     card = ['SPCADD', self.spc_id] + self.spc_ids
     #print("card = ", card)
     if size == 8:
         bdf_file.write(print_card_8(card))
     else:
         bdf_file.write(print_card_16(card))
开发者ID:saullocastro,项目名称:pyNastran,代码行数:7,代码来源:spcadd.py


示例8: write_card

 def write_card(self, bdf_file, size=8):
     card = ['NLPCI', self.nlpci_id, self.Type, self.minalr,
             self.maxalr, self.scale, None, self.desiter, self.mxinc]
     if size == 8:
         bdf_file.write(print_card_8(card))
     else:
         bdf_file.write(print_card_16(card))
开发者ID:hurlei,项目名称:pyNastran,代码行数:7,代码来源:nlpci.py


示例9: write_card

    def write_card(self, f, size=8, property_id=None):
        #print('PBARL.n = %s' % self.n)
        if self.n:
            if property_id is None:
                i = arange(self.n)
            else:
                i = searchsorted(self.property_id, property_id)
            #print('i = %s' % i)
            #cid = [cid if cid != 0 else '' for cid in self.coord_id]

            #group = set_blank_if_default(self.group, 'MSCBMLO')
            #list_fields = ['PBARL', self.pid, self.Mid(), group, self.Type, None,
                           #None, None, None] + self.dim + [self.nsm]

            #self.model.log.debug('*pbarl write pids=%s' % self.property_id)
            for (j, pid, mid, group, Type, nsm) in zip(count(), self.property_id[i], self.material_id[i],
                                                       self.group[i], self.Type[i], self.nsm[i]):
                dim = self.dim[j]
                sgroup = set_blank_if_default(group, 'MSCBMLO')

                list_fields = ['PBARL', pid, mid, group, Type, None,
                               None, None, None] + dim + [nsm]
                if size == 8:
                    f.write(print_card_8(list_fields))
                else:
                    f.write(print_card_16(list_fields))
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:26,代码来源:pbarl.py


示例10: write_card

 def write_card(self, f, size=8, is_double=False):
     if self.n:
         card = ['GRDSET', None, self.cp, None, None, None, self.cd, self.seid]
         if size == 8:
             f.write(print_card_8(card))
         else:
             f.write(print_card_16(card))
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:7,代码来源:grid.py


示例11: write_card

 def write_card(self, f, size=8):
     card = ['SPCADD', self.spc_id] + self.spc_ids
     #print "card = ", card
     if size == 8:
         f.write(print_card_8(card))
     else:
         f.write(print_card_16(card))
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:7,代码来源:spcadd.py


示例12: write_card

 def write_card(self, f, size=8):
     for comp, nodes in iteritems(self.components):
         card = ['SPC1', self.constraint_id, comp] + list(nodes)
         if size == 8:
             f.write(print_card_8(card))
         else:
             f.write(print_card_16(card))
开发者ID:HibernantBear,项目名称:pyNastran,代码行数:7,代码来源:spc1.py


示例13: write_card

    def write_card(self, f, size=8, is_double=True, element_id=None):
        assert size in [8, 16], size
        assert is_double in [True, False], is_double
        if self.n:
            if element_id is None:
                i = arange(self.n)
            else:
                #assert len(unique(element_id))==len(element_id), unique(element_id)
                i = searchsorted(self.element_id, element_id)

            Cid = [cid if cid != 0 else '' for cid in self.coord_id[i]]
            Nspan = [nspan if nspan != 0 else '' for nspan in self.nspan[i]]
            Nchord = [nchord if nchord != 0 else '' for nchord in self.nchord[i]]

            Igid = self.igid[i]
            Lspan = [lspan if lspan != 0. else '' for lspan in self.lspan[i]]
            Lchord = [lchord if lchord != 0. else '' for lchord in self.lchord[i]]

            for (eid, pid, cid, nspan, nchord, lspan, lchord, igid,
                 p1, x12, p4, x43) in zip(self.element_id[i], self.property_id[i],
                 Cid, Nspan, Nchord, Lspan, Lchord, Igid,
                 self.p1[i, :], self.x12[i], self.p4[i, :], self.x43[i]):
                card = ['CAERO1', eid, pid, cid, nspan, nchord, lspan, lchord, igid,
                        p1[0], p1[1], p1[2], x12,
                        p4[0], p4[1], p4[2], x43,]
                if size == 8:
                    f.write(print_card_8(card))
                else:
                    f.write(print_card_16(card))
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:29,代码来源:caero1.py


示例14: write_card

 def write_card(self, size=8, is_double=False):
     card = wipe_empty_fields(self.repr_fields())
     if size == 8 or len(card) == 8: # to last node
         msg = self.comment + print_card_8(card)
     else:
         msg = self.comment + print_card_16(card)
     return msg
开发者ID:saullocastro,项目名称:pyNastran,代码行数:7,代码来源:axisymmetric_shells.py


示例15: cart3d_to_nastran_filename

def cart3d_to_nastran_filename(cart3d_filename, bdf_filename, log=None, debug=False):
    """
    Converts a Cart3D file to Nastran format.

    Parameters
    ----------
    cart3d_filename : str
        path to the input Cart3D file
    bdf_filename : str
        path to the output BDF file
    log : log / None
        log : a logger object
        None : a log will be defined
    debug : bool
        True/False (used if log is not defined)
    """
    cart3d = Cart3D(log=log, debug=debug)
    cart3d.read_cart3d(cart3d_filename)
    nodes = cart3d.nodes
    elements = cart3d.elements
    regions = cart3d.regions

    #bdf = BDF()
    #bdf.nodes = cart3d.nodes
    #bdf.elements = cart3d.elements
    #bdf.write_bdf(bdf_filename)
    #return
    f = open(bdf_filename, 'wb')
    f.write('CEND\n')
    f.write('BEGIN BULK\n')
    f.write('$Nodes\n')

    i = 0
    nid = 1
    cid = 0
    for node in nodes:
        card = print_card_16(['GRID', nid, cid] + list(node))
        f.write(card)
        nid += 1

    eid = 1
    f.write('$Elements\n')
    for (n1, n2, n3), pid in zip(elements, regions):
        card = print_card_8(['CTRIA3', eid, pid, n1, n2, n3])
        f.write(card)
        eid += 1

    t = 0.1
    E = 1e7
    nu = 0.3
    f.write('$Properties\n')
    for pid in unique(regions):
        mid = pid
        card = print_card_8(['PSHELL', pid, mid, t])
        f.write(card)
        card = print_card_8(['MAT1', mid, E, None, nu])
        f.write(card)
    f.write('ENDDATA\n')
    f.close()
开发者ID:HibernantBear,项目名称:pyNastran,代码行数:59,代码来源:cart3d_to_nastran.py


示例16: write_card

 def write_card(self, bdf_file, size=8, is_double=False):
     # .. todo:: collapse the IDs
     if self.n:
         card = ["EPOINT"] + list(self.epoint)
         if size == 8:
             bdf_file.write(print_card_8(card))
         else:
             bdf_file.write(print_card_16(card))
开发者ID:hurlei,项目名称:pyNastran,代码行数:8,代码来源:epoint.py


示例17: write_card

 def write_card(self, f, size=8, is_double=False):
     #.. todo:: collapse the IDs
     if self.n:
         card = ['EPOINT'] + list(self.epoint)
         if size == 8:
             f.write(print_card_8(card))
         else:
             f.write(print_card_16(card))
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:8,代码来源:epoint.py


示例18: write_card_by_index

    def write_card_by_index(self, bdf_file, size=8, is_double=False, i=None):
        for (lid, nid, cid, mag, xyz) in zip(self.load_id, self.node_id, self.coord_id, self.mag, self.xyz):

            card = ["FORCE2", lid, nid, cid, mag, xyz[0], xyz[1], xyz[2]]
            if size == 8:
                bdf_file.write(print_card_8(card))
            else:
                bdf_file.write(print_card_16(card))
开发者ID:hurlei,项目名称:pyNastran,代码行数:8,代码来源:force2.py


示例19: write_card_by_index

 def write_card_by_index(self, bdf_file, size=8, is_double=False, i=None):
     if self.n:
         for (pid, k, ge, s) in zip(self.property_id[i], self.K[i], self.ge[i], self.s[i]):
             card = ['PELAS', pid, k, ge, s]
             if size == 8:
                 bdf_file.write(print_card_8(card))
             else:
                 bdf_file.write(print_card_16(card))
开发者ID:hurlei,项目名称:pyNastran,代码行数:8,代码来源:pelas.py


示例20: write_card

 def write_card(self, bdf_file, size=8):
     if self.n:
         for (nid, constraint, enforced) in zip(self.node_id, self.components, self.enforced_motion):
             fields = ['SPCD', self.constraint_id, nid, constraint, enforced]
             if size == 8:
                 bdf_file.write(print_card_8(fields))
             else:
                 bdf_file.write(print_card_16(fields))
开发者ID:saullocastro,项目名称:pyNastran,代码行数:8,代码来源:spcd.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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