4.1.1.1.1.1. pyfem.core.api module

High-level API for programmatic control of a PyFEM analysis.

This module provides the PyFEMAPI class which encapsulates the complete calculation machinery (input reader, solver, output manager) and exposes a step-wise interface so callers can advance the analysis one step at a time or drive the entire run to completion.

Usage:

api = PyFEMAPI(‘mycase.pro’) while api.is_active:

api.step()

results = api.get_results()

class PyFEMAPI(props: str | Path | Tuple[Any, Any])[source]

Bases: object

Programmatic API to run PyFEM analyses step-by-step.

The class can be constructed with either:
  • a path to a .pro file (string or Path), OR

  • a pre-built (props, globdat) tuple returned by InputRead.

step()[source]

advance one solver/output cycle

run_all()

run until globdat.active becomes False

is_active()

boolean property exposing globdat.active

get_results()

return a light-weight results dict (placeholder)

close()[source]

finalize and free resources

property isActive: bool
step(nCyc: int = 1) None[source]

Perform a single solver step (by default) followed by output processing .

runAll() None[source]

Run steps until the analysis completes.

getResults() Any[source]

Return a lightweight results container.

This is a small convenience wrapper; consumers can directly inspect self.globdat for detailed state if needed.

close() None[source]

Finalize the analysis and close global data resources.

run(props: str | Path | Tuple[Any, Any]) Any[source]

Convenience function mirroring the old run behavior used in scripts.

Creates a PyFEMAPI instance, runs the analysis to completion and returns the results dictionary.