Viz¶
Visualization of solved results: field lines, the field-display models and the render targets a viewer draws.
femforge.viz
¶
Visualization of solved results: field-line rendering, the field-display models and the composable render targets a viewer draws from a case.vtu.
Modules:
-
colormaps–ParaView's colormap presets, registered with matplotlib so every colormap name resolves through pyvista.
-
field_display–Field display state for a solved run: which array is colored, how it reduces to a scalar, and the color range that follows; pyvista is imported lazily inside the render half.
-
field_lines–3D magnetic field lines from a solved Elmer
case.vtu: streamlines seeded through the domain and colored by|B|. -
glyphs–Scene glyphs of what a run's groups received: load arrows, held-face tints, magnet arrows, current markers and value labels, plus the Setup tab's selection, section outline and authored ghost.
-
scene–Composable render targets: a
Scenedraws severalRenderables in one plotter refresh, on the plotter thread. -
symmetry–Expansion of a 2D section into a 3D view: an axisymmetric r–z section mirrored or revolved, a Cartesian one extruded through its depth.
Classes:
-
FieldLines–A
Renderablefor the solved B-field streamlines of onecase.vtu. -
FieldLineOptions–Typed options for the 3D field-line render.
-
SeedPlacement–Where the streamline seed points are placed within the domain bounding box.
-
Colormap–Perceptually-uniform matplotlib colormaps for the
|B|magnitude scale. -
OpacityTransfer–A pyvista opacity transfer function that maps the
|B|scalar to per-element opacity; the_rvariants reverse the ramp. -
InterpolatorType–The cell-location strategy the streamline integrator uses (pyvista's
interpolator_type). -
StreamlineActor–The plotter actor names
draw_streamlinesregisters, so toggling the overlay off is a singleremove_actor. -
StreamlineActors–The precomputed drawables for a field-line view, split from plotting so the expensive part runs off the UI thread.
-
Association–Whether a VTU array lives on mesh points or cells (pyvista's
preference). -
BodyPaint–Where a body's color comes from.
-
BodyStyle–A body's own look: where its color comes from, a solid color when it has one, and its opacity.
-
DisplayMode–How a field array is reduced to the value that drives the color.
-
DisplaySpec–The complete, serializable state of one field display: which array is colored, how it reduces, and how the colors map.
-
EdgeStyle–How the drawn lines draw: the feature-edge outline, the hover and selection outlines and the field lines.
-
Shading–How solid surfaces shade under the lights.
-
FieldInfo–One displayable VTU array: where it lives, how wide it is, and which display modes it supports.
-
FieldKind–What one row of a field array holds, which sets its display modes and whether an expansion turns it.
-
FieldScene–One run's solved bodies as a recolorable field display.
-
SceneActor–The plotter actor names a
FieldSceneregisters, so a toggle removes exactly one. -
Renderable–Something a workbench run returns for display: it draws itself into
plotter(on the plotter thread). -
Scene–An ordered group of
Renderables drawn into one plotter refresh: clear once, draw in order (later items on top), repaint once. -
Expansion–How a 2D section is shown.
-
Basis–Where the solve frame sits in the authored model.
-
Prism–A Cartesian section's depth along the solve Z, with the section plane at its middle.
-
GlyphLabels–How glyph values are labelled in the scene.
-
GlyphActor–The plotter actor names the glyph layer owns, so a redraw replaces or removes exactly these.
-
EntityKind–Whether an entity row names a body group or a boundary group.
-
EntityRef–A body or boundary group by kind and name, so a body and a named face that share a name stay apart.
-
Glyph–One condition as the scene draws it, in the solve frame the run was meshed in.
-
GlyphView–What the Setup tab asks the scene to draw: which glyphs, their labels and size, and the selection, outline and ghost around them.
-
GlyphPlacement–How solve-frame geometry lands in the displayed scene: as solved, beside its mirror image, on the planes of a revolution, or on the front face of an extrusion.
-
GlyphHost–The scene a glyph layer draws over: its frame, how it is shown and the cells of each group.
-
GlyphDraw–One merged glyph actor: its name, its geometry and how it is styled.
-
GlyphLayer–A run's glyphs and the scene decorations the Setup tab asks for, drawn over a host scene as named actors.
-
GroupScene–A run without fields drawn from its Elmer mesh: every body plain grey, with its glyph layer over them.
Functions:
-
select_flux_density_array–Pick the B array from a VTU's array names: the nodal form first (no cell→point projection needed), then the elemental
"... e", then any name containing the phrase (case-insensitive). -
seed_points–The
(N, 3)streamline seed coordinates for the domainboundsandoptions(pure Python — unit-testable without a render context). -
build_streamlines–Seed and integrate |B| streamlines through a dataset that already carries B as point data, without touching a plotter.
-
build_streamlines_from_vtu–Read a solved
case.vtuand integrate its B-field streamlines into a drawableStreamlineActors— no plotter touched, safe off the UI thread. -
build_swept_streamlines–Field lines of a revolved or extruded section: seeded in the shown 3D frame, folded into the section, integrated there and carried back to each seed's angle or depth.
-
prepare_streamline_source–Narrow a read grid to the integration region and put B on its points, returning the dataset and the B array name — the read-independent half of
build_streamlines_from_vtu. -
draw_streamlines–Draw a precomputed
StreamlineActorsintoplotterwithout clearing or showing it, so it composes inside aScene. -
render_streamlines–One-shot: build streamlines through
datasetand draw them, in a plotter of its own whenplotteris None. -
render_field_lines–Render the magnetic flux-density field lines from a solved
case.vtu, headless to a PNG or in an interactive window. -
field_infos–Every displayable array of a VTU as a
FieldInfo, sorted by display name;GeometryIdsand tensors are left out. -
line_vectors–The vector field the field lines follow: the shown one when it is a vector, else the flux density, else the first vector field; None for a run with none.
-
default_display–The display a run opens on: its stack's primary field, on the component its loads share, with field lines and opacity mapping for a flux or current.
-
reduce_field–The scalar a display mode draws from one field array.
-
polar_angle–Each vector's XY direction as a cyclic coordinate in
[0, 1]—atan2(y, x)mapped off[-pi, pi]. -
polar_rgba–Per-vector RGBA for
DisplayMode.POLAR_XY: hue from the XY angle through a cycliccmap, brightness and alpha from the sigmoid-scaled XY magnitude. -
color_range–The
(lo, hi)color limits spanning every scalar chunk's own range, from the finite values only; an empty selection gives(0.0, 1.0). -
camera_needs_reset–Whether the camera has lost the model, with the box behind it or outside its view cone; a camera inside the box always keeps its view.
-
list_fields–Every displayable field of a VTU grid (
GeometryIdsexcluded), sorted by display name, with the unitsphysicsdecides. -
split_by_body–The grid split into one block per named body, keyed by its
entities.jsonname via theGeometryIdscell array. -
feature_outline–The feature and boundary edges of a multiblock's outer surface — the black wireframe drawn over the field, the body outlines on a 2D slice — or None when the surface has none.
-
model_dim_of–2 for a flat (axisymmetric slice) grid with no Z extent, else 3.
-
sample_colormap–countevenly-spaced RGBA rows from a named colormap, resolved through pyvista'sget_cmap_safe. -
extrude–The closed surface of a Cartesian section extruded along the solve Z through
depth, centred on the section plane. -
mirror–Both halves of an axisymmetric section in the solve frame: its triangles and quads beside their reflection across the axis; line and vertex cells are dropped.
-
revolve–The surfaces of an axisymmetric section swept about its axis into the authored frame, capped on a partial sweep.
-
swept_lines–The quads a section's line cells sweep
sweepdegrees about the axis,segmentssteps per turn, uncapped. -
glyph_label–The short scene label of
condition, magnitudes only since the shape shows the direction; None for a condition the shape says enough about. -
glyphs_of–The glyphs of every drawable condition a run's groups received, joined to their measured centroids and normals.
-
glyph_actors–The merged glyph actors of the shown glyphs, at most one per
GLYPH_ACTORSname. -
plain_spec–specwith every one ofbodiespaintedPLAIN_BODY, its own opacity kept.
Attributes:
-
Bounds–A pyvista axis-aligned bounding box, as
(xmin, xmax, ymin, ymax, zmin, zmax). -
Point3–One 3D seed coordinate, as
(x, y, z). -
FLUX_DENSITY–The MagnetoDynamicsCalcFields name for B in its nodal form; the elemental form the solver writes by default appends
" e". -
FIELD_RENAMES(dict[str, str]) –Display-name overrides for solver array names that title-casing alone leaves cryptic.
-
SCALARS_ARRAY–The point/cell array every reduction is written to, so one mapper name serves every field and mode.
-
GLYPH_ACTORS(tuple[GlyphActor, ...]) –The actors that draw conditions, at most one merged actor each.
Bounds
module-attribute
¶
A pyvista axis-aligned bounding box, as (xmin, xmax, ymin, ymax, zmin, zmax).
FLUX_DENSITY
module-attribute
¶
The MagnetoDynamicsCalcFields name for B in its nodal form; the elemental form the solver writes by default appends " e".
FIELD_RENAMES
module-attribute
¶
Display-name overrides for solver array names that title-casing alone leaves cryptic.
SCALARS_ARRAY
module-attribute
¶
The point/cell array every reduction is written to, so one mapper name serves every field and mode.
GLYPH_ACTORS
module-attribute
¶
GLYPH_ACTORS: tuple[GlyphActor, ...] = (GlyphActor.ARROWS, GlyphActor.HALOS, GlyphActor.FACES, GlyphActor.LINES, GlyphActor.MARKS, GlyphActor.LEADERS, GlyphActor.LABELS)
The actors that draw conditions, at most one merged actor each.
FieldLines
dataclass
¶
FieldLines(vtu_path: str | Path, options: FieldLineOptions | None = None)
A Renderable for the solved B-field streamlines of one case.vtu.
VTU read + streamline integration run in __post_init__ (whichever worker thread constructs it); render only draws precomputed actors, keeping the plotter thread free.
Methods:
-
render–Draw the precomputed field lines into
plotter.
Attributes:
-
vtu_path(str | Path) –The solved
case.vtuwhose B field the lines follow. -
options(FieldLineOptions | None) –The streamline options; None uses the defaults.
vtu_path
instance-attribute
¶
The solved case.vtu whose B field the lines follow.
options
class-attribute
instance-attribute
¶
options: FieldLineOptions | None = None
The streamline options; None uses the defaults.
render
¶
Draw the precomputed field lines into plotter.
Source code in src/femforge/viz/field_lines.py
FieldLineOptions
pydantic-model
¶
Bases: BaseModel
Typed options for the 3D field-line render.
Config:
use_attribute_docstrings:Truevalidate_assignment:True
Fields:
-
seed_placement(SeedPlacement) -
seed_grid(bool) -
line_count(int) -
max_length(float) -
colormap(Colormap | str | list[str]) -
invert(bool) -
log_scale(bool) -
clim(tuple[float, float] | None) -
opacity_map(tuple[float, float] | None) -
opacity(float | OpacityTransfer) -
interpolator(InterpolatorType) -
seed_fraction(float) -
region_array(str | None) -
region_id(int | None) -
clip_to_region(bool) -
tube_radius(float | None) -
line_width(float) -
initial_step_length(float) -
min_step_length(float) -
max_step_length(float) -
show_outline(bool) -
vectors(str | None)
seed_placement
pydantic-field
¶
seed_placement: SeedPlacement = SeedPlacement.CENTER_PLANE
Where to seed the streamlines within the domain bounding box.
seed_grid
pydantic-field
¶
seed_grid: bool = True
Seed the streamlines on a grid (True) or at random points (False).
line_count
pydantic-field
¶
line_count: int = 18
Seed points per axis: CENTER_PLANE seeds line_count², VOLUME line_count³, GAP_LINE line_count.
max_length
pydantic-field
¶
max_length: float = 0.75
[-]: Fraction of the domain diagonal a streamline may integrate along, keeping the picture framed on the magnets.
colormap
pydantic-field
¶
The |B| colormap: a Colormap member, any matplotlib or colorcet colormap name, or a list of colors interpolated across the scalar range.
clim
pydantic-field
¶
[?]: The |B| color limits, or None for the lines' own range.
opacity_map
pydantic-field
¶
[-]: The opacity at the low and high color limits, linear in the color mapping between them; it replaces an OpacityTransfer.
opacity
pydantic-field
¶
opacity: float | OpacityTransfer = 1.0
[-]: Line or tube opacity: a constant in [0, 1], or an OpacityTransfer that maps |B| to opacity like the color.
interpolator
pydantic-field
¶
interpolator: InterpolatorType = InterpolatorType.CELL
The integrator's cell-location strategy. CELL (default) fixes the straight "spike" streamlines a point locator produces near the air↔magnet interface.
seed_fraction
pydantic-field
¶
seed_fraction: float = 0.6
[-]: Fraction of the bounding box, centered, that the seed grid spans, keeping seeds out of the outer air shell where B ≈ 0.
region_array
pydantic-field
¶
region_array: str | None = None
Name of a cell-data region-id array (e.g. Elmer's "GeometryIds") identifying each cell's body. Used with region_id and clip_to_region.
region_id
pydantic-field
¶
region_id: int | None = None
The single region id to confine integration to when clip_to_region is set (e.g. the air body id).
clip_to_region
pydantic-field
¶
clip_to_region: bool = False
Confine streamline integration to region_id (needs region_array and region_id), which keeps elemental B from averaging across the air↔magnet interface.
tube_radius
pydantic-field
¶
tube_radius: float | None = None
r_tube [m]: Streamline tube radius; None draws the streamlines as plain poly-lines.
line_width
pydantic-field
¶
line_width: float = 1.0
[px]: The width of a plain poly-line in window pixels.
initial_step_length
pydantic-field
¶
initial_step_length: float = 0.5
[-]: The integrator's initial step, in cell lengths; smaller values follow tight curves.
min_step_length
pydantic-field
¶
min_step_length: float = 0.01
[-]: The integrator's smallest step, in cell lengths.
max_step_length
pydantic-field
¶
max_step_length: float = 1.0
[-]: The integrator's largest step, in cell lengths.
SeedPlacement
¶
Bases: StrEnum
Where the streamline seed points are placed within the domain bounding box.
Attributes:
-
CENTER_PLANE–A
line_count×line_countgrid on the mid-Z plane (the field-line cross-section), the default. -
VOLUME–A
line_count³ grid filling the box: denser, fuller 3D coverage. -
GAP_LINE–A single line of
line_countpoints along X through the center (e.g. across the Halbach gap).
CENTER_PLANE
class-attribute
instance-attribute
¶
A line_count × line_count grid on the mid-Z plane (the field-line cross-section), the default.
VOLUME
class-attribute
instance-attribute
¶
A line_count³ grid filling the box: denser, fuller 3D coverage.
GAP_LINE
class-attribute
instance-attribute
¶
A single line of line_count points along X through the center (e.g. across the Halbach gap).
Colormap
¶
Bases: StrEnum
Perceptually-uniform matplotlib colormaps for the |B| magnitude scale.
Attributes:
OpacityTransfer
¶
Bases: StrEnum
A pyvista opacity transfer function that maps the |B| scalar to per-element opacity; the _r variants reverse the ramp.
Attributes:
-
LINEAR–Opacity rises linearly with
|B|. -
LINEAR_R–Opacity falls linearly with
|B|. -
GEOM–Opacity rises geometrically with
|B|. -
GEOM_R–Opacity falls geometrically with
|B|. -
SIGMOID–Opacity follows a sigmoid in
|B|, so weak-field lines fade out. -
SIGMOID_R–Opacity follows a reversed sigmoid in
|B|, so strong-field lines fade out.
LINEAR_R
class-attribute
instance-attribute
¶
Opacity falls linearly with |B|.
SIGMOID
class-attribute
instance-attribute
¶
Opacity follows a sigmoid in |B|, so weak-field lines fade out.
SIGMOID_R
class-attribute
instance-attribute
¶
Opacity follows a reversed sigmoid in |B|, so strong-field lines fade out.
InterpolatorType
¶
Bases: StrEnum
The cell-location strategy the streamline integrator uses (pyvista's interpolator_type).
Both integrate the same point vector field; this only changes how each step finds its containing cell.
Attributes:
-
CELL–Locate cells with a cell locator, the right default for this geometry.
-
POINT–Locate cells via the nearest mesh point (pyvista's default). Faster, but near interfaces/thin features it can grab the wrong
CELL
class-attribute
instance-attribute
¶
Locate cells with a cell locator, the right default for this geometry.
It stays robust near the air↔magnet interface and thin air gaps, where a point locator mislocates a step into the wrong (magnet) cell and sends the streamline off as a straight "spike".
POINT
class-attribute
instance-attribute
¶
Locate cells via the nearest mesh point (pyvista's default). Faster, but near interfaces/thin features it can grab the wrong cell's vector and produce the spike streamlines.
StreamlineActor
¶
Bases: StrEnum
The plotter actor names draw_streamlines registers, so toggling the overlay off is a single remove_actor.
Attributes:
StreamlineActors
dataclass
¶
StreamlineActors(streamlines: PolyData, b_name: str, outline: PolyData | None, magnitudes: list[NDArray[float64]])
The precomputed drawables for a field-line view, split from plotting so the expensive part runs off the UI thread.
Built by build_streamlines (worker-thread safe) and drawn by draw_streamlines (plotter thread only).
Attributes:
-
streamlines(PolyData) –The integrated streamlines, within the integration region.
-
b_name(str) –The name of the B array the lines carry for coloring.
-
outline(PolyData | None) –The domain's bounding-box outline; None when
show_outlineis off. -
magnitudes(list[NDArray[float64]]) –The integrated field's magnitudes over the integration region, one chunk per body, which set the lines' color range.
Association
¶
Bases: StrEnum
Whether a VTU array lives on mesh points or cells (pyvista's preference).
Attributes:
BodyPaint
¶
Bases: StrEnum
Where a body's color comes from.
Attributes:
BodyStyle
pydantic-model
¶
Bases: BaseModel
A body's own look: where its color comes from, a solid color when it has one, and its opacity.
Config:
use_attribute_docstrings:Truefrozen:True
Fields:
Validators:
-
_solid_has_color
DisplayMode
¶
Bases: StrEnum
How a field array is reduced to the value that drives the color.
Attributes:
-
VALUE–The value itself.
-
ABSVALUE–The absolute value.
-
X–The x component.
-
Y–The y component.
-
Z–The z component.
-
MAGNITUDE–The vector magnitude.
-
POLAR_XY–The in-plane direction as hue, brightened by the in-plane magnitude.
-
MAX_PRINCIPAL–The largest of the three principal values.
-
MID_PRINCIPAL–The middle one of the three principal values.
-
MIN_PRINCIPAL–The smallest of the three principal values.
-
label(str) –The mode's name as it reads in a picker.
POLAR_XY
class-attribute
instance-attribute
¶
The in-plane direction as hue, brightened by the in-plane magnitude.
MAX_PRINCIPAL
class-attribute
instance-attribute
¶
The largest of the three principal values.
MID_PRINCIPAL
class-attribute
instance-attribute
¶
The middle one of the three principal values.
MIN_PRINCIPAL
class-attribute
instance-attribute
¶
The smallest of the three principal values.
DisplaySpec
pydantic-model
¶
Bases: BaseModel
The complete, serializable state of one field display: which array is colored, how it reduces, and how the colors map.
Config:
use_attribute_docstrings:Truevalidate_assignment:True
Fields:
-
field(str) -
mode(DisplayMode) -
colormap(str) -
log_scale(bool) -
invert(bool) -
clim(tuple[float, float] | None) -
robust(bool) -
legend(Legend) -
expansion(Expansion) -
sweep(float) -
warp(str | None) -
warp_scale(float | None) -
hidden_bodies(tuple[str, ...]) -
outline(bool) -
edges(EdgeStyle) -
shading(Shading) -
scale(float) -
opacity(float) -
opacity_map(tuple[float, float] | None) -
body_styles(tuple[BodyStyle, ...]) -
body_colormap(str) -
streamlines(FieldLineOptions | None)
field
pydantic-field
¶
field: str = ''
Name of the VTU array to color by; empty opens the viewer on each run's default_display, and fitted takes the first array.
mode
pydantic-field
¶
mode: DisplayMode = DisplayMode.VALUE
How the array is reduced to the displayed value.
colormap
pydantic-field
¶
colormap: str = 'turbo'
Colormap name, resolved through pyvista's get_cmap_safe (matplotlib and colorcet names both work).
log_scale
pydantic-field
¶
log_scale: bool = False
Map the color range logarithmically; only the strictly positive values take part.
clim
pydantic-field
¶
[?]: Pinned color limits in the displayed value's unit, or None to recompute them from the data on every apply.
robust
pydantic-field
¶
robust: bool = True
Clamp the automatic limits to the 2-98 percentiles so a few outlier cells cannot flatten the picture.
legend
pydantic-field
¶
Whether and where the color bar is drawn; field lines mapped like the field share it.
expansion
pydantic-field
¶
How a run solved on a section is shown, one its frame lacks taken as the frame's 3D form (Revolve becomes Extrude for a Cartesian section); a run solved in 3D is shown as is.
sweep
pydantic-field
¶
sweep: float = FULL_SWEEP
[deg]: The turn a revolved section sweeps; less than a full one leaves a cutaway.
warp
pydantic-field
¶
warp: str | None
The vector array the bodies are displaced by, None to draw them undeformed.
warp_scale
pydantic-field
¶
warp_scale: float | None = None
[-]: The displacement exaggeration; None moves the largest displacement WARP_SHARE of the section diagonal.
hidden_bodies
pydantic-field
¶
Body names to hide, by their entities.json name.
outline
pydantic-field
¶
outline: bool = False
Draw the black feature-edge wireframe over the visible bodies.
scale
pydantic-field
¶
scale: float = 1.0
[-]: Window pixels per CSS pixel, which the wireframe's width scales by.
opacity_map
pydantic-field
¶
[-]: The opacity at the low and high color limits, linear in the color mapping between them; None draws opacity throughout.
body_styles
pydantic-field
¶
Bodies with a color source or an opacity of their own; the rest take the field colormap at full opacity.
body_colormap
pydantic-field
¶
body_colormap: str = 'batlow'
The colormap the COLORMAP bodies share, in body_styles order.
streamlines
pydantic-field
¶
streamlines: FieldLineOptions | None
Options for the field-line overlay, or None to draw none.
solid
¶
The color of every body not on the field colormap, by body: its own, or its share of the body colormap.
Source code in src/femforge/viz/field_display.py
body_opacity
¶
A body's drawn opacity: its own times the overall one.
unmatched
¶
The hidden_bodies and body_styles names missing from bodies, in spec order.
Source code in src/femforge/viz/field_display.py
fitted
¶
fitted(fields: Sequence[FieldInfo]) -> DisplaySpec
This spec snapped to what a run offers: an unset field takes the first one, a disallowed mode the field's first allowed one, and a warp without a vector field to follow is dropped.
An unknown field name raises KeyError naming the available arrays.
Source code in src/femforge/viz/field_display.py
EdgeStyle
pydantic-model
¶
Bases: BaseModel
How the drawn lines draw: the feature-edge outline, the hover and selection outlines and the field lines.
Config:
frozen:Trueuse_attribute_docstrings:True
Fields:
width
pydantic-field
¶
width: float = 2.0
[px]: The width of the feature-edge outline in CSS pixels.
feature_angle
pydantic-field
¶
feature_angle: float = FEATURE_ANGLE
[deg]: The dihedral angle above which a surface edge counts as a feature edge.
Shading
pydantic-model
¶
Bases: BaseModel
How solid surfaces shade under the lights.
Config:
frozen:Trueuse_attribute_docstrings:True
Fields:
smooth
pydantic-field
¶
smooth: bool = True
Interpolate the normals across each surface so curved faces shade evenly; False shades every facet flat.
split_angle
pydantic-field
¶
split_angle: float = FEATURE_ANGLE
[deg]: The dihedral angle above which a smooth surface keeps its edge sharp.
FieldInfo
dataclass
¶
FieldInfo(name: str, association: Association, components: int, dtype: str, unit: str | None = None, physics: Physics | None = None)
One displayable VTU array: where it lives, how wide it is, and which display modes it supports.
Attributes:
-
name(str) –The array's name in the VTU.
-
association(Association) –Whether the array lives on points or cells.
-
components(int) –The number of components per value: 1 for a scalar, 3 for a vector.
-
dtype(str) –The array's numpy dtype name.
-
unit(str | None) –The unit the values are in, None when unknown.
-
physics(Physics | None) –The physics the run solved, which decides what its potential is; None when unknown.
-
display_name(str) –The array's name as it reads in a picker: the variable's display name,
Magnetic Potentialfor a 2D magnetostatic one, with theFIELD_RENAMESoverrides applied. -
title(str) –The display name with the unit in brackets, as a color bar is titled.
-
kind(FieldKind) –What one row of the array holds.
-
modes(tuple[DisplayMode, ...]) –The display modes this array supports, the default first; a tensor supports none.
association
instance-attribute
¶
association: Association
Whether the array lives on points or cells.
components
instance-attribute
¶
components: int
The number of components per value: 1 for a scalar, 3 for a vector.
unit
class-attribute
instance-attribute
¶
unit: str | None = None
The unit the values are in, None when unknown.
physics
class-attribute
instance-attribute
¶
physics: Physics | None = None
The physics the run solved, which decides what its potential is; None when unknown.
display_name
property
¶
display_name: str
The array's name as it reads in a picker: the variable's display name, Magnetic Potential for a 2D magnetostatic one, with the FIELD_RENAMES overrides applied.
modes
property
¶
modes: tuple[DisplayMode, ...]
The display modes this array supports, the default first; a tensor supports none.
FieldKind
¶
Bases: StrEnum
What one row of a field array holds, which sets its display modes and whether an expansion turns it.
Attributes:
-
SCALAR–One value.
-
VECTOR–A 3-component vector, turned with a mirrored or revolved copy.
-
PRINCIPAL–Three principal values, which no rotation changes.
-
TENSOR–A Voigt tensor, whole or as one of the
stress_xxcolumns Elmer splits it into, or any other width; not displayed.
VECTOR
class-attribute
instance-attribute
¶
A 3-component vector, turned with a mirrored or revolved copy.
PRINCIPAL
class-attribute
instance-attribute
¶
Three principal values, which no rotation changes.
TENSOR
class-attribute
instance-attribute
¶
A Voigt tensor, whole or as one of the stress_xx columns Elmer splits it into, or any other width; not displayed.
FieldScene
¶
FieldScene(*, grid: UnstructuredGrid, blocks: MultiBlock, fields: Sequence[FieldInfo], model_dim: int, run_id: str, bodies: Bodies | None = None, frame: Frame | None = None, boundaries: Boundaries | None = None)
One run's solved bodies as a recolorable field display.
It is a Renderable whose DisplaySpec picks the field, its reduction, its colors and how a section is expanded.
Parameters:
-
grid(UnstructuredGrid) –The solved VTU grid.
-
blocks(MultiBlock) –The grid split into one block per named body.
-
fields(Sequence[FieldInfo]) –The displayable arrays.
-
model_dim(int) –2 for an axisymmetric slice, else 3.
-
run_id(str) –The run bundle's name.
-
bodies(Bodies | None, default:None) –The named bodies from
entities.json; None names none. -
frame(Frame | None, default:None) –The solve frame; None takes the first shipped frame that solves on the grid's dimension.
-
boundaries(Boundaries | None, default:None) –The named boundaries from
entities.json; None names none.
Methods:
-
from_run–Open a run bundle's VTU as a field scene, its bodies split and named from
entities.json. -
expansion_of–The expansion and sweep a spec asks of this run, an expansion its frame lacks taken as the frame's 3D form: a run solved in 3D is shown as is, and only a revolution has a sweep.
-
dim_for–The dimension the run shows in under a spec.
-
auto_warp_scale–The scale that moves the largest
namedisplacementWARP_SHAREof the section's bounds diagonal, 0.0 when nothing moves. -
warp_of–The vector array and the scale a spec displaces the bodies by: its own scale, else the automatic one; None for no warp or a zero scale.
-
shades_like–Whether the drawn surfaces carry the normals
shadingasks for; its light terms restyle them in place. -
reshaped–Whether a spec asks for other shown blocks than the scene holds: another expansion, sweep or warp.
-
expand–Rebuilds the shown blocks and grid for the spec's expansion and warp when either changed, dropping the field lines integrated for the old ones; True when it did.
-
field_info–The
FieldInfofor an array name, resolved the same way a field query resolves one. -
apply–Write the spec's reduction into every block's
display_scalarsarray and return the color limits it produced. -
render–Draw the whole display into
plotter: the composite body actor, then everythingupdateowns; solid bodies an earlier scene left go first. -
update–Recolor an already-rendered scene in place, the cheap path a panel calls on every knob change; a changed expansion or warp draws the scene anew.
-
group_cells–The solved cells of a body, or of a boundary a condition marked in the VTU; None for any other group.
-
shown_blocks–The blocks of every body not in
hidden, under their names. -
lines_share–Whether lines drawn with
styledmap like the field: the same colormap, inversion, log scale, opacity map and limits. -
lines_array–The array the field lines follow: the one asked for when the grid has it, else the one
line_vectorspicks for theshownarray. -
integrated–The cached field lines when
optionsonly restyle them, None when they need integrating. -
integrate_streamlines–Seed and integrate the field lines through the shown grid, carried into a revolved or extruded display from its section — the compute half, safe off the UI thread.
-
region_bounds–The shown bounds the field lines seed: the integration region's body when the options confine them to one, else every body.
-
swept_seeds–The seeds of the revolved display as a solid run would place them in
bounds, less the ones a partial sweep cuts away; None leaves a full sweep to seed itself. -
region_magnitudes–The magnitudes of array
nameper body of a region (every body for None) as solved, the chunks a field-line range spans. -
show_streamlines–Draw integrated field lines into
plotterin the display's mapping, record their options as the drawn ones and keep the lines for a restyle. -
lines_follow–Whether field lines following
vectorstake the display's range: it shows that field's magnitude, so one scale reads for both. -
lines_title–The field lines' scalar bar title: the integrated field's name and unit.
-
line_style–The field lines at the display's width, in its colormap, inversion, log scale and opacity map; a polar display leaves their colors as asked.
Attributes:
-
section_grid(UnstructuredGrid) –The grid as solved.
-
section_blocks(MultiBlock) –The bodies as solved, whose values set every range.
-
grid(UnstructuredGrid) –The grid as shown, which the field lines run through: the section, its mirror, or the section again under a revolved or extruded display, displaced under a warp.
-
blocks(MultiBlock) –The bodies as shown.
-
basis(Basis | None) –Where the section sits in the authored model, None for a run solved whole.
-
depth(float) –t[m]: The depth a Cartesian section extrudes through; 0 for any other frame. -
expanded(tuple[Expansion, float]) –The expansion and sweep the shown blocks were built for.
-
warped(tuple[str, float] | None) –The vector array and the scale the shown blocks are displaced by, None while they are drawn as solved.
-
glyphs(GlyphLayer | None) –The run's glyph layer, drawn after everything else on every redraw; None draws none.
-
glyph_view(GlyphView | None) –What the glyph layer draws; None removes its actors.
-
shading(Shading) –How the drawn surfaces shade, whose normals a change of smoothness or split angle rebuilds.
-
drawn_lines(FieldLineOptions | None) –The styled options of the lines the plotter holds.
-
expandable(bool) –Whether the run was solved on a section that can be shown in another form.
-
display_dim(int) –2 while the run is shown flat, 3 when it is solid, revolved or extruded.
-
bounds(Bounds) –The bounds of the shown bodies.
Source code in src/femforge/viz/field_display.py
987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 | |
section_blocks
instance-attribute
¶
The bodies as solved, whose values set every range.
grid
instance-attribute
¶
The grid as shown, which the field lines run through: the section, its mirror, or the section again under a revolved or extruded display, displaced under a warp.
basis
instance-attribute
¶
basis: Basis | None = scaled_basis(plane) if plane is not None and self.frame.revolves else None
Where the section sits in the authored model, None for a run solved whole.
depth
instance-attribute
¶
depth: float = prism_depth(self.frame)
t [m]: The depth a Cartesian section extrudes through; 0 for any other frame.
expanded
instance-attribute
¶
The expansion and sweep the shown blocks were built for.
warped
instance-attribute
¶
The vector array and the scale the shown blocks are displaced by, None while they are drawn as solved.
glyphs
instance-attribute
¶
glyphs: GlyphLayer | None = None
The run's glyph layer, drawn after everything else on every redraw; None draws none.
glyph_view
instance-attribute
¶
glyph_view: GlyphView | None = None
What the glyph layer draws; None removes its actors.
shading
instance-attribute
¶
How the drawn surfaces shade, whose normals a change of smoothness or split angle rebuilds.
drawn_lines
instance-attribute
¶
drawn_lines: FieldLineOptions | None = None
The styled options of the lines the plotter holds.
expandable
property
¶
expandable: bool
Whether the run was solved on a section that can be shown in another form.
display_dim
property
¶
display_dim: int
2 while the run is shown flat, 3 when it is solid, revolved or extruded.
from_run
classmethod
¶
from_run(run: Run) -> FieldScene
Open a run bundle's VTU as a field scene, its bodies split and named from entities.json.
Source code in src/femforge/viz/field_display.py
expansion_of
¶
expansion_of(spec: DisplaySpec) -> tuple[Expansion, float]
The expansion and sweep a spec asks of this run, an expansion its frame lacks taken as the frame's 3D form: a run solved in 3D is shown as is, and only a revolution has a sweep.
Source code in src/femforge/viz/field_display.py
dim_for
¶
dim_for(spec: DisplaySpec) -> int
auto_warp_scale
¶
The scale that moves the largest name displacement WARP_SHARE of the section's bounds diagonal, 0.0 when nothing moves.
Source code in src/femforge/viz/field_display.py
warp_of
¶
warp_of(spec: DisplaySpec) -> tuple[str, float] | None
The vector array and the scale a spec displaces the bodies by: its own scale, else the automatic one; None for no warp or a zero scale.
Source code in src/femforge/viz/field_display.py
shades_like
¶
Whether the drawn surfaces carry the normals shading asks for; its light terms restyle them in place.
Source code in src/femforge/viz/field_display.py
reshaped
¶
reshaped(spec: DisplaySpec) -> bool
Whether a spec asks for other shown blocks than the scene holds: another expansion, sweep or warp.
expand
¶
expand(spec: DisplaySpec) -> bool
Rebuilds the shown blocks and grid for the spec's expansion and warp when either changed, dropping the field lines integrated for the old ones; True when it did.
Source code in src/femforge/viz/field_display.py
field_info
¶
The FieldInfo for an array name, resolved the same way a field query resolves one.
Source code in src/femforge/viz/field_display.py
apply
¶
apply(spec: DisplaySpec) -> tuple[float, float]
Write the spec's reduction into every block's display_scalars array and return the color limits it produced.
Source code in src/femforge/viz/field_display.py
render
¶
Draw the whole display into plotter: the composite body actor, then everything update owns; solid bodies an earlier scene left go first.
Source code in src/femforge/viz/field_display.py
update
¶
update(plotter: Plotter, spec: DisplaySpec) -> None
Recolor an already-rendered scene in place, the cheap path a panel calls on every knob change; a changed expansion or warp draws the scene anew.
Source code in src/femforge/viz/field_display.py
group_cells
¶
group_cells(ref: EntityRef) -> DataSet | None
The solved cells of a body, or of a boundary a condition marked in the VTU; None for any other group.
Source code in src/femforge/viz/field_display.py
shown_blocks
¶
The blocks of every body not in hidden, under their names.
Source code in src/femforge/viz/field_display.py
lines_share
¶
lines_share(styled: FieldLineOptions) -> bool
Whether lines drawn with styled map like the field: the same colormap, inversion, log scale, opacity map and limits.
Source code in src/femforge/viz/field_display.py
lines_array
¶
lines_array(options: FieldLineOptions, shown: str) -> str | None
The array the field lines follow: the one asked for when the grid has it, else the one line_vectors picks for the shown array.
Source code in src/femforge/viz/field_display.py
integrated
¶
integrated(options: FieldLineOptions) -> StreamlineActors | None
The cached field lines when options only restyle them, None when they need integrating.
Source code in src/femforge/viz/field_display.py
integrate_streamlines
¶
integrate_streamlines(options: FieldLineOptions) -> StreamlineActors
Seed and integrate the field lines through the shown grid, carried into a revolved or extruded display from its section — the compute half, safe off the UI thread.
Source code in src/femforge/viz/field_display.py
region_bounds
¶
region_bounds(options: FieldLineOptions) -> Bounds
The shown bounds the field lines seed: the integration region's body when the options confine them to one, else every body.
Source code in src/femforge/viz/field_display.py
swept_seeds
¶
swept_seeds(options: FieldLineOptions, bounds: Bounds) -> FloatArray | None
The seeds of the revolved display as a solid run would place them in bounds, less the ones a partial sweep cuts away; None leaves a full sweep to seed itself.
Source code in src/femforge/viz/field_display.py
region_magnitudes
¶
The magnitudes of array name per body of a region (every body for None) as solved, the chunks a field-line range spans.
Source code in src/femforge/viz/field_display.py
show_streamlines
¶
show_streamlines(plotter: Plotter, actors: StreamlineActors, options: FieldLineOptions) -> None
Draw integrated field lines into plotter in the display's mapping, record their options as the drawn ones and keep the lines for a restyle.
Parameters:
-
plotter(Plotter) –The plotter to draw into.
-
actors(StreamlineActors) –The integrated field lines.
-
options(FieldLineOptions) –The options the lines were integrated with.
Source code in src/femforge/viz/field_display.py
lines_follow
¶
Whether field lines following vectors take the display's range: it shows that field's magnitude, so one scale reads for both.
Source code in src/femforge/viz/field_display.py
lines_title
¶
The field lines' scalar bar title: the integrated field's name and unit.
line_style
¶
line_style(options: FieldLineOptions, actors: StreamlineActors) -> FieldLineOptions
The field lines at the display's width, in its colormap, inversion, log scale and opacity map; a polar display leaves their colors as asked.
Their range is the display's while it shows their field's magnitude, else the automatic range of that magnitude over their own region, whatever the bodies show.
Source code in src/femforge/viz/field_display.py
SceneActor
¶
Bases: StrEnum
The plotter actor names a FieldScene registers, so a toggle removes exactly one.
Methods:
-
of–The actor name of one body under this prefix.
Attributes:
Renderable
¶
Scene
¶
Scene(*items: Renderable)
An ordered group of Renderables drawn into one plotter refresh: clear once, draw in order (later items on top), repaint once.
Scene is itself a Renderable, so scenes can nest.
Methods:
-
add–Append a renderable to draw; returns
selfso calls chain. -
render–Clear the plotter but keep its lights, draw every item in order, and repaint — once. Call on the plotter thread.
Source code in src/femforge/viz/scene.py
add
¶
add(item: Renderable) -> Scene
render
¶
Clear the plotter but keep its lights, draw every item in order, and repaint — once. Call on the plotter thread.
Source code in src/femforge/viz/scene.py
Expansion
¶
Bases: StrEnum
How a 2D section is shown.
Attributes:
-
SECTION–The r–z half-plane as solved.
-
MIRROR–Both halves of the r–z plane, still 2D in the solve frame.
-
REVOLVE–The section swept around the axis into the authored 3D frame.
-
EXTRUDE–A Cartesian section extruded through its depth, centred on the section plane in the solve frame.
-
dim(Literal[2, 3]) –The dimension of the shown geometry.
MIRROR
class-attribute
instance-attribute
¶
Both halves of the r–z plane, still 2D in the solve frame.
REVOLVE
class-attribute
instance-attribute
¶
The section swept around the axis into the authored 3D frame.
EXTRUDE
class-attribute
instance-attribute
¶
A Cartesian section extruded through its depth, centred on the section plane in the solve frame.
Basis
dataclass
¶
Where the solve frame sits in the authored model.
Methods:
-
of–The basis of a frame's solve plane, as numpy rows.
-
directions–The unit radial and azimuthal directions
e_rande_φat each angle, as(N, 3)rows. -
place–The authored points of section points
(r, z)swept totheta; any section Z is ignored. -
rotate–The authored form of solve-frame vectors at
theta: X alonge_r, Y along the axis, Z along-e_φ. -
fold–The section points
(r, z, 0)of authored points and their angles in(-π, π], invertingplace. -
carry–valuesrotated tothetawhen they are 3-component floating vectors, else unchanged.
Attributes:
-
origin(Triple) –A point on the axis, the section's
(0, 0). -
radial(Triple) –The unit radial direction at θ = 0, the section's +X.
-
axis(Triple) –The unit axis direction, the section's +Y.
-
DEFAULT(Basis) –The default frame's basis: radial +X, axis +Z, normal +Y.
-
SOLVE(Basis) –The solve frame itself, whose θ = π half is the section's mirror image.
-
normal(Triple) –The radial direction at θ = 90°,
axis × radial.
SOLVE
class-attribute
¶
SOLVE: Basis
The solve frame itself, whose θ = π half is the section's mirror image.
of
classmethod
¶
of(plane: SolvePlane) -> Basis
The basis of a frame's solve plane, as numpy rows.
Source code in src/femforge/viz/symmetry.py
directions
¶
The unit radial and azimuthal directions e_r and e_φ at each angle, as (N, 3) rows.
Source code in src/femforge/viz/symmetry.py
place
¶
place(section: FloatArray, theta: FloatArray | float) -> FloatArray
The authored points of section points (r, z) swept to theta; any section Z is ignored.
Source code in src/femforge/viz/symmetry.py
rotate
¶
rotate(vectors: FloatArray, theta: FloatArray | float) -> FloatArray
The authored form of solve-frame vectors at theta: X along e_r, Y along the axis, Z along -e_φ.
Source code in src/femforge/viz/symmetry.py
fold
¶
fold(points: FloatArray) -> tuple[FloatArray, FloatArray]
The section points (r, z, 0) of authored points and their angles in (-π, π], inverting place.
Source code in src/femforge/viz/symmetry.py
carry
¶
carry(values: AnyArray, theta: FloatArray | float) -> AnyArray
values rotated to theta when they are 3-component floating vectors, else unchanged.
Source code in src/femforge/viz/symmetry.py
Prism
dataclass
¶
Prism(depth: float)
A Cartesian section's depth along the solve Z, with the section plane at its middle.
Methods:
-
fold–The section points
(x, y, 0)of solve-frame points and their Z, invertingplace. -
place–Section points
(x, y)at solve Zalong; any section Z is ignored. -
carry–valuesunchanged, since an extrusion turns no vector.
Attributes:
fold
¶
fold(points: FloatArray) -> tuple[FloatArray, FloatArray]
The section points (x, y, 0) of solve-frame points and their Z, inverting place.
Source code in src/femforge/viz/symmetry.py
place
¶
place(section: FloatArray, along: FloatArray | float) -> FloatArray
Section points (x, y) at solve Z along; any section Z is ignored.
Source code in src/femforge/viz/symmetry.py
GlyphActor
¶
Bases: StrEnum
The plotter actor names the glyph layer owns, so a redraw replaces or removes exactly these.
Attributes:
-
ARROWS–Load, magnet and displacement arrows and the filled marks.
-
HALOS–The dark hulls behind the arrows.
-
FACES–Translucent tints of 3D or revolved faces.
-
LINES–Opaque tints of 2D faces.
-
MARKS–Clamp ticks, support pins, rollers and current markers.
-
LEADERS–The lines from a face to its label chip.
-
LABELS–Value labels.
-
SELECTION–The accent silhouette or line of the selected entity.
-
SELECTION_FILL–The accent fill of the selected entity.
-
SELECTION_GLYPHS–The selected entity's arrows and pins redrawn in the accent.
-
OUTLINE–The boundary loops of a 2D section.
-
PLANE–The section plane under a revolved display.
-
GHOST–The translucent authored bodies a 2D frame sectioned.
-
HULL–The ghost's silhouette and the dashed prism or revolved outline it is checked against.
-
HOVER–The prefix of each entity's hidden hover outline, which the browser shows while the entity's row is hovered.
ARROWS
class-attribute
instance-attribute
¶
Load, magnet and displacement arrows and the filled marks.
FACES
class-attribute
instance-attribute
¶
Translucent tints of 3D or revolved faces.
MARKS
class-attribute
instance-attribute
¶
Clamp ticks, support pins, rollers and current markers.
LEADERS
class-attribute
instance-attribute
¶
The lines from a face to its label chip.
SELECTION
class-attribute
instance-attribute
¶
The accent silhouette or line of the selected entity.
SELECTION_FILL
class-attribute
instance-attribute
¶
The accent fill of the selected entity.
SELECTION_GLYPHS
class-attribute
instance-attribute
¶
The selected entity's arrows and pins redrawn in the accent.
OUTLINE
class-attribute
instance-attribute
¶
The boundary loops of a 2D section.
PLANE
class-attribute
instance-attribute
¶
The section plane under a revolved display.
GHOST
class-attribute
instance-attribute
¶
The translucent authored bodies a 2D frame sectioned.
HULL
class-attribute
instance-attribute
¶
The ghost's silhouette and the dashed prism or revolved outline it is checked against.
HOVER
class-attribute
instance-attribute
¶
The prefix of each entity's hidden hover outline, which the browser shows while the entity's row is hovered.
EntityKind
¶
EntityRef
dataclass
¶
EntityRef(kind: EntityKind, name: str)
A body or boundary group by kind and name, so a body and a named face that share a name stay apart.
Methods:
Attributes:
Glyph
pydantic-model
¶
Bases: BaseModel
One condition as the scene draws it, in the solve frame the run was meshed in.
Config:
frozen:Trueuse_attribute_docstrings:True
Fields:
-
group(str) -
target(EntityKind) -
kind(ConditionGlyph) -
anchor(Vec3Field) -
normal(Vec3Field | None) -
vector(Vec3Field | None) -
share(float) -
label(str | None) -
held(tuple[bool, ...]) -
extent(float | None) -
reach(float)
normal
pydantic-field
¶
normal: Vec3Field | None = None
[-]: The outward normal of a boundary; None for a body or an ill-defined normal.
vector
pydantic-field
¶
vector: Vec3Field | None = None
[-]: The unit direction of the condition vector the solver received; None for a condition without one.
share
pydantic-field
¶
share: float = 1.0
[-]: The load's size against the largest load of its kind, which sets an arrow's length.
held
pydantic-field
¶
Whether each solve coordinate is held, for a fixed displacement.
GlyphView
pydantic-model
¶
Bases: BaseModel
What the Setup tab asks the scene to draw: which glyphs, their labels and size, and the selection, outline and ghost around them.
Config:
frozen:Trueuse_attribute_docstrings:True
Fields:
-
kinds(frozenset[ConditionGlyph]) -
hidden(frozenset[str]) -
plain_bodies(bool) -
labels(GlyphLabels) -
scale(float) -
selected(str | None) -
outline(bool) -
ghost(bool) -
accent(str) -
hover(str) -
ink(str) -
edges(EdgeStyle) -
shading(Shading)
kinds
pydantic-field
¶
kinds: frozenset[ConditionGlyph]
The glyph kinds drawn; empty draws no glyph.
plain_bodies
pydantic-field
¶
plain_bodies: bool = False
Paint every body plain grey while the view is shown.
scale
pydantic-field
¶
scale: float = 1.0
[-]: Window pixels per CSS pixel, which text sizes and line widths scale by.
selected
pydantic-field
¶
selected: str | None = None
The entity id highlighted in the accent; None highlights nothing.
ghost
pydantic-field
¶
ghost: bool = False
Draw the authored bodies a 2D frame sectioned, beside the prism or revolved outline they are checked against.
hover
pydantic-field
¶
hover: str = GLYPH_ACCENT
The hover outline color, any color pyvista resolves.
GlyphPlacement
dataclass
¶
GlyphPlacement(expansion: Expansion = SECTION, sweep: float = FULL_SWEEP, basis: Basis | None = None, diagonal: float = 1.0, flat: bool = False, depth: float = 0.0)
How solve-frame geometry lands in the displayed scene: as solved, beside its mirror image, on the planes of a revolution, or on the front face of an extrusion.
Methods:
-
placed–Solve-frame
(n, 3)points on the plane atthetaradians of a revolved display, unchanged otherwise. -
copies–Solve-frame
(n, 3)points as the display shows them: once, beside their mirror image, on the 0° plane of a revolution, or on an extrusion's front face. -
swept_face–The surface solve-frame
(n, 2, 3)line segments sweep in a revolved or extruded display, standing for the face a section line is; None in a flat one. -
angles–The radians a revolved display repeats a body's arrow at; only 0 otherwise.
Attributes:
-
expansion(Expansion) –How the section is shown.
-
sweep(float) –[deg]: The turn a revolved display sweeps. -
basis(Basis | None) –Where the section sits in the authored model; None for a run solved whole.
-
diagonal(float) –D[m]: The undeformed scene diagonal glyph sizes scale with. -
flat(bool) –Whether the run solved on a 2D section.
-
depth(float) –t[m]: The depth an extruded display extrudes the section through. -
revolved(bool) –Whether the section is shown revolved into the authored frame.
-
extruded(bool) –Whether the section is shown extruded through its depth.
-
front(FloatArray) –The offset from the section plane to the front face of an extruded display, which the viewer of a flat run faces; zero otherwise.
expansion
class-attribute
instance-attribute
¶
How the section is shown.
sweep
class-attribute
instance-attribute
¶
sweep: float = FULL_SWEEP
[deg]: The turn a revolved display sweeps.
basis
class-attribute
instance-attribute
¶
basis: Basis | None = None
Where the section sits in the authored model; None for a run solved whole.
diagonal
class-attribute
instance-attribute
¶
diagonal: float = 1.0
D [m]: The undeformed scene diagonal glyph sizes scale with.
flat
class-attribute
instance-attribute
¶
flat: bool = False
Whether the run solved on a 2D section.
depth
class-attribute
instance-attribute
¶
depth: float = 0.0
t [m]: The depth an extruded display extrudes the section through.
front
property
¶
The offset from the section plane to the front face of an extruded display, which the viewer of a flat run faces; zero otherwise.
placed
¶
placed(points: FloatArray, theta: float = 0.0) -> FloatArray
Solve-frame (n, 3) points on the plane at theta radians of a revolved display, unchanged otherwise.
Source code in src/femforge/viz/glyphs.py
copies
¶
copies(points: FloatArray) -> list[FloatArray]
Solve-frame (n, 3) points as the display shows them: once, beside their mirror image, on the 0° plane of a revolution, or on an extrusion's front face.
Source code in src/femforge/viz/glyphs.py
swept_face
¶
The surface solve-frame (n, 2, 3) line segments sweep in a revolved or extruded display, standing for the face a section line is; None in a flat one.
Source code in src/femforge/viz/glyphs.py
angles
¶
The radians a revolved display repeats a body's arrow at; only 0 otherwise.
GlyphHost
¶
Bases: Protocol
The scene a glyph layer draws over: its frame, how it is shown and the cells of each group.
GlyphDraw
dataclass
¶
GlyphDraw(actor: str, mesh: PolyData, color: str = GLYPH_FILL, opacity: float = 1.0, line_width: float | None = None, culling: Literal['front'] | None = None, labels: tuple[str, ...] = (), font_size: int = 0, overlay: bool = False, layer: Layer = BASE)
One merged glyph actor: its name, its geometry and how it is styled.
Attributes:
-
actor(str) –The actor name: a
GlyphActor, or the hover prefix and an entity id. -
mesh(PolyData) –The geometry, in the displayed scene's frame.
-
color(str) –Any color pyvista resolves.
-
opacity(float) –[-]: The actor's opacity. -
line_width(float | None) –[px]: The width of its lines in window pixels; None for surfaces. -
culling(Literal['front'] | None) –The faces culled, front for an arrow's halo.
-
labels(tuple[str, ...]) –The text at each point of a label actor; empty for geometry.
-
font_size(int) –The label font size in window pixels.
-
overlay(bool) –Whether the lines draw over the scene as a 2D overlay at their world positions rather than among the bodies.
-
layer(Layer) –Which coincident geometry it draws over by a depth offset, its points left where they are.
actor
instance-attribute
¶
actor: str
The actor name: a GlyphActor, or the hover prefix and an entity id.
line_width
class-attribute
instance-attribute
¶
line_width: float | None = None
[px]: The width of its lines in window pixels; None for surfaces.
culling
class-attribute
instance-attribute
¶
culling: Literal['front'] | None = None
The faces culled, front for an arrow's halo.
labels
class-attribute
instance-attribute
¶
The text at each point of a label actor; empty for geometry.
font_size
class-attribute
instance-attribute
¶
font_size: int = 0
The label font size in window pixels.
overlay
class-attribute
instance-attribute
¶
overlay: bool = False
Whether the lines draw over the scene as a 2D overlay at their world positions rather than among the bodies.
layer
class-attribute
instance-attribute
¶
Which coincident geometry it draws over by a depth offset, its points left where they are.
GlyphLayer
dataclass
¶
GlyphLayer(glyphs: list[Glyph], bodies: Sequence[Body] = (), boundaries: Sequence[Boundary] = (), frame: Frame = (lambda: default_frame(3))(), mesh_groups: MeshGroups | None = None, authored: PolyData | None = None, run_id: str = '', host: GlyphHost | None = None, drawn: tuple[object, ...] | None = None, names: frozenset[str] = frozenset(), label_spots: FloatArray = (lambda: zeros((0, 3)))(), label_texts: tuple[str, ...] = (), hover_actors: dict[str, Actor] = dict(), chosen: tuple[object, ...] | None = None, chosen_names: frozenset[str] = frozenset(), shown: tuple[list[Glyph], dict[str, DataSet]] = (lambda: ([], {}))(), shapes: dict[tuple[str, str, float], PolyData] = dict())
A run's glyphs and the scene decorations the Setup tab asks for, drawn over a host scene as named actors.
Methods:
-
from_run–The glyphs of
runfrom its conditions sidecar and entities, in the frame ofscenewhen given, else of its manifest. -
group_cells–The solve-frame cells of
reffromhost(else the last host), else from the Elmer mesh; None when neither has any. -
has–Whether
refhas cells to highlight. -
placement–How
hostshows the solve frame. -
bounds_of–The bounds of
refas the last host shows it, its cells moved by their mean warp as the glyph anchors are, from its measured box when it has no cells there; None when it has neither. -
update–Draw
viewoverhostas named actors, rebuilt only when the view, the expansion, the warp or the hidden bodies changed. -
draw_base–Draw everything but the selection: the glyphs, the decorations and the hidden hover outlines.
-
draw_selection–Swap only the selection actors for those of the selected entity, so a new selection never rebuilds the rest of the layer.
-
shape–A copy of a body's surface or feature outline, extracted once while the host, expansion and warp stay.
-
refs–Every body
hostdraws and every boundary of the run. -
hover_draw–The outline
refshows while its row is hovered: a body's feature edges, a boundary's lines or rim; None when it has no cells. -
moved_glyphs–The shown glyphs with their anchors moved with
host's warp, and the warped cells of each glyph's group by entity id. -
accent_glyphs–The arrows and pins of one entity's glyphs, which a highlight redraws in its color; None when the entity shows none.
-
selection–The accent silhouette and fill of the selected body, or the accent lines or cells of the selected boundary.
-
decorations–The section outline with its plane, and the authored ghost with its hull.
-
deformed_section–The section blocks of
hostdisplaced by its warp, so an outline follows the body the scene shows; as solved without a warp. -
hull–The
(m, 2, 3)edges the ghost is checked against: the section extruded through the prism depth, or revolved about the axis.
Attributes:
-
glyphs(list[Glyph]) –The drawable conditions, in the solve frame.
-
bodies(Sequence[Body]) –The run's bodies.
-
boundaries(Sequence[Boundary]) –The run's boundaries.
-
frame(Frame) –The frame the run solved in.
-
mesh_groups(MeshGroups | None) –The group cells from the Elmer mesh, for groups the host has no cells of; None when the mesh is gone.
-
authored(PolyData | None) –The authored bodies a 2D frame sectioned, in the solve frame; None when the run wrote none.
-
run_id(str) –The run bundle's name, for the log.
-
host(GlyphHost | None) –The scene the layer last drew over.
-
drawn(tuple[object, ...] | None) –What the drawn actors were built for: the view, the expansion, the warp and the hidden bodies.
-
names(frozenset[str]) –The actor names the plotter holds from the last draw.
-
label_spots(FloatArray) –[m]: The(n, 3)points the last draw labelled, in the displayed scene's frame. -
label_texts(tuple[str, ...]) –The text at each of
label_spots. -
hover_actors(dict[str, Actor]) –The hidden hover outline of each entity id the last draw outlined.
-
chosen(tuple[object, ...] | None) –What the selection actors were built for: the drawn key and the selected entity id.
-
chosen_names(frozenset[str]) –The selection actor names the plotter holds from the last selection draw.
-
shown(tuple[list[Glyph], dict[str, DataSet]]) –The glyphs the last draw showed, anchors moved with the warp, and their groups' warped cells, which a selection reuses.
-
shapes(dict[tuple[str, str, float], PolyData]) –A body's surface or feature outline by kind, name and feature angle, kept while the host, its expansion and its warp stay.
boundaries
class-attribute
instance-attribute
¶
The run's boundaries.
frame
class-attribute
instance-attribute
¶
frame: Frame = field(default_factory=lambda: default_frame(3))
The frame the run solved in.
mesh_groups
class-attribute
instance-attribute
¶
mesh_groups: MeshGroups | None = None
The group cells from the Elmer mesh, for groups the host has no cells of; None when the mesh is gone.
authored
class-attribute
instance-attribute
¶
The authored bodies a 2D frame sectioned, in the solve frame; None when the run wrote none.
host
class-attribute
instance-attribute
¶
host: GlyphHost | None = None
The scene the layer last drew over.
drawn
class-attribute
instance-attribute
¶
What the drawn actors were built for: the view, the expansion, the warp and the hidden bodies.
names
class-attribute
instance-attribute
¶
The actor names the plotter holds from the last draw.
label_spots
class-attribute
instance-attribute
¶
[m]: The (n, 3) points the last draw labelled, in the displayed scene's frame.
label_texts
class-attribute
instance-attribute
¶
The text at each of label_spots.
hover_actors
class-attribute
instance-attribute
¶
The hidden hover outline of each entity id the last draw outlined.
chosen
class-attribute
instance-attribute
¶
What the selection actors were built for: the drawn key and the selected entity id.
chosen_names
class-attribute
instance-attribute
¶
The selection actor names the plotter holds from the last selection draw.
shown
class-attribute
instance-attribute
¶
The glyphs the last draw showed, anchors moved with the warp, and their groups' warped cells, which a selection reuses.
shapes
class-attribute
instance-attribute
¶
A body's surface or feature outline by kind, name and feature angle, kept while the host, its expansion and its warp stay.
from_run
classmethod
¶
from_run(run: Run, scene: FieldScene | None = None) -> GlyphLayer
The glyphs of run from its conditions sidecar and entities, in the frame of scene when given, else of its manifest.
Source code in src/femforge/viz/glyphs.py
group_cells
¶
The solve-frame cells of ref from host (else the last host), else from the Elmer mesh; None when neither has any.
Source code in src/femforge/viz/glyphs.py
has
¶
placement
¶
placement(host: GlyphHost) -> GlyphPlacement
How host shows the solve frame.
Source code in src/femforge/viz/glyphs.py
bounds_of
¶
The bounds of ref as the last host shows it, its cells moved by their mean warp as the glyph anchors are, from its measured box when it has no cells there; None when it has neither.
Source code in src/femforge/viz/glyphs.py
update
¶
Draw view over host as named actors, rebuilt only when the view, the expansion, the warp or the hidden bodies changed.
Parameters:
-
plotter(Plotter) –The plotter the host scene is drawn in.
-
host(GlyphHost) –The scene the glyphs sit on.
-
view(GlyphView | None) –What to draw; None removes every glyph actor.
Source code in src/femforge/viz/glyphs.py
draw_base
¶
draw_base(plotter: Plotter, host: GlyphHost, view: GlyphView | None, key: tuple[object, ...], present: set[str]) -> None
Draw everything but the selection: the glyphs, the decorations and the hidden hover outlines.
Parameters:
-
plotter(Plotter) –The plotter the host scene is drawn in.
-
host(GlyphHost) –The scene the glyphs sit on.
-
view(GlyphView | None) –What to draw, without a selection; None removes every glyph actor.
-
key(tuple[object, ...]) –What the actors are built for, recorded as the drawn key.
-
present(set[str]) –The actor names the plotter holds.
Source code in src/femforge/viz/glyphs.py
1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 | |
draw_selection
¶
Swap only the selection actors for those of the selected entity, so a new selection never rebuilds the rest of the layer.
Parameters:
-
plotter(Plotter) –The plotter the host scene is drawn in.
-
host(GlyphHost) –The scene the glyphs sit on.
-
view(GlyphView | None) –What to draw; its
selectednames the entity to accent.
Source code in src/femforge/viz/glyphs.py
shape
¶
A copy of a body's surface or feature outline, extracted once while the host, expansion and warp stay.
Parameters:
-
host(GlyphHost) –The scene whose blocks hold the body.
-
kind(str) –surfacefor the outer surface,outlinefor the feature edges. -
name(str) –The body's block name.
-
feature_angle(float, default:0.0) –The crease angle of an outline, in degrees.
Source code in src/femforge/viz/glyphs.py
refs
¶
Every body host draws and every boundary of the run.
Source code in src/femforge/viz/glyphs.py
hover_draw
¶
The outline ref shows while its row is hovered: a body's feature edges, a boundary's lines or rim; None when it has no cells.
Parameters:
-
ref(EntityRef) –The body or boundary to outline.
-
host(GlyphHost) –The scene the outline sits on, whose warp it follows.
-
view(GlyphView) –The view whose hover color and pixel scale it takes.
Source code in src/femforge/viz/glyphs.py
moved_glyphs
¶
The shown glyphs with their anchors moved with host's warp, and the warped cells of each glyph's group by entity id.
Source code in src/femforge/viz/glyphs.py
accent_glyphs
staticmethod
¶
accent_glyphs(ref_id: str, glyphs: Sequence[Glyph], cells: Mapping[str, DataSet], placement: GlyphPlacement, view: GlyphView) -> PolyData | None
The arrows and pins of one entity's glyphs, which a highlight redraws in its color; None when the entity shows none.
Parameters:
-
ref_id(str) –The entity id whose glyphs to take.
-
glyphs(Sequence[Glyph]) –The shown glyphs, anchors already moved with the warp.
-
cells(Mapping[str, DataSet]) –The warped cells of each glyph's group by entity id.
-
placement(GlyphPlacement) –How the solve frame lands in the displayed scene.
-
view(GlyphView) –How large the glyphs draw.
Source code in src/femforge/viz/glyphs.py
selection
¶
The accent silhouette and fill of the selected body, or the accent lines or cells of the selected boundary.
Source code in src/femforge/viz/glyphs.py
decorations
¶
The section outline with its plane, and the authored ghost with its hull.
Source code in src/femforge/viz/glyphs.py
deformed_section
¶
deformed_section(host: GlyphHost) -> MultiBlock
The section blocks of host displaced by its warp, so an outline follows the body the scene shows; as solved without a warp.
Source code in src/femforge/viz/glyphs.py
hull
¶
hull(host: GlyphHost, placement: GlyphPlacement) -> FloatArray
The (m, 2, 3) edges the ghost is checked against: the section extruded through the prism depth, or revolved about the axis.
Source code in src/femforge/viz/glyphs.py
GroupScene
¶
GroupScene(groups: MeshGroups, *, bodies: Bodies, boundaries: Boundaries, frame: Frame, run_id: str)
A run without fields drawn from its Elmer mesh: every body plain grey, with its glyph layer over them.
Parameters:
-
groups(MeshGroups) –The run's Elmer mesh by group.
-
bodies(Bodies) –The run's bodies.
-
boundaries(Boundaries) –The run's boundaries.
-
frame(Frame) –The frame the run solved in.
-
run_id(str) –The run bundle's name.
Methods:
-
from_run–The mesh-only scene of
runwith its glyph layer; None when its Elmer mesh is gone. -
group_cells–The cells of
reffrom the Elmer mesh. -
render–Draw every body shaded in its body color, a solid run's feature edges in black over them, then the glyph layer.
Source code in src/femforge/viz/glyphs.py
from_run
classmethod
¶
from_run(run: Run) -> GroupScene | None
The mesh-only scene of run with its glyph layer; None when its Elmer mesh is gone.
Source code in src/femforge/viz/glyphs.py
group_cells
¶
group_cells(ref: EntityRef) -> DataSet | None
The cells of ref from the Elmer mesh.
Source code in src/femforge/viz/glyphs.py
render
¶
Draw every body shaded in its body color, a solid run's feature edges in black over them, then the glyph layer.
Source code in src/femforge/viz/glyphs.py
select_flux_density_array
¶
Pick the B array from a VTU's array names: the nodal form first (no cell→point projection needed), then the elemental "... e", then any name containing the phrase (case-insensitive).
Raises KeyError naming the available arrays if none matches.
Source code in src/femforge/viz/field_lines.py
seed_points
¶
seed_points(bounds: Bounds, options: FieldLineOptions) -> list[Point3]
The (N, 3) streamline seed coordinates for the domain bounds and options (pure Python — unit-testable without a render context).
The grid is centered and spans seed_fraction of each axis, keeping seeds out of the outer air shell where B ≈ 0.
Source code in src/femforge/viz/field_lines.py
build_streamlines
¶
build_streamlines(dataset: DataSet, b_name: str, options: FieldLineOptions | None = None) -> StreamlineActors
Seed and integrate |B| streamlines through a dataset that already carries B as point data, without touching a plotter.
Parameters:
-
dataset(DataSet) –The dataset carrying B on its points.
-
b_name(str) –The point array the lines follow.
-
options(FieldLineOptions | None, default:None) –The field-line options; None takes the defaults.
Source code in src/femforge/viz/field_lines.py
build_streamlines_from_vtu
¶
build_streamlines_from_vtu(vtu_path: str | Path, options: FieldLineOptions | None = None) -> StreamlineActors
Read a solved case.vtu and integrate its B-field streamlines into a drawable StreamlineActors — no plotter touched, safe off the UI thread.
Source code in src/femforge/viz/field_lines.py
build_swept_streamlines
¶
build_swept_streamlines(section: DataSet, b_name: str, options: FieldLineOptions, basis: Basis | Prism, bounds: Bounds, *, seeds: NDArray[float64] | None = None) -> StreamlineActors
Field lines of a revolved or extruded section: seeded in the shown 3D frame, folded into the section, integrated there and carried back to each seed's angle or depth.
Parameters:
-
section(DataSet) –The solved section in the solve frame, carrying B on its points.
-
b_name(str) –The point array the lines follow.
-
options(FieldLineOptions) –The field-line options.
-
basis(Basis | Prism) –How the section folds out of the shown frame: a revolution's basis or an extrusion's prism.
-
bounds(Bounds) –The shown 3D bounds, which the seeds fill and the outline draws.
-
seeds(NDArray[float64] | None, default:None) –(N, 3)authored seed points to use instead of seedingbounds.
Source code in src/femforge/viz/field_lines.py
prepare_streamline_source
¶
prepare_streamline_source(grid: UnstructuredGrid, options: FieldLineOptions) -> tuple[DataSet, str]
Narrow a read grid to the integration region and put B on its points, returning the dataset and the B array name — the read-independent half of build_streamlines_from_vtu.
Source code in src/femforge/viz/field_lines.py
draw_streamlines
¶
draw_streamlines(actors: StreamlineActors, options: FieldLineOptions, plotter: Plotter) -> None
Draw a precomputed StreamlineActors into plotter without clearing or showing it, so it composes inside a Scene.
Parameters:
-
actors(StreamlineActors) –The integrated lines; an empty set removes any lines drawn before.
-
options(FieldLineOptions) –The field-line options that style them.
-
plotter(Plotter) –The plotter to draw into, on its own thread.
Source code in src/femforge/viz/field_lines.py
render_streamlines
¶
render_streamlines(dataset: DataSet, b_name: str, options: FieldLineOptions | None = None, *, off_screen: bool = False, screenshot: str | Path | None = None, plotter: Plotter | None = None) -> None
One-shot: build streamlines through dataset and draw them, in a plotter of its own when plotter is None.
Parameters:
-
dataset(DataSet) –The dataset carrying B on its points.
-
b_name(str) –The point array the lines follow.
-
options(FieldLineOptions | None, default:None) –The field-line options; None takes the defaults.
-
off_screen(bool, default:False) –Render without a window.
-
screenshot(str | Path | None, default:None) –The PNG to write when rendering off screen.
-
plotter(Plotter | None, default:None) –A live plotter to add the lines to instead of opening one.
Source code in src/femforge/viz/field_lines.py
render_field_lines
¶
render_field_lines(vtu_path: str | Path, options: FieldLineOptions | None = None, *, off_screen: bool = False, screenshot: str | Path | None = None, plotter: Plotter | None = None) -> None
Render the magnetic flux-density field lines from a solved case.vtu, headless to a PNG or in an interactive window.
Parameters:
-
vtu_path(str | Path) –The solved
case.vtu. -
options(FieldLineOptions | None, default:None) –The field-line options; None takes the defaults.
-
off_screen(bool, default:False) –Render without a window.
-
screenshot(str | Path | None, default:None) –The PNG to write when rendering off screen.
-
plotter(Plotter | None, default:None) –A live plotter to add the lines to instead of opening one.
Source code in src/femforge/viz/field_lines.py
field_infos
¶
field_infos(point_arrays: Mapping[str, AnyArray], cell_arrays: Mapping[str, AnyArray], physics: Physics | None = None) -> list[FieldInfo]
Every displayable array of a VTU as a FieldInfo, sorted by display name; GeometryIds and tensors are left out.
Parameters:
-
point_arrays(Mapping[str, AnyArray]) –The VTU's point arrays by name.
-
cell_arrays(Mapping[str, AnyArray]) –The VTU's cell arrays by name.
-
physics(Physics | None, default:None) –The physics the run solved, which names the unit of its potential; None leaves it unitless.
Source code in src/femforge/viz/field_display.py
line_vectors
¶
The vector field the field lines follow: the shown one when it is a vector, else the flux density, else the first vector field; None for a run with none.
Parameters:
-
fields(Sequence[FieldInfo]) –The run's displayable fields, in picker order.
-
shown(str) –The name of the array the display colors by.
Source code in src/femforge/viz/field_display.py
default_display
¶
default_display(run: Run) -> DisplaySpec
The display a run opens on: its stack's primary field, on the component its loads share, with field lines and opacity mapping for a flux or current.
Source code in src/femforge/viz/field_display.py
reduce_field
¶
reduce_field(values: AnyArray, mode: DisplayMode) -> FloatArray
The scalar a display mode draws from one field array.
VALUE passes the array through, POLAR_XY returns the XY magnitude (the quantity that sets the color range; the angle rides along as hue) and a principal mode picks from each row sorted.
Source code in src/femforge/viz/field_display.py
polar_angle
¶
Each vector's XY direction as a cyclic coordinate in [0, 1] — atan2(y, x) mapped off [-pi, pi].
Source code in src/femforge/viz/field_display.py
polar_rgba
¶
Per-vector RGBA for DisplayMode.POLAR_XY: hue from the XY angle through a cyclic cmap, brightness and alpha from the sigmoid-scaled XY magnitude.
Parameters:
-
values(AnyArray) –The
(N, 3)vectors. -
lo(float) –The XY magnitude at the dark end.
-
hi(float) –The XY magnitude at the bright end.
-
cmap(Colormapper) –The cyclic colormap the XY angle maps through.
Source code in src/femforge/viz/field_display.py
color_range
¶
color_range(chunks: Iterable[AnyArray], *, log_scale: bool = False, robust: bool = True) -> tuple[float, float]
The (lo, hi) color limits spanning every scalar chunk's own range, from the finite values only; an empty selection gives (0.0, 1.0).
Parameters:
-
chunks(Iterable[AnyArray]) –The scalar arrays, one per body.
-
log_scale(bool, default:False) –Keep only the strictly positive values and start at their 1st percentile.
-
robust(bool, default:True) –Clamp each chunk to its 2-98 percentiles, so a small body keeps its range beside a large one.
Source code in src/femforge/viz/field_display.py
camera_needs_reset
¶
camera_needs_reset(position: Sequence[float], focal: Sequence[float], bounds: Sequence[float] | None, *, half_angle_deg: float = 30.0) -> bool
Whether the camera has lost the model, with the box behind it or outside its view cone; a camera inside the box always keeps its view.
Parameters:
-
position(Sequence[float]) –The camera position.
-
focal(Sequence[float]) –The camera's focal point.
-
bounds(Sequence[float] | None) –The model box as
(xmin, xmax, ymin, ymax, zmin, zmax); missing or non-finite bounds always re-frame. -
half_angle_deg(float, default:30.0) –The half angle of the view cone some box corner must fall inside, in degrees.
Source code in src/femforge/viz/field_display.py
list_fields
¶
Every displayable field of a VTU grid (GeometryIds excluded), sorted by display name, with the units physics decides.
Source code in src/femforge/viz/field_display.py
split_by_body
¶
split_by_body(grid: UnstructuredGrid, bodies: Bodies) -> MultiBlock
The grid split into one block per named body, keyed by its entities.json name via the GeometryIds cell array.
Source code in src/femforge/viz/field_display.py
feature_outline
¶
feature_outline(blocks: MultiBlock, feature_angle: float = FEATURE_ANGLE) -> PolyData | None
The feature and boundary edges of a multiblock's outer surface — the black wireframe drawn over the field, the body outlines on a 2D slice — or None when the surface has none.
Source code in src/femforge/viz/field_display.py
model_dim_of
¶
model_dim_of(grid: DataSet) -> int
2 for a flat (axisymmetric slice) grid with no Z extent, else 3.
Source code in src/femforge/viz/field_display.py
sample_colormap
¶
count evenly-spaced RGBA rows from a named colormap, resolved through pyvista's get_cmap_safe.
Source code in src/femforge/viz/field_display.py
extrude
¶
The closed surface of a Cartesian section extruded along the solve Z through depth, centred on the section plane.
Parameters:
-
dataset(DataSet) –The section in the solve frame; line and vertex cells are dropped.
-
depth(float) –t[m]: The extrusion depth. -
still(frozenset[str], default:frozenset()) –The array names copied as they are; an extrusion turns no vector, so it changes nothing.
Source code in src/femforge/viz/symmetry.py
mirror
¶
Both halves of an axisymmetric section in the solve frame: its triangles and quads beside their reflection across the axis; line and vertex cells are dropped.
Parameters:
-
dataset(DataSet) –The section in the solve frame.
-
still(frozenset[str], default:frozenset()) –The array names copied unturned, such as principal values.
Source code in src/femforge/viz/symmetry.py
revolve
¶
revolve(dataset: DataSet, basis: Basis, *, segments: int = 72, sweep: float = 360.0, still: frozenset[str] = frozenset()) -> PolyData
The surfaces of an axisymmetric section swept about its axis into the authored frame, capped on a partial sweep.
Parameters:
-
dataset(DataSet) –The section in the solve frame; line and vertex cells are dropped.
-
basis(Basis) –Where the section sits in the authored frame.
-
segments(int, default:72) –The ring count per full turn.
-
sweep(float, default:360.0) –The swept angle in degrees, in
(0, 360]. -
still(frozenset[str], default:frozenset()) –The array names copied unturned, such as principal values.
Source code in src/femforge/viz/symmetry.py
swept_lines
¶
swept_lines(points: FloatArray, lines: IntArray, basis: Basis, *, segments: int = 72, sweep: float = 360.0) -> Surface
The quads a section's line cells sweep sweep degrees about the axis, segments steps per turn, uncapped.
Parameters:
-
points(FloatArray) –The
(N, 3)section points, X = r and Y = z. -
lines(IntArray) –The
(E, 2)point ids of each line cell. -
basis(Basis) –Where the section sits in the authored frame.
-
segments(int, default:72) –The ring count per full turn.
-
sweep(float, default:360.0) –The swept angle in degrees, in
(0, 360].
Source code in src/femforge/viz/symmetry.py
glyph_label
¶
glyph_label(condition: ConditionUnion, *, revolved: bool, dropped: Sequence[str] = ()) -> str | None
The short scene label of condition, magnitudes only since the shape shows the direction; None for a condition the shape says enough about.
Parameters:
-
condition(ConditionUnion) –The authored condition.
-
revolved(bool) –Whether the run solves a revolved section, whose loads are totals over the turn.
-
dropped(Sequence[str], default:()) –The authored fields the frame has no solve coordinate for.
Source code in src/femforge/viz/glyphs.py
glyphs_of
¶
glyphs_of(conditions: ConditionsFile, bodies: Sequence[Body], boundaries: Sequence[Boundary], frame: Frame) -> list[Glyph]
The glyphs of every drawable condition a run's groups received, joined to their measured centroids and normals.
Parameters:
-
conditions(ConditionsFile) –What each group received from the sif.
-
bodies(Sequence[Body]) –The run's bodies, which carry the centroids and bounding boxes.
-
boundaries(Sequence[Boundary]) –The run's boundaries, which carry the centroids and outward normals.
-
frame(Frame) –The frame the run solved in.
Source code in src/femforge/viz/glyphs.py
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 | |
glyph_actors
¶
glyph_actors(glyphs: Sequence[Glyph], cells: Mapping[str, DataSet], placement: GlyphPlacement, view: GlyphView) -> list[GlyphDraw]
The merged glyph actors of the shown glyphs, at most one per GLYPH_ACTORS name.
Parameters:
-
glyphs(Sequence[Glyph]) –The run's glyphs, anchors already moved with the warp.
-
cells(Mapping[str, DataSet]) –The solve-frame cells of each glyph's group by entity id, already displaced with the warp.
-
placement(GlyphPlacement) –How the solve frame lands in the displayed scene.
-
view(GlyphView) –Which glyphs to draw, and how large.
Source code in src/femforge/viz/glyphs.py
968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 | |
plain_spec
¶
plain_spec(spec: DisplaySpec, bodies: Iterable[str]) -> DisplaySpec
spec with every one of bodies painted PLAIN_BODY, its own opacity kept.