User interface
GMSH toolbox for locally structured meshes on polygon.
- class lostinmsh.CircularBoundary(*, center, radius, background_name, thickness=None, thickness_name='thickness')
Circular boundary.
- center
Center of the circle.
- Type:
Vec2
- radius
Radius of the circle.
- Type:
float
- background_name
Name of the background.
- Type:
str
- thickness
Thickness of the border.
- Type:
float, optional
- thickness_name
Name of the thickness.
- Type:
str, optional
- dist_to_inner_boundary(points)
Sign distance to the inner boundary.
It is positive if all the points are inside and it is negative if at least one point is outside.
- Parameters:
points (
GenericAlias[floating[Any]]) – list of points should be an array of shape (N, 2) with N ≥ 1.- Return type:
float
- class lostinmsh.Geometry(*, polygons, boundary)
Geometry class.
- boundary
- Type:
ExteriorBoundary
- critical_interval()
Compute the critical interval of polygons.
- Returns:
Critical interval of the polygon.
- Return type:
tuple[float,float]
- discrete_critical_interval()
Compute the discrete critical interval of polygons.
- Returns:
Discrete critical interval of the polygon.
- Return type:
tuple[float,float]
- classmethod from_polygon(polygon, boundary)
Create a geometry from a polygon.
- class lostinmsh.GmshOptions(*, filename=None, element_order=1, additional_options=None, renumber_nodes='RCMK', show_terminal_output=False, show_gui=False)
Gmsh options.
Attributes:
- filename: PurePath | None, default None
Path to the output mesh file. If None, the mesh is not saved.
- element_order: int, default 1
Order of the finite elements. Must be an integer >= 1.
- additional_options: dict[str, Any] | None, default None
Additional Gmsh options as a dictionary of key-value pairs. See GMSH documentation http://gmsh.info/doc/texinfo/gmsh.html#Gmsh-options.
- renumber_nodes: str | None, default “RCMK”
Renumbering strategy for the nodes. If None, no renumbering is performed.
- show_terminal_output: bool, default False
If True, show Gmsh terminal output.
- show_gui: bool, default False
If True, launch the Gmsh GUI.
- raises ValueError:
If the element order is less than 1.
- class lostinmsh.Polygon(*, name, vertices, corners, lengths)
Polygon class.
- critical_interval()
Compute the critical interval of the polygon.
- Returns:
Critical interval of the polygon.
- Return type:
tuple[float,float]
- discrete_critical_interval()
Compute the discrete critical interval of the polygon.
- Returns:
Discrete critical interval of the polygon.
- Return type:
tuple[float,float]
- classmethod from_vertices(vertices, name, *, max_subdiv=16)
Create a polygon from its vertices.
- Parameters:
vertices (
ArrayLike) – Array like of shape (N, 2) containing the polygon vertices.name (
str) – Name of the polygon.max_subdiv (
int) – Maximum subdivision of the corner.
- Return type:
Self
- class lostinmsh.RectangularBoundary(*, corner_low, corner_high, background_name, thickness=None, thickness_name='thickness')
Rectangular boundary.
- corner_low
Lower left corner of the rectangle.
- Type:
Vec2
- corner_high
Higher right corner of the rectangle.
- Type:
Vec2
- background_name
Name of the background.
- Type:
str
- thickness
Thickness of the border.
- Type:
float, optional
- thickness_name
Name of the thickness.
- Type:
str, optional
- dist_to_inner_boundary(points)
Sign distance to the inner boundary.
It is positive if all the points are inside and it is negative if at least one point is outside.
- Parameters:
points (
GenericAlias[floating[Any]]) – list of points should be an array of shape (N, 2) with N ≥ 1.- Return type:
float
- lostinmsh.circular_boundary(polygons, inner_factor, background_name, thickness_factor=None, thickness_name='thickness')
Compute the circular boundary.
- Parameters:
polygons (
list[Polygon])inner_factor (
float)background_name (
str)thickness_factor (
float|None)thickness_name (
str)
- Return type:
- lostinmsh.mesh_locally_structured(geometry, mesh_size, gmsh_options=GmshOptions(filename=None, key_val={'General.Terminal': 0, 'General.SmallAxes': 0, 'Mesh.ElementOrder': 1, 'Mesh.TransfiniteTri': 1, 'Mesh.Smoothing': 0, 'Mesh.Algorithm': 6, 'Mesh.MeshSizeExtendFromBoundary': 1, 'Mesh.SurfaceFaces': 1, 'Mesh.ColorCarousel': 2}, renumber_nodes='RCMK', show_gui=False))
T-conform mesh a polygon.
- Parameters:
geometry (
Geometry)mesh_size (
float)gmsh_options (
GmshOptions)
- Return type:
PurePath|None
- lostinmsh.mesh_unstructured(geometry, mesh_size, gmsh_options=GmshOptions(filename=None, key_val={'General.Terminal': 0, 'General.SmallAxes': 0, 'Mesh.ElementOrder': 1, 'Mesh.TransfiniteTri': 1, 'Mesh.Smoothing': 0, 'Mesh.Algorithm': 6, 'Mesh.MeshSizeExtendFromBoundary': 1, 'Mesh.SurfaceFaces': 1, 'Mesh.ColorCarousel': 2}, renumber_nodes='RCMK', show_gui=False))
Unstructured mesh of a geometry.
- Parameters:
geometry (
Geometry)mesh_size (
float)gmsh_options (
GmshOptions)
- Returns:
Filename of the output mesh file or None if not saved.
- Return type:
PurePath|None
- lostinmsh.open_msh_file(filename)
Open a mesh file in GMSH.
- Parameters:
filename (
PurePath|str) – Path to the mesh file to be opened.- Return type:
None
- lostinmsh.plot_geometry(geometry, ax=None)
Plot geometry.
- Parameters:
geometry (
Geometry)ax (plt.Axes, optional, default=None)
- Return type:
None
- lostinmsh.plot_mesh(filename, *, ax=None)
Plot mesh from .msh file.
- Parameters:
filename (
PurePath|str) – Path to .msh file.- Return type:
None
- lostinmsh.plot_polygon(polygon, *, ax=None, show_pq=False)
Plot polygon.
- Parameters:
polygon (
Polygon)ax (plt.Axes, optional, default=None)
show_pq (bool, optional, default=False)
- Return type:
None
- lostinmsh.rectangular_boundary(polygons, inner_factor, background_name, thickness_factor=None, thickness_name='thickness')
Compute the rectangular boundary.
- Parameters:
polygons (
list[Polygon])inner_factor (
float)background_name (
str)thickness_factor (
float|None)thickness_name (
str)
- Return type: