示例#1
0
 def add_card(cls, card, comment=''):
     conid = integer(card, 1, 'conid')
     rid = integer(card, 2, 'rid')
     hid = integer(card, 3, 'hid')
     c = components(card, 4, 'c')
     d = double(card, 5, 'd')
     return SPCAX(conid, rid, hid, c, d, comment=comment)
示例#2
0
 def add_card(cls, card, icard=0, comment=''):
     noffset = 3 * icard
     sid = integer(card, 1, 'sid')
     p = integer(card, 2 + noffset, 'p')
     c = components_or_blank(card, 3 + noffset, 'c', 0)
     scale = double(card, 4 + noffset, 'scale')
     return DAREA(sid, p, c, scale, comment=comment)
示例#3
0
    def add_card(self, card, comment=''):
        #self.model.log.debug('chexa8-add')
        i = self.i
        #comment = self._comments[i]
        eid = integer(card, 1, 'element_id')

        if comment:
            self.set_comment(eid, comment)

        #: Element ID
        self.element_id[i] = eid
        #: Property ID
        self.property_id[i] = integer(card, 2, 'property_id')
        #: Node IDs
        nids = array([
            integer(card, 3, 'node_id_1'),
            integer(card, 4, 'node_id_2'),
            integer(card, 5, 'node_id_3'),
            integer(card, 6, 'node_id_4'),
            integer(card, 7, 'node_id_5'),
            integer(card, 8, 'node_id_6'),
            integer(card, 9, 'node_id_7'),
            integer(card, 10, 'node_id_8')
        ], dtype='int32')
        assert 0 not in nids, '%s\n%s' % (nids, card)
        self.node_ids[i, :] = nids
        assert len(card) == 11, 'len(CHEXA8 card) = %i\ncard=%s' % (len(card), card)
        self.i += 1
示例#4
0
    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 = []
示例#5
0
    def __init__(self, card=None, data=None, comment=''):
        ThermalElement.__init__(self, card)
        if comment:
            self._comment = comment
        if card:
            #: Surface element ID
            self.eid = integer(card, 1, 'eid')

            #: PHBDY property entry identification numbers. (Integer > 0)
            self.pid = integer(card, 2, 'pid')
            assert self.pid > 0

            self.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

            #: A VIEW entry identification number for the front face.
            self.iViewFront = integer_or_blank(card, 4, 'iViewFront', 0)

            #: A VIEW entry identification number for the back face.
            self.iViewBack = integer_or_blank(card, 5, 'iViewBack', 0)

            #: Grid point identification numbers of grids bounding the surface.
            #: (Integer > 0)
            self.g1 = integer(card, 6, 'g1')
            #: Grid point identification numbers of grids bounding the surface.
            #: (Integer > 0)
            if self.Type != 'POINT':
                self.g2 = integer(card, 7, 'g2')
            else:
                self.g2 = blank(card, 7, 'g2')

            #: Orientation grid point. (Integer > 0; Default = 0)
            self.g0 = integer_or_blank(card, 8, 'g0', 0)

            #: RADM identification number for front face of surface element.
            #: (Integer > 0)
            self.radMidFront = integer_or_blank(card, 9, 'radMidFront', 0)

            #: RADM identification number for back face of surface element.
            #: (Integer > 0)
            self.radMidBack = integer_or_blank(card, 10, 'radMidBack', 0)

            #: Grid point identification number of a midside node if it is used
            #: with the line type surface element.
            self.gmid = integer_or_blank(card, 11, 'gmid')
            #: Coordinate system for defining orientation vector.
            #: (Integer > 0; Default = 0
            self.ce = integer_or_blank(card, 12, 'ce', 0)

            #: Components of the orientation vector in coordinate system CE.
            #: The origin of the orientation vector is grid point G1.
            #: (Real or blank)
            self.e1 = double_or_blank(card, 13, 'e3')
            self.e2 = double_or_blank(card, 14, 'e3')
            self.e3 = double_or_blank(card, 15, 'e3')
            assert len(card) <= 16, 'len(CHBDYP card) = %i' % len(card)
        else:
            raise NotImplementedError(data)
示例#6
0
 def add_card(cls, card, comment=''):
     pid = integer(card, 1, 'pid')
     mid = integer(card, 2, 'mid')  # MATHE, MATHP
     cid = integer_or_blank(card, 3, 'cid', 0)
     stress_strain_output_location = string_or_blank(card, 4, 'str', 'GRID')
     return PLPLANE(pid, mid, cid, stress_strain_output_location,
                    comment=comment)
示例#7
0
    def add(self, card, comment=''):
        i = self.i
        #comment = self._comments[i]
        eid = integer(card, 1, 'element_id')
        if comment:
            self._comments[eid] = comment

        #: Element ID
        self.element_id[i] = eid
        #: Property ID
        self.property_id[i] = integer(card, 2, 'property_id')
        #: Node IDs
        nids = array([
            integer(card, 3, 'node_id_1'), integer(card, 4, 'node_id_2'),
            integer(card, 5, 'node_id_3'), integer(card, 6, 'node_id_4'),
            integer(card, 7, 'node_id_5'), integer(card, 8, 'node_id_6'),
            integer(card, 9, 'node_id_7'), integer(card, 10, 'node_id_8'),
            integer_or_blank(card, 11, 'node_id_9', 0),
            integer_or_blank(card, 12, 'node_id_10', 0),
            integer_or_blank(card, 13, 'node_id_11', 0),
            integer_or_blank(card, 14, 'node_id_12', 0),
            integer_or_blank(card, 15, 'node_id_13', 0),
            integer_or_blank(card, 16, 'node_id_14', 0),
            integer_or_blank(card, 17, 'node_id_15', 0),
            integer_or_blank(card, 18, 'node_id_16', 0),
            integer_or_blank(card, 19, 'node_id_17', 0),
            integer_or_blank(card, 20, 'node_id_18', 0),
            integer_or_blank(card, 21, 'node_id_19', 0),
            integer_or_blank(card, 22, 'node_id_20', 0)
        ], dtype='int32')
        self.node_ids[i, :] = nids
        assert len(card) <= 23, 'len(CHEXA20 card) = %i' % len(card)
        self.i += 1
