Пример #1
0
    def test_rbe1_01(self):
        lines = [
            'RBE1    10201   10201   123     10202   456',
            '           UM   10201   456     10202   123',
        ]

        card = bdf.process_card(lines)
        #print(print_card(card))
        card = BDFCard(card)
        #print(card)
        card2 = RBE1(card)
        fields = card2.raw_fields()
        msg = print_card(fields).rstrip()
        #print(msg)

        lines_expected = [
            'RBE1       10201   10201     123   10202     456',
            '              UM   10201     456   10202     123'
        ]

        lines_actual = msg.rstrip().split('\n')
        msg = '\n%s\n\n%s\n' % ('\n'.join(lines_expected), msg)
        msg += 'nlines_actual=%i nlines_expected=%i' % (len(lines_actual),
                                                        len(lines_expected))
        self.assertEqual(len(lines_actual), len(lines_expected), msg)
        for actual, expected in zip(lines_actual, lines_expected):
            self.assertEqual(actual, expected, msg)
Пример #2
0
    def test_rbe1_02(self):
        lines = [
            'RBE1        1001    1000  123456',
            '              UM    1002     123    1003     123    1004     123',
            '                    1005     123    1006     123    1008     123',
            '                    1009     123    1010     123    1011     123',
            '                    1012     123',
        ]
        card = bdf.process_card(lines)
        #print(print_card_8(card))
        card = BDFCard(card)
        rbe = RBE1.add_card(card)
        fields = rbe.raw_fields()
        msg = print_card_8(fields).rstrip()

        lines_expected = [
            'RBE1        1001    1000  123456',
            '              UM    1002     123    1003     123    1004     123',
            '                    1005     123    1006     123    1008     123',
            '                    1009     123    1010     123    1011     123',
            '                    1012     123',
        ]

        lines_actual = msg.rstrip().split('\n')
        msg = '\n%s\n\n%s\n' % ('\n'.join(lines_expected), msg)
        msg += 'nlines_actual=%i nlines_expected=%i' % (len(lines_actual),
                                                        len(lines_expected))
        self.assertEqual(len(lines_actual), len(lines_expected), msg)
        for actual, expected in zip(lines_actual, lines_expected):
            self.assertEqual(actual, expected, msg)
Пример #3
0
    def test_rbe1_03(self):
        lines = [
            'rbe1,46,3,123456, , , , , ,+rbe46',
            '+rbe46,UM,4,123456,5,123456,2.0-6'
        ]
        card = bdf.process_card(lines)
        #print(print_card(card))
        card = BDFCard(card)
        #print(card)
        card2 = RBE1(card)
        fields = card2.raw_fields()
        msg = print_card(fields).rstrip()
        #print(msg)

        lines_expected = [
            'RBE1          46       3  123456',
            '              UM       4  123456       5  123456 .000002'
        ]

        lines_actual = msg.rstrip().split('\n')
        msg = '\n%s\n\n%s\n' % ('\n'.join(lines_expected), msg)
        msg += 'nlines_actual=%i nlines_expected=%i' % (len(lines_actual),
                                                        len(lines_expected))
        self.assertEqual(len(lines_actual), len(lines_expected), msg)
        for actual, expected in zip(lines_actual, lines_expected):
            self.assertEqual(actual, expected, msg)
Пример #4
0
    def test_rbe1_03(self):
        lines = [
            'rbe1,46,3,123456, , , , , ,+rbe46',
            '+rbe46,UM,4,123456,5,123456,2.0-6'
        ]
        card = bdf._process_card(lines)
        card = BDFCard(card)
        rbe = RBE1.add_card(card)
        fields = rbe.raw_fields()
        msg = print_card_8(fields).rstrip()

        lines_expected = [
            'RBE1          46       3  123456',
            '              UM       4  123456       5  123456 .000002'
        ]
        lines_actual = msg.rstrip().split('\n')
        msg = '\n%s\n\n%s\n' % ('\n'.join(lines_expected), msg)
        msg += 'nlines_actual=%i nlines_expected=%i' % (len(lines_actual),
                                                        len(lines_expected))
        self.assertEqual(len(lines_actual), len(lines_expected), msg)
        for actual, expected in zip(lines_actual, lines_expected):
            self.assertEqual(actual, expected, msg)

        dependent_nid_to_components = check_rbe(rbe)
        assert dependent_nid_to_components == {
            4: '123456',
            5: '123456'
        }, dependent_nid_to_components
