Skip to content

PatternManager

PatternManager

PatternManager(mesh_maker: Model, time_series_manager=None, ground_motion_manager=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.

Create an empty manager with pattern tags starting at 1.

Attributes

_mesh_maker instance-attribute

_mesh_maker = mesh_maker

_patterns instance-attribute

_patterns: Dict[int, Pattern] = {}

_start_tag instance-attribute

_start_tag = 1

_tagging instance-attribute

_tagging = CompactRetagPolicy[Pattern]()

_time_series_manager instance-attribute

_time_series_manager = time_series_manager

_ground_motion_manager instance-attribute

_ground_motion_manager = ground_motion_manager

Methods:

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.

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.

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, **kwargs) -> 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, T00 through T22 can be supplied in kwargs.

None
origin Optional[Sequence[float]]

Optional 3-value transformed origin. If not provided, x00 through x02 can be supplied in kwargs.

None
**kwargs

Compatibility support for individual matrix/origin values.

{}

Returns:

Type Description
H5DRMPattern

Managed H5DRMPattern instance.

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.

multiple_support

multiple_support() -> MultipleSupportPattern

Create and manage a MultipleSupportPattern.

Returns:

Type Description
MultipleSupportPattern

Managed empty MultipleSupportPattern instance.

_next_available_tag

_next_available_tag() -> int

Return the next unused pattern tag in this manager's tag space.

_reassign_tags

_reassign_tags() -> None

Retag all managed patterns from _start_tag in tag order.

_sync_attached_load_tags

_sync_attached_load_tags(pattern: Pattern) -> None

Keep loads attached to a plain pattern aligned with its current tag.

_validate_dependencies

_validate_dependencies(pattern: Pattern) -> None

Ensure a pattern only references dependencies from the local context.