示例#8
0
    def __init__(self, card=None, data=None, comment=''):
        ThermalElement.__init__(self, card)
        if comment:
            self._comment = comment
        if card:
            #: Surface element ID number for a side of an
            #: element. (0 < Integer < 100,000,000)
            self.eid = integer(card, 1, 'eid')

            #: A heat conduction element identification
            self.eid2 = integer(card, 2, 'eid2')

            #: A consistent element side identification number
            #: (1 < Integer < 6)
            self.side = integer(card, 3, 'side')
            assert 0 < self.side < 7

            #: A VIEW entry identification number for the front face
            self.iViewFront = integer_or_blank(card, 4, 'iViewFront', 0)
            #: A VIEW entry identification number for the back face
            self.iViewBack = integer_or_blank(card, 5, 'iViewBack', 0)

            #: RADM identification number for front face of surface element
            #: (Integer > 0)
            self.radMidFront = integer_or_blank(card, 6, 'radMidFront', 0)
            #: RADM identification number for back face of surface element
            #: (Integer > 0)
            self.radMidBack = integer_or_blank(card, 7, 'radMidBack', 0)
            assert len(card) <= 8, 'len(CHBDYE card) = %i' % len(card)
        else:
            raise NotImplementedError(data)
        self.grids = []
示例#9
0
 def add_card(cls, card, icard=0, comment=''):
     noffset = 2 * icard
     sid = integer(card, 1, 'sid')
     Type = string(card, 2, 'Type')
     id = integer(card, 3 + noffset, 'id')
     value = double(card, 4 + noffset, 'value')
     return NSM(sid, Type, id, value, comment=comment)
示例#10
0
    def add(self, card, comment=''):
        #self.model.log.debug('RBE2.add')
        i = self.i
        #if comment:
            #self._comment = comment
        eid = integer(card, 1, 'element_id')
        gn = integer(card, 2, 'gn')
        cm = components_or_blank(card, 3, 'cm')
        #assert gn is not None, 'gn=%s' % self.gn
        #assert cm is not None, 'cm=%s' % self.cm

        self.element_id[i] = eid
        self.gn[i] = gn
        self.cm[i] = cm

        alpha = integer_or_double(card, len(card) - 1, 'alpha')
        if isinstance(alpha, float):
            # the last field is not part of Gmi
            self.alpha[i] = alpha
            n = 1
        else:
            # the last field is part of Gmi
            n = 0
            #self.alpha[i] = 0.0  # we don't need to set alpha

        j = 4
        gmis = []
        for k in range(len(card) - 4 - n):
            gmi = integer(card, j + k, 'Gm%i' % (k + 1))
            #print('GM%i = %s' % (k + 1, gmi))
            gmis.append(gmi)
        self.gmi[i] = gmis
        self.i += 1
示例#11
0
    def add_card(self, card, comment=''):
        i = self.i
        self.property_id[i] = integer(card, 1, 'pid')
        self.material_id[i] = integer(card, 2, 'mid')
        self.cordm[i] = integer_or_blank(card, 3, 'cordm', 0)
        self.integ[i] = integer_string_or_blank(card, 4, 'integ', '')
        #validIntegration = ['THREE', 'TWO', 'FULL', 'BUBBLE',
        #                    2, 3, None, 'REDUCED']
        # ISOP
        # ------
        #    1.  FULL
        #    2.
        #    3.
        #    REDUCED

        # IN
        # ------
        #    1.
        #    2.      TWO
        #    3.      THREE
        #    BUBBLE - 2 for CTETRA, 3 for CHEXA/CPENTA

        # STRESS
        # ------
        #    1.  GAUSS (no midside nodes on CPENTA/CHEXA; ok on CTETRA)
        #    2.
        self.stress[i] = integer_string_or_blank(card, 5, 'stress', '')
        self.isop[i] = integer_string_or_blank(card, 6, 'isop', '')
        self.fctn[i] = string_or_blank(card, 7, 'fctn', 'SMECH')
        assert len(card) <= 8, 'len(PSOLID card) = %i\ncard=%s' % (len(card), card)
        self.i += 1
示例#12
0
    def __init__(self, card=None, data=None, comment=''):
        """
        Intilizes the CORD3G

        :param card: a list version of the fields
        """
        if comment:
            self.comment = comment

        Coord.__init__(self, card, data)

        self.cid = integer(card, 1, 'cid')
        method = string_or_blank(card, 2, 'E313')
        self.methodES = method[0]
        self.methodInt = int(method[1:])
        assert self.methodES in ['E', 'S'] # Euler / Space-Fixed
        assert 0 < self.methodInt < 1000

        self.form = string_or_blank(card, 3, 'form', 'EQN')
        self.thetas = [integer(card, 4, 'theta1'),
                       integer(card, 5, 'theta2'),
                       integer(card, 6, 'theta3')]
        assert len(self.thetas) == 3, 'thetas=%s' % (self.thetas)
        self.rid = integer_or_blank(card, 7, 'cidRef')
        assert len(card) <= 8, 'len(CORD3G card) = %i\ncard=%s' % (len(card), card)

        # EQN for DEQATN, TABLE for TABLE3D
        assert self.form in ['EQN', 'TABLE']
示例#13
0
文件: bars.py 项目: hurlei/pyNastran
    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')
        gc = integer(card, 5, 'gc')

        x, g0 = cls._init_x_g0(card, eid)

        wa = np.array([double_or_blank(card, 9, 'w1a', 0.0),
                       double_or_blank(card, 10, 'w2a', 0.0),
                       double_or_blank(card, 11, 'w3a', 0.0)], dtype='float64')

        wb = np.array([double_or_blank(card, 12, 'w1b', 0.0),
                       double_or_blank(card, 13, 'w2b', 0.0),
                       double_or_blank(card, 14, 'w3b', 0.0)], dtype='float64')

        wc = np.array([double_or_blank(card, 15, 'w1c', 0.0),
                       double_or_blank(card, 16, 'w2c', 0.0),
                       double_or_blank(card, 17, 'w3c', 0.0)], dtype='float64')

        tw = np.array([double_or_blank(card, 18, 0., 'twa'),
                       double_or_blank(card, 19, 0., 'twb'),
                       double_or_blank(card, 20, 0., 'twc')], dtype='float64')

        s = np.array([integer_or_blank(card, 21, 'sa'),
                      integer_or_blank(card, 22, 'sb'),
                      integer_or_blank(card, 23, 'sc')], dtype='float64')
        assert len(card) <= 24, 'len(CBEAM3 card) = %i\ncard=%s' % (len(card), card)
        return CBEAM3(eid, pid, ga, gb, gc, x, g0,
                      wa, wb, wc, tw, s, comment='')
