|
40 | 40 | ) |
41 | 41 | from pyNastran.f06.flutter_response import _reshape_eigenvectors |
42 | 42 | from pyNastran.f06.parse_trim import read_f06_trim |
| 43 | +from pyNastran.f06.f06_matrix_parser import _parse_real_row_lines, _parse_complex_row_lines |
43 | 44 | from pyNastran.f06.f06_to_pressure_loads import f06_to_pressure_loads |
44 | 45 | from pyNastran.f06.dev.read_sol_200 import plot_sol_200 # read_sol_200 |
45 | 46 | from pyNastran.op2.op2 import OP2 |
46 | 47 | from pyNastran.utils import print_bad_path |
47 | 48 | try: |
48 | 49 | from pyNastran.f06.dev.flutter.utils import ( |
49 | | - load_f06_op2, get_png_filename, get_plot_file) |
| 50 | + load_f06_op2, get_png_filename, get_plot_file, |
| 51 | + point_removal_str_to_point_removal, |
| 52 | + get_point_removal_str) |
50 | 53 | except ImportError: |
51 | 54 | pass |
52 | 55 | IS_DEV = pyNastran.DEV |
|
61 | 64 |
|
62 | 65 |
|
63 | 66 | class TestF06Flutter(unittest.TestCase): |
| 67 | + def test_point_removal(self): |
| 68 | + log = SimpleLogger(level='debug') |
| 69 | + msg = '400:410,450:500' |
| 70 | + point_removal = [[400.0, 410.0], [450.0, 500.0]] |
| 71 | + point_removal_list = point_removal_str_to_point_removal( |
| 72 | + msg, log) |
| 73 | + assert np.allclose(point_removal, point_removal_list), point_removal_list |
| 74 | + |
| 75 | + out = get_point_removal_str(point_removal_list) |
| 76 | + assert out == msg, out |
64 | 77 |
|
65 | 78 | def test_reshape_eigenvectors(self): |
66 | 79 | """ |
@@ -941,6 +954,40 @@ def test_split_int_colon(self): |
941 | 954 | f = split_int_colon('1,3,5') |
942 | 955 | assert f == [1, 3, 5], f |
943 | 956 |
|
| 957 | + def test_parse_real_row_lines(self): |
| 958 | + lines = [ |
| 959 | + ' 1) 1.1010E+01 1.3762E+00 -4.2021E+00 -5.2526E-01', |
| 960 | + ] |
| 961 | + row1, data1 = _parse_real_row_lines(lines) |
| 962 | + assert np.array_equal(row1, [1, 2, 3, 4]) |
| 963 | + assert np.array_equal(data1, [1.1010E+01, 1.3762E+00, -4.2021E+00, -5.2526E-01]) |
| 964 | + |
| 965 | + def test_parse_complex_row_lines(self): |
| 966 | + lines = [ |
| 967 | + ' 1) -3.5846E+01,-1.3275E+02 -1.5510E+01, 2.3578E-01 -3.2339E+01,-4.9373E+00 6.8078E+01, 1.3428E+01 3.0262E+01, 2.4554E+01', |
| 968 | + ' 6) 1.5360E-04,-1.1042E-04 -4.7606E-04, 2.3069E-04 1.0359E-03,-1.5668E-04 -1.3075E-03, 7.8472E-04 2.3471E-04,-4.8359E-04', |
| 969 | + ] |
| 970 | + row1, data1 = _parse_complex_row_lines(lines) |
| 971 | + assert np.array_equal(row1, [1, 2, 3, 4, 5, |
| 972 | + 6, 7, 8, 9, 10]), row1 |
| 973 | + reals = [ |
| 974 | + -3.5846E+01, -1.5510E+01, -3.2339E+01, 6.8078E+01, 3.0262E+01, |
| 975 | + 1.5360E-04, -4.7606E-04, 1.0359E-03, -1.3075E-03, 2.3471E-04] |
| 976 | + imags = [ |
| 977 | + -1.3275E+02, 2.3578E-01, -4.9373E+00, 1.3428E+01, 2.4554E+01, |
| 978 | + -1.1042E-04, 2.3069E-04, -1.5668E-04, 7.8472E-04, -4.8359E-04] |
| 979 | + assert np.array_equal(data1.real, reals) |
| 980 | + assert np.array_equal(data1.imag, imags) |
| 981 | + |
| 982 | + lines = [ |
| 983 | + ' 1) -3.5846E+01,-1.3275E+02', |
| 984 | + ' 6) 1.5360E-04,-1.1042E-04', |
| 985 | + ] |
| 986 | + row2, data2 = _parse_complex_row_lines(lines) |
| 987 | + assert np.array_equal(row2, [1, 6]) |
| 988 | + assert np.array_equal(data2.real, [-3.5846E+01, 1.5360E-04]) |
| 989 | + assert np.array_equal(data2.imag, [-1.3275E+02, -1.1042E-04]) |
| 990 | + |
944 | 991 |
|
945 | 992 | if __name__ == '__main__': # pragma: no cover |
946 | 993 | unittest.main() |
0 commit comments