API Reference

Data source

FerriteViz.FEDataType
FEData(dh::Ferrite.AbstractDofHandler, u::Vector; topology, adaptivity=true)

Source node of the visualization pipeline: builds the static "L2" triangulation of Ferrite.get_grid(dh) (nodes shared between cells are duplicated per cell so discontinuous fields render with their jumps) and holds u as an Observable for live updating via FerriteViz.update!.

Named data arrays are resolved with point_data/cell_data and registered with set_point_data!/set_cell_data!. Transformations are applied by piping into filters: ds |> WarpByVector(:u, 2.0) |> Gradient(:u) |> VonMises().

For large 3D grids, pass a precomputed topology::Ferrite.ExclusiveTopology to avoid rebuilding it.

adaptivity controls how this dataset's plots refine: adaptivity=true (the default) applies the Adaptivity filter with its default tolerances, so solutionplot and meshplot re-tessellate the visible cells by longest-edge bisection until the drawn triangles resolve both the exact geometry and the color field — watertight, camera-independent, following FerriteViz.update!. Pass an Adaptivity(...) of your own to tweak the tolerances (equivalent to FEData(...; adaptivity=false) |> Adaptivity(...)), or adaptivity=false to always draw the static tessellation. The setting is a dataset property, shared by every plot of it and carried through filters. A color the adaptive path cannot re-evaluate at refined vertices (a raw point-data array) falls back to the static tessellation for that plot.

The static tessellation the constructor builds is the flat base for every cell — with adaptivity on, curved rendering comes from the adaptive path. For a uniformly subdivided static tessellation instead, compose explicitly: FEData(dh, u; adaptivity=false) |> Refine(2) (or Refine() for its automatic per-cell-type choice).

source
FerriteViz.AdaptivityType
Adaptivity(; geometry_tol=1e-3, solution_tol=5e-3, max_depth=10, sample_type=Float32)

How a dataset's plots refine — the error-adaptive tessellation settings, owned by the FEData (every plot of a dataset follows the same settings; there are no per-plot overrides). The tolerances and the depth cap are Observables: assigning them (ds.adaptivity.solution_tol[] = 1e-4) re-refines every open plot of the dataset.

Adaptivity is a filter: ds |> Adaptivity(...) returns the same dataset (geometry and data shared) with these settings — configuring a dataset that had adaptivity disabled, or replacing another configuration. The FEData constructor applies it automatically: adaptivity=true (the default) with these defaults, adaptivity=Adaptivity(...) with yours, adaptivity=false for the static tessellation.

  • geometry_tol: geometry-error tolerance, as a fraction of the grid's bounding-box diagonal. The drawn triangles approximate the exact geometry (dofhandler interpolation, including warps) to within it.
  • solution_tol: solution-error tolerance, as a fraction of the color field's value span. The linear vertex-color interpolation approximates the exact field polynomial to within it.
  • max_depth: maximum bisection depth per base triangle.
  • sample_type: the number type the pipeline samples geometry and fields in, by default what the renderer draws (GLMakie uploads Float32). Tolerances are floored at its resolution; pass Float64 to sample at full precision.

Construct FEData(dh, u; adaptivity=Adaptivity(...)) to tweak, adaptivity=false to disable and always draw the static tessellation.

source
FerriteViz.update!Function
FerriteViz.update!(ds::FEData, u::Vector)

Update the source solution observable, propagating through all filters and open plots down to the GPU buffers. Can be called on any dataset of a pipeline; it always updates the root solution (u must match its length).

Not exported: both Makie and Ferrite export distinct functions named update!, so call this one qualified.

source
FerriteViz.point_dataFunction
point_data(ds::FEData, name::Symbol) -> Observable{Matrix{Float64}}

The named data array on the tessellation vertices (nvertices × ncomponents; tensor components in Tensors.jl linear order). These are the vertices of the triangulation the dataset renders, not the vertices of the finite element cells — see the architecture overview. Fields of the dof handler are transferred to the tessellation lazily and cached; :default resolves to the first field.

Note

:default is reserved for this purpose wherever a name is expected, so a dof handler carrying a field named :default is rejected by FEData.

source
FerriteViz.set_point_data!Function
set_point_data!(ds::FEData, name::Symbol, data)

Register a named data array on the tessellation vertices (see num_vertices — one row per vertex of the rendered triangulation, not per grid node). data may be a Vector/Matrix or an Observable of one — updates to a registered Observable propagate into plots. Existing names are overwritten; dof field names cannot be shadowed.

source
FerriteViz.set_cell_data!Function
set_cell_data!(ds::FEData, name::Symbol, data)

Register a named per-cell data array (length ncells, any element type — e.g. stress tensors, to be reduced by filters like VonMises). data may be a Vector or an Observable of one. Existing names are overwritten; dof field names cannot be shadowed.

source

Filters

Filters transform an FEData into a new one and compose with |>:

ds = FEData(dh, u)
solutionplot(ds |> WarpByVector(:u, 2.0) |> Gradient(:u) |> VonMises(); color=:vonMises)
FerriteViz.applyFunction
apply(f::AbstractFilter, ds::FEData) -> FEData

Apply a filter to a dataset. Filters are callable, so ds |> f is equivalent.

source
FerriteViz.WarpByVectorType
WarpByVector(field=:default, scale=1.0)

Filter displacing the geometry (tessellation vertices and grid nodes) by scale times the vector-valued field. scale may be a number or an Observable (e.g. driven by a slider). Warps compose: the displacement is added to the input dataset's current coordinates.

