@@ -15,8 +15,7 @@ module Example280_BasisPlotter
1515using ExtendableFEMBase
1616using ExtendableGrids
1717using GridVisualize
18- using UnicodePlots
19- using Term
18+ using UnicodePlots, Term
2019
2120# # everything is wrapped in a main function
2221function main (; dim = 1 , order = 3 , Plotter = UnicodePlots)
@@ -49,27 +48,24 @@ function main(; dim = 1, order = 3, Plotter = UnicodePlots)
4948 if dim == 1
5049 layout = (1 , 1 ) # everything is plotted into one plot
5150 size = (600 , 600 )
51+ colors = [:red , :green , :blue , :white , :yellow , :cyan , :magenta ]
5252 elseif dim == 2
53- if order in [1 , 2 ]
54- layout = (order, 3 )
55- size = (900 , 300 * order)
56- elseif order == 3
57- layout = (2 , 5 )
58- size = (1000 , 400 )
59- elseif order == 4
60- layout = (3 , 5 )
61- size = (1000 , 600 )
53+ l = round (Int, ceil (sqrt (ndofs)))
54+ if l^ 2 - l >= ndofs
55+ layout = (l - 1 , l)
56+ else
57+ layout = (l, l)
6258 end
59+ size = (1000 , 1000 )
60+ p = permutedims (reshape (1 : prod (layout), layout))[:]
6361 end
6462 plt = GridVisualizer (; Plotter = Plotter, layout = layout, size = size)
65- colors = [:red , :green , :blue , :white , :yellow , :cyan , :magenta ]
66- r, c = 1 , 1
6763 for j in 1 : ndofs
68- if dim == 2
69- c = mod (j - 1 , layout[2 ]) + 1
70- r = Int (ceil ((j - 0.5 ) / layout[2 ]))
64+ if dim == 1
65+ ExtendableFEMBase. scalarplot! (plt[1 ], I[1 ], IdentityComponent{j}; Plotter = Plotter, clear = false , title = " dof $j " , color = dim == 1 ? colors[j] : :white )
66+ else
67+ ExtendableFEMBase. scalarplot! (plt[p[j]], I[1 ], IdentityComponent{j}; Plotter = Plotter, clear = false , title = " dof $j " , color = dim == 1 ? colors[j] : :white )
7168 end
72- GridVisualize. scalarplot! (plt[r, c], I[1 ], IdentityComponent{j}; Plotter = Plotter, clear = false , title = " dof $j " , color = dim == 1 ? colors[j] : :white )
7369 end
7470 reveal (plt)
7571 return FEFunc, plt
0 commit comments