Exemple #1
0
 def repr_fields(self):
     cntrlnd = set_blank_if_default(self.cntrlnd, 0)
     eids = self.element_ids
     eids.sort()
     list_fields = ['QBDY3', self.sid, self.q0, cntrlnd
                    ] + collapse_thru_by(eids)
     return list_fields
Exemple #2
0
    def test_accel1_2(self):
        """tests problematic ACCEL1 cards"""
        cards = [
            ['ACCEL1  1               -32.2   0.2672610.5345220.801784',
             '+       1       2       3       4       5'],
            ['ACCEL1  2               -64.4   0.2672610.5345220.801784',
             '+       6       THRU    9       10'],
            ['ACCEL1  3               -96.6   0.2672610.5345220.801784',
             '+       11      12      THRU    15'],
            ['ACCEL1  4               -128.8  0.2672610.5345220.801784',
             '+       1       THRU    10      BY      2       12      THRU    24',
             '+       BY      2'],
            ['ACCEL1  5               -161.0  0.2672610.5345220.801784',
             '+       14      THRU    24      BY      3'],
        ]
        fields = ['14', 'THRU', '24', 'BY', '2']
        fields = expand_thru_by(fields, set_fields=True, sort_fields=True)
        assert fields == [14, 16, 18, 20, 22, 24], 'fields=%s' % fields
        assert collapse_thru_by(fields) == [14, 'THRU', 24, 'BY', 2], collapse_thru_by(fields)

        fields = ['2', 'THRU', '5', 'BY', '1', '10']
        fields = expand_thru_by(fields, set_fields=True, sort_fields=True)
        assert fields == [2, 3, 4, 5, 10], 'fields=%s' % fields
        assert collapse_thru_by(fields) == [2, 'THRU', 5, 10], collapse_thru_by(fields)

        fields = ['14', 'THRU', '24', 'BY', '3']
        fields = expand_thru_by(fields, set_fields=True, sort_fields=True)
        assert fields == [14, 17, 20, 23, 24], 'fields=%s' % fields
        # [14, 'THRU', 24, 'BY', 3] - this is the ideal answer, but close enough...
        assert collapse_thru_by(fields) == [14, 17, 20, 23, 24], collapse_thru_by(fields)

        fields = ['14', 'THRU', '24', 'BY', '2']
        fields = expand_thru_by(fields, set_fields=True, sort_fields=True)
        assert collapse_thru_by(fields) == [14, 'THRU', 24, 'BY', 2], collapse_thru_by(fields)

        model = BDF()
        for card_lines in cards:
            model.add_card(card_lines, 'ACCEL1', comment='',
                           is_list=False, has_none=True)

        for key, loads in sorted(model.loads.items()):
            for load in loads:
                str(load)
Exemple #3
0
 def repr_fields(self):
     cntrlnd = set_blank_if_default(self.cntrlnd, 0)
     eids = self.Eids()
     eids.sort()
     list_fields = ['QBDY3', self.sid, self.Q0, cntrlnd] + collapse_thru_by(eids)
     return list_fields
Exemple #4
0
 def raw_fields(self):
     eids = self.Eids()
     eids.sort()
     list_fields = (['QBDY3', self.sid, self.Q0, self.cntrlnd] +
                    collapse_thru_by(eids))
     return list_fields
Exemple #5
0
 def repr_fields(self):
     eids = collapse_thru_by(self.element_ids)
     list_fields = ['QBDY1', self.sid, self.qFlux] + eids
     return list_fields
Exemple #6
0
 def repr_fields(self):
     eids = collapse_thru_by(self.element_ids)
     list_fields = ['QVOL', self.sid, self.qvol, self.control_point] + eids
     return list_fields
Exemple #7
0
    def test_base_card_01_collapse_thru(self):
        """
        tests collapse_thru method used by SETx cards
        """
        data = [1, 2, 3, 4, 5, 10]
        expected = [1, u'THRU', 5, 10]
        self.assertEqual(collapse_thru_by(data), expected,
                         collapse_thru_by(data))

        data = [1, 3, 4, 5, 6, 17]
        expected = [1, 3, 4, 5, 6, 17]
        msg = 'expected=%s actual=%s' % (expected, collapse_thru_by(data))
        self.assertEqual(collapse_thru_by(data), expected, msg)

        data = [1, 3, 4, 5, 6, 7, 17]
        expected = [1, 3, 4, 'THRU', 7, 17]
        self.assertEqual(collapse_thru_by(data), expected,
                         collapse_thru_by(data))

        data = [1, 3, 4, 6, 8, 10, 12, 14, 17]
        expected = [1, 3, 4, 'THRU', 14, 'BY', 2, 17]
        self.assertEqual(collapse_thru_by(data), expected,
                         collapse_thru_by(data))

        data = [1, 3, 4, 5, 6, 8, 10, 12, 14, 16, 18, 20, 22, 101]
        expected = [1, 3, 4, 5, 6, 8, 'THRU', 22, 'BY', 2, 101]
        self.assertEqual(collapse_thru_by(data), expected,
                         collapse_thru_by(data))

        data = [1, 2, 3, 4, 5]
        expected = [1, 'THRU', 5]
        self.assertEqual(collapse_thru_by(data), expected,
                         collapse_thru_by(data))

        data = [5]
        expected = [5]
        self.assertEqual(collapse_thru_by(data), expected,
                         collapse_thru_by(data))

        data = [1, 2, 3, 4, 5, 7, 9, 11, 12, 14, 16]
        expected = [1, 'THRU', 5, 7, 9, 11, 12, 14, 16]
        self.assertEqual(collapse_thru_by(data), expected,
                         collapse_thru_by(data))

        data = [1, 2]
        expected = [1, 2]
        self.assertEqual(collapse_thru_by(data), expected,
                         collapse_thru_by(data))

        data = [1, 3, 5, 7, 9, 11]
        expected = [1, 'THRU', 11, 'BY', 2]
        self.assertEqual(collapse_thru_by(data), expected,
                         collapse_thru_by(data))

        data = [1, 2, 3, 4]
        expected = [1, 'THRU', 4]
        self.assertEqual(collapse_thru_by(data), expected,
                         collapse_thru_by(data))

        data = [1, 2, 3]
        expected = [1, 2, 3]
        self.assertEqual(collapse_thru_by(data), expected,
                         collapse_thru_by(data))

        data = [1, 2, 3, 4, 5, 6, 7, 8]
        expected = [1, 'THRU', 8]
        self.assertEqual(collapse_thru_by(data), expected,
                         collapse_thru_by(data))
