Skip to content

PatternManager

PatternManager

PatternManager(mesh_maker: Model, time_series_manager: 'TimeSeriesManager | None' = None, ground_motion_manager: 'GroundMotionManager | None' = None)

Local manager for Pattern lifecycle and tag assignment.

The manager is intentionally not a singleton. Each instance owns an independent pattern tag space for one model context.

Use model.pattern to register a loading definition, then add the pattern to model.process at the point where it should become active in Tcl. Registration alone does not schedule activation. Time-series and imposed motion dependencies must belong to this Model.

Example
from femora import Model

model = Model()
series = model.time_series.constant()
gravity = model.pattern.plain(series)
gravity.add_load.node(node_tag=1, values=[0.0, 0.0, -10.0])
model.process.add_step(gravity, "Apply gravity")
assert model.pattern.get(gravity.tag) is gravity

This defines loading only, not a stable/solvable domain. Uniform excitation, imposed support motions, and DRM have different physical conventions; do not interchange their recorded acceleration interpretations. Consult each concrete pattern and recorder before adding ground motion in postprocessing.

Removing/clearing a pattern edits Python registration, not the active solver. Use an appropriate process action for solver-side load-pattern removal.

Create an empty manager with pattern tags starting at 1.

Methods:

Name Description
plain

Create and manage a PlainPattern.

uniform_excitation

Create and manage a UniformExcitation pattern.

multiple_support

Create and manage a MultipleSupportPattern.

h5drm

Create and manage an H5DRMPattern.

add

Add an existing pattern and assign a tag if needed.

get

Return the pattern with tag if it exists.

get_all

Return a shallow copy of all managed patterns keyed by tag.

remove

Remove a managed pattern and compact the remaining tags.

clear

Remove all patterns and clear their assigned tags.

set_tag_start

Set the first tag used by this manager and retag existing patterns.

Methods:

plain

plain(time_series: TimeSeries, factor: float = 1.0) -> PlainPattern

Create and manage a PlainPattern.

Parameters:

Name Type Description Default
time_series TimeSeries

Managed TimeSeries referenced by the pattern.

required
factor float

Optional scale factor for all loads in the pattern.

1.0

Returns:

Type Description
PlainPattern

Managed PlainPattern instance.

uniform_excitation

uniform_excitation(dof: int, time_series: TimeSeries, vel0: float = 0.0, factor: float = 1.0) -> UniformExcitation

Create and manage a UniformExcitation pattern.

Parameters:

Name Type Description Default
dof int

1-based DOF direction for the uniform excitation.

required
time_series TimeSeries

Managed acceleration TimeSeries.

required
vel0 float

Initial velocity.

0.0
factor float

Scale factor applied to the time series.

1.0

Returns:

Type Description
UniformExcitation

Managed UniformExcitation instance.

multiple_support

multiple_support() -> MultipleSupportPattern

Create and manage a MultipleSupportPattern.

Returns:

Type Description
MultipleSupportPattern

Managed empty MultipleSupportPattern instance.

h5drm

h5drm(filepath: str, factor: float, crd_scale: float, distance_tolerance: float, do_coordinate_transformation: int, transform_matrix: Optional[Sequence[float]] = None, origin: Optional[Sequence[float]] = None, *, T00: float | None = None, T01: float | None = None, T02: float | None = None, T10: float | None = None, T11: float | None = None, T12: float | None = None, T20: float | None = None, T21: float | None = None, T22: float | None = None, x00: float | None = None, x01: float | None = None, x02: float | None = None) -> H5DRMPattern

Create and manage an H5DRMPattern.

Parameters:

Name Type Description Default
filepath str

Path to the H5DRM dataset file.

required
factor float

Scale factor for DRM forces and displacements.

required
crd_scale float

Coordinate scale factor for the DRM dataset.

required
distance_tolerance float

Node matching tolerance.

required
do_coordinate_transformation int

0 or 1 flag for coordinate transformation.

required
transform_matrix Optional[Sequence[float]]

Optional 9-value transformation matrix. If not provided, use the named T00 through T22 parameters.

None
origin Optional[Sequence[float]]

Optional 3-value transformed origin. If not provided, use the named x00 through x02 parameters.

None
T00 float | None

Compatibility matrix entry, row 0 column 0.

None
T01 float | None

Compatibility matrix entry, row 0 column 1.

None
T02 float | None

Compatibility matrix entry, row 0 column 2.

None
T10 float | None

Compatibility matrix entry, row 1 column 0.

None
T11 float | None

Compatibility matrix entry, row 1 column 1.

None
T12 float | None

Compatibility matrix entry, row 1 column 2.

None
T20 float | None

Compatibility matrix entry, row 2 column 0.

None
T21 float | None

Compatibility matrix entry, row 2 column 1.

None
T22 float | None

Compatibility matrix entry, row 2 column 2.

None
x00 float | None

Compatibility transformed-origin x coordinate.

None
x01 float | None

Compatibility transformed-origin y coordinate.

None
x02 float | None

Compatibility transformed-origin z coordinate.

None

Returns:

Type Description
H5DRMPattern

Managed H5DRMPattern instance.

add

add(pattern: Pattern) -> Pattern

Add an existing pattern and assign a tag if needed.

Parameters:

Name Type Description Default
pattern Pattern

Unmanaged or already-managed Pattern instance.

required

Returns:

Type Description
Pattern

The same pattern instance after it is stored by this manager.

Raises:

Type Description
TypeError

If pattern is not a Pattern instance.

ValueError

If its preassigned tag conflicts with a different object already managed here.

get

get(tag: int) -> Optional[Pattern]

Return the pattern with tag if it exists.

Parameters:

Name Type Description Default
tag int

Pattern tag to look up.

required

Returns:

Type Description
Optional[Pattern]

The matching Pattern instance, or None.

get_all

get_all() -> Dict[int, Pattern]

Return a shallow copy of all managed patterns keyed by tag.

remove

remove(tag: int) -> None

Remove a managed pattern and compact the remaining tags.

Parameters:

Name Type Description Default
tag int

Tag of the pattern to remove. Missing tags are ignored.

required

clear

clear() -> None

Remove all patterns and clear their assigned tags.

set_tag_start

set_tag_start(start_tag: int) -> None

Set the first tag used by this manager and retag existing patterns.

Parameters:

Name Type Description Default
start_tag int

Positive integer for the first assigned pattern tag.

required

Raises:

Type Description
ValueError

If start_tag is less than 1.