MaterialManager
MaterialManager
Local manager for Material lifecycle and tag assignment.
The manager is intentionally not a singleton. Each :class:Model
instance owns one MaterialManager with an independent tag space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh_maker
|
Model
|
The :class: |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If mesh_maker is not a :class: |
Attributes:
| Name | Type | Description |
|---|---|---|
nd |
NDMaterialManager
|
Factories available through |
uniaxial |
UniaxialMaterialManager
|
Factories through
|
Example
Warning
Removal and start-tag changes can retag surviving objects. Do not treat a cached integer tag as a persistent identifier across edits. Use object references or unique names while constructing the model.
Methods:
| Name | Description |
|---|---|
add |
Add an existing material and assign a tag if needed. |
get |
Look up a material by its current manager-assigned tag. |
get_by_name |
Look up a registered material by its exact user name. |
get_all |
Return a shallow registry snapshot keyed by current integer tag. |
remove |
Remove a managed material and compact the remaining tags. |
clear |
Detach every material, clear its tag, and empty both lookup indices. |
set_tag_start |
Set the first tag used by this manager and retag existing objects. |
Methods:
add
Add an existing material and assign a tag if needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material
|
Material
|
Unmanaged or already-managed :class: |
required |
Returns:
| Type | Description |
|---|---|
Material
|
The same |
Raises:
| Type | Description |
|---|---|
TypeError
|
If material is not a :class: |
ValueError
|
If its preassigned tag conflicts with a different object already managed here, or if it already belongs to another manager. |
get
Look up a material by its current manager-assigned tag.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tag
|
int
|
Tag, converted with |
required |
Returns:
| Type | Description |
|---|---|
Optional[Material]
|
Material | None: Registered object, or None if the tag is absent. |
Raises:
| Type | Description |
|---|---|
TypeError
|
The supplied value cannot be converted to an integer. |
ValueError
|
Integer conversion fails for the supplied value. |
get_by_name
Look up a registered material by its exact user name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Case-sensitive registered |
required |
Returns:
| Type | Description |
|---|---|
Optional[Material]
|
Material | None: Matching object or None. No material is created. |
get_all
remove
Remove a managed material and compact the remaining tags.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tag
|
int
|
Tag of the material to remove. Missing tags are ignored. |
required |
clear
Detach every material, clear its tag, and empty both lookup indices.
This does not remove elements or sections referring to those objects, clear the whole Model, or execute an OpenSees command. Detached objects must be registered again before rendering tag-dependent definitions.