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


Python base_card.expand_thru函数代码示例

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


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

示例1: __init__

 def __init__(self, ids, components, comment=''):
     Set.__init__(self)
     if comment:
         self.comment = comment
     #:  Identifiers of grids points. (Integer > 0)
     self.ids = expand_thru(ids)
     self.components = components
开发者ID:hurlei,项目名称:pyNastran,代码行数:7,代码来源:bdf_sets.py

示例2: add_card

    def add_card(self, card, comment=''):
        assert self.n > 0, self.n
        i = self.i
        load_id = integer(card, 1, 'load_id')
        tbar = double(card, 3, 'Tbar')
        tprime = double(card, 4, 'Tprime')
        t1 = double_or_blank(card, 5, 'T1')
        t2 = double_or_blank(card, 6, 'T2')

        self.load_id[i] = load_id
        self.element_id[i] = integer(card, 2, 'element_id')
        self.tbar[i] = tbar
        self.tprime[i] = tprime
        self.temp[i, 0] = t1
        self.temp[i, 1] = t2
        self.i += 1

        if len(card) >= 7:
            # i must be < self.n
            eids = expand_thru(card[9:])
            for eid in eids:
                self.load_id[i] = load_id
                assert isinstance(eid, int), eid
                self.element_id[i] = eid
                self.tbar[i] = tbar
                self.tprime[i] = tprime
                self.temp[i, 0] = t1
                self.temp[i, 1] = t2
                self.i += 1
                assert self.i <= self.n

        assert len(card) <= 7, '%s; n=%s' % (card, len(card))
        #assert len(card) <= 7, len(card)
        self.eids = None
开发者ID:hurlei,项目名称:pyNastran,代码行数:34,代码来源:temp.py

示例3: add_card

 def add_card(cls, card, comment=''):
     fields = []
     for i in range(1, len(card)):
         field = integer_or_string(card, i, 'ID%i' % i)
         fields.append(field)
     points = set(expand_thru(fields))
     return cls(points, comment=comment)
开发者ID:hurlei,项目名称:pyNastran,代码行数:7,代码来源:nodes.py

示例4: __init__

 def __init__(self, conid, sets, comment=''):
     ConstraintADD.__init__(self)
     if comment:
         self.comment = comment
     self.conid = conid
     self.sets = expand_thru(sets)
     self.sets.sort()
开发者ID:hurlei,项目名称:pyNastran,代码行数:7,代码来源:constraints.py

示例5: get_spcadd_constraint

def get_spcadd_constraint(card):
    constraint_id = integer(card, 1, 'constraint_id')

    node_ids = card.fields(2)
    node_ids = expand_thru(node_ids)

    assert isinstance(constraint_id, int), constraint_id
    return constraint_id, node_ids
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:8,代码来源:spcadd.py

示例6: get_spc1_constraint

def get_spc1_constraint(card):
    constraint_id = integer(card, 1, 'constraint_id')
    dofs = components(card, 2, 'constraints')  # 246 = y; dx, dz dir

    node_ids = card.fields(3)
    node_ids = expand_thru(node_ids)

    assert isinstance(constraint_id, int), constraint_id
    return constraint_id, dofs, node_ids
开发者ID:hurlei,项目名称:pyNastran,代码行数:9,代码来源:spc1.py

示例7: __init__

    def __init__(self, card=None, data=None, comment=''):
        Set.__init__(self, card, data)
        if comment:
            self._comment = comment
        self.seid = integer(card, 1, 'seid')
        #: Grid or scalar point identification number.
        #: (0 < Integer < 1000000; G1 < G2)
        self.IDs = []

        IDs = fields(integer_or_string, card, 'ID', i=2, j=len(card))
        self.IDs = expand_thru(IDs)
        self.clean_ids()
开发者ID:marcinch18,项目名称:pyNastran,代码行数:12,代码来源:bdf_sets.py

示例8: add

    def add(self, card, comment=''):
        fields = []
        for i in range(1, len(card)):
            field = integer_or_string(card, i, 'ID%i' % i)
            fields.append(field)

        ex = expand_thru(fields)
        ex = set(ex)

        self.spoint.update(ex)
        self._comments.append(comment)
        self.n = len(self.spoint)
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:12,代码来源:spoint.py

示例9: __init__

 def __init__(self, sid, qFlux, eids, comment=''):
     ThermalLoad.__init__(self)
     if comment:
         self.comment = comment
     #: Load set identification number. (Integer > 0)
     self.sid = sid
     #: Heat flux into element (FLOAT)
     self.qFlux = qFlux
     #: CHBDYj element identification numbers (Integer)
     #: .. todo:: use expand_thru_by ???
     assert len(eids) > 0
     self.eids = expand_thru(eids)
开发者ID:saullocastro,项目名称:pyNastran,代码行数:12,代码来源:loads.py

示例10: add_card

    def add_card(cls, card, comment=''):
        seid = integer(card, 1, 'seid')
        components = fcomponents_or_blank(card, 2, 'components', 0)

        nfields = len(card)
        ids = []
        i = 1
        for ifield in range(3, nfields):
            idi = integer_string_or_blank(card, ifield, 'ID%i' % i)
            if idi:
                i += 1
                ids.append(idi)
        ids = expand_thru(ids)
        return cls(seid, components, ids, comment=comment)
开发者ID:hurlei,项目名称:pyNastran,代码行数:14,代码来源:bdf_sets.py