Пример #5
0
    def test_rbe1_01(self):
        lines = [
            'RBE1    10201   10201   123     10202   456',
            '           UM   10201   456     10202   123',
        ]

        card = bdf._process_card(lines)
        #print(print_card_8(card))
        card = BDFCard(card)
        rbe = RBE1.add_card(card)
        fields = rbe.raw_fields()
        msg = print_card_8(fields).rstrip()

        lines_expected = [
            'RBE1       10201   10201     123   10202     456',
            '              UM   10201     456   10202     123'
        ]
        lines_actual = msg.rstrip().split('\n')
        msg = '\n%s\n\n%s\n' % ('\n'.join(lines_expected), msg)
        msg += 'nlines_actual=%i nlines_expected=%i' % (len(lines_actual),
                                                        len(lines_expected))
        self.assertEqual(len(lines_actual), len(lines_expected), msg)
        for actual, expected in zip(lines_actual, lines_expected):
            self.assertEqual(actual, expected, msg)

        dependent_nid_to_components = check_rbe(rbe)
        assert dependent_nid_to_components == {
            10201: '456',
            10202: '123'
        }, dependent_nid_to_components
Пример #6
0
    def test_rbe1_02(self):
        lines = [
            'RBE1        1001    1000  123456',
            '              UM    1002     123    1003     123    1004     123',
            '                    1005     123    1006     123    1008     123',
            '                    1009     123    1010     123    1011     123',
            '                    1012     123',
        ]
        card = bdf.process_card(lines)
        #print(print_card_8(card))
        card = BDFCard(card)
        rbe = RBE1.add_card(card)
        fields = rbe.raw_fields()
        msg = print_card_8(fields).rstrip()

        lines_expected = [
            'RBE1        1001    1000  123456',
            '              UM    1002     123    1003     123    1004     123',
            '                    1005     123    1006     123    1008     123',
            '                    1009     123    1010     123    1011     123',
            '                    1012     123',
        ]


        lines_actual = msg.rstrip().split('\n')
        msg = '\n%s\n\n%s\n' % ('\n'.join(lines_expected), msg)
        msg += 'nlines_actual=%i nlines_expected=%i' % (len(lines_actual), len(lines_expected))
        self.assertEqual(len(lines_actual), len(lines_expected), msg)
        for actual, expected in zip(lines_actual, lines_expected):
            self.assertEqual(actual, expected, msg)
Пример #7
0
    def test_rbe1_02(self):
        lines = [
            'RBE1        1001    1000  123456',
            '              UM    1002     123    1003     123    1004     123',
            '                    1005     123    1006     123    1008     123',
            '                    1009     123    1010     123    1011     123',
            '                    1012     123',
        ]
        card = bdf._process_card(lines)
        #print(print_card_8(card))
        card = BDFCard(card)
        rbe = RBE1.add_card(card)
        fields = rbe.raw_fields()
        msg = print_card_8(fields).rstrip()

        lines_expected = [
            'RBE1        1001    1000  123456',
            '              UM    1002     123    1003     123    1004     123',
            '                    1005     123    1006     123    1008     123',
            '                    1009     123    1010     123    1011     123',
            '                    1012     123',
        ]
        lines_actual = msg.rstrip().split('\n')
        msg = '\n%s\n\n%s\n' % ('\n'.join(lines_expected), msg)
        msg += 'nlines_actual=%i nlines_expected=%i' % (len(lines_actual),
                                                        len(lines_expected))
        self.assertEqual(len(lines_actual), len(lines_expected), msg)
        for actual, expected in zip(lines_actual, lines_expected):
            self.assertEqual(actual, expected, msg)

        dependent_nid_to_components = check_rbe(rbe)
        assert dependent_nid_to_components == {
            1002: '123',
            1003: '123',
            1004: '123',
            1005: '123',
            1006: '123',
            1008: '123',
            1009: '123',
            1010: '123',
            1011: '123',
            1012: '123'
        }, dependent_nid_to_components

        model = BDF(debug=None, log=None, mode='msc')
        eid = rbe.eid
        Gni = rbe.Gni
        Cni = rbe.Cni
        Gmi = rbe.Gmi
        Cmi = rbe.Cmi
        alpha = rbe.alpha
        model.add_rbe1(eid, Gni, Cni, Gmi, Cmi, alpha=alpha, comment='rbe1')
        nids = [
            1000, 1002, 1003, 1004, 1005, 1006, 1008, 1009, 1010, 1011, 1012
        ]
        for nid in nids:
            model.add_grid(nid, [0., 0., 0.])
        save_load_deck(model)
Пример #8
0
    def test_rbe1_03(self):
        lines = [
            'rbe1,46,3,123456, , , , , ,+rbe46',
            '+rbe46,UM,4,123456,5,123456,2.0-6'
        ]
        card = bdf.process_card(lines)
        card = BDFCard(card)
        rbe = RBE1.add_card(card)
        fields = rbe.raw_fields()
        msg = print_card_8(fields).rstrip()

        lines_expected = [
            'RBE1          46       3  123456',
            '              UM       4  123456       5  123456 .000002'
        ]

        lines_actual = msg.rstrip().split('\n')
        msg = '\n%s\n\n%s\n' % ('\n'.join(lines_expected), msg)
        msg += 'nlines_actual=%i nlines_expected=%i' % (len(lines_actual), len(lines_expected))
        self.assertEqual(len(lines_actual), len(lines_expected), msg)
        for actual, expected in zip(lines_actual, lines_expected):
            self.assertEqual(actual, expected, msg)