AssemblySection
AssemblySection
AssemblySection(meshpart_manager, meshparts: List[str], num_partitions: int = 1, partition_algorithm: str = 'kd-tree', partitioner: Optional[str] = None, merge_points: bool = True, merge_in_final: bool = True, progress_callback=None, mass_merging: str = 'sum', tolerance: float = 1e-05)
A class representing a group of mesh parts combined into a single mesh.
The AssemblySection class takes multiple mesh parts, combines them into a single
mesh, and optionally partitions the mesh for parallel computing. Section
registration with the assembler is performed by Assembler.create_section(...),
which assigns a unique tag for identification.
This class is responsible for: - Validating mesh parts before assembly - Merging mesh parts with appropriate metadata - Managing degrees of freedom consistency - Partitioning the mesh for parallel processing - Storing references to elements and materials
Attributes:
| Name | Type | Description |
|---|---|---|
meshparts_list |
List[MeshPart]
|
List of MeshPart objects in this section |
num_partitions |
int
|
Number of partitions for parallel processing |
partition_algorithm |
str
|
Algorithm used for partitioning the mesh |
merge_points |
bool
|
Whether points are merged during assembly |
mesh |
UnstructuredGrid
|
The assembled mesh |
elements |
List[Element]
|
Elements used in this assembly section |
materials |
List[Material]
|
Materials used in this assembly section |
actor |
PyVista actor for visualization |
|
tag |
int
|
Unique tag assigned by the Assembler |
Initialize an AssemblySection by combining multiple mesh parts.
This constructor takes a list of mesh part names, validates them, combines them
into a single mesh, and optionally partitions the result. Registration with
the assembler happens in Assembler.create_section(...).
If the partition algorithm is "kd-tree" and num_partitions is not a power of 2, it will be automatically rounded up to the next power of 2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
meshparts
|
List[str]
|
List of mesh part names to be assembled. These must be names of previously created MeshPart instances. |
required |
num_partitions
|
int
|
Number of partitions for parallel processing. For kd-tree, will be rounded to next power of 2. Defaults to 1 (no partitioning). |
1
|
partition_algorithm
|
str
|
Backward-compatible name for the mesh partitioner.
Prefer using |
'kd-tree'
|
partitioner
|
str
|
Mesh partitioner name (Femora terminology), e.g. "kd-tree",
"morton", "geometric".
If provided, it overrides |
None
|
mass_merging
|
str
|
Method for merging mass properties of mesh parts. Options are "sum" or "average". Defaults to "sum". |
'sum'
|
merge_points
|
bool
|
Whether to merge points that are within a tolerance distance when assembling mesh parts. Defaults to True. |
True
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If no valid mesh parts are provided, if the partition algorithm is invalid, or if mesh assembly fails |
Methods:
| Name | Description |
|---|---|
plot |
Plot the assembled mesh using PyVista. |
Attributes
tag
property
Get the unique tag for this AssemblySection.
The tag is a unique identifier assigned by the assembler when the section
is registered through Assembler.create_section(...). It can be used to
retrieve the section from the assembler later.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Unique tag assigned by the Assembler |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the section hasn't been successfully added to the Assembler |
meshparts
property
Get the names of mesh parts in this AssemblySection.
This property returns a list of the user-friendly names of all mesh parts included in this assembly section. These are the names that were originally provided when creating the mesh parts.
Returns:
| Type | Description |
|---|---|
List[str]
|
List[str]: Names of mesh parts included in this assembly section |
Methods:
plot
Plot the assembled mesh using PyVista.
This method visualizes the assembled mesh for the assembly section. It uses the PyVista plotting capabilities to render the mesh with optional parameters for customization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
off_screen
|
bool
|
Render off-screen. |
False
|
screenshot
|
str
|
File path to save the screenshot. |
None
|
**kwargs
|
Any
|
Additional keyword arguments to customize the plot (e.g., color, opacity) |
{}
|