示例#14
0
文件: bars.py 项目: hurlei/pyNastran
    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)
示例#15
0
    def add_card(cls, card, comment=''):
        #: Property ID
        pid = integer(card, 1, 'pid')
        #: Material ID
        mid1 = integer_or_blank(card, 2, 'mid1', 0)
        t1 = double_or_blank(card, 3, 't1')

        mid2 = integer_or_blank(card, 4, 'mid2', 0)
        if mid2 > 0:
            i = double(card, 5, 'i')
            assert i > 0.0
        else:
            i = blank(card, 5, 'i')

        mid3 = integer(card, 6, 0)
        if mid3 > 0:
            t2 = double(card, 7, 't3')
            assert t2 > 0.0
        else:
            t2 = blank(card, 7, 't3')

        nsm = double(card, 8, 'nsm')
        z1 = double(card, 9, 'z1')
        z2 = double(card, 10, 'z2')

        j = 1
        phi = []
        for i in range(11, len(card)):
            phii = double(card, i, 'phi' % j)
            phi.append(phii)
            j += 1
        return PCONEAX(pid, mid1, t1, mid2, i, mid3, t2, nsm, z1, z2, phi,
                       comment=comment)
示例#16
0
    def __init__(self, card, comment=''):
        self.pid = integer(card, 1, 'property_id')
        self.sets = []
        self.Types = []
        self.gammas = []
        self._cps = []
        #self.set = integer(card, 2, 'set_id')
        #self.Type = string(card, 3, 'Type')
        #if self.Type not in ['NEWTON','PRANDTL-MEYER', 'CP']:
        #    raise RuntimeError('Type=%r' % Type)
        #self.gamma = double_or_blank(card, 4, 'gamma', 1.4)

        i = 2
        while i < len(card):
            self.sets.append(integer(card, i, 'set_id'))
            Type = string(card, i+1, 'Type')
            self.Types.append(Type)
            #if self.Type not in ['NEWTON','PRANDTL-MEYER', 'CP']:
                #raise RuntimeError('Type=%r' % Type)
            self.gammas.append(double_or_blank(card, i+2, 'gamma', 1.4))

            _cp = None
            if Type == 'CP':
                _cp = double(card, i+3, 'Cp')
            elif Type == 'NEWTON':
                _cp = double_or_blank(card, i+3, 'Cp_nominal', 2.0)
            self._cps.append(_cp)
            i += 7
示例#17
0
 def add_card(cls, card, comment=''):
     eid = integer(card, 1, 'eid')
     pid = integer_or_blank(card, 2, 'pid', eid)
     nids = [integer(card, 3, 'n1'),
             integer(card, 4, 'n2')]
     assert len(card) == 5, 'len(CROD card) = %i\ncard=%s' % (len(card), str(card))
     return CROD(eid, pid, nids, comment=comment)
示例#18
0
    def add(self, card, comment=''):
        i = self.i
        self.property_id[i] = integer(card, 1, 'property_id')
        self.material_id[i] = integer(card, 2, 'material_id')
        self.area[i] = double_or_blank(card, 3, 'area', 0.0)
        self.I1[i] = double_or_blank(card, 4, 'I1', 0.0)
        self.I2[i] = double_or_blank(card, 5, 'I2', 0.0)

        #: .. todo:: support SOL 600 default
        Jdefault = 0.5 * (self.I1[i] + self.I2[i])
        self.J[i] = double_or_blank(card, 6, 'J', Jdefault)
        self.nsm[i] = double_or_blank(card, 7, 'non-structural_mass', 0.0)

        if 0:
            self.C1 = double_or_blank(card, 9, 'C1', 0.0)
            self.C2 = double_or_blank(card, 10, 'C2', 0.0)
            self.D1 = double_or_blank(card, 11, 'D1', 0.0)
            self.D2 = double_or_blank(card, 12, 'D2', 0.0)
            self.E1 = double_or_blank(card, 13, 'E1', 0.0)
            self.E2 = double_or_blank(card, 14, 'E2', 0.0)
            self.F1 = double_or_blank(card, 15, 'F1', 0.0)
            self.F2 = double_or_blank(card, 16, 'F2', 0.0)

            #: default=infinite; assume 1e8
            self.K1 = double_or_blank(card, 17, 'K1', 1e8)
            #: default=infinite; assume 1e8
            self.K2 = double_or_blank(card, 18, 'K2', 1e8)
            #: I12 -> use I12()
            self.i12 = double_or_blank(card, 19, 'I12', 0.0)
            if self.A == 0.0 and self.i12 == 0.0:
                assert self.K1 is None, 'K1 must be blank if A=0.0 and I12=0.0; A=%r I12=%r K1=%r' % (self.A, self.i12, self.K1)
                assert self.K2 is None, 'K2 must be blank if A=0.0 and I12=0.0; A=%r I12=%r K2=%r' % (self.A, self.i12, self.K2)
            assert len(card) <= 20, 'len(PBAR card) = %i' % len(card)

        self.i += 1
示例#19
0
    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)
示例#20
0
    def add_card(cls, card, comment=''):
        sid = integer(card, 1, 'sid')
        nid0 = integer(card, 2, 'nid0')
        # component 0 means an SPOINT/EPOINT
        c = components_or_blank(card, 3, 'components_0', 0)
        b0 = double_or_blank(card, 4, 'b0', 0.)
        b1 = double_or_blank(card, 5, 'b1', 0.)
        b2 = double_or_blank(card, 6, 'b2', 0.)

        nfields = len(card) - 9
        nrows = nfields // 8
        if nfields % 8 > 0:
            nrows += 1

        nids = []
        components = []
        a = []
        for irow in range(nrows):
            j = irow * 8 + 9
            #ifield = irow + 1
            nid = integer(card, j, 'grid_%i' % (irow + 1))
            component = components_or_blank(card, j + 1, 'components_%i' % (irow + 1), 0)
            a0 = double_or_blank(card, j + 2, 'a0_%i' % (irow + 1), 0.)
            a1 = double_or_blank(card, j + 3, 'a1_%i' % (irow + 1), 0.)
            a2 = double_or_blank(card, j + 4, 'a2_%i' % (irow + 1), 0.)
            nids.append(nid)
            components.append(component)
            a.append([a0, a1, a2])
        return TF(sid, nid0, c, b0, b1, b2, nids, components, a,
                  comment=comment)
