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


Python BDF.cross_reference方法代码示例

本文整理汇总了Python中pyNastran.bdf.dev_vectorized.bdf.BDF.cross_reference方法的典型用法代码示例。如果您正苦于以下问题:Python BDF.cross_reference方法的具体用法?Python BDF.cross_reference怎么用?Python BDF.cross_reference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyNastran.bdf.dev_vectorized.bdf.BDF的用法示例。


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

示例1: test_cord2r_02

# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import cross_reference [as 别名]
    def test_cord2r_02(self):
        grid = ['GRID       20143       7 -9.31-4  .11841 .028296']
        coord = ['CORD2R         7           1.135 .089237  -.0676    .135 .089237  -.0676',
                 '           1.135 .089237   .9324']

        model = BDF(debug=False)
        card_count = {
            'GRID' : 1,
            'CORD2R' : 1,
        }
        model.allocate(card_count)
        card = model.process_card(grid)
        model.add_card(card, card[0])

        card = model.process_card(coord)
        model.add_card(card, card[0])
        model.cross_reference()

        g = model.Node(20143)
        #xyz = g.Position()
        xyz = model.coords.get_global_position_by_node_id(20143, g.cp[0])[0]

        # by running it through Patran...
        #GRID     20143          1.1067  .207647 -.068531
        expected = array([1.106704, .207647, -0.068531])
        diff = xyz - expected

        msg = '\nexpected=%s \nactual  =%s \ndiff    =%s' % (expected, xyz, diff)
        assert allclose(diff, 0.), msg
        coord = model.Coord(7)
        coord.T()
        self.assertTrue(array_equal(coord.T(), coord.beta_n(2)))
开发者ID:umvarma,项目名称:pynastran,代码行数:34,代码来源:test_coords.py

示例2: getNodes

# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import cross_reference [as 别名]
    def getNodes(self, grids, grids_expected, coords):
        model = BDF(debug=False)

        card_count = {
            'GRID' : len(grids),
            'CORD2R' : len(coords),
        }
        model.allocate(card_count)
        for grid in grids:
            (nid, cid, x, y, z) = grid
            model.add_card(['GRID', nid, cid, x, y, z], 'GRID')

        for coord in coords:
            (cid, rid, x, y, z) = coord
            model.add_card(['CORD2R', cid, rid] + x + y + z, 'CORD2R')
            #coordObj = model.Coord(cid)

        model.cross_reference()

        for (i, grid) in enumerate(grids_expected):
            (nid, cid, x, y, z) = grid
            nodes = model.grid
            pos = nodes.get_position_by_node_id([nid])[0]
            n = array([x, y, z])
            msg = 'i=%s expected=%s actual=%s\n' % (i, n, pos)
            print(msg)
            assert allclose(n, pos), msg
开发者ID:umvarma,项目名称:pynastran,代码行数:29,代码来源:test_coords.py

示例3: test_cord2c_01

# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import cross_reference [as 别名]
    def test_cord2c_01(self):
        lines = [
            'CORD2C*                3               0              0.              0.',
            '*                     0.              0.              0.              1.*',
            '*                     1.              0.              1.'
        ]
        model = BDF(debug=False)
        card = model.process_card(lines)
        card = BDFCard(card)
        model.coords.add_cord2c(card)

        lines = [
            'CORD2R         4       3     10.      0.      5.     10.     90.      5.',
            '             10.      0.      6.'
        ]
        card = model.process_card(lines)
        card = BDFCard(card)
        model.coords.add_cord2r(card)
        model.cross_reference()

        cord2r = model.Coord(3)
        self.assertEquals(cord2r.Cid(), 3)
        self.assertEquals(cord2r.Rid(), 0)

        cord2r = model.Coord(4)
        self.assertEquals(cord2r.Cid(), 4)
        self.assertEquals(cord2r.Rid(), 3)

        self.assertTrue(allclose(cord2r.i, array([0., 0., 1.])))
        delta = cord2r.j - array([1., 1., 0.]) / 2**0.5
        self.assertTrue(allclose(cord2r.j, array([1., 1., 0.]) / 2**0.5), str(delta))
        delta = cord2r.k - array([-1., 1., 0.]) / 2**0.5
        self.assertTrue(allclose(cord2r.k, array([-1., 1., 0.]) / 2**0.5), str(delta))
开发者ID:umvarma,项目名称:pynastran,代码行数:35,代码来源:test_coords.py

示例4: test_cord1_01

# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import cross_reference [as 别名]
    def test_cord1_01(self):
        model = BDF(debug=False)
        card_count = {
            'CCORD1R' : 1,
            'GRID' : 3,
        }
        model.allocate(card_count)
        cards = [
            ['CORD1R', 1, 1, 2, 3],  # fails on self.k
            ['GRID', 1, 0, 0., 0., 0.],
            ['GRID', 2, 0, 1., 0., 0.],
            ['GRID', 3, 0, 1., 1., 0.],
        ]
        for card in cards:
            model.add_card(card, card[0], comment='comment', is_list=True)
        c1 = model.Coord(1)
        self.assertEquals(c1.G1(), 1)
        self.assertEquals(c1.G2(), 2)
        self.assertEquals(c1.G3(), 3)

        model.cross_reference()
        self.assertEquals(c1.G1(), 1)
        self.assertEquals(c1.G2(), 2)
        self.assertEquals(c1.G3(), 3)

        self.assertEquals(c1.NodeIDs(), [1, 2, 3])
开发者ID:umvarma,项目名称:pynastran,代码行数:28,代码来源:test_coords.py

示例5: test_solid_03

# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import cross_reference [as 别名]
    def test_solid_03(self):
        """checks linear static solid material"""
        mid = 2
        pid = 4
        rho = 0.1
        tableID = 42
        cards = [
            #$ Solid Nodes
            ['GRID', 11, 0, 0., 0., 0., 0],
            ['GRID', 12, 0, 1., 0., 0., 0],
            ['GRID', 13, 0, 1., 1., 0., 0],
            ['GRID', 14, 0, 0., 1., 0., 0],

            ['GRID', 15, 0, 0., 0., 2., 0],
            ['GRID', 16, 0, 1., 0., 2., 0],
            ['GRID', 17, 0, 1., 1., 2., 0],
            ['GRID', 18, 0, 0., 1., 2., 0],

            # Solids
            ['CHEXA',  7, pid, 11, 12, 13, 14, 15, 16,  17, 18],
            ['CTETRA', 8, pid, 11, 12, 13, 15],

            # Solid Nodes
            ['GRID',  21, 0, 0., 0., 0.,  0,],
            ['GRID',  22, 0, 1., 0., 0.,  0,],
            ['GRID',  23, 0, 1., 1., 0.,  0,],
            ['GRID',  24, 0, 0., 0., 2.,  0,],
            ['GRID',  25, 0, 1., 0., 2.,  0,],
            ['GRID',  26, 0, 1., 1., 2.,  0,],
            ['CPENTA', 9, pid, 21, 22, 23, 24, 25, 26],

            # static
            ['PSOLID', pid, mid, 0],
            ['MAT1', mid, 1.0, 2.0, 3.0, rho],
            ['MATS1', mid, tableID, 'PLASTIC', 0.0, 1, 1, 100000., ],
            #['TABLEST'],
            ['TABLES1', tableID, 1, None, None, None, None, None, None,
            1.0, 10.0, 2.0, 10.0, 'ENDT'],
        ]
        card_count = {
            'GRID' : 14,
            'CPENTA6': 1,
            'CTETRA4': 1,
            'PSOLID': 1,
            'CHEXA8' : 1,
            'MAT1': 1,
            'MATS1': 1,
            'TABLES1': 1,
        }
        model = BDF(debug=False)
        model.allocate(card_count)
        for fields in cards:
            model.add_card(fields, fields[0], is_list=True)
        model.cross_reference()

        mat = model.materials[mid]
        print('----MAT----', type(mat))
        print(mat)
        print('E = %s' % mat.get_E_by_material_index())
        print('E = %s' % mat.get_E_by_material_id())
开发者ID:umvarma,项目名称:pynastran,代码行数:62,代码来源:test_solids.py

示例6: test_solid_02

# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import cross_reference [as 别名]
    def test_solid_02(self):
        mid = 2
        pid = 4
        rho = 0.1
        cards = [
            #$ Solid Nodes
            ['GRID', 11, 0, 0., 0., 0., 0],
            ['GRID', 12, 0, 1., 0., 0., 0],
            ['GRID', 13, 0, 1., 1., 0., 0],
            ['GRID', 14, 0, 0., 1., 0., 0],

            ['GRID', 15, 0, 0., 0., 2., 0],
            ['GRID', 16, 0, 1., 0., 2., 0],
            ['GRID', 17, 0, 1., 1., 2., 0],
            ['GRID', 18, 0, 0., 1., 2., 0],

            # Solids
            ['CHEXA', 7, pid, 11, 12, 13, 14, 15, 16,  17, 18],
            ['CTETRA', 8, pid, 11, 12, 13, 15],

            # Solid Nodes
            ['GRID', 21, 0, 0., 0., 0.,  0,],
            ['GRID', 22, 0, 1., 0., 0.,  0,],
            ['GRID', 23, 0, 1., 1., 0.,  0,],
            ['GRID', 24, 0, 0., 0., 2.,  0,],
            ['GRID', 25, 0, 1., 0., 2.,  0,],
            ['GRID', 26, 0, 1., 1., 2.,  0,],
            ['CPENTA', 9, pid, 21, 22, 23, 24, 25, 26],

            # hyperelastic
            ['PLSOLID', pid, mid, 'GRID'],
            ['MATHP', mid, None, None, None, rho],
        ]
        card_count = {
            'GRID' : 14,
            'CTETRA4': 1,
            'CPENTA6': 1,
            'CHEXA8' : 1,
            'PLSOLID': 1,
            'MATHP': 1,
        }
        model = BDF(debug=True)
        model.allocate(card_count)
        for fields in cards:
            model.add_card(fields, fields[0], is_list=True)
        model.cross_reference()

        # CTETRA
        eid = 8
        nsm = 0.
        V = 1. / 3.
        self.check_solid(model, eid, 'CTETRA4', pid, 'PLSOLID', mid, 'MATHP', nsm, rho, V)

        eid = 9
        V = 1.0
        self.check_solid(model, eid, 'CPENTA6', pid, 'PLSOLID', mid, 'MATHP', nsm, rho, V)

        eid = 7
        V = 2.0
        self.check_solid(model, eid, 'CHEXA8', pid, 'PLSOLID', mid, 'MATHP', nsm, rho, V)
开发者ID:umvarma,项目名称:pynastran,代码行数:62,代码来源:test_solids.py

示例7: test_cord2_rcs_03

# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import cross_reference [as 别名]
    def test_cord2_rcs_03(self):
        """
        all points are located at <30,40,50>
        """
        model = BDF(debug=False)
        card_count = {
            'GRID' : 3,
            'CORD2R' : 1,
            'CORD2C' : 1,
            'CORD2S' : 2,
        }
        model.allocate(card_count)

        cards = [
            ['CORD2S*                2               0              0.              0.',
            '*                     0.              0.              0.              1.*       ',
            '*                     1.              0.              1.',],
            [#'$ Femap with NX Nastran Coordinate System 30 : rectangular in spherical',
            'CORD2R*               30               2             14.             30.',
            '*                    70.    13.431863852   32.1458443949   75.2107442927*       ',
            '*          14.4583462334   33.4569982885   68.2297989286',],
            [#'$ Femap with NX Nastran Coordinate System 31 : cylindrical in spherical',
            'CORD2C*               31               2              3.             42.',
            '*                  -173.   2.86526881213   45.5425615252   159.180363517*       ',
            '*          3.65222385965   29.2536614627  -178.631312271',],
            [#'$ Femap with NX Nastran Coordinate System 32 : spherical in spherical',
            'CORD2S*               32               2             22.             14.',
            '*                    85.   22.1243073983   11.9537753718   77.9978191005*       ',
            '*          21.0997242967   13.1806120497   88.4824763008',],
            ['GRID*                 30              30   40.7437952957  -23.6254877994',
            '*           -33.09784854               0',],
            ['GRID*                 31              31   62.9378078196   15.9774797923',
            '*          31.0484428362               0',],
            ['GRID*                 32              32   53.8270847449   95.8215692632',
            '*          159.097767463               0',],
        ]
        for lines in cards:
            card = model.process_card(lines)
            model.add_card(card, card[0])
        model.cross_reference()
        for nid in model.nodes:
            a = array([30.,40.,50.])
            b = model.Node(nid).Position()
            self.assertTrue(allclose(array([30.,40.,50.]), model.Node(nid).Position()), str(a-b))
开发者ID:umvarma,项目名称:pynastran,代码行数:46,代码来源:test_coords.py

示例8: test_cord2_rcs_02

# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import cross_reference [as 别名]
 def test_cord2_rcs_02(self):
     """
     all points are located at <30,40,50>
     """
     model = BDF(debug=False)
     card_count = {
         'GRID' : 3,
         'CORD2R' : 1,
         'CORD2C' : 2,
         'CORD2S' : 1,
     }
     model.allocate(card_count)
     cards = [
         ['CORD2C*                1               0              0.              0.',
         '*                     0.              0.              0.              1.*       ',
         '*                     1.              0.              1.',],
         [#'$ Femap with NX Nastran Coordinate System 20 : rectangular defined in cylindrical',
         'CORD2R*               20               1              7.             20.',
         '*                    -6.   7.07106781187   28.1301023542             -6.*       ',
         '*          7.70710678119             20.  -5.29289321881',],
         [#'$ Femap with NX Nastran Coordinate System 21 : cylindrical defined in cylindrical',
         'CORD2C*               21               1             15.            -30.',
         '*                    12.   14.6565766735  -30.3177805524   12.9355733712*       ',
         '*          14.6234241583  -26.4257323272   11.9304419665',],
         [#'$ Femap with NX Nastran Coordinate System 22 : spherical defined in cylindrical',
         'CORD2S*               22               1              5.            -75.',
         '*                    20.   5.66032384035  -82.9319986389   19.8502545865*       ',
         '*          4.88876051026  -73.8006653677   19.0116094889',],
         ['GRID*                 20              20   64.2559135157  -14.9400459772',
         '*          27.3271005317               0',],
         ['GRID*                 21              21   52.8328862418  -28.8729017195',
         '*           34.615939507               0',],
         ['GRID*                 22              22   61.1042111232   158.773483595',
         '*           -167.4951724               0',],
     ]
     for lines in cards:
         card = model.process_card(lines)
         model.add_card(card, card[0])
     model.cross_reference()
     for nid in model.nodes:
         a = array([30.,40.,50.])
         b = model.Node(nid).Position()
         self.assertTrue(allclose(array([30.,40.,50.]), model.Node(nid).Position()), str(a-b))
开发者ID:umvarma,项目名称:pynastran,代码行数:45,代码来源:test_coords.py

示例9: test_cord2_rcs_01

# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import cross_reference [as 别名]
    def test_cord2_rcs_01(self):
        """
        all points are located at <30,40,50>
        """
        model = BDF(debug=False)
        card_count = {
            'GRID' : 3,
            'CORD2R' : 1,
            'CORD2C' : 1,
            'CORD2S' : 1,
        }
        model.allocate(card_count)
        cards = [
            [#'$ Femap with NX Nastran Coordinate System 10 : rectangular defined in a rectangular',
            'CORD2R*               10               0             10.              5.',
            '*                     3.   10.3420201433   4.53015368961   3.81379768136*       ',
            '*          10.7198463104   5.68767171433   3.09449287122',],
            [#'$ Femap with NX Nastran Coordinate System 11 : cylindrical defined in rectangular',
            'CORD2C*               11               0              7.              3.',
            '*                     9.   7.64278760969   2.73799736977   9.71984631039*       ',
            '*          7.75440650673   3.37968226211   8.46454486422',],
            [#'$ Femap with NX Nastran Coordinate System 12 : spherical defined in rectangular',
            'CORD2S*               12               0             12.              8.',
            '*                     5.   12.6427876097   7.86697777844   5.75440650673*       ',
            '*          12.6634139482   8.58906867688   4.53861076379',],

            ['GRID*                 10              10   42.9066011565   34.2422137135',
            '*          28.6442730262               0',],
            ['GRID*                 11              11   48.8014631871   78.8394787869',
            '*          34.6037164304               0',],
            ['GRID*                 12              12   58.0775343829   44.7276544324',
            '*          75.7955331161               0',],
        ]
        for lines in cards:
            card = model.process_card(lines)
            model.add_card(card, card[0])
        model.cross_reference()
        for nid in model.nodes:
            a = array([30.,40.,50.])
            b = model.Node(nid).Position()
            self.assertTrue(allclose(array([30.,40.,50.]), model.Node(nid).Position()), str(a-b))
开发者ID:umvarma,项目名称:pynastran,代码行数:43,代码来源:test_coords.py

示例10: test_cord2_bad_01

# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import cross_reference [as 别名]
    def test_cord2_bad_01(self):
        model = BDF(debug=False)
        cards = [
            ['CORD2R', 1, 0, 0., 0., 0.,
                             0., 0., 0.,
                             0., 0., 0.],  # fails on self.k
            ['CORD2R', 2, 0, 0., 0., 0.,
                             1., 0., 0.,
                             0., 0., 0.],  # fails on normalize self.j
            ['CORD2R', 3, 0, 0., 0., 0.,
                             1., 0., 0.,
                             1., 1., 0.],  # passes
            ['CORD2R', 4, 0, 0., 1., 0.,
                             1., 0., 0.,
                             1., 1., 0.],  # passes
            ['CORD2R', 5, 4, 0., 1., 0.,
                             1., 0., 0.,
                             1., 1., 0.],  # passes
        ]
        for card in cards:
            cid = card[1]
            if cid in [1, 2]:
                with self.assertRaises(RuntimeError):
                    model.add_card(card, card[0], is_list=True)
            else:
                model.add_card(card, card[0], is_list=True)

        # this runs because it's got rid=0
        cord4 = model.Coord(4)
        cord4.transformToGlobal([0., 0., 0.])

        # this doesn't run because rid != 0
        cord5 = model.Coord(5)
        with self.assertRaises(RuntimeError):
            cord5.transformToGlobal([0., 0., 0.])
        model.cross_reference()
开发者ID:umvarma,项目名称:pynastran,代码行数:38,代码来源:test_coords.py

示例11: test_solid_01

# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import cross_reference [as 别名]
    def test_solid_01(self):
        """checks linear static solid material"""
        mid = 2
        pid = 4
        rho = 0.1
        cards = [
            #$ Solid Nodes
            ['GRID', 11, 0, 0., 0., 0., 0],
            ['GRID', 12, 0, 1., 0., 0., 0],
            ['GRID', 13, 0, 1., 1., 0., 0],
            ['GRID', 14, 0, 0., 1., 0., 0],

            ['GRID', 15, 0, 0., 0., 2., 0],
            ['GRID', 16, 0, 1., 0., 2., 0],
            ['GRID', 17, 0, 1., 1., 2., 0],
            ['GRID', 18, 0, 0., 1., 2., 0],

            # Solids
            ['CHEXA', 7, pid, 11, 12, 13, 14, 15, 16,  17, 18],
            ['CTETRA', 8, pid, 11, 12, 13, 15],

            # Solid Nodes
            ['GRID', 21, 0, 0., 0., 0.,  0,],
            ['GRID', 22, 0, 1., 0., 0.,  0,],
            ['GRID', 23, 0, 1., 1., 0.,  0,],
            ['GRID', 24, 0, 0., 0., 2.,  0,],
            ['GRID', 25, 0, 1., 0., 2.,  0,],
            ['GRID', 26, 0, 1., 1., 2.,  0,],
            ['CPENTA', 9, pid, 21, 22, 23, 24, 25, 26],

            # static
            ['PSOLID', pid, mid, 0],
            ['MAT1',  mid, 1.0, 2.0, 3.0, rho]
        ]
        card_count = {
            'GRID' : 14,
            'CTETRA4': 1,
            'CPENTA6': 1,
            'CHEXA8' : 1,
            'PSOLID': 1,
            'MAT1': 1,
        }
        model = BDF(debug=True)
        model.allocate(card_count)
        for fields in cards:
            model.add_card(fields, fields[0], is_list=True)
        model.cross_reference()

        # CTETRA
        eid = 8
        mid = 2
        pid = 4
        nsm = 0.
        V = 1. / 3.
        rho = 0.1
        self.check_solid(model, eid, 'CTETRA4', pid, 'PSOLID', mid, 'MAT1', nsm, rho, V)

        eid = 9
        V = 1.0
        self.check_solid(model, eid, 'CPENTA6', pid, 'PSOLID', mid, 'MAT1', nsm, rho, V)

        eid = 7
        V = 2.0
        self.check_solid(model, eid, 'CHEXA8', pid, 'PSOLID', mid, 'MAT1', nsm, rho, V)
开发者ID:umvarma,项目名称:pynastran,代码行数:66,代码来源:test_solids.py

示例12: get_mass

# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import cross_reference [as 别名]
    def get_mass(self,nid1, nid2, xyz1, xyz2, eid, pid, mid, A, J, c, nsm, E, G, nu, rho, L):
        """tests a CROD and a CONROD"""
        card_count = {
            'CONROD' : 1,
            'CTUBE' : 1,
            'PTUBE' : 1,
            'CROD' : 1,
            'PROD' : 1,
            'GRID' : 2,
            'MAT1' : 1,
        }
        model = BDF(debug=debug)
        model.allocate(card_count)
        lines = ['conrod,%i, %i, %i, %i, %f, %f, %f, %f' % (eid, nid1, nid2, mid, A, J, c, nsm)]
        model.add_card(lines, 'conrod', is_list=False)

        lines = ['crod,%i, %i, %i, %i' % (eid+1, pid, nid1, nid2)]
        model.add_card(lines, 'crod', is_list=False)

        #lines = ['ctube,%i, %i, %i, %i' % (eid+2, pid+1, nid1, nid2)]
        #model.add_card(lines, 'ctube', is_list=False)

        lines = ['prod,%i, %i, %f, %f, %f, %f' % (pid, mid, A, J, c, nsm)]
        model.add_card(lines, 'prod', is_list=False)

        OD1 = sqrt(4*A/pi)
        t = 0.
        OD2 = OD1
        #lines = ['ptube,%i, %i, %f, %f, %f, %f' % (pid+1, mid, OD1, t, nsm, OD2)]
        #model.add_card(lines, 'ptube', is_list=False)

        lines = ['mat1,%i, %.2e, %.2e, %f, %f' % (mid, E, G, nu, rho)]
        model.add_card(lines, 'mat1', is_list=False)

        lines = ['grid,%i, %i, %f, %f, %f' % (nid1, 0, xyz1[0], xyz1[1], xyz1[2])]
        model.add_card(lines, 'grid', is_list=False)

        lines = ['grid,%i, %i, %f, %f, %f' % (nid2, 0, xyz2[0], xyz2[1], xyz2[2])]
        model.add_card(lines, 'grid', is_list=False)

        model.cross_reference()
        mass = L * (rho * A + nsm)

        # conrod
        conrod = model.conrod[eid]
        self.assertEquals(conrod.get_element_id_by_element_index(), eid)
        #self.assertEquals(conrod.get_property_id_by_element_index(), None)
        self.assertEquals(conrod.get_material_id_by_element_index(), mid)
        self.assertEquals(conrod.get_length_by_element_index(), L)
        #self.assertEquals(conrod.Nsm(), nsm)
        self.assertEquals(conrod.get_mass_by_element_index(), mass)
        #self.assertEquals(conrod.E(), E)
        #self.assertEquals(conrod.G(), G)
        #self.assertEquals(conrod.Area(), A)
        #self.assertEquals(conrod.J(), J)
        #self.assertEquals(conrod.C(), c)
        #self.assertEquals(conrod.Rho(), rho)

        # crod
        conrod = model.conrod[eid+1]
        self.assertEquals(crod.get_element_id_by_element_index(), eid+1)
        self.assertEquals(crod.get_property_id_by_element_index(), pid)
        self.assertEquals(crod.get_material_id_by_element_index(), mid)
        self.assertEquals(crod.get_length_by_element_index(), L)
        #self.assertEquals(crod.Nsm(), nsm)
        self.assertEquals(crod.get_mass_by_element_index(), mass)
        #self.assertEquals(crod.E(), E)
        #self.assertEquals(crod.G(), G)
        #self.assertEquals(crod.Area(), A)
        #self.assertEquals(crod.J(), J)
        #self.assertEquals(crod.C(), c)
        #self.assertEquals(crod.Rho(), rho)
        #self.assertEquals(crod.Nu(), nu)

        # prod
        self.assertEquals(prod.Pid(), pid)
        self.assertEquals(prod.Mid(), mid)
        self.assertEquals(prod.Nsm(), nsm)
        self.assertEquals(prod.E(), E)
        self.assertEquals(prod.G(), G)
        self.assertEquals(prod.Area(), A)
        self.assertEquals(prod.J(), J)
        self.assertEquals(prod.C(), c)
        self.assertEquals(prod.Rho(), rho)

        # ctube
        if 0:
            self.assertEquals(ctube.Eid(), eid+2)
            self.assertEquals(ctube.Pid(), pid+1)
            self.assertEquals(ctube.Mid(), mid)
            self.assertEquals(ctube.Length(), L)
            self.assertEquals(ctube.Nsm(), nsm)
            self.assertAlmostEquals(ctube.Mass(), mass, 5)
            self.assertEquals(ctube.E(), E)
            self.assertEquals(ctube.G(), G)
            self.assertAlmostEquals(ctube.Area(), A, 5)
            ctube.J()
            self.assertEquals(ctube.Rho(), rho)

        # ptube
#.........这里部分代码省略.........
开发者ID:umvarma,项目名称:pynastran,代码行数:103,代码来源:test_rods.py


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