Skip to content

config

Base model for the concern-grouped configuration of a simulation.

gsim.fdtd, gsim.tcad and gsim.thermal configure a simulation through a few concern objects (geometry, domain, materials, solver, ...). Each is a validated pydantic model that can be set one attribute at a time or several at once by calling it.

A concern can be mutated in place at any time, so a Simulation that keeps a mesh or a solve compares snapshots of its inputs (:func:fingerprint) rather than watching assignments.

Classes:

  • Concern –

    A Simulation attribute that validates whatever replaces it.

  • MutableModel –

    Validated model that supports concise batch updates.

  • NamedModels –

    Insertion-ordered collection of models with a unique name.

  • Same –

    Snapshot of an object compared by identity.

Functions:

  • component_digest –

    The drawn polygons of a component, so an edit in place is seen.

  • fingerprint –

    A comparable snapshot of a configuration value.

Concern

Concern(kind: type[T])

A Simulation attribute that validates whatever replaces it.

A model concern takes a model, a mapping of its fields, or None for its defaults; a collection takes the collection or a list of items.

NamedModels

NamedModels(items: Iterable[T | Mapping[str, Any]] | None = None)

Insertion-ordered collection of models with a unique name.

Methods:

  • clear –

    Remove every item.

  • remove –

    Remove and return one item by name.

clear

clear() -> None

Remove every item.

remove

remove(name: str) -> T

Remove and return one item by name.

Same

Same(value: Any)

Snapshot of an object compared by identity.

Holds the object, so its address cannot be reused by another one that would then compare equal.

component_digest

component_digest(component: Any) -> Any

The drawn polygons of a component, so an edit in place is seen.

fingerprint

fingerprint(value: Any) -> Any

A comparable snapshot of a configuration value.

Models and containers are taken apart, arrays by their bytes; any other object (a function) by identity.