Skip to content

Commit

Permalink
fix default args
Browse files Browse the repository at this point in the history
  • Loading branch information
koehlerson committed Mar 23, 2023
1 parent e036b0a commit ceb0623
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions src/makieplotting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ end
Solutionplot produces the classical contour plot onto the finite element mesh. Most important
keyword arguments are:
- `field::Symbol=:default` representing the field which gets plotted, defaults to the first field in the `dh`.
- `field::Symbol=:u` representing the field which gets plotted, defaults to the first field in the `dh`.
- `deformation_field::Symbol=:default` field that transforms the mesh by the given deformation, defaults to no deformation
- `process::Function=postprocess` function to construct nodal scalar values from a vector valued problem
- `colormap::Symbol=:cividis`
Expand All @@ -29,7 +29,7 @@ keyword arguments are:
Attributes(
scale_plot=false,
shading=false,
field=:default,
field=:u,
deformation_field=:default,
process=postprocess,
colormap=:cividis,
Expand All @@ -42,11 +42,7 @@ end
function Makie.plot!(SP::SolutionPlot{<:Tuple{<:MakiePlotter}})
plotter = SP[1][]
solution = @lift begin
if $(SP[:field])===:default
reshape(transfer_solution(plotter,$(plotter.u); field_name=Ferrite.getfieldnames(plotter.dh)[1], process=$(SP[:process])), num_vertices(plotter))
else
reshape(transfer_solution(plotter,$(plotter.u); field_name=$(SP[:field]), process=$(SP[:process])), num_vertices(plotter))
end
reshape(transfer_solution(plotter,$(plotter.u); field_name=Ferrite.getfieldnames(plotter.dh)[1], process=$(SP[:process])), num_vertices(plotter))
end
u_matrix = @lift begin
if $(SP[:deformation_field])===:default
Expand Down Expand Up @@ -300,7 +296,7 @@ values are transformed to a scalar based on `process` which defaults to the magn
"""
@recipe(Surface) do scene
Attributes(
field = :default,
field = :u,
process = postprocess,
scale_plot = false,
shading = false,
Expand Down Expand Up @@ -337,7 +333,7 @@ the arrows are unicolored. Otherwise the color corresponds to the magnitude, or
Attributes(
arrowsize = Makie.Automatic(),
normalize = true, #TODO: broken
field = :default,
field = :u,
color = :default,
colormap = :cividis,
process=postprocess,
Expand Down
2 changes: 1 addition & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ function getfieldhandlers(dh::Ferrite.DofHandler,field_name)
field_idx = Ferrite.find_field(dh,field_name)
ip_field = Ferrite.getfieldinterpolation(dh,field_idx)
field_dim_ = Ferrite.getfielddim(dh,field_idx)
return [Ferrite.FieldHandler([Ferrite.Field(:u,ip_field,field_dim_)],Set(1:Ferrite.getncells(dh.grid)))]
return [Ferrite.FieldHandler([Ferrite.Field(field_name,ip_field,field_dim_)],Set(1:Ferrite.getncells(dh.grid)))]
end

function getfieldhandlers(dh::Ferrite.MixedDofHandler,field_name)
Expand Down

0 comments on commit ceb0623

Please sign in to comment.