Skip to content

Commit

Permalink
added :mag to default_dec_generate_matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
quffaro committed Dec 14, 2024
1 parent 89a4686 commit 541d97b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 20 deletions.
8 changes: 2 additions & 6 deletions docs/src/cism/cism.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,8 @@ We provide here the mapping from symbols to differential operators. As more of t
function generate(sd, my_symbol; hodge=GeometricHodge())
# We pre-allocate matrices that encode differential operators.
op = @match my_symbol begin
:mag => x -> norm.(x)
:♯ => begin
sharp_mat = ♯_mat(sd, AltPPSharp())
x -> sharp_mat * x
end
x => error("Unmatched operator $my_symbol")
x => default_dec_matrix_generate(sd, x, hodge)
_ => error("Unmatched operator $my_symbol")
end
return (args...) -> op(args...)
end
Expand Down
10 changes: 2 additions & 8 deletions docs/src/ebm_melt/ebm_melt.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,8 @@ constants_and_parameters = (
# Define how symbols map to Julia functions
function generate(sd, my_symbol; hodge=GeometricHodge())
op = @match my_symbol begin
:♯ => begin
sharp_mat = ♯_mat(sd, AltPPSharp())
x -> sharp_mat * x
end
:mag => x -> begin
norm.(x)
end
x => error("Unmatched operator $my_symbol")
x => default_dec_matrix_generate(sd, x, hodge)
_ => error("Unmatched operator $my_symbol")
end
return (args...) -> op(args...)
end
Expand Down
8 changes: 2 additions & 6 deletions docs/src/grigoriev/grigoriev.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,8 @@ to_graphviz(ice_dynamics)
``` @example DEC
function generate(sd, my_symbol; hodge=GeometricHodge())
op = @match my_symbol begin
:mag => x -> norm.(x)
:♯ => begin
sharp_mat = ♯_mat(sd, AltPPSharp())
x -> sharp_mat * x
end
x => error("Unmatched operator $my_symbol")
x => default_dec_matrix_generate(sd, x, hodge)
_ => error("Unmatched operator $my_symbol")
end
return op
end
Expand Down
1 change: 1 addition & 0 deletions src/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ function default_dec_matrix_generate(sd::HasDeltaSet, my_symbol::Symbol, hodge::
:avg₀₁ => dec_avg₀₁(sd)

:neg => x -> -1 .* x
:mag => x -> norm.(x)
_ => error("Unmatched operator $my_symbol")
end

Expand Down

0 comments on commit 541d97b

Please sign in to comment.