FerriteViz.ClipPlaneType
ClipPlane{T}(normal, distance_to_origin)

Clip plane with data of type T described by the normal and its distance to the coordinate origin.

Details

INTERNAL: Instances are callable as plane(grid, cellid) returning true if all nodes of a cell are on the side of the positive side of the plane, i.e. where for its normal we have coord ⋅ plane.normal > plane.distance. With this helper we perform the crinkle clip internally. xref [crinkle_clip!](@ref)

FerriteViz.MakiePlotterMethod
MakiePlotter(dh::Ferrite.AbstractDofHandler, u::Vector)
MakiePlotter(dh::Ferrite.AbstractDofHandler, u::Vector, topology::TOP) where {TOP<:Ferrite.AbstractTopology}

Builds a static triangulation of the underlying grid in dh.grid for rendering via Makie. The triangulation acts as a "L2" triangulation, i.e. the nodes which are shared between elements in the mesh are doubled.

Tip

For large 3D grids, prefer to use the second constructor if you have already a topology. Otherwise, it will be rebuilt which is time consuming.

FerriteViz._tensorsjl_gradient_accessorMethod
_tensorsjl_gradient_accessor(v::Tensors.Vec, field_dim_idx::Int, spatial_dim_idx::Int)

This is a helper to access the correct value in Tensors.jl entities, because the gradient index is the outermost one.

FerriteViz.arrows!Method
arrows(plotter::MakiePlotter; kwargs...)
arrows(dh::AbstractDofHandler, u::Vector; kwargs...)
arrows!(plotter::MakiePlotter; kwargs...)
arrows!(dh::AbstractDofHandler, u::Vector; kwargs...)

At every node position a arrows is drawn, where the arrow tip ends at the node. Only works in dim >=2. If a color is specified the arrows are unicolored. Otherwise the color corresponds to the magnitude, or any other scalar value based on the process function.

  • arrowsize = 0.08
  • normalize = true
  • field = :default
  • color = :default
  • colormap = :cividis
  • process=postprocess
  • lengthscale = 1f0
FerriteViz.arrowsMethod
arrows(plotter::MakiePlotter; kwargs...)
arrows(dh::AbstractDofHandler, u::Vector; kwargs...)
arrows!(plotter::MakiePlotter; kwargs...)
arrows!(dh::AbstractDofHandler, u::Vector; kwargs...)

At every node position a arrows is drawn, where the arrow tip ends at the node. Only works in dim >=2. If a color is specified the arrows are unicolored. Otherwise the color corresponds to the magnitude, or any other scalar value based on the process function.

  • arrowsize = 0.08
  • normalize = true
  • field = :default
  • color = :default
  • colormap = :cividis
  • process=postprocess
  • lengthscale = 1f0
FerriteViz.cellplot!Method
cellplot(plotter::MakiePlotter,σ::Vector{T}; kwargs...) where T
cellplot!(plotter::MakiePlotter,σ::Vector{T}; kwargs...) where T

cellplot plots constant scalar data on the cells of the finite element mesh. If T is not a number, the keyword argument process can be passed in order to reduce the elements of σ to a scalar.

keyword arguments are:

  • deformation_field::Symbol=:default field that transforms the mesh by the given deformation, defaults to no deformation
  • process::Function=identity function to construct cell scalar values. Defaults to identity, i.e. scalar values.
  • colormap::Symbol=:cividis
  • deformation_scale=1.0
  • shading=false
  • scale_plot=false
  • transparent=false
FerriteViz.cellplotMethod
cellplot(plotter::MakiePlotter,σ::Vector{T}; kwargs...) where T
cellplot!(plotter::MakiePlotter,σ::Vector{T}; kwargs...) where T

cellplot plots constant scalar data on the cells of the finite element mesh. If T is not a number, the keyword argument process can be passed in order to reduce the elements of σ to a scalar.

keyword arguments are:

  • deformation_field::Symbol=:default field that transforms the mesh by the given deformation, defaults to no deformation
  • process::Function=identity function to construct cell scalar values. Defaults to identity, i.e. scalar values.
  • colormap::Symbol=:cividis
  • deformation_scale=1.0
  • shading=false
  • scale_plot=false
  • transparent=false
FerriteViz.crinkle_clip!Method
crinkle_clip!(plotter::MakiePlotter{3}, decision_fun)

Crinkle clip updates the visibility of the triangles, based on an implicit description of the clipping surface. Here decision_fun takes the grid and a cell index as input and returns whether the cell is visible or not.

Warning

Chained calls to crinkle_clip! won't work at the moment.

FerriteViz.crinkle_clipMethod
crinkle_clip(plotter::MakiePlotter{3}, decision_fun) -> MakiePlotter

Crinkle clip generates a new plotter with updated visibility of the triangles. Non-mutating version of crinkle_clip!. Note that chained calls to crinkle_clip won't work.

FerriteViz.decompose!Method
decompose!(coord_offset, coord_matrix, ref_coord_matrix, triangle_offset, triangle_matrix, grid, cell::Ferrite.AbstractCell{3,N,M})

Decompose volumetric objects via their faces.

FerriteViz.decompose!Method
decompose!(coord_offset, coord_matrix, ref_coord_matrix, triangle_offset, triangle_matrix, grid, cell::Union{Ferrite.AbstractCell{2,N,3}, Ferrite.AbstractCell{3,3,1}})

Decompose a triangle into a coordinates and a triangle index list to disconnect it properly. Guarantees to preserve orderings and orientations.

FerriteViz.decompose!Method
decompose!(coord_offset, coord_matrix::Vector{Point{space_dim,T}}, ref_coord_matrix, triangle_offset, triangle_matrix, grid, cell::Union{Ferrite.AbstractCell{2,N,4}, Ferrite.AbstractCell{3,4,1}})

Decompose a quadrilateral into a coordinates and a triangle index list to disconnect it properly. Guarantees to preserve orderings and orientations.

Details

This function takes a CCW ordered quadrilateral, i.e.

4-------3
|       |
|       |
|       |
|       |
|       |
1-------2

and creates the decomposition

4-------3
| \ C / |
|  \ /  |
|D  5  B|
|  / \  |
| / A \ |
1-------2

where A=(1,2,5),B=(2,3,5),C=(3,4,5),D=(4,1,5) are the generated triangles in this order.

FerriteViz.elementinfo!Method
elementinfo(ip::Interpolation; kwargs...)
elementinfo(cell::AbstractCell; kwargs...)
elementinfo(ip::Type{Interpolation}; kwargs...)
elementinfo(cell::Type{AbstractCell}; kwargs...)
  • plotnodes=true controls if nodes of element are plotted
  • strokewidth=2 strokwidth of faces/edges
  • color=theme(scene, :linecolor)
  • markersize=30 size of the nodes
  • textsize=60 textsize of node-, edges- and facelabels
  • nodelabels=true switch that controls plotting of nodelabels
  • nodelabelcolor=:darkred
  • nodelabeloffset=(0.0,0.0) offset of the nodelabel text relative to its associated node
  • facelabels=true switch that controls plotting of facelabels
  • facelabelcolor=:darkgreen
  • facelabeloffset=(-40,0) offset of the facelabel text relative to its associated face middlepoint
  • edgelabels=true switch that controls plotting of edgelabels
  • edgelabelcolor=:darkblue
  • edgelabeloffset=(-40,-40) offset of the edgelabel text relative to its associated edge middlepoint
  • font="Julia Mono" font of the node-, edge-, and facelabels
