@@ -19,7 +19,20 @@ function plot!(p::GridVisualizer, ops, sol; kwargs...)
1919Plots the operator evaluations ops of blocks in sol into the GridVisualizer.
2020
2121"""
22- function plot! (p:: GridVisualizer , ops, sol; rasterpoints = 10 , linewidth = 1 , keep = [], ncols = size (p. subplots, 2 ), do_abs = true , do_vector_plots = true , title_add = " " , kwargs... )
22+ function plot! (
23+ p:: GridVisualizer ,
24+ ops,
25+ sol;
26+ rasterpoints = 10 ,
27+ linewidth = 1 ,
28+ keep = [],
29+ ncols = size (p. subplots, 2 ),
30+ do_abs = true ,
31+ do_vector_plots = true ,
32+ title_add = " " ,
33+ average_broken_plots = false ,
34+ kwargs...
35+ )
2336 col, row, id = 0 , 1 , 0
2437 for op in ops
2538 col += 1
@@ -48,7 +61,11 @@ function plot!(p::GridVisualizer, ops, sol; rasterpoints = 10, linewidth = 1, ke
4861 title = op[2 ] == Identity ? " $(sol[op[1 ]]. name) " : " $(op[2 ]) ($(sol[op[1 ]]. name) )"
4962 end
5063 if resultdim == 1
51- GridVisualize. scalarplot! (p[row, col], sol[op[1 ]]. FES. dofgrid, view (nodevalues (sol[op[1 ]], op[2 ]; abs = false ), 1 , :), title = title * title_add; kwargs... )
64+ if ! average_broken_plots && ExtendableFEMBase. broken (sol[op[1 ]]. FES)
65+ broken_scalarplot! (p[row, col], sol[op[1 ]], op[2 ]; title = title * title_add, kwargs... )
66+ else
67+ GridVisualize. scalarplot! (p[row, col], sol[op[1 ]]. FES. dofgrid, view (nodevalues (sol[op[1 ]], op[2 ]; abs = false ), 1 , :), title = title * title_add; kwargs... )
68+ end
5269 elseif do_abs == true
5370 GridVisualize. scalarplot! (p[row, col], sol[op[1 ]]. FES. dofgrid, view (nodevalues (sol[op[1 ]], op[2 ]; abs = true ), 1 , :), title = " |" * title * " |" * title_add; kwargs... )
5471 else
@@ -72,6 +89,31 @@ function plot!(p::GridVisualizer, ops, sol; rasterpoints = 10, linewidth = 1, ke
7289end
7390
7491
92+ """
93+ broken_scalarplot!(vis, feVectorBlock::FEVectorBlock, operator = Identity; kwargs...)
94+
95+ A "broken" scalarplot of a broken finite element vector.
96+ Instead of averaging the discontinuous values on the grid nodes, each grid cell is plotted
97+ independently. Thus, a discontinuous plot is generated.
98+
99+ All kwargs of the calling method are transferred to the scalarplot in this method.
100+ """
101+ function broken_scalarplot! (vis, feVectorBlock:: FEVectorBlock , operator = Identity; kwargs... )
102+
103+ dofgrid = feVectorBlock. FES. dofgrid
104+ cell_nodes = dofgrid[CellNodes]
105+ coords = dofgrid[Coordinates]
106+
107+ all_values = nodevalues (feVectorBlock, operator; cellwise = true ) # cellwise evaluation of the FE
108+ all_coords = @views coords[:, cell_nodes[:]]
109+ all_cells = reshape (1 : length (all_values), size (all_values))
110+
111+ GridVisualize. scalarplot! (vis, all_coords, all_cells, view (all_values, :); kwargs... )
112+
113+ return nothing
114+ end
115+
116+
75117"""
76118````
77119function plot!(p::GridVisualizer, ops, sol; Plotter = nothing, kwargs...)
0 commit comments