示例#21
0
    def add_card(cls, card, comment=''):
        sid = integer(card, 1, 'sid')
        excite_id = integer(card, 2, 'excite_id')
        delay = integer_or_blank(card, 3, 'delay', 0)
        Type = integer_string_or_blank(card, 4, 'Type', 'LOAD')

        T1 = double_or_blank(card, 5, 'T1', 0.0)
        T2 = double_or_blank(card, 6, 'T2', T1)
        frequency = double_or_blank(card, 7, 'frequency', 0.)
        phase = double_or_blank(card, 8, 'phase', 0.)
        c = double_or_blank(card, 9, 'c', 0.)
        b = double_or_blank(card, 10, 'b', 0.)
        us0 = double_or_blank(card, 11, 'us0', 0.)
        vs0 = double_or_blank(card, 12, 'vs0', 0.)

        if Type in [0, 'L', 'LO', 'LOA', 'LOAD']:
            Type = 'LOAD'
        elif Type in [1, 'D', 'DI', 'DIS', 'DISP']:
            Type = 'DISP'
        elif Type in [2, 'V', 'VE', 'VEL', 'VELO']:
            Type = 'VELO'
        elif Type in [3, 'A', 'AC', 'ACC', 'ACCE']:
            Type = 'ACCE'
        elif Type in [5, 6, 7, 12, 13]:
            pass
        else:
            msg = 'invalid TLOAD2 type  Type=%r' % Type
            raise RuntimeError(msg)
        assert len(card) <= 13, 'len(TLOAD2 card) = %i\ncard=%s' % (len(card), card)
        return TLOAD2(sid, excite_id, delay, Type, T1, T2, frequency, phase,
                      c, b, us0, vs0, comment=comment)
示例#22
0
    def add(self, card, comment=''):
        i = self.i
        self.element_id[i] = integer(card, 1, 'element_id')
        self.property_id[i] = integer(card, 2, 'property_id')
        self.coord_id[i] = integer_or_blank(card, 3, 'cp', 0)

        self.nspan[i] = integer_or_blank(card, 4, 'nspan', 0)
        self.nchord[i] = integer_or_blank(card, 5, 'nchord', 0)

        #if self.nspan==0:
        self.lspan[i] = integer_or_blank(card, 6, 'lspan', 0)

        #if self.nchord==0:
        self.lchord[i] = integer_or_blank(card, 7, 'lchord', 0)

        self.igid[i] = integer(card, 8, 'igid')

        self.p1[i, :] = [double_or_blank(card, 9, 'x1', 0.0),
                         double_or_blank(card, 10, 'y1', 0.0),
                         double_or_blank(card, 11, 'z1', 0.0)]
        self.x12[i] = double_or_blank(card, 12, 'x12', 0.)

        self.p4[i, :] = [double_or_blank(card, 13, 'x4', 0.0),
                         double_or_blank(card, 14, 'y4', 0.0),
                         double_or_blank(card, 15, 'z4', 0.0)]
        self.x43[i] = double_or_blank(card, 16, 'x43', 0.)
        assert len(card) <= 17, 'len(CAERO1 card) = %i\ncard=%s' % (len(card), card)
        self.i += 1
示例#23
0
    def add_card(self, card, comment=''):
        i = self.i
        sid = integer(card, 1, 'sid')
        excite_id = integer(card, 2, 'excite_id')
        delay = integer_double_or_blank(card, 3, 'delay', 0.)
        dphase = integer_double_or_blank(card, 4, 'dphase', 0.)
        tc = integer_double_or_blank(card, 5, 'tc', 0)
        td = integer_double_or_blank(card, 6, 'td', 0)
        Type = integer_string_or_blank(card, 7, 'Type', 'LOAD')

        if Type in [0, 'L', 'LO', 'LOA', 'LOAD']:
            Type = 'LOAD'
        elif Type in [1, 'D', 'DI', 'DIS', 'DISP']:
            Type = 'DISP'
        elif Type in [2, 'V', 'VE', 'VEL', 'VELO']:
            Type = 'VELO'
        elif Type in [3, 'A', 'AC', 'ACC', 'ACCE']:
            Type = 'ACCE'
        elif Type in [5, 6, 7, 12, 13]:
            pass
        else:
            msg = 'invalid TLOAD2 type  Type=%r' % Type
            raise RuntimeError(msg)
        assert len(card) <= 13, 'len(TLOAD2 card) = %i\ncard=%s' % (len(card), card)

        self.sid[i] = sid
        self.excite_id[i] = excite_id
        if isinstance(delay, int):
            self.delay_id[i] = delay
            self.is_delay_table[i] = 1
        elif isinstance(delay, float):
            self.delay_tau[i] = delay
            self.is_delay_table[i] = 0
        else:
            raise NotImplementedError(delay)

        if isinstance(dphase, int):
            self.dphase_id[i] = dphase
            self.is_dphase_table[i] = 1
        elif isinstance(dphase, float):
            self.dphase_lead[i] = dphase
            self.is_dphase_table[i] = 0
        else:
            raise NotImplementedError(dphase)

        self.Type[i] = Type
        if isinstance(tc, int):
            self.table_c[i] = tc
        elif isinstance(tc, float):
            self.constant_c[i] = tc
        else:
            raise NotImplementedError('tc=%r' % tc)

        if isinstance(td, int):
            self.table_d[i] = td
        elif isinstance(td, float):
            self.constant_d[i] = td
        else:
            raise NotImplementedError('tc=%r' % tc)
        self.i += 1