FerriteViz.elementinfoMethod
elementinfo(ip::Interpolation; kwargs...)
elementinfo(cell::AbstractCell; kwargs...)
elementinfo(ip::Type{Interpolation}; kwargs...)
elementinfo(cell::Type{AbstractCell}; kwargs...)
  • plotnodes=true controls if nodes of element are plotted
  • strokewidth=2 strokwidth of faces/edges
  • color=theme(scene, :linecolor)
  • markersize=30 size of the nodes
  • textsize=60 textsize of node-, edges- and facelabels
  • nodelabels=true switch that controls plotting of nodelabels
  • nodelabelcolor=:darkred
  • nodelabeloffset=(0.0,0.0) offset of the nodelabel text relative to its associated node
  • facelabels=true switch that controls plotting of facelabels
  • facelabelcolor=:darkgreen
  • facelabeloffset=(-40,0) offset of the facelabel text relative to its associated face middlepoint
  • edgelabels=true switch that controls plotting of edgelabels
  • edgelabelcolor=:darkblue
  • edgelabeloffset=(-40,-40) offset of the edgelabel text relative to its associated edge middlepoint
  • font="Julia Mono" font of the node-, edge-, and facelabels
FerriteViz.ferriteviewerMethod
ferriteviewer(plotter::MakiePlotter)
ferriteviewer(plotter::MakiePlotter, u_history::Vector{Vector{T}}})

Constructs a viewer with a solutionplot, Colorbar as well as sliders,toggles and menus to change the current view. If the second dispatch is called a timeslider is added, in order to step through a set of solutions obtained from a simulation.

FerriteViz.interpolate_gradient_fieldMethod
interpolate_gradient_field(dh::DofHandler, u::AbstractVector, field_name::Symbol; copy_fields::Vector{Symbol})

Compute the piecewise discontinuous gradient field for field_name. Returns the flux dof handler and the corresponding flux dof values. If the additional keyword argument copy_fields is provided with a non empty Vector{Symbol}, the corresponding fields of dh will be copied into the returned flux dof handler and flux dof value vector.

FerriteViz.linear_face_cellMethod
linear_face_cell(cell::Ferrite.Cell, local_face_idx::Int)

Get the geometrically linear face of a given cell.

Warning

This may extracts the face spanned by the vertices, not the actual face!

FerriteViz.postprocessMethod
postprocess(node_values::Vector{T}) -> T

Takes the nodal dof vector and maps it either to the scalar or to the euclidean norm (in the vectorial case)

FerriteViz.solutionplot!Method
solutionplot(plotter::MakiePlotter; kwargs...)
solutionplot(dh::AbstractDofHandler, u::Vector; kwargs...)
solutionplot!(plotter::MakiePlotter; kwargs...)
solutionplot!(dh::AbstractDofHandler, u::Vector; kwargs...)

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.
  • 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
  • deformation_scale=1.0
  • shading=false
  • scale_plot=false
  • transparent=false
FerriteViz.solutionplotMethod
solutionplot(plotter::MakiePlotter; kwargs...)
solutionplot(dh::AbstractDofHandler, u::Vector; kwargs...)
solutionplot!(plotter::MakiePlotter; kwargs...)
solutionplot!(dh::AbstractDofHandler, u::Vector; kwargs...)

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.
  • 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
  • deformation_scale=1.0
  • shading=false
  • scale_plot=false
  • transparent=false
FerriteViz.surface!Method
surface(plotter::MakiePlotter; kwargs...)
surface(dh::AbstractDofHandler, u::Vector; kwargs...)
surface!(plotter::MakiePlotter; kwargs...)
surface!(dh::AbstractDofHandler, u::Vector; kwargs...)

Uses the given field and plots the scalar values as a surface. If it's a vector valued problem, the nodal vector values are transformed to a scalar based on process which defaults to the magnitude. Only availble in dim=2.

  • field = :default
  • process = postprocess
  • scale_plot = false
  • shading = false
  • colormap = :cividis
FerriteViz.surfaceMethod
surface(plotter::MakiePlotter; kwargs...)
surface(dh::AbstractDofHandler, u::Vector; kwargs...)
surface!(plotter::MakiePlotter; kwargs...)
surface!(dh::AbstractDofHandler, u::Vector; kwargs...)

