Skip to content

Commit 2483995

Browse files
authored
operator id(u, c) and direct broken scalarplot! (#66)
* Add id(u, c) high level operator * Add direct scalarplot! dispatch for broken plots Now the user can manually plot broken functions into a GridVisualizer
1 parent 9d96bd2 commit 2483995

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
## v1.3.0
44

55
### Added
6-
- `plot` for broken FE Spaces are now plotted discontinuously to avoid averaging of values at the grid nodes.
6+
- `plot` and `scalarplot!` for broken FE Spaces are now plotted discontinuously to avoid averaging of values at the grid nodes.
77
This can be disabled by passing the kwarg `average_broken_plots = true` to the `plot` call.
8+
- new `id(u, c)` operator for the component `c` of a FE function `u` wrapping `IdentityComponent{c}` from ExtendableFEMBase
89

910
## v1.2.0 June 4, 2025
1011

src/ExtendableFEM.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ using ExtendableFEMBase: ExtendableFEMBase, AbstractFiniteElement,
1818
FaceDofs, Gradient, H1BR, H1BUBBLE, H1CR, H1MINI,
1919
H1P1, H1P1TEB, H1P2, H1P2B, H1P3, H1Pk, H1Q1, H1Q2,
2020
HCURLN0, HCURLN1, HDIVBDM1, HDIVBDM2, HDIVRT0,
21-
HDIVRT1, HDIVRTk, HDIVRTkENRICH, Hessian, Identity,
21+
HDIVRT1, HDIVRTk, HDIVRTkENRICH, Hessian, Identity, IdentityComponent,
2222
L2P0, L2P1, Laplacian, Length4Operator,
2323
NeededDerivative4Operator, NormalFlux,
2424
ParentDofmap4Dofmap, PointEvaluator, QPInfos,

src/plots.jl

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1-
function GridVisualize.scalarplot!(p, op::Tuple{Unknown, DataType}, sol; abs = false, component = 1, title = String(op[1].identifier), kwargs...)
2-
return GridVisualize.scalarplot!(p, sol[op[1]].FES.dofgrid, view(nodevalues(sol[op[1]], op[2]; abs = abs), component, :); title = title, kwargs...)
3-
end
4-
function GridVisualize.scalarplot!(p, op::Tuple{Int, DataType}, sol; abs = false, component = 1, title = sol[op[1]].name, kwargs...)
5-
return GridVisualize.scalarplot!(p, sol[op[1]].FES.dofgrid, view(nodevalues(sol[op[1]], op[2]; abs = abs), component, :); title = title, kwargs...)
1+
function GridVisualize.scalarplot!(
2+
p,
3+
op::Union{Tuple{Unknown, DataType}, Tuple{Int, DataType}},
4+
sol;
5+
abs = false,
6+
component = 1,
7+
title = typeof(op) <: Tuple{Unknown, DataType} ? String(op[1].identifier) : sol[op[1]].name,
8+
average_broken_plots = false,
9+
kwargs...
10+
)
11+
if !average_broken_plots && ExtendableFEMBase.broken(sol[op[1]].FES)
12+
broken_scalarplot!(p, sol[op[1]], op[2]; title, average_broken_plots, kwargs...)
13+
else
14+
return GridVisualize.scalarplot!(p, sol[op[1]].FES.dofgrid, view(nodevalues(sol[op[1]], op[2]; abs = abs), component, :); title = title, kwargs...)
15+
end
616
end
17+
718
function GridVisualize.vectorplot!(p, op::Tuple{Unknown, DataType}, sol; title = String(op[1].identifier), kwargs...)
819
return GridVisualize.vectorplot!(p, sol[op[1]].FES.dofgrid, eval_func_bary(PointEvaluator([op], sol)); title = title, kwargs...)
920
end

src/unknowns.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ alias for (u, Identity)
101101
"""
102102
id(u) = (u, Identity)
103103

104+
"""
105+
id(u, c::Int)
106+
107+
alias for (u, IdentityComponent{c})
108+
"""
109+
id(u, c::Int) = (u, IdentityComponent{c})
110+
104111
"""
105112
curl1(u)
106113

0 commit comments

Comments
 (0)