示例#24
0
 def add_card(cls, card, comment=''):
     eid = integer(card, 1, 'eid')
     pid = integer(card, 2, 'pid')
     nids = [integer_or_blank(card, 3, 'n1', 0),
             integer_or_blank(card, 4, 'n2', 0)]
     assert len(card) <= 5, 'len(CDAMP5 card) = %i\ncard=%s' % (len(card), card)
     return CDAMP5(eid, pid, nids, comment=comment)
示例#25
0
    def add_card(cls, card, comment=''):
        m = np.zeros((6, 6))
        eid = integer(card, 1, 'eid')
        nid = integer(card, 2, 'nid')
        cid = integer_or_blank(card, 3, 'cid', 0)

        m[0, 0] = double_or_blank(card, 4, 'M11', 0.)
        m[1, 0] = double_or_blank(card, 5, 'M21', 0.)
        m[1, 1] = double_or_blank(card, 6, 'M22', 0.)
        m[2, 0] = double_or_blank(card, 7, 'M31', 0.)
        m[2, 1] = double_or_blank(card, 8, 'M32', 0.)
        m[2, 2] = double_or_blank(card, 9, 'M33', 0.)
        m[3, 0] = double_or_blank(card, 10, 'M41', 0.)
        m[3, 1] = double_or_blank(card, 11, 'M42', 0.)
        m[3, 2] = double_or_blank(card, 12, 'M43', 0.)
        m[3, 3] = double_or_blank(card, 13, 'M44', 0.)
        m[4, 0] = double_or_blank(card, 14, 'M51', 0.)
        m[4, 1] = double_or_blank(card, 15, 'M52', 0.)
        m[4, 2] = double_or_blank(card, 16, 'M53', 0.)
        m[4, 3] = double_or_blank(card, 17, 'M54', 0.)
        m[4, 4] = double_or_blank(card, 18, 'M55', 0.)
        m[5, 0] = double_or_blank(card, 19, 'M61', 0.)
        m[5, 1] = double_or_blank(card, 20, 'M62', 0.)
        m[5, 2] = double_or_blank(card, 21, 'M63', 0.)
        m[5, 3] = double_or_blank(card, 22, 'M64', 0.)
        m[5, 4] = double_or_blank(card, 23, 'M65', 0.)
        m[5, 5] = double_or_blank(card, 24, 'M66', 0.)
        assert len(card) <= 25, 'len(CONM1 card) = %i' % len(card)
        return CONM1(eid, nid, cid, m, comment=comment)
示例#26
0
文件: temp.py 项目: hurlei/pyNastran
    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
示例#27
0
 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)
示例#28
0
 def add_card(cls, card, comment=''):
     sid = integer(card, 1, 'sid')
     excite_id = integer(card, 2, 'excite_id')
     lid = integer(card, 3, 'lid')
     tid = integer_or_blank(card, 4, 'tid')
     assert len(card) <= 5, 'len(LSEQ card) = %i\ncard=%s' % (len(card), card)
     return LSEQ(sid, excite_id, lid, tid, comment=comment)
示例#29
0
 def add_card(cls, card, comment=''):
     eid = integer(card, 1, 'eid')
     pid = integer_or_blank(card, 2, 'pid', eid)
     nids = [integer(card, 3, 'n1'),
             integer(card, 4, 'n2')]
     assert len(card) == 5, 'len(CTUBE card) = %i' % len(card)
     return CTUBE(eid, pid, nids, comment=comment)
示例#30
0
    def __init__(self, card, nCoord, data, comment):
        Coord.__init__(self, card, data, comment)
        self.is_resolved = False
        if nCoord is not None:
            assert nCoord in (0, 1), 'nCoord=%r' % (nCoord)
            nCoord *= 4  # 0 if the 1st coord, 4 if the 2nd

            #: the coordinate ID
            self.cid = integer(card, 1 + nCoord, 'cid')
            #: a Node at the origin
            self.g1 = integer(card, 2 + nCoord, 'g1')
            #: a Node on the z-axis
            self.g2 = integer(card, 3 + nCoord, 'g2')
            #: a Node on the xz-plane
            self.g3 = integer(card, 4 + nCoord, 'g3')
        else:
            self.cid = data[0]
            self.g1 = data[1]
            self.g2 = data[2]
            self.g3 = data[3]
            assert len(data) == 4, 'data = %s' % (data)

        assert self.g1 != self.g2
        assert self.g1 != self.g3
        assert self.g2 != self.g3

        self.e1 = None
        self.e2 = None
        self.e3 = None
        self.i = None
        self.j = None
        self.k = None
示例#31
0
    def add_card(cls, card, comment=''):
        """
        Adds a FREQ2 card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card
        """
        sid = integer(card, 1, 'sid')
        f1 = double(card, 2, 'f1')  # default=0.0 ?
        f2 = double(card, 3, 'f2')
        ndf = integer_or_blank(card, 4, 'nf', 1)
        assert len(card) <= 5, 'len(FREQ2 card) = %i\ncard=%s' % (len(card),
                                                                  card)
        return FREQ2(sid, f1, f2, ndf, comment=comment)
示例#32
0
    def add_card(cls, card, comment=''):
        """
        Adds a PACBAR card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card
        """
        pid = integer(card, 1, 'pid')
        mback = double(card, 2, 'mback')
        mseptm = double(card, 3, 'mseptm')
        freson = double_or_blank(card, 4, 'freson')
        kreson = double_or_blank(card, 5, 'kreson')
        assert len(card) <= 6, f'len(PACBAR card) = {len(card):d}\ncard={card}'
        return PACBAR(pid, mback, mseptm, freson, kreson, comment=comment)
示例#33
0
    def add_card(cls, card, comment=''):
        """
        Adds a PELAST card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card
        """
        pid = integer(card, 1, 'pid')
        tkid = integer_or_blank(card, 2, 'tkid', 0)
        tgeid = integer_or_blank(card, 3, 'tgeid', 0)
        tknid = integer_or_blank(card, 4, 'tknid', 0)
        assert len(card) <= 5, 'len(PELAST card) = %i\ncard=%s' % (len(card),
                                                                   card)
        return PELAST(pid, tkid, tgeid, tknid, comment=comment)
