Пример #1
0
    def test_mat11_01(self):
        lines = [  # fails
            'MAT11          1    1.+75000000. 700000.      .1     .13     .267000000.+',
            '+       9000000.3000000.      .1    1.-5    7.-6    8.-6     50.',
        ]
        lines_expected = [
            'MAT11          1    1.+75000000. 700000.      .1     .137000000.9000000.',
            '        3000000.      .1  .00001 .000007 .000008     50.'
        ]
        card = bdf.process_card(lines)
        card = BDFCard(card)
        card2 = MAT11(card)

        fields = card2.raw_fields()
        msg = print_card(fields)
        #f = StringIO.StringIO()
        size = 8
        msg = card2.write_bdf(size, 'dummy')
        #msg = f.getvalue()
        #print(msg)

        lines_actual = msg.rstrip().split('\n')
        msg = '\n%s\n\n%s' % ('\n'.join(lines_expected), msg)
        msg += 'nlines_actual=%i nlines_expected=%i' % (len(lines_actual),
                                                        len(lines_expected))
        #print(msg)
        self.assertEqual(len(lines_actual), len(lines_expected), msg)
        for actual, expected in zip(lines_actual, lines_expected):
            msg = 'actual   = %r\n' % actual
            msg += 'expected = %r' % expected
            self.assertEqual(actual, expected, msg)
    def test_mat11_01(self):
        lines = [
            'MAT11          1    1.+75000000. 700000.      .1     .13     .267000000.+',
            '+       9000000.3000000.      .1    1.-5    7.-6    8.-6     50.',
        ]
        lines_expected = [
            'MAT11          1    1.+75000000. 700000.      .1     .13     .267000000.',
            '        9000000.3000000.      .1  .00001 .000007 .000008     50.'
        ]
        card = bdf.process_card(lines)
        cardi = BDFCard(card)
        card2 = MAT11.add_card(cardi)

        fields = card2.raw_fields()
        msg = print_card_8(fields)
        #f = StringIO.StringIO()
        size = 8
        msg = card2.write_card(size, 'dummy')
        #msg = f.getvalue()
        #print(msg)

        lines_actual = msg.rstrip().split('\n')
        msg = '\n%s\n\n%s' % ('\n'.join(lines_expected), msg)
        msg += 'nlines_actual=%i nlines_expected=%i' % (len(lines_actual), len(lines_expected))
        #print(msg)
        self.assertEqual(len(lines_actual), len(lines_expected), msg)
        for actual, expected in zip(lines_actual, lines_expected):
            msg = '\nactual   = %r\n' % actual
            msg += 'expected =  %r' % expected
            self.assertEqual(actual, expected, msg)
Пример #3
0
    def test_mat11_01(self):
        """tests MAT11"""
        lines = [
            'MAT11          1    1.+75000000. 700000.      .1     .13     .267000000.+',
            '+       9000000.3000000.      .1    1.-5    7.-6    8.-6     50.',
        ]
        lines_expected = [
            'MAT11          1    1.+75000000. 700000.      .1     .13     .267000000.',
            '        9000000.3000000.      .1  .00001 .000007 .000008     50.'
        ]
        model = BDF(debug=False)
        card = model.process_card(lines)
        cardi = BDFCard(card)
        card2 = MAT11.add_card(cardi)

        fields = card2.raw_fields()
        msg = print_card_8(fields)
        #f = StringIO.StringIO()
        size = 8
        msg = card2.write_card(size, 'dummy')
        #msg = f.getvalue()
        #print(msg)

        lines_actual = msg.rstrip().split('\n')
        msg = '\n%s\n\n%s' % ('\n'.join(lines_expected), msg)
        msg += 'nlines_actual=%i nlines_expected=%i' % (len(lines_actual),
                                                        len(lines_expected))
        #print(msg)
        self.assertEqual(len(lines_actual), len(lines_expected), msg)
        for actual, expected in zip(lines_actual, lines_expected):
            msg = '\nactual   = %r\n' % actual
            msg += 'expected =  %r' % expected
            self.assertEqual(actual, expected, msg)
Пример #4
0
    def test_mat11_01(self):
        """tests MAT11"""
        log = get_logger(level='warning')
        model = BDF(log=log)
        lines = [
            'MAT11          1    1.+75000000. 700000.      .1     .13     .267000000.+',
            '+       9000000.3000000.      .1    1.-5    7.-6    8.-6     50.',
        ]
        lines_expected = [
            'MAT11          1    1.+75000000. 700000.      .1     .13     .267000000.',
            '        9000000.3000000.      .1  .00001 .000007 .000008     50.'
        ]
        card = model._process_card(lines)
        cardi = BDFCard(card)
        mat = MAT11.add_card(cardi)

        fields = mat.raw_fields()
        msg = print_card_8(fields)
        #f = StringIO.StringIO()
        size = 8
        msg = mat.write_card(size, 'dummy')
        #msg = f.getvalue()
        #print(msg)

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

        save_load_deck(model,
                       xref='standard',
                       punch=True,
                       run_remove_unused=False)
Пример #5
0
    def test_mat11_01(self):
        """tests MAT11"""
        lines = [
            'MAT11          1    1.+75000000. 700000.      .1     .13     .267000000.+',
            '+       9000000.3000000.      .1    1.-5    7.-6    8.-6     50.',
        ]
        lines_expected = [
            'MAT11          1    1.+75000000. 700000.      .1     .13     .267000000.',
            '        9000000.3000000.      .1  .00001 .000007 .000008     50.'
        ]
        model = BDF(debug=False)
        card = model._process_card(lines)
        cardi = BDFCard(card)
        mat = MAT11.add_card(cardi)

        fields = mat.raw_fields()
        msg = print_card_8(fields)
        #f = StringIO.StringIO()
        size = 8
        msg = mat.write_card(size, 'dummy')
        #msg = f.getvalue()
        #print(msg)

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

        mid = 10
        e1 = 1.
        e2 = 2.
        e3 = 3.
        nu12 = 12.
        nu13 = 13.
        nu23 = 23.
        g12 = 112.
        g13 = 113.
        g23 = 123.
        model = BDF(debug=False)
        mat3d = model.add_mat3d(mid,
                                e1,
                                e2,
                                e3,
                                nu12,
                                nu13,
                                nu23,
                                g12,
                                g13,
                                g23,
                                rho=1.0,
                                comment='mat3d')
        mat3d.raw_fields()
        mat3d.write_card(size=8, is_double=False)
        mat3d.write_card(size=16, is_double=False)
        mat3d.write_card(size=16, is_double=True)
        save_load_deck(model,
                       xref='standard',
                       punch=True,
                       run_remove_unused=False,
                       run_convert=True,
                       run_renumber=True,
                       run_mirror=True,
                       run_save_load=True)