Skip to content

Implementation

Module: xfea.viewers.viewer

Viewer(plugin: str | None = None, settings: ViewerSettings | None = None)

Viewer for rendering models and results.

Parameters

Name Type Description
plugin str, optional Registered viewer plugin name used to instantiate the backend. If omitted, the registry default is used.
settings ViewerSettings, optional Visual settings passed to the plugin for scene building.
Methods
add_model(model)

No docstring available.

add_results(results, units=None)
add_results(results, units: str | None = None)

Add result fields to visualise.

Can be called multiple times to accumulate fields — each call appends rather than replacing. results may be a dict of {field: component} or a single (field, component) tuple.

Parameters

Name Type Description
results dict or tuple {field: component} mapping, e.g. {temp: "T"}.
units str, optional Unit string applied to all fields added in this call.
clear()

No docstring available.

clear_items()

No docstring available.

render(step=None, load_fields=None, results_fields=None, results_units=None)
render(
    step=None,
    load_fields=None,
    results_fields=None,
    results_units: str | None = None,
)

No docstring available.

run(**kwargs)

No docstring available.

Module: xfea.viewers.base

ViewerBase(*args, **kwargs)

Adapter interface for viewer plugins.

Methods
build_scene(ctx)

Populate the scene context before rendering.

clear()

Clear the viewer scene.

render(scene, **kwargs)

Render a scene in the backend viewer.

show()

Show the viewer window.

Module: xfea.viewers.context

SceneContext(
    scene: Scene = <factory>,
    settings: ViewerSettings = <factory>,
    model: object | None = None,
    step: object | None = None,
    load_fields: Iterable | None = None,
    results_fields: dict | None = None,
    results_units: str | None = None,
)

SceneContext(scene: xfea.viewers.scene.scene.Scene = <factory>, settings: xfea.viewers.scene.settings.ViewerSettings = <factory>, model: Optional[object] = None, step: Optional[object] = None, load_fields: Optional[Iterable] = None, results_fields: Optional[dict] = None, results_units: Optional[str] = None)

Module: xfea.viewers.registry

get_default_viewer()

Return the default viewer name, if set.

get_viewer(name)

Return the viewer class for a given name.

list_viewers()

List registered viewer names.

load_entry_points()

Load viewer plugins from entry points.

register_viewer(name, cls)

Register a viewer class under a name.

set_viewer(name)

Set the default viewer name used by Viewer.

viewer(name)

Decorator to register a viewer class.

© 2026 Francesco Ranaudo · Text and pictures CC BY 4.0 · Code Elastic License 2.0 · how to reuse them