@@ -67,7 +67,7 @@ function test_convergence_order!(test_case, tab, results = Dict(); refinement_ra
6767 refinement_range, # ::UnitRange, 2:4 is more fine than 1:3
6868 )
6969 computed_order = maximum (cr. computed_order)
70- results[tab, test_case. test_name] = (; expected_order, computed_order)
70+ results[test_case. test_name, typeof (alg) ] = (; expected_order, computed_order)
7171 return nothing
7272end
7373
@@ -89,50 +89,15 @@ function convergence_order_results(tabs, test_cases)
8989 return results
9090end
9191
92- function tabulate_convergence_orders (test_cases, tabs, results)
93- columns = map (test_cases) do test_case
94- map (tab -> results[tab, test_case. test_name], tabs)
95- end
96- expected_order = map (tab -> default_expected_order (nothing , tab), tabs)
97- tab_names = map (tab -> " $tab ($(default_expected_order (nothing , tab)) )" , tabs)
98- data = hcat (columns... )
99- summary (result) = result. computed_order
100- data_summary = map (d -> summary (d), data)
101-
102- table_data = hcat (tab_names, data_summary)
103- precentage_fail = sum (fail_conv .(getindex .(data, 1 ), getindex .(data, 2 ))) / length (data) * 100
104- @info " Percentage of failed convergence order tests: $precentage_fail "
105- fail_conv_hl = PrettyTables. Highlighter (
106- (data, i, j) -> j ≠ 1 && fail_conv (expected_order[i], data[i, j]),
107- PrettyTables. crayon " red bold" ,
108- )
109- super_conv_hl = PrettyTables. Highlighter (
110- (data, i, j) -> j ≠ 1 && super_conv (expected_order[i], data[i, j]),
111- PrettyTables. crayon " yellow bold" ,
112- )
113- tab_column_hl = PrettyTables. Highlighter ((data, i, j) -> j == 1 , PrettyTables. crayon " green bold" )
114- test_case_names = map (test_case -> test_case. test_name, test_cases)
115-
116- header = ([" Tableau (theoretic)" , test_case_names... ],
117- # ["", ["" for tc in test_case_names]...],
118- )
119-
120- PrettyTables. pretty_table (
121- table_data;
122- header_crayon = PrettyTables. crayon " green bold" ,
123- highlighters = (tab_column_hl, fail_conv_hl, super_conv_hl),
124- title = " Computed convergence orders, red=fail, yellow=super-convergence" ,
125- header,
126- alignment = :c ,
127- crop = :none ,
128- )
129- end
130-
131- function tabulate_convergence_orders_new (prob_names, algs, results, expected_orders)
92+ function tabulate_convergence_orders_new (prob_names, algs, results, expected_orders; tabs = nothing )
13293 data = hcat (map (prob_names) do name
13394 map (alg -> results[name, typeof (alg)], algs)
13495 end ... )
135- alg_names = @. string (nameof (typeof (algs)))
96+ alg_names = if tabs ≠ nothing
97+ @. string (nameof (typeof (tabs)))
98+ else
99+ @. string (typeof (algs))
100+ end
136101 summary (result) = last (result)
137102 data_summary = map (d -> summary (d), data)
138103
0 commit comments