RegionManager
RegionManager
Organize region definitions through model.region.
The manager always includes a global region at tag zero. Mesh parts without an explicit region receive that global region on registration. Non-global regions have unique names and positive tags and can associate damping with selected model components.
Attributes:
| Name | Type | Description |
|---|---|---|
element |
Typed callable factory returning a registered ElementRegion.
Select elements with |
|
node |
Typed callable factory returning a registered NodeRegion.
Select nodes with |
Example
Warning
Parts sharing a region share its damping association. Removing/replacing regions does not repair dependent parts or refresh an assembled mesh.
Methods:
| Name | Description |
|---|---|
add |
Register a region, assigning a name and tag where needed. |
get |
Look up a region by integer tag or exact name, returning None if absent. |
get_all |
Return a shallow registry snapshot, including the global region. |
remove |
Detach a non-global region and retag surviving non-global regions. |
clear |
Detach existing regions and create a new global region at tag zero. |
set_tag_start |
Set the non-global tag origin and retag non-global definitions. |
Attributes
global_region
property
Current global RegionBase object reserved at registry tag zero.
A new object is created by clear(); do not assume a previously held
global-region reference remains registered after that operation.
Methods:
add
Register a region, assigning a name and tag where needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
region
|
RegionBase
|
Concrete region object. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
region |
RegionBase
|
Original registered object. GlobalRegion uses reserved tag zero; other regions use this manager's positive space. |
Raises:
| Type | Description |
|---|---|
TypeError
|
Input is not a RegionBase. |
ValueError
|
Foreign ownership, duplicate name, or tag conflict. |
get
Look up a region by integer tag or exact name, returning None if absent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
identifier
|
int | str
|
Python/NumPy integers are tags. Other values are converted to strings for name lookup; numeric strings are names. |
required |
get_all
Return a shallow registry snapshot, including the global region.
Object values remain shared; editing dictionary membership does not edit the owning manager.
remove
Detach a non-global region and retag surviving non-global regions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
identifier
|
int | str
|
Tag or name; missing entries are ignored. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
Attempt to remove the global region at tag zero. |
Dependent parts and already assembled region arrays are not rewritten.
clear
Detach existing regions and create a new global region at tag zero.
Old region objects are not reused. Parts retaining those objects must be rebuilt/reassigned; this is not a coordinated whole-model clear.
set_tag_start
Set the non-global tag origin and retag non-global definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_tag
|
int
|
Integer-convertible origin of at least one. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
Converted origin is below one or conversion fails. |
TypeError
|
Integer conversion is unsupported. |
The global region remains at zero. Existing integer references can become stale.
model.region.element(...)
Callable exposed as model.region.element; not constructed by users.
Methods:
| Name | Description |
|---|---|
__call__ |
Create an ElementRegion and register it with the owning model. |
Methods:
__call__
__call__(user_name: str | None = None, damping: Damping | None = None, *, elements: list[int] | ndarray | None = None, element_range: list[int] | ndarray | None = None, element_only: bool = False) -> ElementRegion
Create an ElementRegion and register it with the owning model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_name
|
str | None
|
Unique label or None for a generated name. |
None
|
damping
|
Damping | None
|
Optional damping definition retained weakly. |
None
|
elements
|
list[int] | ndarray | None
|
Explicit solver element tags. |
None
|
element_range
|
list[int] | ndarray | None
|
Inclusive start/end solver element tags. |
None
|
element_only
|
bool
|
Restrict the region to its selected elements. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
region |
RegionBase
|
Registered ElementRegion. Component/registry validation errors propagate; no solver command executes here. |
model.region.node(...)
Callable exposed as model.region.node; not constructed by users.
Methods:
| Name | Description |
|---|---|
__call__ |
Create a NodeRegion and register it with the owning model. |
Methods:
__call__
__call__(user_name: str | None = None, damping: Damping | None = None, *, nodes: list[int] | ndarray | None = None, node_range: list[int] | ndarray | None = None, node_only: bool = False) -> NodeRegion
Create a NodeRegion and register it with the owning model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_name
|
str | None
|
Unique label or None for a generated name. |
None
|
damping
|
Damping | None
|
Optional damping definition retained weakly. |
None
|
nodes
|
list[int] | ndarray | None
|
Explicit solver node tags. |
None
|
node_range
|
list[int] | ndarray | None
|
Inclusive start/end solver node tags. |
None
|
node_only
|
bool
|
Restrict the region to its selected nodes. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
region |
RegionBase
|
Registered NodeRegion. Creation does not generate a node group or add new nodes to the model. |