Structure Gene#
- class sgio.StructureGene(name: str = '', sgdim: int | None = None, smdim: int | None = None, spdim: int | None = None)#
Bases:
objectA finite element level structure gene model in the theory of MSG.
- name#
Name of the SG.
- Type:
str
- sgdim#
Dimension of the SG.
- Type:
int or None
- smdim#
Dimension of the material/structural model.
- Type:
int or None
- spdim#
Dimension of the space containing SG.
- Type:
int or None
- analysis_config#
Analysis configuration object.
- Type:
- analysis#
Analysis configurations (legacy proxy to
analysis_config.analysis). * 0 - homogenization (default) * 1 - dehomogenization/localization/recover * 2 - failure (SwiftComp only)- Type:
int
- fn_gmsh_msh#
File name of the Gmsh mesh file.
- Type:
str
- physics#
Physics included in the analysis (legacy proxy to
analysis_config.physics). * 0 - elastic (default) * 1 - thermoelastic * 2 - conduction * 3 - piezoelectric/piezomagnetic * 4 - thermopiezoelectric/thermopiezomagnetic * 5 - piezoelectromagnetic * 6 - thermopiezoelectromagnetic- Type:
int
- model#
Macroscopic structural model (legacy proxy to
analysis_config.model). * 0 - classical (default) * 1 - refined (e.g., generalized Timoshenko) * 2 - Vlasov model (beam only) * 3 - trapeze effect (beam only)- Type:
int
- geo_correct#
Flag of geometrically corrected shell model (legacy proxy to
analysis_config.geo_correct).- Type:
bool
- do_damping#
Flag of damping computation (legacy proxy to
analysis_config.do_damping).- Type:
int
- is_temp_nonuniform#
Flag of uniform temperature (legacy proxy to
analysis_config.is_temp_nonuniform).- Type:
int
- force_flag#
Force flag (legacy proxy to
analysis_config.force_flag).- Type:
int
- steer_flag#
Steer flag (legacy proxy to
analysis_config.steer_flag).- Type:
int
- initial_twist#
Initial twist (beam only).
- Type:
float
- initial_curvature#
Initial curvature.
- Type:
list of float
- oblique#
Oblique (beam only).
- Type:
list of float
- lame_params#
Lame parameters for geometrically corrected shell model.
- Type:
list of float
- materials#
Dictionary of materials indexed by material name.
- Type:
dict[str, MaterialModel]
- mocombos#
Backward-compatible mapping view derived from
sections. Maps property_id to (material_name, orientation_angle).- Type:
dict[int, tuple[str, float]]
- ndim_degen_elem#
Number of degenerate elements.
- Type:
int
- num_slavenodes#
Number of slave nodes.
- Type:
int
- omega#
Omega (see SwiftComp manual).
- Type:
float
- itf_pairs#
Interface pairs.
- Type:
list
- itf_nodes#
Interface nodes.
- Type:
list
- node_elements#
Node elements.
- Type:
list
- add_material(material: Any, name: str | None = None) str#
Add a material to the structure gene.
- Parameters:
material (MaterialModel) – Material object to add.
name (str, optional) – Material name. If not provided, uses material.name attribute.
- Returns:
Material name used as key.
- Return type:
str
- Raises:
ValueError – If material name is empty or None.
- add_section(name: str, material: str, orientation: float = 0.0, property_id: int | None = None, extras: Mapping[str, Any] | None = None) Section#
Add a FE section to the structure gene.
- Parameters:
name (str) – Section name.
material (str) – Referenced material name.
orientation (float, optional) – In-plane orientation angle in degrees.
property_id (int or None, optional) – Property/layer identifier. If omitted, the next available one is assigned.
extras (mapping, optional) – Extra adapter-specific metadata.
- Returns:
Newly created section object.
- Return type:
- copy() StructureGene#
Create a deep copy of the StructureGene.
- Returns:
Deep copy of the current instance.
- Return type:
- find_combo_by_material_orientation(name: str, angle: float) int | None#
Find material-orientation combination by material name and angle.
- Parameters:
name (str) – Material name.
angle (float) – Orientation angle.
- Returns:
Property/combo id if found, None otherwise.
- Return type:
int or None
- find_material_by_name(name: str) str | None#
Find material by name (returns material name if exists).
- Parameters:
name (str) – Material name.
- Returns:
Material name if found, None otherwise.
- Return type:
str or None
Notes
This method is kept for API compatibility. For direct access, use get_material(name) or check name in sg.materials.
- get_material(name: str) Any | None#
Get material by name.
- Parameters:
name (str) – Material name.
- Returns:
Material object if found, None otherwise.
- Return type:
MaterialModel or None
- get_section_by_property_id(property_id: int) Section | None#
Get a section by property/layer identifier.
- translate(v: ndarray | list) None#
Translate the mesh.
- Parameters:
v (array_like) – Translation vector.
- Raises:
ValueError – If mesh is not defined.
- property analysis: int#
Legacy proxy for
analysis_config.analysis.
- property do_damping: int#
Legacy proxy for
analysis_config.do_damping.
- property extras: dict[str, Any]#
Additional FE-level metadata.
- property force_flag: int#
Legacy proxy for
analysis_config.force_flag.
- property geo_correct: bool#
Legacy proxy for
analysis_config.geo_correct.
- property is_temp_nonuniform: int#
Legacy proxy for
analysis_config.is_temp_nonuniform.
- property materials: dict[str, Any]#
Materials indexed by material name.
- property mocombos: MutableMapping[int, tuple[str, float]]#
Legacy material-orientation combinations derived from sections.
- property model: int#
Legacy proxy for
analysis_config.model.
- property name: str#
Name of the structure gene.
- property nelems: int#
Number of elements in the mesh.
- Returns:
Number of elements.
- Return type:
int
- Raises:
ValueError – If mesh is not defined.
- property nma_combs: int#
Number of material-orientation combinations.
- Returns:
Number of material-orientation combinations.
- Return type:
int
- property nmates: int#
Number of materials.
- Returns:
Number of materials.
- Return type:
int
- property nnodes: int#
Number of nodes in the mesh.
- Returns:
Number of nodes.
- Return type:
int
- Raises:
ValueError – If mesh is not defined.
- property orientations: dict[str, Any]#
Placeholder FE orientations.
- property physics: int#
Legacy proxy for
analysis_config.physics.
- property steer_flag: int#
Legacy proxy for
analysis_config.steer_flag.
- property use_elem_local_orient: int#
Flag of using element local orientation.
- Returns:
1 if using element local orientation, 0 otherwise.
- Return type:
int
- Raises:
ValueError – If mesh is not defined.