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


Python baseCard.expand_thru函数代码示例

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


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

示例1: __init__

    def __init__(self, card=None, data=None, comment=''):
        Set.__init__(self, card, data)
        if comment:
            self._comment = comment
        #:  Unique identification number. (Integer > 0)
        self.sid = integer(card, 1, 'sid')

        self.IDs = []

        IDs = []
        i = 1
        for ifield in range(2, len(card)):
            ID = integer_string_or_blank(card, ifield, 'ID%i' % i)
            if ID:
                i += 1
                IDs.append(ID)
        #IDs = fields(integer_or_string, card, 'ID', i=2, j=len(card))

        self.isSkin = False
        i = 0
        if isinstance(IDs[0], str) and IDs[0] == 'SKIN':
            self.isSkin = True
            i += 1

        #:  List of structural grid point or element identification numbers.
        #:  (Integer > 0 or 'THRU'; for the 'THRU' option, ID1 < ID2 or 'SKIN';
        #:  in field 3)
        self.IDs = expand_thru(IDs[i:])
        self.cleanIDs()
开发者ID:anick107,项目名称:von_mises_rms,代码行数:29,代码来源:sets.py

示例2: __init__

 def __init__(self, card=None, data=None):
     Constraint.__init__(self, card, data)
     self.conid = card.field(1)
     self.constraints = str(card.field(2, ''))  # 246 = y; dx, dz dir
     nodes = card.fields(3)
     self.nodes = expand_thru(nodes)
     self.nodes.sort()
开发者ID:xirxa,项目名称:pynastran-locr,代码行数:7,代码来源:constraints.py

示例3: __init__

    def __init__(self, card=None, data=None, comment=''):
        ThermalLoad.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Load set identification number. (Integer > 0)
            self.sid = integer(card, 1, 'sid')

            #: Heat flux into element (FLOAT)
            self.qFlux = double(card, 2, 'qFlux')
            eids  = []
            j = 1
            for i in range(3, len(card)):
                eid = integer_or_string(card, i, 'eid%i' % j)
                eids.append(eid)
                j += 1
            #: CHBDYj element identification numbers (Integer)
            assert len(eids) > 0

            #: .. todo:: use expand_thru_by ???
            self.eids = expand_thru(eids)
        else:
            self.sid = data[0]
            self.qFlux = data[1]
            self.eids = data[2:]
开发者ID:umvarma,项目名称:pynastran,代码行数:25,代码来源:loads.py

示例4: __init__

 def __init__(self, card=None, data=None):  ## @todo doesnt support data
     ## Set identification number. (Integer > 0)
     self.sid = card.field(1)
     ## List of aerodynamic boxes generated by CAERO1 entries to define a
     ## surface. (Integer > 0 or 'THRU')
     self.elements = expand_thru(card.fields(2))
     self.cleanIDs()
开发者ID:xirxa,项目名称:pynastran-locr,代码行数:7,代码来源:aero.py

示例5: add

    def add(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:ClaesFredo,项目名称:pyNastran,代码行数:34,代码来源:temp.py

示例6: __init__

    def __init__(self, card=None, data=None, comment=''):
        """
        Creates the SPOINTs card that contains many SPOINTs
        :param self:
          the SPOINTs object pointer
        :param card:
          a BDFCard object
        :type card:
          BDFCard
        :param data:
          a list with the SPOINT fields defined in OP2 format
        :type data:
          LIST
        :param comment:
          a comment for the card
        :type comment:
          string
        """
        if comment:
            self._comment = comment
        Node.__init__(self, card, data)

        if card:
            fields = []
            for i in range(1, len(card)):
                field = integer_or_string(card, i, 'ID%i' % i)
                fields.append(field)
        else:
            fields = data
            assert isinstance(data, list), data
            assert isinstance(data[0], int), data
        self.spoints = set(expand_thru(fields))
开发者ID:umvarma,项目名称:pynastran,代码行数:32,代码来源:nodes.py

示例7: 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:umvarma,项目名称:pynastran,代码行数:8,代码来源:spcadd.py

示例8: 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:HibernantBear,项目名称:pyNastran,代码行数:9,代码来源:spc1.py

示例9: __init__

    def __init__(self, card=None, data=None):
        Node.__init__(self, card, data)
        #nFields = card.nFields()

        if card:
            fields = card.fields(1)
        else:
            fields = data
        self.spoints = set(expand_thru(fields))
开发者ID:xirxa,项目名称:pynastran-locr,代码行数:9,代码来源:nodes.py

示例10: __init__

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

        self.IDs = expand_thru(card.fields(2))
        self.cleanIDs()
开发者ID:xirxa,项目名称:pynastran-locr,代码行数:9,代码来源:sets.py

示例11: 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:ClaesFredo,项目名称:pyNastran,代码行数:12,代码来源:spoint.py

示例12: __init__

 def __init__(self, card=None, data=None, comment=''):
     ConstraintADD.__init__(self, card, data)
     if comment:
         self._comment = comment
     if card:
         self.conid = integer(card, 1, 'conid')
         sets = card.fields(2)
         self.sets = expand_thru(sets)
         self.sets.sort()
     else:
         msg = '%s has not implemented data parsing' % self.type
         raise NotImplementedError(msg)
开发者ID:HibernantBear,项目名称:pyNastran,代码行数:12,代码来源:constraints.py

示例13: __init__

    def __init__(self, card=None, data=None, comment=''):
        if comment:
            self._comment = comment
        Node.__init__(self, card, data)

        if card:
            fields = []
            for i in range(1, len(card)):
                field = integer_or_string(card, i, 'ID%i' % i)
                fields.append(field)
        else:
            fields = data
            assert isinstance(data, list), data
            assert isinstance(data[0], int), data
        self.points = set(expand_thru(fields))
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:15,代码来源:nodes.py

示例14: __init__

    def __init__(self, card=None, data=None, comment=''):
        Set.__init__(self, card, data)
        if comment:
            self._comment = comment

        #:  Identifiers of grids points. (Integer > 0)
        self.IDs = []
        if string_or_blank(card, 2, 'C') == 'ALL':
            self.components = '123456'
        else:
            self.components = components(card, 1, 'components')

        IDs2 = []
        ii = 1
        for ifield in range(2, len(card)):
            integer_or_string(card, ifield, 'ID' % ii)
            ii += 1
        self.IDs = expand_thru(IDs)
开发者ID:HibernantBear,项目名称:pyNastran,代码行数:18,代码来源:bdf_sets.py

示例15: build

    def build(self):
        """
        :param self: the PLOAD4 object
        """
        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' % len(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:ClaesFredo,项目名称:pyNastran,代码行数:89,代码来源:pload4.py


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