4.1.1.9.1.3. pyfem.util.dataStructures module

cleanVariable(a: Any) Any[source]

Convert a textual configuration value into a Python object.

  • ‘true’ -> True

  • ‘false’ -> False

  • otherwise: try eval, fall back to original string

Parameters:

a – Input value (typically a string) read from configuration.

Returns:

Parsed Python object or the original value if parsing fails.

class solverStatus[source]

Bases: object

Container for tracking solver progress and timing.

cycle

Current step/cycle number.

Type:

int

iiter

Current iteration count within step.

Type:

int

time

Current simulation time.

Type:

float

time0

Reference time (unused internally here).

Type:

float

dtime

Time increment for a cycle.

Type:

float

lam

Load or continuation parameter.

Type:

float

increaseStep() None[source]

Advance to the next solver step and reset iteration counter.

class Properties(dictionary: Dict[str, Any] = {})[source]

Bases: object

Simple attribute container built from a dictionary.

Instances expose dictionary keys as attributes and support iteration over (name, value) pairs. This is a lightweight alternative to types.SimpleNamespace.

store(key: str, val: Any) None[source]

Store a property given a dotted key path or a simple key.

Examples

store(‘alpha’, 1) store(‘parent.child.value’, ‘x’)

class GlobalData(nodes: Any, elements: Any, dofs: Any)[source]

Bases: Properties

Global data container for finite element analysis.

This class holds the global state vectors, forces, boundary conditions, and manages I/O operations for nodal data. It inherits from Properties to provide flexible attribute storage.

nodes

Node container with coordinates and connectivity.

elements

Element container with element definitions.

dofs

Degree of freedom manager.

state

Current state vector (displacements, temperatures, etc.).

Dstate

Incremental state vector.

fint

Internal force vector.

fhat

Applied external force vector.

velo

Velocity vector (for dynamic analysis).

acce

Acceleration vector (for dynamic analysis).

solverStatus

Solver status tracker.

outputNames

List of output variable names.

readFromFile(fname: str) None[source]

Read external forces from an input file.

Parses the <ExternalForces> section of the input file and populates the fhat vector with prescribed external forces.

Parameters:

fname – Path to the input file containing external forces.

Returns:

None

Note

Expected format in file: <ExternalForces> dofType[nodeID] = value; </ExternalForces>

printNodes(fileName: str | None = None, inodes: List[int] | None = None) None[source]

Print nodal data to file or screen.

Outputs a formatted table containing nodal state values, internal forces, and any additional output variables.

Parameters:
  • fileName – Path to output file. If None, prints to screen.

  • inodes – List of node IDs to print. If None, prints all nodes.

Returns:

None

getData(outputName: str, inodes: Any) Any[source]

Retrieve weighted output data for specified nodes.

Computes weighted average of output data for nodes. The weights are typically used to average data from multiple elements sharing a node.

Parameters:
  • outputName – Name of the output variable to retrieve.

  • inodes – Node ID (int) or list of node IDs to retrieve data for.

Returns:

Weighted output value(s). Returns float for single node, list of values for multiple nodes.

resetNodalOutput() None[source]

Clear all nodal output data and weights.

Removes all output variables and their corresponding weights from the global data structure. Called at the start of each analysis step.

Returns:

None

close() None[source]

Finalize analysis and print execution summary.

Prints the total elapsed time and a success message to the log. Called at the end of a successful analysis.

Returns:

None

class elementData(elstate: ndarray, elDstate: ndarray)[source]

Bases: object

Container for element-level state and computed quantities.

This class stores element state vectors, element matrices (stiffness, mass), element force vectors, and output labels for post-processing.

state

Element state vector (displacements, etc.).

Dstate

Element incremental state vector.

stiff

Element tangent stiffness matrix.

fint

Element internal force vector.

mass

Element mass matrix.

lumped

Element lumped mass vector.

diss

Element dissipation (energy dissipated).

outlabel

List of output variable labels for this element.