Cubit Functions¶
- cubit_functions.get_last_geometry(geometry_type: str) hypnos.generic_classes.CubitInstance¶
Get last created geometry of given type
- Parameters
geometry_type (str) – Type of geometry
- Returns
Last created geometry
- Return type
- cubit_functions.cmd_geom(command: str, geom_type: str) hypnos.generic_classes.CubitInstance¶
Create a geometry in cubit. Raise an error if creation fails.
- Parameters
command (str) – Cubit command to create geoemtry
geom_type (str) – Type of geometry intended to create
- Returns
Created geometry
- Return type
- Raises
CubismError – If geometry type is not recognised. If specified geometry type is not created.
- cubit_functions.cmd_group(command: str) int¶
Create cubit group. Return 0 if group already exists.
- Parameters
command (str) – Cubit command to create group
- Returns
ID of created group, or 0
- Return type
int
- cubit_functions.get_id_string(geometry_list: list[hypnos.generic_classes.CubitInstance]) str¶
Convert list of geometries to a string of space-separated IDs.
- Parameters
geometry_list (list[CubitInstance]) – Geometries
- Returns
String of space-separated IDs
- Return type
str
- cubit_functions.get_entities_from_group(group_identifier: int | str, entity_type: str) list[int]¶
Get cubit entity IDs from cubit group
- Parameters
group_identifier (int | str) – group ID or name
entity_type (str) – group/ surface/ volume/ etc
- Returns
list of IDs
- Return type
list[int]
- Raises
CubismError – Group ID/ name not recognised Entity type not recognised
- cubit_functions.add_to_new_entity(entity_type: str, name: str, thing_type: str, things_to_add)¶
Create a new group, block, or sideset. Add entities or groups to it.
- Parameters
entity_type (str) – group/ block/ sideset
name (str) – Name of group/block/sideset
thing_type (str) – What to add to entity
things_to_add (int/ list[int]) – IDs of said thing
Functions used to convert references between different cubit geometries.
- cubit_functions.to_owning_body(geometry: hypnos.generic_classes.CubitInstance) hypnos.generic_classes.CubitInstance¶
Convert geometry to a reference to it’s parent body. (All geometries like volumes, surfaces, etc. in cubit are part of ‘body’ entities)
- Parameters
geometry (CubitInstance) – Geometry to convert
- Returns
Parent body
- Return type
- cubit_functions.to_bodies(component_list: list[hypnos.generic_classes.CubitInstance]) list[hypnos.generic_classes.CubitInstance]¶
Turns geometries (surfaces, volumes, etc.) into references to their parent bodies.
- Parameters
component_list (list[CubitInstance]) – list of geometries
- Returns
list of parent bodies
- Return type
list[CubitInstance]
- cubit_functions.to_volumes(geometry_list: list[hypnos.generic_classes.CubitInstance]) list[hypnos.generic_classes.CubitInstance]¶
Turns bodies into references to their children volumes. (All volumes in cubit are owned by ‘body’ entities)
- Parameters
geometry_list (list[CubitInstance]) – list of bodies
- Returns
list of children volumes
- Return type
list[CubitInstance]
- cubit_functions.to_surfaces(component_list: list[hypnos.generic_classes.CubitInstance]) list[hypnos.generic_classes.CubitInstance]¶
Turns bodies and volumes into geometries referencing their children surfaces. (All surfaces and volumes in cubit are owned by ‘body’ entities)
- Parameters
component_list (list[CubitInstance]) – list of bodies and/or volumes
- Returns
list of surfaces
- Return type
list[CubitInstance]
Booleans
- cubit_functions.subtract(subtract_from: list[hypnos.generic_classes.CubitInstance], subtract: list[hypnos.generic_classes.CubitInstance], destroy=True) list[hypnos.generic_classes.CubitInstance]¶
Subtract some geometries from others.
- Parameters
subtract_from (list[CubitInstance]) – Geometries to be subtracted from
subtract (list[CubitInstance]) – Geometries to subtract
destroy (bool, optional) – whether to destroy original geometries, by default True
- Returns
list of subtracted geometries
- Return type
list[CubitInstance]
- cubit_functions.union(geometries: list[hypnos.generic_classes.CubitInstance], destroy=True)¶
Take the union of a list of geometries
- Parameters
geometries (list[CubitInstance]) – list of geometries to union
destroy (bool, optional) – whether to destroy original , by default True
- Returns
list of union’d geometries
- Return type
list[CubitInstance]