User interface

GMSH toolbox for locally structured meshes on polygon.

class lostinmsh.AutoCircular(*, border_factor, thickness_factor=None)

Auto circular.

border_factor
Type:

float

thickness_factor
Type:

float, optional

get_border(points)

Auto set.

Parameters:

points (NDArray) – list of points should be an array of shape (N, 2) with N ≥ 1.

Return type:

Circular

class lostinmsh.AutoRectangular(*, border_factor, thickness_factor=None)

Auto rectangular.

border_factor
Type:

float

thickness_factor
Type:

float, optional

get_border(points)

Auto set.

Parameters:

points (NDArray) – list of points should be an array of shape (N, 2) with N ≥ 1.

Return type:

Rectangular

class lostinmsh.Circular(*, center, background_name='background', thickness=None, thickness_name='PML', radius)

Circular boundary.

dist_to_inner_boundary(points)

Sign distance to the inner boundary.

It is positive is all the points are inside and it is negative if at least one point is outside.

Parameters:

points (NDArray) – list of points should be an array of shape (N, 2) with N ≥ 1.

Return type:

float

class lostinmsh.Geometry(*, polygons, border)

Geometry class.

polygons
Type:

list[Polygon]

border
Type:

Border

critical_interval()

Get the critical interval.

Return type:

dict[str, tuple[Fraction, Fraction]]

classmethod from_polygon(polygon, border)

Create a geometry from a polygon.

Parameters:
  • polygon (Polygon)

  • border (Union[Border, AutoBorder])

Return type:

Geometry

classmethod from_polygons(polygons, border)

Create a geometry from polygons.

Parameters:
  • polygon (Iterable[Polygon])

  • border (Union[Border, AutoBorder])

Return type:

Geometry

make_center_origin()

Do a translation to set the center at (0, 0).

max_corner_radius()

Maximum corner radius.

Return type:

float

class lostinmsh.GmshOptions(*, element_order=1, terminal=False, gui=False, filename=None, hide_model_entities=True, additional_options=None)

GMSH Options.

http://gmsh.info/doc/texinfo/gmsh.html#Gmsh-options

element_order
Type:

int, default=1

terminal
Type:

bool, default=False

gui
Type:

bool,default=False

filename
Type:

OptionalPathLike, optional

hide_model_entities
Type:

bool, default=True

additional_options
Type:

dict[str, Any], optional

class lostinmsh.Polygon(*, corners, lengths, name)

Polygon class.

critical_interval()

Get the critical interval.

Return type:

tuple[Fraction, Fraction]

classmethod from_vertices(vertices, name, *, max_denominator=32)

Create a polygon from the vertices.

Return type:

Polygon

get_elementary_angle()

Get the elementary angle.

Return type:

Angle

get_vertices()

Get vertices.

Return type:

ndarray[Any, dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]]

property nbside: int

Return the angle value.

translate(vector)

Translate the vertices of the polygon.

Return type:

None

class lostinmsh.Rectangular(*, center, background_name='background', thickness=None, thickness_name='PML', half_width, half_height)

Rectangular boundary.

dist_to_inner_boundary(points)

Sign distance to the inner boundary.

It is positive is all the points are inside and it is negative if at least one point is outside.

Parameters:

points (NDArray) – list of points should be an array of shape (N, 2) with N ≥ 1.

Return type:

float

lostinmsh.mesh_loc_struct(geometry, mesh_size, gmsh_options=None, *, corner_radius_shrink=0.75, corner_geometric_coef=1.5)

T-confrom mesh a polygon.

Parameters:
  • geom (Geometry)

  • mesh_size (float)

  • gmsh_options (GmshOptions, optional)

  • corner_radius_shrink (float, default=0.75)

  • corner_geometric_coef (float, default=1.5)

Return type:

Optional[PurePath]

lostinmsh.mesh_unstructured(geometry, mesh_size, gmsh_options=None)

Mesh a geometry.

Parameters:
Return type:

Optional[PurePath]

lostinmsh.plot_geometry(geometry, ax=None)

Plot geometry.

Parameters:
  • geometry (Geometry)

  • ax (plt.Axes, optional)

Return type:

None

lostinmsh.plot_polygon(polygon, ax=None)

Plot polygon.

Parameters:
  • polygon (Polygon)

  • ax (plt.Axes, optional)

Return type:

None