示例11: add_card

    def add_card(self, card, comment=None):
        i = self.i
        self._comments.append(comment)
        #element_ids = {}
        #for i in range(ncards):
            #element_ids[i] = []


        self.load_id[i] = integer(card, 1, 'load_id')
        eid = integer(card, 2, 'element_id')
        self.element_ids[i] = eid
        p1 = double_or_blank(card, 3, 'p1', 0.0)
        p = [p1,
             double_or_blank(card, 4, 'p2', p1),
             double_or_blank(card, 5, 'p3', p1),
             double_or_blank(card, 6, 'p4', p1)]
        self.pressures[i, :] = p

        self.element_ids[i] = [eid]
        if(integer_string_or_blank(card, 7, 'g1/THRU') == 'THRU' and
           integer_or_blank(card, 8, 'eid2')):  # plates
            eid2 = integer(card, 8, 'eid2')
            if eid2:
                self.element_ids[i] = list(unique(expand_thru([eid, 'THRU', eid2],
                                           set_fields=False, sort_fields=False)))
            #self.g1 = None
            #self.g34 = None
        else:
            #: used for CPENTA, CHEXA
            self.element_ids[i] = [eid]
            #: used for solid element only
            self.g1[i] = integer_or_blank(card, 7, 'g1', -1)
            #: g3/g4 - different depending on CHEXA/CPENTA or CTETRA
            self.g34[i] = integer_or_blank(card, 8, 'g34', -1)

        #: Coordinate system identification number. See Remark 2.
        #: (Integer >= 0;Default=0)
        self.cid[i] = integer_or_blank(card, 9, 'cid', 0)
        self.nvector[i, :] = [
            double_or_blank(card, 10, 'N1'),
            double_or_blank(card, 11, 'N2'),
            double_or_blank(card, 12, 'N3'), ]
        self.sorl[i] = string_or_blank(card, 13, 'sorl', 'SURF')
        self.ldir[i] = string_or_blank(card, 14, 'ldir', 'NORM')
        assert len(card) <= 15, 'len(PLOAD4 card) = %i\ncard=%s' % (len(card), card)
        self.i += 1
开发者ID:hurlei,项目名称:pyNastran,代码行数:46,代码来源:pload4.py

示例12: add_op2_data

 def add_op2_data(cls, data, comment=''):
     fields = data
     assert isinstance(data, list), data
     assert isinstance(data[0], int), data
     points = set(expand_thru(fields))
     return cls(points, comment=comment)
开发者ID:hurlei,项目名称:pyNastran,代码行数:6,代码来源:nodes.py

示例13: build

    def build(self):
        cards = self._cards
        ncards = len(cards)
        self.n = ncards
        if ncards:
            float_fmt = self.model.float

            self.load_id = zeros(ncards, 'int32')
            #: Element ID
            self.element_id = zeros(ncards, 'int32')
            #: Property ID
            self.pressures = zeros((ncards, 4), 'int32')

            element_ids = {}
            for i in range(ncards):
                element_ids[i] = []

            self.g1 = full(ncards, nan, 'int32')
            self.g34 = full(ncards, nan, 'int32')

            self.ldir = full(ncards, nan, '|S4')
            self.sorl = full(ncards, nan, '|S4')

            self.cid = zeros(ncards, dtype='int32')
            self.NVector = zeros((ncards, 3), dtype=float_fmt)

            for i, card in enumerate(cards):
                self.load_id[i] = integer(card, 1, 'load_id')
                eid = integer(card, 2, 'element_id')
                self.element_id[i] = eid
                p1 = double_or_blank(card, 3, 'p1', 0.0)
                p = [p1,
                     double_or_blank(card, 4, 'p2', p1),
                     double_or_blank(card, 5, 'p3', p1),
                     double_or_blank(card, 6, 'p4', p1)]
                self.pressures[i, :] = p

                self.element_ids[i] = [eid]
                if(integer_string_or_blank(card, 7, 'g1/THRU') == 'THRU' and
                   integer_or_blank(card, 8, 'eid2')):  # plates
                    eid2 = integer(card, 8, 'eid2')
                    if eid2:
                        self.element_ids[i] = list(unique(expand_thru([self.eid, 'THRU', eid2],
                                                   set_fields=False, sort_fields=False)))
                    #self.g1 = None
                    #self.g34 = None
                else:
                    #: used for CPENTA, CHEXA
                    self.element_ids[i] = [self.eid]
                    #: used for solid element only
                    self.g1[i] = integer_or_blank(card, 7, 'g1')
                    #: g3/g4 - different depending on CHEXA/CPENTA or CTETRA
                    self.g34[i] = integer_or_blank(card, 8, 'g34')

                #: Coordinate system identification number. See Remark 2.
                #: (Integer >= 0;Default=0)
                self.cid[i] = integer_or_blank(card, 9, 'cid', 0)
                self.NVector[i, :] = [
                    double_or_blank(card, 10, 'N1', 0.0),
                    double_or_blank(card, 11, 'N2', 0.0),
                    double_or_blank(card, 12, 'N3', 0.0), ]
                self.sorl[i] = string_or_blank(card, 13, 'sorl', 'SURF')
                self.ldir[i] = string_or_blank(card, 14, 'ldir', 'NORM')
                assert len(card) <= 15, 'len(PLOAD4 card) = %i\ncard=%s' % (len(card), card)

            i = self.load_id.argsort()
            #self.element_id = self.element_id[i]
            self.pressures = self.pressures[i, :]
            #self.node_ids = self.node_ids[i, :]

            #element_ids = {}
            #for j in range(ncards):
                #element_ids[j] = element_ids[i[j]]

            self.g1 = self.g1[i]
            self.g34 = self.g34[i]
            self.ldir = self.ldir[i]
            self.sorl = self.sorl[i]
            self.cid = self.cid[i]
            self.NVector = self.NVector[i, :]
            self.n += len(eids)

            self.load_cases = {}
            self.load_ids = unique(self.load_id)
        else:
            self.load_id = array([], dtype='int32')
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:86,代码来源:pload4.py


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