Skip to content

ProcessManager

ProcessManager

ProcessManager(mesh_maker: 'Model')

Order solver operations through model.process before Tcl export.

Steps can contain constraints, patterns, recorders, analyses, or actions. Adding a step schedules its Tcl emission; it does not run an analysis. Unlike a Jobs Workflow, this sequence lives inside one solver script.

Actions are held directly. Other supported objects are weakly referenced and must remain alive, normally through their owning model manager.

Example
from femora import Model

model = Model()
index = model.process.add_step(model.actions.set_time(0.0), "Start clock")
assert index == 0
assert "setTime" in model.process.to_tcl()

Methods:

Name Description
add_step

Append an operation, or append each operation in a list in order.

insert_step

Insert an operation or ordered list at a step position.

remove_step

Remove a step without deleting its component from its owning manager.

get_steps

Return the live step list, not a detached snapshot.

get_step

Look up the live record for a nonnegative zero-based index.

clear

Empty the sequence and reset its current-step index to -1.

to_tcl

Render all steps, in order, with their description comments.

Methods:

add_step

add_step(component: Union[ProcessComponent, List[ProcessComponent]], description: str = '') -> int

Append an operation, or append each operation in a list in order.

Parameters:

Name Type Description Default
component Union[ProcessComponent, List[ProcessComponent]]

Supported process object or list of such objects.

required
description str

Comment written before each operation's Tcl.

''

Returns:

Name Type Description
int int

Zero-based index of the final appended step; -1 for an empty list.

Raises:

Type Description
TypeError

An object is not a supported process component. Earlier items in a list may already have been appended when this occurs.

insert_step

insert_step(index: int, component: Union[ProcessComponent, List[ProcessComponent]], description: str = '') -> bool

Insert an operation or ordered list at a step position.

Parameters:

Name Type Description Default
index int

Insertion position; negative positions are adjusted by len(steps) + 1, so -1 appends.

required
component Union[ProcessComponent, List[ProcessComponent]]

Supported process object or list of objects.

required
description str

Comment applied to each inserted operation.

''

Returns:

Name Type Description
bool bool

Whether insertion succeeded. An out-of-range position returns

bool

False. List insertion is not transactional.

Raises:

Type Description
TypeError

A component is unsupported at a valid insertion position.

remove_step

remove_step(index: int) -> bool

Remove a step without deleting its component from its owning manager.

Parameters:

Name Type Description Default
index int

Nonnegative zero-based step index.

required

Returns:

Name Type Description
bool bool

True when removed, False for an invalid or negative index.

get_steps

get_steps() -> List[Dict]

Return the live step list, not a detached snapshot.

Returns:

Type Description
List[Dict]

list[dict]: Entries with component and description keys.

List[Dict]

Non-action components are stored as weak references. Prefer the

List[Dict]

insertion/removal methods over direct mutation of this list.

get_step

get_step(index: int) -> Optional[Dict]

Look up the live record for a nonnegative zero-based index.

Parameters:

Name Type Description Default
index int

Step position; negative indices are not supported.

required

Returns:

Type Description
Optional[Dict]

dict | None: Stored record, or None when out of range. Component

Optional[Dict]

values follow the same reference convention as get_steps().

clear

clear() -> None

Empty the sequence and reset its current-step index to -1.

Model components and output files are not deleted. This does not send wipe or any other command to a running solver.

to_tcl

to_tcl() -> str

Render all steps, in order, with their description comments.

Returns:

Name Type Description
str str

Combined Tcl, or an empty string for an empty process.

Note

Referenced components must still exist. This method neither runs the Tcl nor validates solver convergence or command compatibility.