示例#34
0
    def add_card(cls, card, icard=0, comment=''):
        """
        Adds a PMASS card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        icard : int; default=0
            the index of the card that's being parsed
        comment : str; default=''
            a comment for the card
        """
        icard *= 2
        #: Property ID
        pid = integer(card, 1 + icard, 'pid')
        mass = double_or_blank(card, 2 + icard, 'mass', 0.)
        return PMASS(pid, mass, comment=comment)
示例#35
0
    def add_card(cls, card, icard=0, comment=''):
        """
        Adds a PDAMP card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        icard : int; default=0
            the index of the card that's being parsed
        comment : str; default=''
            a comment for the card
        """
        noffset = icard * 2
        pid = integer(card, 1 + noffset, 'pid')

        b = double(card, 2 + noffset, 'b')
        return PDAMP(pid, b, comment=comment)
示例#36
0
 def add_card(cls, card, comment=''):
     seid = integer(card, 1, 'seid')
     superelement_type = string(card, 2, 'superelement_type')
     rseid = integer_or_blank(card, 3, 'rseid', 0)
     method = string_or_blank(card, 4, 'method', 'AUTO')
     tol = double_or_blank(card, 5, 'tol', 1e-5)
     loc = string_or_blank(card, 6, 'loc', 'YES')
     unitno = integer_or_blank(card, 7, 'seid')
     assert len(card) <= 8, 'len(SEBULK card) = %i\ncard=%s' % (len(card),
                                                                card)
     return SEBULK(seid,
                   superelement_type,
                   rseid,
                   method=method,
                   tol=tol,
                   loc=loc,
                   unitno=unitno,
                   comment=comment)
示例#37
0
    def add_card(cls, card, comment=''):
        """
        Adds a CELAS3 card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card
        """
        eid = integer(card, 1, 'eid')
        pid = integer_or_blank(card, 2, 'pid', eid)

        s1 = integer_or_blank(card, 3, 's1', 0)
        s2 = integer_or_blank(card, 4, 's2', 0)
        assert len(card) <= 5, 'len(CELAS3 card) = %i\ncard=%s' % (len(card), card)
        return CELAS3(eid, pid, [s1, s2], comment=comment)
示例#38
0
    def add_card(self, card, comment=''):
        """
        Adds a CELAS4 card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card
        """
        eid = integer(card, 1, 'eid')
        k = double(card, 2, 'k')
        s1 = integer_or_blank(card, 3, 's1', 0)
        s2 = integer_or_blank(card, 4, 's2', 0)
        assert len(card) <= 5, 'len(CELAS4 card) = %i\ncard=%s' % (len(card),
                                                                   card)
        self.add(eid, k, [s1, s2], comment=comment)
示例#39
0
文件: loads.py 项目: zbhfut/pyNastran
    def add_card(cls, card, comment=''):
        """
        Adds a QBDY3 card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card
        """
        sid = integer(card, 1, 'sid')
        q0 = double(card, 2, 'q0')
        cntrlnd = integer_or_blank(card, 3, 'cntrlnd', 0)

        nfields = card.nfields
        eids = fields(integer_or_string, card, 'eid', i=4, j=nfields)
        return QBDY3(sid, q0, cntrlnd, eids, comment=comment)
示例#40
0
文件: mass.py 项目: arne182/pyNastran
    def add_card(cls, card, comment=''):
        """
        Adds a CMASS3 card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card

        """
        eid = integer(card, 1, 'eid')
        pid = integer_or_blank(card, 2, 'pid', eid)
        s1 = integer_or_blank(card, 3, 's1')
        s2 = integer_or_blank(card, 4, 's2')
        assert len(card) <= 5, f'len(CMASS3 card) = {len(card):d}\ncard={card}'
        return CMASS3(eid, pid, [s1, s2], comment=comment)
示例#41
0
    def add_card(cls, card, comment=''):
        # TODO: remove fields...
        #fields = card.fields(1)

        nfields = len(card)
        assert len(card) > 1, card
        nterms = int(nfields / 2.)
        n = 1
        IDs = []
        Cs = []
        for i in range(nterms):
            nstart = 1 + 2 * i
            ID = integer(card, nstart, 'ID%s' % n)
            C = components_or_blank(card, nstart + 1, 'component%s' % n, '0')
            IDs.append(ID)
            Cs.append(C)
            n += 1
        return SUPORT(IDs, Cs, comment=comment)
示例#42
0
    def add_card(cls, card, comment=''):
        """
        Adds a RADBC card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card
        """
        nodamb = integer(card, 1, 'nodamb')
        famb = double(card, 2, 'famb')
        cntrlnd = integer_or_blank(card, 3, 'cntrlnd', 0)

        nfields = card.nfields
        eids = fields(integer_or_string, card, 'eid', i=4, j=nfields)
        return RADBC(nodamb, famb, cntrlnd, eids, comment=comment)
示例#43
0
    def add_card(self, card, comment=''):
        # type: (Any, str) -> GRID
        """
        Adds a GRID card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card
        """
        nfields = len(card)
        #print('card = %s' % card)
        #: Node ID
        nid = integer(card, 1, 'nid')

        #: Grid point coordinate system
        cp = integer_or_blank(card, 2, 'cp', 0)

        #: node location in local frame
        xyz = [
            double_or_blank(card, 3, 'x1', 0.),
            double_or_blank(card, 4, 'x2', 0.),
            double_or_blank(card, 5, 'x3', 0.)
        ]

        if nfields > 6:
            #: Analysis coordinate system
            cd = integer_or_blank(card, 6, 'cd', 0)

            #: SPC constraint
            ps = components_or_blank(card, 7, 'ps', '')
            #u(integer_or_blank(card, 7, 'ps', ''))

            #: Superelement ID
            seid = integer_or_blank(card, 8, 'seid', 0)
            assert len(card) <= 9, 'len(GRID card) = %i\ncard=%s' % (len(card),
                                                                     card)
        else:
            cd = 0
            ps = ''
            seid = 0
        self.add(nid, xyz, cp, cd, ps, seid, comment=comment)