field may name any vector-valued point-data array; the tessellation vertices (surfaces and the meshplot wireframe) always follow. The original grid nodes (meshplot's node markers and labels) can only be displaced when the field is a dof-backed field of the dof handler and stay put otherwise.

source
FerriteViz.GradientType
Gradient(field=:default; copy_fields=Symbol[])

Filter computing the piecewise discontinuous gradient of field (via interpolate_gradient_field). The output dataset's field is named :gradient; fields listed in copy_fields are carried along. Geometry (including an upstream warp) is shared with the input.

source
FerriteViz.CrinkleClipType
CrinkleClip(decision)

Filter hiding the cells for which decision(grid, cellid) is false, revealing the (crinkled) interior along the clip surface. decision is typically a ClipPlane.

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

Clip plane described by its normal and distance to the coordinate origin, for use as the decision function of CrinkleClip: callable as plane(grid, cellid), returning whether the cell lies on the non-clipped side.

source
FerriteViz.RefineType
Refine()                       # automatic, what FEData applies by default
Refine(n::Int; edges=n)
Refine(; surface=nothing, edges=nothing)

Filter re-tessellating every cell from its reference shape with a subdivided reference tessellation (see FerriteViz.subdivide): surface rounds for the rendered triangles (each round quadruples them, refining the rendered solution), edges rounds for the wireframe segments drawn by meshplot (each round doubles them, refining the rendered geometry edges). The subdivided reference vertices are mapped through the cell's geometric interpolation, so curved (high-order) geometry and high-order deformation render curved instead of as flat facets and straight chords.

The counts are absolute, not relative to the input's tessellation: Refine(2) yields 2 subdivision rounds regardless of how the dataset was tessellated before.

A count given as nothing is chosen per cell type: no subdivision when the geometry and every dof field are (multi-)linear, otherwise 1 surface and 3 edge rounds. FEData itself always builds the flat base tessellation (curved rendering comes from the adaptive path); uniform static subdivision is an explicit composition, e.g. for one branch of a pipeline:

ds = FEData(dh, u; adaptivity=false)
meshplot(ds)                          # flat, cheap
solutionplot(ds |> Refine(2))         # this plot resolved finer
Memory usage

Every surface round quadruples the rendered triangles and roughly triples the tessellation vertices (each of which carries solution values per field). The automatic mode therefore costs high-order cell types about 4× the memory of the flat tessellation; edge rounds are comparatively cheap (segments only double).

Note

The choice made for a nothing count may change in a future release; such a change is breaking. Explicit counts are stable.

Rebuilds the geometry from the grid (a quadrature-point partition of AddQuadraturePointData does not survive — nor would it gain anything from refinement, its data being piecewise constant), so apply WarpByVector after it; registered point data is dropped, cell data survives.

source
FerriteViz.AddQuadraturePointDataType
AddQuadraturePointData(qr, values; output=:qpdata, extract=identity)

Filter for internal variables, i.e. quantities that carry a value only at the quadrature points and have no interpolation defining them anywhere else (in FEM terms: L2 data). Every cell is partitioned into the Voronoi regions of its quadrature points (see FerriteViz.qp_voronoi_tessellation) and each region is filled with its quadrature point's value, giving a piecewise constant ("flat") rendering that neither averages over the cell nor smooths the data onto a nodal field.

qr is a Ferrite.QuadratureRule, or a Dict mapping reference shapes to rules for grids with mixed cell types.

values may be

  • a Vector of per-cell vectors (values[cell][qp]; nqp may differ per cell),
  • a Matrix (values[cell, qp], requiring a uniform nqp), or
  • an Observable of either — updating it refreshes all open plots.

extract maps a stored entry to the plotted value, so Ferrite material states can be handed over directly (extract = s -> s.εₚ). Scalars, Vecs and (symmetric) second order tensors are supported. The result is registered as point data named output and can be reduced further with VonMises, Derive, ...

Rebuilds the geometry, so apply WarpByVector after this filter.

Example

FEData(dh, u) |> AddQuadraturePointData(qr, states; extract = s -> s.σ) |> VonMises(input = :qpdata)
source
FerriteViz.ExtractComponentType
ExtractComponent(i; input=:default, output=Symbol("x", i))

Filter extracting component i of a data array into a named scalar array.

source
FerriteViz.MagnitudeType
Magnitude(; input=:default, output=:magnitude)

Filter computing the euclidean norm of a data array into a named scalar array.

source
FerriteViz.Norm1Type
Norm1(; input=:default, output=:norm1)

Filter computing the 1-norm of a data array into a named scalar array.

source
FerriteViz.VonMisesType
VonMises(; input=:default, output=:vonMises)

Filter computing the von Mises invariant (vonmises) of a tensor-valued data array into a named scalar array. Note that this is only a stress if the input array holds stresses — apply a constitutive law with Derive first when starting from a displacement gradient.

source
FerriteViz.DeviatorType
Deviator(; input=:default, output=:deviator)

Filter computing the deviatoric part of a tensor-valued data array.

source
FerriteViz.ThresholdType
Threshold(; input=:default, output=:threshold, min=-Inf, max=Inf)

Filter copying a data array with values outside [min, max] replaced by NaN.

Note

This masks values, it does not remove geometry. The tessellation is passed through unchanged and the NaNs reach Makie as colors, so the affected triangles are still drawn — in nan_color (:red by default), and blended across a triangle whose other vertices are inside the range. Set nan_color=:transparent on the representation to hide them. Removing cells from the mesh is what CrinkleClip does.

source
FerriteViz.DeriveType
Derive(f; input=:default, output=:derived)

Generic derivation filter mapping the entries of one or more data arrays through f.

input is a single name or a vector of names. f receives one argument per input, taken from the same tessellation vertex (point data) or the same cell (cell data), so Derive(g; input=[:a, :b]) calls g(a_i, b_i). All inputs must be of the same kind, either all point data or all cell data.

Point-data rows are passed to f as a scalar (1 component), Vec (spatial-dim components) or Tensor{2} (spatial-dim² components). Rows holding a tensor of a different dimension than the grid — a shell or plane-strain problem carrying 3D stresses on a 2D grid — are recognised by their component count as Tensor{2,2} (4), SymmetricTensor{2,3} (6) or Tensor{2,3} (9). Cell-data entries are passed as-is. f may return a scalar, Vec, Tensor or Tuple.

Examples

σ(∇u) = 2G*dev(symmetric(∇u)) + K*tr(∇u)*one(∇u)
ds |> Gradient(:u) |> Derive(∇u -> vonmises(σ(∇u)); output=:σvM)

# several inputs -> one argument each
ds |> Derive((σ, εᵖ) -> σ ⊡ εᵖ; input=[:σ, :εᵖ], output=:dissipation)
source
FerriteViz.vonmisesFunction
vonmises(σ)

Von Mises equivalent stress √(3/2 dev(σ) ⊡ dev(σ)) of a second-order tensor.

source

Representations

Each recipe comes as a plotting function, its mutating variant, and the plot type Makie associates with them; the attributes are documented on the function.

FerriteViz.solutionplotFunction
solutionplot(ds::FEData; kwargs...)
solutionplot(dh::AbstractDofHandler, u::Vector; kwargs...)
solutionplot!(...)

Contour plot of a scalar data array on the finite element mesh.

Deformation is an upstream concern: solutionplot(ds |> WarpByVector(:u, 2.0)).

Plot type

The plot type alias for the solutionplot function is SolutionPlot.

Attributes

alpha = 1.0 — The alpha value of the colormap or color attribute. Multiple alphas like in plot(alpha=0.2, color=(:red, 0.5)), will get multiplied.

clip_planes = @inherit clip_planes automatic — Clip planes offer a way to do clipping in 3D space. You can set a Vector of up to 8 Plane3f planes here, behind which plots will be clipped (i.e. become invisible). By default clip planes are inherited from the parent plot or scene. You can remove parent clip_planes by passing Plane3f[].

color = :default — Name of the field / point-data / cell-data array to color by. :default is the first field of the dof handler, reduced to its magnitude if vector-valued; an explicitly named array must be scalar — reduce with e.g. Magnitude() first. Anything that is not a data name is passed through to Makie as a plain color.

colormap = :cividis — Sets the colormap that is sampled for numeric colors.

colorrange = automatic — The values representing the start and end points of colormap.

colorscale = identity — The color transform function. Can be any function, but only works well together with Colorbar for identity, log, log2, log10, sqrt, logit, Makie.pseudolog10, Makie.Symlog10, Makie.AsinhScale, Makie.SinhScale, Makie.LogScale, Makie.LuptonAsinhScale, and Makie.PowerScale.

depth_shift = 0.0 — Adjusts the depth value of a plot after all other transformations, i.e. in clip space, where -1 <= depth <= 1. This only applies to GLMakie and WGLMakie and can be used to adjust render order (like a tunable overdraw).

fxaa = true — Adjusts whether the plot is rendered with fxaa (fast approximate anti-aliasing, GLMakie only). Note that some plots implement a better native anti-aliasing solution (scatter, text, lines). For them fxaa = true generally lowers quality. Plots that show smoothly interpolated data (e.g. image, surface) may also degrade in quality as fxaa = true can cause blurring.

highclip = automatic — The color for any value above the colorrange.

inspectable = @inherit inspectable — Sets whether this plot should be seen by DataInspector. The default depends on the theme of the parent scene.

inspector_clear = automatic — Sets a callback function (inspector, plot) -> ... for cleaning up custom indicators in DataInspector.

inspector_hover = automatic — Sets a callback function (inspector, plot, index) -> ... which replaces the default show_data methods.

inspector_label = automatic — Sets a callback function (plot, index, position) -> string which replaces the default label generated by DataInspector.

lowclip = automatic — The color for any value below the colorrange.

model = automatic — Sets a model matrix for the plot. This overrides adjustments made with translate!, rotate! and scale!.

nan_color = :red — Replacement color for NaN values.

overdraw = false — Controls if the plot will draw over other plots. This specifically means ignoring depth checks in GL backends

shading = Makie.NoShading — Controls if the plot object is shaded by the parent scene's lights.

space = :data — Sets the transformation space for box encompassing the plot. See Makie.spaces() for possible inputs.

ssao = false — Adjusts whether the plot is rendered with ssao (screen space ambient occlusion). Note that this only makes sense in 3D plots and is only applicable with fxaa = true.

transformation = :automatic — Controls the inheritance or directly sets the transformations of a plot. Transformations include the transform function and model matrix as generated by translate!(...), scale!(...) and rotate!(...). They can be set directly by passing a Transformation() object or inherited from the parent plot or scene. Inheritance options include:

  • :automatic: Inherit transformations if the parent and child space is compatible
  • :inherit: Inherit transformations
  • :inherit_model: Inherit only model transformations
  • :inherit_transform_func: Inherit only the transform function
  • :nothing: Inherit neither, fully disconnecting the child's transformations from the parent

Another option is to pass arguments to the transform!() function which then get applied to the plot. For example transformation = (:xz, 1.0) which rotates the xy plane to the xz plane and translates by 1.0. For this inheritance defaults to :automatic but can also be set through e.g. (:nothing, (:xz, 1.0)).

transparency = false — Adjusts how the plot deals with transparency. In GLMakie transparency = true results in using Order Independent Transparency.

visible = true — Controls whether the plot gets rendered or not.

source
FerriteViz.solutionplot!Function

solutionplot! is the mutating variant of plotting function solutionplot. Check the docstring for solutionplot for further information.

source
FerriteViz.SolutionPlotType

SolutionPlot is the plot type associated with plotting function solutionplot. Check the docstring for solutionplot for further information.

source
FerriteViz.cellplotFunction
cellplot(ds::FEData, values::Vector{<:Real}; kwargs...)
cellplot(ds::FEData; color=:name, kwargs...)
cellplot!(...)

Plot one scalar per cell as constant color on the cells, either passed directly as a vector or by naming a registered cell-data array (see set_cell_data!). Non-scalar per-cell data (e.g. stress tensors) is reduced with a filter first (e.g. VonMises). Shares the solutionplot kwargs.

Plot type

The plot type alias for the cellplot function is CellPlot.

Attributes

alpha = 1.0 — The alpha value of the colormap or color attribute. Multiple alphas like in plot(alpha=0.2, color=(:red, 0.5)), will get multiplied.

clip_planes = @inherit clip_planes automatic — Clip planes offer a way to do clipping in 3D space. You can set a Vector of up to 8 Plane3f planes here, behind which plots will be clipped (i.e. become invisible). By default clip planes are inherited from the parent plot or scene. You can remove parent clip_planes by passing Plane3f[].

color = :default — Name of the field / point-data / cell-data array to color by. :default is the first field of the dof handler, reduced to its magnitude if vector-valued; an explicitly named array must be scalar — reduce with e.g. Magnitude() first. Anything that is not a data name is passed through to Makie as a plain color.

colormap = :cividis — Sets the colormap that is sampled for numeric colors.

colorrange = automatic — The values representing the start and end points of colormap.

colorscale = identity — The color transform function. Can be any function, but only works well together with Colorbar for identity, log, log2, log10, sqrt, logit, Makie.pseudolog10, Makie.Symlog10, Makie.AsinhScale, Makie.SinhScale, Makie.LogScale, Makie.LuptonAsinhScale, and Makie.PowerScale.

depth_shift = 0.0 — Adjusts the depth value of a plot after all other transformations, i.e. in clip space, where -1 <= depth <= 1. This only applies to GLMakie and WGLMakie and can be used to adjust render order (like a tunable overdraw).

fxaa = true — Adjusts whether the plot is rendered with fxaa (fast approximate anti-aliasing, GLMakie only). Note that some plots implement a better native anti-aliasing solution (scatter, text, lines). For them fxaa = true generally lowers quality. Plots that show smoothly interpolated data (e.g. image, surface) may also degrade in quality as fxaa = true can cause blurring.

highclip = automatic — The color for any value above the colorrange.

inspectable = @inherit inspectable — Sets whether this plot should be seen by DataInspector. The default depends on the theme of the parent scene.

inspector_clear = automatic — Sets a callback function (inspector, plot) -> ... for cleaning up custom indicators in DataInspector.

inspector_hover = automatic — Sets a callback function (inspector, plot, index) -> ... which replaces the default show_data methods.

inspector_label = automatic — Sets a callback function (plot, index, position) -> string which replaces the default label generated by DataInspector.

lowclip = automatic — The color for any value below the colorrange.

model = automatic — Sets a model matrix for the plot. This overrides adjustments made with translate!, rotate! and scale!.

nan_color = :red — Replacement color for NaN values.

overdraw = false — Controls if the plot will draw over other plots. This specifically means ignoring depth checks in GL backends

shading = Makie.NoShading — Controls if the plot object is shaded by the parent scene's lights.

space = :data — Sets the transformation space for box encompassing the plot. See Makie.spaces() for possible inputs.

ssao = false — Adjusts whether the plot is rendered with ssao (screen space ambient occlusion). Note that this only makes sense in 3D plots and is only applicable with fxaa = true.

transformation = :automatic — Controls the inheritance or directly sets the transformations of a plot. Transformations include the transform function and model matrix as generated by translate!(...), scale!(...) and rotate!(...). They can be set directly by passing a Transformation() object or inherited from the parent plot or scene. Inheritance options include:

  • :automatic: Inherit transformations if the parent and child space is compatible
  • :inherit: Inherit transformations
  • :inherit_model: Inherit only model transformations
  • :inherit_transform_func: Inherit only the transform function
  • :nothing: Inherit neither, fully disconnecting the child's transformations from the parent

Another option is to pass arguments to the transform!() function which then get applied to the plot. For example transformation = (:xz, 1.0) which rotates the xy plane to the xz plane and translates by 1.0. For this inheritance defaults to :automatic but can also be set through e.g. (:nothing, (:xz, 1.0)).

transparency = false — Adjusts how the plot deals with transparency. In GLMakie transparency = true results in using Order Independent Transparency.

visible = true — Controls whether the plot gets rendered or not.

source
FerriteViz.cellplot!Function

cellplot! is the mutating variant of plotting function cellplot. Check the docstring for cellplot for further information.

source
FerriteViz.CellPlotType

CellPlot is the plot type associated with plotting function cellplot. Check the docstring for cellplot for further information.

source
FerriteViz.meshplotFunction
meshplot(ds::FEData; kwargs...)
meshplot(grid::AbstractGrid; kwargs...)
meshplot!(...)

Plot the finite element mesh (edges and nodes), optionally labeled. The wireframe is drawn from the dataset's tessellation edges, i.e. from the same vertices as the surface plots: it follows an upstream WarpByVector (including high-order and discontinuous deformation), is hidden with the cells a CrinkleClip removes, and bends along curved (high-order) cell edges according to the dataset's subdivision (see Refine).

Node markers and labels are drawn at the grid nodes of the visible cells; they are displaced by a warp only when the warp field is a dof field.

Plot type

The plot type alias for the meshplot function is MeshPlot.

Attributes

celllabelcolor = :darkred — Color of the cell id labels.

celllabels = false — Show global cell id labels.

cellsets = false — Color cells by their cellset association.

clip_planes = @inherit clip_planes automatic — Clip planes offer a way to do clipping in 3D space. You can set a Vector of up to 8 Plane3f planes here, behind which plots will be clipped (i.e. become invisible). By default clip planes are inherited from the parent plot or scene. You can remove parent clip_planes by passing Plane3f[].

color = @inherit linecolor — Color of edges and nodes.

depth_shift = -0.0001 — Depth shift drawing the wireframe in front of surface plots.

fontsize = 15 — Label text size.

fxaa = true — Adjusts whether the plot is rendered with fxaa (fast approximate anti-aliasing, GLMakie only). Note that some plots implement a better native anti-aliasing solution (scatter, text, lines). For them fxaa = true generally lowers quality. Plots that show smoothly interpolated data (e.g. image, surface) may also degrade in quality as fxaa = true can cause blurring.

inspectable = @inherit inspectable — Sets whether this plot should be seen by DataInspector. The default depends on the theme of the parent scene.

inspector_clear = automatic — Sets a callback function (inspector, plot) -> ... for cleaning up custom indicators in DataInspector.

inspector_hover = automatic — Sets a callback function (inspector, plot, index) -> ... which replaces the default show_data methods.

inspector_label = automatic — Sets a callback function (plot, index, position) -> string which replaces the default label generated by DataInspector.

linewidth = @inherit linewidth — Edge line width.

markersize = @inherit markersize — Size of the node markers.

model = automatic — Sets a model matrix for the plot. This overrides adjustments made with translate!, rotate! and scale!.

nodelabelcolor = :darkblue — Color of the node id labels.

nodelabels = false — Show global node id labels.

offset = (0.0, 0.0) — Offset of the node labels.

overdraw = false — Controls if the plot will draw over other plots. This specifically means ignoring depth checks in GL backends

plotnodes = true — Plot the nodes as circles/spheres.

space = :data — Sets the transformation space for box encompassing the plot. See Makie.spaces() for possible inputs.

ssao = false — Adjusts whether the plot is rendered with ssao (screen space ambient occlusion). Note that this only makes sense in 3D plots and is only applicable with fxaa = true.

transformation = :automatic — Controls the inheritance or directly sets the transformations of a plot. Transformations include the transform function and model matrix as generated by translate!(...), scale!(...) and rotate!(...). They can be set directly by passing a Transformation() object or inherited from the parent plot or scene. Inheritance options include:

  • :automatic: Inherit transformations if the parent and child space is compatible
  • :inherit: Inherit transformations
  • :inherit_model: Inherit only model transformations
  • :inherit_transform_func: Inherit only the transform function
  • :nothing: Inherit neither, fully disconnecting the child's transformations from the parent

Another option is to pass arguments to the transform!() function which then get applied to the plot. For example transformation = (:xz, 1.0) which rotates the xy plane to the xz plane and translates by 1.0. For this inheritance defaults to :automatic but can also be set through e.g. (:nothing, (:xz, 1.0)).

transparency = false — Adjusts how the plot deals with transparency. In GLMakie transparency = true results in using Order Independent Transparency.

visible = true — Controls whether the plot gets rendered or not.

source
FerriteViz.meshplot!Function

meshplot! is the mutating variant of plotting function meshplot. Check the docstring for meshplot for further information.

source
FerriteViz.MeshPlotType

MeshPlot is the plot type associated with plotting function meshplot. Check the docstring for meshplot for further information.

source
FerriteViz.arrowplotFunction
arrowplot(ds::FEData; kwargs...)
arrowplot!(ds::FEData; kwargs...)

Draw an arrow at every tessellation vertex for a vector-valued data array (only for spatial dim ≥ 2).

Plot type

The plot type alias for the arrowplot function is ArrowPlot.

Attributes

alpha = 1.0 — The alpha value of the colormap or color attribute. Multiple alphas like in plot(alpha=0.2, color=(:red, 0.5)), will get multiplied.

clip_planes = @inherit clip_planes automatic — Clip planes offer a way to do clipping in 3D space. You can set a Vector of up to 8 Plane3f planes here, behind which plots will be clipped (i.e. become invisible). By default clip planes are inherited from the parent plot or scene. You can remove parent clip_planes by passing Plane3f[].

color = :default — Scalar data array name to color by, or a plain color; :default colors by the vector magnitude.

colormap = :cividis — Sets the colormap that is sampled for numeric colors.

colorrange = automatic — The values representing the start and end points of colormap.

colorscale = identity — The color transform function. Can be any function, but only works well together with Colorbar for identity, log, log2, log10, sqrt, logit, Makie.pseudolog10, Makie.Symlog10, Makie.AsinhScale, Makie.SinhScale, Makie.LogScale, Makie.LuptonAsinhScale, and Makie.PowerScale.

depth_shift = 0.0 — Adjusts the depth value of a plot after all other transformations, i.e. in clip space, where -1 <= depth <= 1. This only applies to GLMakie and WGLMakie and can be used to adjust render order (like a tunable overdraw).

field = :default — Name of the vector data array.

fxaa = true — Adjusts whether the plot is rendered with fxaa (fast approximate anti-aliasing, GLMakie only). Note that some plots implement a better native anti-aliasing solution (scatter, text, lines). For them fxaa = true generally lowers quality. Plots that show smoothly interpolated data (e.g. image, surface) may also degrade in quality as fxaa = true can cause blurring.

highclip = automatic — The color for any value above the colorrange.

inspectable = @inherit inspectable — Sets whether this plot should be seen by DataInspector. The default depends on the theme of the parent scene.

inspector_clear = automatic — Sets a callback function (inspector, plot) -> ... for cleaning up custom indicators in DataInspector.

inspector_hover = automatic — Sets a callback function (inspector, plot, index) -> ... which replaces the default show_data methods.

inspector_label = automatic — Sets a callback function (plot, index, position) -> string which replaces the default label generated by DataInspector.

lengthscale = 1.0 — Scale arrow lengths.

lowclip = automatic — The color for any value below the colorrange.

model = automatic — Sets a model matrix for the plot. This overrides adjustments made with translate!, rotate! and scale!.

nan_color = :transparent — The color for NaN values.

normalize = false — Normalize arrow lengths.

overdraw = false — Controls if the plot will draw over other plots. This specifically means ignoring depth checks in GL backends

space = :data — Sets the transformation space for box encompassing the plot. See Makie.spaces() for possible inputs.

ssao = false — Adjusts whether the plot is rendered with ssao (screen space ambient occlusion). Note that this only makes sense in 3D plots and is only applicable with fxaa = true.

transformation = :automatic — Controls the inheritance or directly sets the transformations of a plot. Transformations include the transform function and model matrix as generated by translate!(...), scale!(...) and rotate!(...). They can be set directly by passing a Transformation() object or inherited from the parent plot or scene. Inheritance options include:

  • :automatic: Inherit transformations if the parent and child space is compatible
  • :inherit: Inherit transformations
  • :inherit_model: Inherit only model transformations
  • :inherit_transform_func: Inherit only the transform function
  • :nothing: Inherit neither, fully disconnecting the child's transformations from the parent

Another option is to pass arguments to the transform!() function which then get applied to the plot. For example transformation = (:xz, 1.0) which rotates the xy plane to the xz plane and translates by 1.0. For this inheritance defaults to :automatic but can also be set through e.g. (:nothing, (:xz, 1.0)).

transparency = false — Adjusts how the plot deals with transparency. In GLMakie transparency = true results in using Order Independent Transparency.

visible = true — Controls whether the plot gets rendered or not.

source
FerriteViz.arrowplot!Function

arrowplot! is the mutating variant of plotting function arrowplot. Check the docstring for arrowplot for further information.

source
FerriteViz.ArrowPlotType

ArrowPlot is the plot type associated with plotting function arrowplot. Check the docstring for arrowplot for further information.

source
FerriteViz.surfaceplotFunction
surfaceplot(ds::FEData{2}; kwargs...)
surfaceplot!(ds::FEData{2}; kwargs...)

Plot a scalar data array of a 2D problem as a surface, with the value as the z-coordinate. color=:default names the array (same resolution rules as solutionplot, but it must be a data array).

Plot type

The plot type alias for the surfaceplot function is SurfacePlot.

Attributes

alpha = 1.0 — The alpha value of the colormap or color attribute. Multiple alphas like in plot(alpha=0.2, color=(:red, 0.5)), will get multiplied.

clip_planes = @inherit clip_planes automatic — Clip planes offer a way to do clipping in 3D space. You can set a Vector of up to 8 Plane3f planes here, behind which plots will be clipped (i.e. become invisible). By default clip planes are inherited from the parent plot or scene. You can remove parent clip_planes by passing Plane3f[].

color = :default — Name of the field / point-data / cell-data array to color by. :default is the first field of the dof handler, reduced to its magnitude if vector-valued; an explicitly named array must be scalar — reduce with e.g. Magnitude() first. Anything that is not a data name is passed through to Makie as a plain color.

colormap = :cividis — Sets the colormap that is sampled for numeric colors.

colorrange = automatic — The values representing the start and end points of colormap.

colorscale = identity — The color transform function. Can be any function, but only works well together with Colorbar for identity, log, log2, log10, sqrt, logit, Makie.pseudolog10, Makie.Symlog10, Makie.AsinhScale, Makie.SinhScale, Makie.LogScale, Makie.LuptonAsinhScale, and Makie.PowerScale.

depth_shift = 0.0 — Adjusts the depth value of a plot after all other transformations, i.e. in clip space, where -1 <= depth <= 1. This only applies to GLMakie and WGLMakie and can be used to adjust render order (like a tunable overdraw).

fxaa = true — Adjusts whether the plot is rendered with fxaa (fast approximate anti-aliasing, GLMakie only). Note that some plots implement a better native anti-aliasing solution (scatter, text, lines). For them fxaa = true generally lowers quality. Plots that show smoothly interpolated data (e.g. image, surface) may also degrade in quality as fxaa = true can cause blurring.

highclip = automatic — The color for any value above the colorrange.

inspectable = @inherit inspectable — Sets whether this plot should be seen by DataInspector. The default depends on the theme of the parent scene.

inspector_clear = automatic — Sets a callback function (inspector, plot) -> ... for cleaning up custom indicators in DataInspector.

inspector_hover = automatic — Sets a callback function (inspector, plot, index) -> ... which replaces the default show_data methods.

inspector_label = automatic — Sets a callback function (plot, index, position) -> string which replaces the default label generated by DataInspector.

lowclip = automatic — The color for any value below the colorrange.

model = automatic — Sets a model matrix for the plot. This overrides adjustments made with translate!, rotate! and scale!.

nan_color = :red — Replacement color for NaN values.

overdraw = false — Controls if the plot will draw over other plots. This specifically means ignoring depth checks in GL backends

shading = Makie.NoShading — Controls if the plot object is shaded by the parent scene's lights.

space = :data — Sets the transformation space for box encompassing the plot. See Makie.spaces() for possible inputs.

ssao = false — Adjusts whether the plot is rendered with ssao (screen space ambient occlusion). Note that this only makes sense in 3D plots and is only applicable with fxaa = true.

transformation = :automatic — Controls the inheritance or directly sets the transformations of a plot. Transformations include the transform function and model matrix as generated by translate!(...), scale!(...) and rotate!(...). They can be set directly by passing a Transformation() object or inherited from the parent plot or scene. Inheritance options include:

  • :automatic: Inherit transformations if the parent and child space is compatible
  • :inherit: Inherit transformations
  • :inherit_model: Inherit only model transformations
  • :inherit_transform_func: Inherit only the transform function
  • :nothing: Inherit neither, fully disconnecting the child's transformations from the parent

Another option is to pass arguments to the transform!() function which then get applied to the plot. For example transformation = (:xz, 1.0) which rotates the xy plane to the xz plane and translates by 1.0. For this inheritance defaults to :automatic but can also be set through e.g. (:nothing, (:xz, 1.0)).

transparency = false — Adjusts how the plot deals with transparency. In GLMakie transparency = true results in using Order Independent Transparency.

visible = true — Controls whether the plot gets rendered or not.

source
FerriteViz.surfaceplot!Function

surfaceplot! is the mutating variant of plotting function surfaceplot. Check the docstring for surfaceplot for further information.

source
FerriteViz.SurfacePlotType

SurfacePlot is the plot type associated with plotting function surfaceplot. Check the docstring for surfaceplot for further information.

source
FerriteViz.elementinfoFunction
elementinfo(ip::Interpolation; kwargs...)
elementinfo(cell::AbstractCell; kwargs...)
elementinfo(ip::Type{Interpolation}; kwargs...)
elementinfo(cell::Type{AbstractCell}; kwargs...)

Plot the reference element with vertex/edge/face annotations; for a cell the geometry nodes are labeled "N", for an interpolation the dofs are labeled "D".

Plot type

The plot type alias for the elementinfo function is Elementinfo.

Attributes

clip_planes = @inherit clip_planes automatic — Clip planes offer a way to do clipping in 3D space. You can set a Vector of up to 8 Plane3f planes here, behind which plots will be clipped (i.e. become invisible). By default clip planes are inherited from the parent plot or scene. You can remove parent clip_planes by passing Plane3f[].

color = @inherit linecolor — Color of edges and nodes.

depth_shift = 0.0 — Adjusts the depth value of a plot after all other transformations, i.e. in clip space, where -1 <= depth <= 1. This only applies to GLMakie and WGLMakie and can be used to adjust render order (like a tunable overdraw).

edgelabelcolor = :darkblue — Color of the edge labels.

edgelabeloffset = (-40, -40) — Offset of the edge labels.

edgelabels = true — Show the edge labels.

facelabelcolor = :darkgreen — Color of the face labels.

facelabeloffset = (-40, 0) — Offset of the face labels.

facelabels = true — Show the face labels.

font = @inherit font — Font of the labels.

fontsize = 60 — Fontsize of the labels.

fxaa = true — Adjusts whether the plot is rendered with fxaa (fast approximate anti-aliasing, GLMakie only). Note that some plots implement a better native anti-aliasing solution (scatter, text, lines). For them fxaa = true generally lowers quality. Plots that show smoothly interpolated data (e.g. image, surface) may also degrade in quality as fxaa = true can cause blurring.

inspectable = @inherit inspectable — Sets whether this plot should be seen by DataInspector. The default depends on the theme of the parent scene.

inspector_clear = automatic — Sets a callback function (inspector, plot) -> ... for cleaning up custom indicators in DataInspector.

inspector_hover = automatic — Sets a callback function (inspector, plot, index) -> ... which replaces the default show_data methods.

inspector_label = automatic — Sets a callback function (plot, index, position) -> string which replaces the default label generated by DataInspector.

linewidth = @inherit linewidth — Stroke width of faces/edges.

markersize = @inherit markersize — Size of the node markers.

model = automatic — Sets a model matrix for the plot. This overrides adjustments made with translate!, rotate! and scale!.

nodelabelcolor = :darkred — Color of the node labels.

nodelabeloffset = (0.0, 20.0) — Offset of the node labels.

nodelabels = true — Show the node labels.

overdraw = false — Controls if the plot will draw over other plots. This specifically means ignoring depth checks in GL backends

plotnodes = true — Plot the nodes.

space = :data — Sets the transformation space for box encompassing the plot. See Makie.spaces() for possible inputs.

ssao = false — Adjusts whether the plot is rendered with ssao (screen space ambient occlusion). Note that this only makes sense in 3D plots and is only applicable with fxaa = true.

transformation = :automatic — Controls the inheritance or directly sets the transformations of a plot. Transformations include the transform function and model matrix as generated by translate!(...), scale!(...) and rotate!(...). They can be set directly by passing a Transformation() object or inherited from the parent plot or scene. Inheritance options include:

  • :automatic: Inherit transformations if the parent and child space is compatible
  • :inherit: Inherit transformations
  • :inherit_model: Inherit only model transformations
  • :inherit_transform_func: Inherit only the transform function
  • :nothing: Inherit neither, fully disconnecting the child's transformations from the parent

Another option is to pass arguments to the transform!() function which then get applied to the plot. For example transformation = (:xz, 1.0) which rotates the xy plane to the xz plane and translates by 1.0. For this inheritance defaults to :automatic but can also be set through e.g. (:nothing, (:xz, 1.0)).

transparency = false — Adjusts how the plot deals with transparency. In GLMakie transparency = true results in using Order Independent Transparency.

vertexlabelcolor = :darkred — Color of the vertex labels.

vertexlabeloffset = (0.0, 0.0) — Offset of the vertex labels.

vertexlabels = true — Show the vertex labels.

visible = true — Controls whether the plot gets rendered or not.

source
FerriteViz.elementinfo!Function

elementinfo! is the mutating variant of plotting function elementinfo. Check the docstring for elementinfo for further information.

source
FerriteViz.ElementinfoType

Elementinfo is the plot type associated with plotting function elementinfo. Check the docstring for elementinfo for further information.

source

Composable viewer

The viewer is assembled declaratively with Makie.SpecApi: pluggable FerriteViz.Controls feed a view-state observable, a layout(ds, state) hook returns a GridLayoutSpec, and spec helpers build the panels.

FerriteViz.ferriteviewerFunction
ferriteviewer(ds::FEData; layout=default_layout, controls=default_controls(ds), pipeline=default_pipeline)
ferriteviewer(ds::FEData, u_history::Vector{<:Vector}; kwargs...)

Interactive viewer composed declaratively with Makie.SpecApi. controls is a vector of Controls feeding a view-state observable; pipeline(ds, state) derives the dataset to plot (default applies deformation); layout(ds, state) returns the GridLayoutSpec rendered on every structural state change. All three are overridable — the defaults reproduce a single solutionplot panel with a colorbar. The second form appends a TimeSlider for a solution history.

Because plots pass the same ds and named data, structural changes reuse the existing plots (only attributes diff), while FerriteViz.update! and deformation stream through the shared GPU buffers without rebuilding.

source
FerriteViz.ControlResultType
ControlResult(content; structural=[], dynamic=[], placement=:column)

Return value of a Control's builder. content is a vector of layoutables; placement decides where they go: :column (the right-hand controls column, default) or :below (each on its own full-width row under the plot — e.g. a TimeSlider). structural state pairs (name => Observable) trigger a spec rebuild when they change; dynamic state pairs are made available to the pipeline/layout but do not (they stream through the shared observables instead, e.g. a deformation scale).

source
FerriteViz.default_controlsFunction
default_controls(ds) -> Vector{Control}

The default control set: field/process/colormap menus, a wireframe toggle, a labels toggle and (if a field can deform the mesh) a deformation toggle. Override via the controls keyword of ferriteviewer.

source
FerriteViz.default_layoutFunction
default_layout(ds, state) -> Makie.GridLayoutSpec

The default single-panel layout: a solutionplot colored by the selected field/process, a meshplot wireframe (shown/labeled per the wireframe and labels toggles), and a linked colorbar. Pass your own layout(ds, state) to ferriteviewer for any composition of panels and representations.

source
FerriteViz.ProcessMenuFunction
ProcessMenu(; label="processing", options=["magnitude","x₁","x₂","x₃"])

Control choosing the scalar reduction of the colored field (state :process).

source
FerriteViz.ColormapMenuFunction
ColormapMenu(; label="colormap", options=["cividis","inferno","thermal"])

Control choosing the colormap (state :colormap, a Symbol).

source
FerriteViz.DeformationToggleFunction
DeformationToggle(; label="deformation", active=false)

Control toggling warp-by-vector deformation (dynamic state :deform_scale; the scale streams through the shared observables without a spec rebuild).

source
FerriteViz.TimeSliderFunction
TimeSlider(u_history; label="timestep")

Control stepping FerriteViz.update! through a solution history. Placed as a full-width slider below the plot (placement=:below). Purely side-effecting: it streams new solutions into the pipeline, contributing no structural state.

source
FerriteViz.panelspecFunction
panelspec(plots...; colorbar=nothing, dim=2, axis=(;), colorbar_attributes=(;))

Assemble one or more PlotSpecs into a GridLayoutSpec of a single axis (an Axis for dim ≤ 2, an LScene otherwise), optionally with a linked Colorbar. Pass the PlotSpec to colorbar-link as colorbar (typically one of plots). axis is a NamedTuple of axis attributes.

source