stem.mesh module
- class stem.mesh.Element(id: int, element_type: str, node_ids: List[int])
Bases:
objectClass containing information about an element
- Attributes:
id (int): element id
element_type (str): Gmsh element type
node_ids (Sequence[int]): node ids
Initialize the element.
- Args:
id (int): Element id
element_type (str): Gmsh-element type
node_ids (List[int]): Node connectivities
- class stem.mesh.ElementShape(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
EnumEnum class for the element shape. TRIANGLE for triangular elements and tetrahedral elements, QUADRILATERAL for quadrilateral elements and hexahedral elements.
- QUADRILATERAL = 'quadrilateral'
- TRIANGLE = 'triangle'
- class stem.mesh.Mesh(ndim: int)
Bases:
objectClass containing information about the mesh
- Args:
ndim (int): number of dimensions of the mesh
- Attributes:
Initialize the mesh.
- Args:
ndim (int): number of dimensions of the mesh
- calculate_centroids() ndarray[tuple[Any, ...], dtype[float64]]
Calculate the centroids of all elements
- Returns:
npty.NDArray[np.float64]: centroids of all elements
- classmethod create_mesh_from_gmsh_group(mesh_data: Dict[str, Any], group_name: str) Mesh
Creates a mesh object from gmsh group
- Args:
mesh_data (Dict[str, Any]): dictionary of mesh data
group_name (str): name of the group
- Raises:
ValueError: If the group name is not found in the mesh data
- Returns:
Mesh: mesh object
- find_elements_connected_to_nodes() Dict[int, List[int]]
Creates a dictionary of node ids as keys and a list of element ids which are connected to the node as values.
- Returns:
Dict[int, List[int]]: dictionary containing node ids as keys and a list of element ids which are
connected to the node as values.
- class stem.mesh.MeshSettings(element_size: float = -1, element_order: int = 1, element_shape: ElementShape = ElementShape.TRIANGLE)
Bases:
objectA class to represent the mesh settings.
- Attributes:
element_size (float): The element size (default -1, which means that gmsh determines the size).
element_shape (
ElementShape): The element shape. TRIANGLE for triangular elements and tetrahedral elements, QUADRILATERAL for quadrilateral elements and hexahedral elements. (default TRIANGLE)__element_order (int): The element order. 1 for linear elements, 2 for quadratic elements. (default 1)
Initialize the mesh settings.
- Args:
element_size (float): The element size (default -1, which means that gmsh determines the size).
element_order (int): The element order. 1 for linear elements, 2 for quadratic elements. (default 1)
element_shape (
ElementShape): The element shape. TRIANGLE for triangular elements and tetrahedral elements, QUADRILATERAL for quadrilateral elements and hexahedral elements. (default TRIANGLE)
- property constraints: Dict[str, Any]
Get the constraints.
- Returns:
Dict[str, Any]: The constraints.
- set_structured_mesh_constraint_line(line_id: int, n_points: int)
Set the structured mesh constraint for a line.
- Args:
line_id (int): The line id.
n_points (int): The number of points.