示例#44
0
 def add_card(cls, card, comment=''):
     eid = integer(card, 1, 'eid')
     pid = integer(card, 2, 'pid')
     nids = [
         integer(card, 3, 'n1'),
         integer(card, 4, 'n2'),
         integer(card, 5, 'n3'),
         integer(card, 6, 'n4'),
     ]
     theta = integer_double_or_blank(card, 7, 'theta', 0.)
     assert len(card) <= 8, 'len(CQUADX4 card) = %i\ncard=%s' % (len(card),
                                                                 card)
     return CQUADX4(eid, pid, nids, theta=theta, comment=comment)
示例#45
0
    def add_card(cls, card, comment=''):
        """
        Adds a PBUSH card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card
        """
        k_fields = []
        b_fields = []
        ge_fields = []
        rcv_fields = [None, None, None, None]
        m_fields = []

        pid = integer(card, 1, 'pid')

        nfields = card.nfields
        istart = 2
        while istart < nfields:
            pname = string(card, istart, 'pname')
            if pname == 'K':
                k_fields = cls._read_k(card, istart)
            elif pname == 'B':
                b_fields = cls._read_b(card, istart)
            elif pname == 'GE':
                ge_fields = cls._read_ge(card, istart)
            elif pname == 'RCV':
                rcv_fields = cls._read_rcv(card, istart)
            elif pname == 'M':
                m_fields = cls._read_m(card, istart)
            else:
                raise RuntimeError('unsupported PBUSH type; pname=%r' % pname)
                #break #  old version...
            istart += 8
        return PBUSH(pid,
                     k_fields,
                     b_fields,
                     ge_fields,
                     rcv_fields,
                     m_fields,
                     comment=comment)
示例#46
0
    def add_card(cls, card, comment=''):
        """
        Adds a PCONEAX card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card

        """
        #: Property ID
        pid = integer(card, 1, 'pid')
        #: Material ID
        mid1 = integer_or_blank(card, 2, 'mid1', 0)
        t1 = double_or_blank(card, 3, 't1')

        mid2 = integer_or_blank(card, 4, 'mid2', 0)
        if mid2 > 0:
            i = double(card, 5, 'i')
            assert i > 0.0
        else:
            i = blank(card, 5, 'i')

        mid3 = integer_or_blank(card, 6, 'mid3', 0)
        if mid3 > 0:
            t2 = double(card, 7, 't3')
            assert t2 > 0.0
        else:
            t2 = blank(card, 7, 't3')

        nsm = double_or_blank(card, 8, 'nsm', 0.0)
        z1 = double(card, 9, 'z1')
        z2 = double(card, 10, 'z2')

        j = 1
        phi = []
        for icard in range(11, len(card)):
            phii = double(card, icard, 'phi%i' % icard)
            phi.append(phii)
            j += 1
        return PCONEAX(pid, mid1, t1, mid2, i, mid3, t2, nsm, z1, z2, phi,
                       comment=comment)
示例#47
0
    def add_card(cls, card, comment=''):
        """
        Creates the GRID card

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        data : List[int/float]; default=None
            a list with the GRID fields defined in OP2 format
        comment : str; default=''
          a comment for the card
        """
        nfields = len(card)
        #: Node ID
        nid = integer(card, 1, 'nid')

        #: Grid point coordinate system
        cp = integer_or_blank(card, 2, 'cp', 0)

        #: node location in local frame
        xyz = np.array([
            double_or_blank(card, 3, 'x1', 0.),
            double_or_blank(card, 4, 'x2', 0.),
            double_or_blank(card, 5, 'x3', 0.)
        ],
                       dtype='float64')

        if nfields > 6:
            #: Analysis coordinate system
            cd = integer_or_blank(card, 6, 'cd', 0)

            #: SPC constraint
            ps = u(integer_or_blank(card, 7, 'ps', ''))

            #: Superelement ID
            seid = integer_or_blank(card, 8, 'seid', 0)
            assert len(card) <= 9, 'len(GRID card) = %i\ncard=%s' % (len(card),
                                                                     card)
        else:
            cd = 0
            ps = ''
            seid = 0
        return GRID(nid, cp, xyz, cd, ps, seid, comment=comment)
示例#48
0
    def add_card(cls, card, comment=''):
        """
        Adds a CVISC card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card
        """
        eid = integer(card, 1, 'eid')
        pid = integer_or_blank(card, 2, 'pid', eid)
        nids = [
            integer_or_blank(card, 3, 'n1', 0),
            integer_or_blank(card, 4, 'n2', 0)
        ]
        assert len(card) <= 5, f'len(CVISC card) = {len(card):d}\ncard={card}'
        return CVISC(eid, pid, nids, comment=comment)
示例#49
0
    def add_card(cls, card, comment=''):
        """
        Adds a CDAMP2 card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card
        """
        eid = integer(card, 1, 'eid')
        b = double(card, 2, 'b')
        nids = [integer_or_blank(card, 3, 'n1', 0),
                integer_or_blank(card, 5, 'n2', 0)]
        c1 = integer_or_blank(card, 4, 'c1', 0)
        c2 = integer_or_blank(card, 6, 'c2', 0)
        assert len(card) <= 7, 'len(CDAMP2 card) = %i\ncard=%s' % (len(card), card)
        return CDAMP2(eid, b, nids, c1, c2, comment=comment)
示例#50
0
    def add_card(cls, card, comment=''):
        """
        Adds a CMASS2 card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card
        """
        eid = integer(card, 1, 'eid')
        mass = double_or_blank(card, 2, 'mass', 0.)
        g1 = integer_or_blank(card, 3, 'g1')
        c1 = integer_or_blank(card, 4, 'c1')
        g2 = integer_or_blank(card, 5, 'g2')
        c2 = integer_or_blank(card, 6, 'c2')
        assert len(card) <= 7, 'len(CMASS2 card) = %i\ncard=%s' % (len(card), card)
        return CMASS2(eid, mass, g1, c1, g2, c2, comment=comment)
示例#51
0
    def add_card(self, card, comment=''):
        """
        Adds a CSHEAR card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card
        """
        eid = integer(card, 1, 'eid')
        pid = integer_or_blank(card, 2, 'pid', eid)
        nids = [integer_or_blank(card, 3, 'n1'),
                integer_or_blank(card, 4, 'n2'),
                integer_or_blank(card, 5, 'n3'),
                integer_or_blank(card, 6, 'n4')]
        assert len(card) <= 7, 'len(CSHEAR card) = %i\ncard=%s' % (len(card), card)
        self.add(eid, pid, nids)