Uses the given field and plots the scalar values as a surface. If it's a vector valued problem, the nodal vector values are transformed to a scalar based on process which defaults to the magnitude. Only availble in dim=2.

  • field = :default
  • process = postprocess
  • scale_plot = false
  • shading = false
  • colormap = :cividis
FerriteViz.transfer_solutionMethod
transfer_solution(plotter::MakiePlotter{dim,DH,T}, u::Vector; field_idx::Int=1, process::Function=FerriteViz.postprocess) where {dim,DH<:Ferrite.AbstractDofHandler,T}

Transfer the solution of a plotter to the tessellated mesh in dim.

Details

TODO: Refactor. This is peak inefficiency.

FerriteViz.uniform_refinementMethod
uniform_refinement(plotter::MakiePlotter)
uniform_refinement(plotter::MakiePlotter, num_refinements::Int)

Generates 3 triangles for each triangle by adding a center vertex and connecting them (orientation preserving).

Danger

This method has high RAM usage!

Info

This function currently does not increase the resolution of the geometrical points in space, only the solution quality!

Details

TODO investigate whether it is possible to eliminate the coordinate duplication without trashing the caches

FerriteViz.update!Method
FerriteViz.update!(plotter::MakiePlotter, u::Vector)

Updates the Observable plotter.u and thereby, triggers the plot to update.

FerriteViz.verticesMethod

Get the vertices represented as a list of coordinates of a cell.

Details

TODO refactor into Ferrite core.

FerriteViz.wireframe!Method
wireframe(plotter::MakiePlotter; kwargs...)
wireframe(dh::AbstractDofHandler, u::Vector; kwargs...)
wireframe(grid::AbstractGrid; kwargs...)
wireframe!(plotter::MakiePlotter; kwargs...)
wireframe!(dh::AbstractDofHandler, u::Vector; kwargs...)
wireframe!(grid::AbstractGrid; kwargs...)

Plots the finite element mesh, optionally labels it and transforms it if a suitable deformation_field is given.

  • plotnodes::Bool=true plots the nodes as circles/spheres
  • strokewidth::Int=2 how thick faces/edges are drawn
  • color::Symbol=theme(scene,:linecolor) color of the faces/edges and nodes
  • markersize::Int=30 size of the nodes
  • deformation_field::Symbol=:default field that transforms the mesh by the given deformation, defaults to no deformation
  • deformation_scale::Number=1.0 scaling of the deformation
  • cellsets=false Color cells based on their cellset association. If no cellset is found for a cell, the cell is marked blue.
  • nodelables=false global node id labels
  • nodelabelcolor=:darkblue
  • celllabels=false global cell id labels
  • celllabelcolor=:darkred
  • textsize::Int=15 size of the label's text
  • visible=true
FerriteViz.wireframeMethod
wireframe(plotter::MakiePlotter; kwargs...)
wireframe(dh::AbstractDofHandler, u::Vector; kwargs...)
wireframe(grid::AbstractGrid; kwargs...)
wireframe!(plotter::MakiePlotter; kwargs...)
wireframe!(dh::AbstractDofHandler, u::Vector; kwargs...)
wireframe!(grid::AbstractGrid; kwargs...)

Plots the finite element mesh, optionally labels it and transforms it if a suitable deformation_field is given.

  • plotnodes::Bool=true plots the nodes as circles/spheres
  • strokewidth::Int=2 how thick faces/edges are drawn
  • color::Symbol=theme(scene,:linecolor) color of the faces/edges and nodes
  • markersize::Int=30 size of the nodes
  • deformation_field::Symbol=:default field that transforms the mesh by the given deformation, defaults to no deformation
  • deformation_scale::Number=1.0 scaling of the deformation
  • cellsets=false Color cells based on their cellset association. If no cellset is found for a cell, the cell is marked blue.
  • nodelables=false global node id labels
  • nodelabelcolor=:darkblue
  • celllabels=false global cell id labels
  • celllabelcolor=:darkred
  • textsize::Int=15 size of the label's text
  • visible=true