Exemple #8
0
 def repr_fields(self):
     cntrlnd = set_blank_if_default(self.cntrlnd, 0)
     eids = collapse_thru_by(self.Eids())
     list_fields = ['RADBC', self.nodamb, self.famb, cntrlnd] + eids
     return list_fields
    def test_base_card_01_collapse_thru(self):
        """
        tests collapse_thru method used by SETx cards
        """
        data = [1, 2, 3, 4, 5, 10]
        expected = [1, u'THRU', 5, 10]
        self.assertEqual(collapse_thru_by(data), expected, collapse_thru_by(data))

        data = [1, 3, 4, 5, 6, 17]
        expected = [1, 3, 4, 5, 6, 17]
        msg = 'expected=%s actual=%s' % (expected, collapse_thru_by(data))
        self.assertEqual(collapse_thru_by(data), expected, msg)

        data = [1, 3, 4, 5, 6, 7, 17]
        expected = [1, 3, 4, 'THRU', 7, 17]
        self.assertEqual(collapse_thru_by(data), expected, collapse_thru_by(data))

        data = [1, 3, 4, 6, 8, 10, 12, 14, 17]
        expected = [1, 3, 4, 'THRU', 14, 'BY', 2, 17]
        self.assertEqual(collapse_thru_by(data), expected, collapse_thru_by(data))

        data = [1, 3, 4, 5, 6, 8, 10, 12, 14, 16, 18, 20, 22, 101]
        expected = [1, 3, 4, 5, 6, 8, 'THRU', 22, 'BY', 2, 101]
        self.assertEqual(collapse_thru_by(data), expected, collapse_thru_by(data))

        data = [1, 2, 3, 4, 5]
        expected = [1, 'THRU', 5]
        self.assertEqual(collapse_thru_by(data), expected, collapse_thru_by(data))

        data = [5]
        expected = [5]
        self.assertEqual(collapse_thru_by(data), expected, collapse_thru_by(data))

        data = [1, 2, 3, 4, 5, 7, 9, 11, 12, 14, 16]
        expected = [1, 'THRU', 5,
                    7, 9, 11,
                    12, 14, 16]
        self.assertEqual(collapse_thru_by(data), expected, collapse_thru_by(data))

        data = [1, 2]
        expected = [1, 2]
        self.assertEqual(collapse_thru_by(data), expected, collapse_thru_by(data))

        data = [1, 3, 5, 7, 9, 11]
        expected = [1, 'THRU', 11, 'BY', 2]
        self.assertEqual(collapse_thru_by(data), expected, collapse_thru_by(data))

        data = [1, 2, 3, 4]
        expected = [1, 'THRU', 4]
        self.assertEqual(collapse_thru_by(data), expected, collapse_thru_by(data))

        data = [1, 2, 3]
        expected = [1, 2, 3]
        self.assertEqual(collapse_thru_by(data), expected, collapse_thru_by(data))

        data = [1, 2, 3, 4, 5, 6, 7, 8]
        expected = [1, 'THRU', 8]
        self.assertEqual(collapse_thru_by(data), expected, collapse_thru_by(data))
Exemple #10
0
 def raw_fields(self):
     eids = self.element_ids
     eids.sort()
     list_fields = (['QBDY3', self.sid, self.q0, self.cntrlnd] +
                    collapse_thru_by(eids))
     return list_fields
Exemple #11
0
 def repr_fields(self):
     eids = collapse_thru_by(self.element_ids)
     list_fields = ['QBDY1', self.sid, self.qflux] + eids
     return list_fields
Exemple #12
0
 def repr_fields(self):
     eids = collapse_thru_by(self.element_ids)
     list_fields = [
         'QVECT', self.sid, self.q0, self.t_source, self.ce
         ] + self.vector_tableds + [self.control_id] + eids
     return list_fields
Exemple #13
0
 def repr_fields(self):
     eids = collapse_thru_by(self.element_ids)
     list_fields = ['QVOL', self.sid, self.qvol, self.control_point] + eids
     return list_fields
Exemple #14
0
 def repr_fields(self):
     cntrlnd = set_blank_if_default(self.cntrlnd, 0)
     eids = collapse_thru_by(self.Eids())
     list_fields = ['RADBC', self.nodamb, self.famb, cntrlnd] + eids
     return list_fields
Exemple #15
0
 def raw_fields(self):
     eids = self.Eids()
     eids.sort()
     list_fields = (['QBDY3', self.sid, self.Q0, self.cntrlnd] +
                    collapse_thru_by(eids))
     return list_fields