示例#52
0
    def add_card(cls, card, comment=''):
        """
        Adds a BCRPARA card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card

        """
        crid = integer(card, 1, 'crid')
        surf = string_or_blank(card, 2, 'surf', 'TOP')
        offset = double_or_blank(card, 3, 'offset', None)
        Type = string_or_blank(card, 4, 'type', 'FLEX')
        grid_point = integer_or_blank(card, 5, 'grid_point', 0)
        return BCRPARA(crid, surf=surf, offset=offset, Type=Type,
                       grid_point=grid_point, comment=comment)
示例#53
0
 def _load_isrr(nrows, card):
     shift_r1 = []
     shift_i1 = []
     isrr_flag = []
     nd1 = []
     for irow in range(nrows):
         i = 9 + 8 * irow
         shift_r1i = double_or_blank(card, i, 'SHIFT_R1', 0.0)
         shift_i1i = double_or_blank(card, i + 1, 'SHIFT_I1', 0.0)
         #2
         #3
         #4
         isrr_flagi = integer_or_blank(card, i + 5, 'ISRR_FLAG', 0)
         nd1i = integer(card, i + 6, 'ND1')
         shift_r1.append(shift_r1i)
         shift_i1.append(shift_i1i)
         isrr_flag.append(isrr_flagi)
         nd1.append(nd1i)
     return shift_r1, shift_i1, isrr_flag, nd1
示例#54
0
    def add_card(cls, card, comment=''):
        """
        Adds a FREQ4 card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card
        """
        sid = integer(card, 1, 'sid')
        f1 = double_or_blank(card, 2, 'f1', 0.0)
        f2 = double_or_blank(card, 3, 'f2', 1.e20)
        fspread = double_or_blank(card, 4, 'fspd', 0.1)
        nfm = integer_or_blank(card, 5, 'nfm', 3)
        assert len(card) <= 6, 'len(FREQ card) = %i\ncard=%s' % (len(card),
                                                                 card)
        return FREQ4(sid, f1, f2, fspread, nfm, comment=comment)
示例#55
0
    def add_card(cls, card, icard=0, comment=''):
        """
        Adds a RINGAX card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card

        """
        ioffset = 2 * icard
        j = icard + 1
        ringfl = integer(card, 1+ioffset, 'ringfl_%i' % j)
        xa = double(card, 2+ioffset, 'xa_%i' % j)
        xb = double_or_blank(card, 3+ioffset, 'xa_%i' % j)
        assert len(card) <= 9, 'len(RINGFL card) = %i\ncard=%s' % (len(card), card)
        return RINGFL(ringfl, xa, xb, comment=comment)
示例#56
0
文件: loads.py 项目: zbhfut/pyNastran
    def add_card(cls, card, icard=0, comment=''):
        """
        Adds a TEMPD card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        icard : int; default=0
            sid to be parsed
        comment : str; default=''
            a comment for the card
        """
        nfields = len(card) - 1
        assert nfields % 2 == 0, 'card=%s' % card
        i = 2 * icard
        sid = integer(card, i + 1, 'sid')
        temperature = double(card, i + 2, 'temp')
        return TEMPD(sid, temperature, comment=comment)
示例#57
0
    def add_card(cls, card, comment=''):
        """
        Adds a MATS1 card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card
        """
        mid = integer(card, 1, 'mid')
        tid = integer_or_blank(card, 2, 'tid')
        Type = string(card, 3, 'Type')

        if Type not in ['NLELAST', 'PLASTIC']:
            raise ValueError('MATS1 Type must be [NLELAST, PLASTIC]; Type=%r' % Type)
        if Type == 'NLELAST':
            # should we even read these?
            h = None
            hr = None
            yf = None
            limit1 = None
            limit2 = None
            #h = blank(card, 4, 'h')
            #hr = blank(card, 6, 'hr')
            #yf = blank(card, 5, 'yf')
            #limit1 = blank(card, 7, 'yf')
            #limit2 = blank(card, 8, 'yf')
        else:
            h = double_or_blank(card, 4, 'H')
            yf = integer_or_blank(card, 5, 'yf', 1)
            hr = integer_or_blank(card, 6, 'hr', 1)
            limit1 = double(card, 7, 'limit1')

            if yf in [3, 4]:
                limit2 = double(card, 8, 'limit2')
            else:
                #limit2 = blank(card, 8, 'limit2')
                limit2 = None
        assert len(card) <= 9, 'len(MATS1 card) = %i\ncard=%s' % (len(card), card)
        return MATS1(mid, tid, Type, h, hr, yf, limit1, limit2, comment=comment)
示例#58
0
    def __init__(self, card, comment=''):
        self.flow_id = integer(card, 1, 'flow_id')
        self.mode = string(card, 2, 'mode')
        if 'VELO' == self.mode:
            self.Vx = double(card, 3, 'Vx')
            self.Vy = double(card, 4, 'Vy')
            self.Vz = double(card, 5, 'Vz')
        elif 'MACH' == self.mode:
            #self.Nx = double(card, 3, 'Nx')
            #self.Ny = double(card, 4, 'Ny')
            #self.Nz = double(card, 5, 'Nz')

            self.Ma = double(card, 3, 'Ma')
            self.alpha = double(card, 4, 'alpha')
            self.beta = double_or_blank(card, 5, 'beta', 0.)
            #self.phi = double_or_blank(card, 9, 'phi', 0.)
            self.phi = 0.0
        self.p = double_or_blank(card, 10, 'p', 0.)
        self.q = double_or_blank(card, 11, 'q', 0.)
        self.r = double_or_blank(card, 12, 'r', 0.)
示例#59
0
    def add_card(cls, card, icard=0, comment=''):
        """
        Adds a PELAS card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        icard : int; default=0
            the index of the PELAS card that's being parsed
            must be 0 or 1
        comment : str; default=''
            a comment for the card
        """
        noffset = icard * 4
        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)
示例#60
0
文件: loads.py 项目: zbhfut/pyNastran
    def add_card(cls, card, comment=''):
        """
        Adds a QBDY1 card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card
        """
        sid = integer(card, 1, 'sid')
        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
        return QBDY1(sid, qflux, eids, comment=comment)