Lattice#

class gyptis.Lattice(vectors, **kwargs)[source]#

Unit cell for periodic problems.

Parameters:
  • dim (int) – Geometric dimension (either 2 or 3, the default is 3).

  • vectors (tuple) – In 2D, a tuple of lengh 2 with the \((x,y)\) coordinates of 2 basis vectors. In 3D, a tuple of lengh 3 with the \((x,y,z)\) coordinates of 3 basis vectors.

  • **kwargs (dictionary) – Additional parameters. See the parent class Geometry.

add_physical(idf, name, dim=None)#

Add a physical domain.

Parameters:
  • idf (int or list of int) – The identifiant(s) of elementary entities making the physical domain.

  • name (str) – Name of the domain.

  • dim (int) – Dimension.

add_polygon(vertices, surface=True, mesh_size=0.0, **kwargs)#

Adds a polygon.

Parameters:
  • points (array of shape (Npoints,3)) – Corrdinates of the points.

  • mesh_size (float) – Mesh sizes at points (the default is 0.0).

  • surface (type) – If True, creates a plane surface (the default is True).

Returns:

The tag of the polygon.

Return type:

int

add_spline(points, mesh_size=0.0, surface=True, **kwargs)#

Adds a spline.

Parameters:
  • points (array of shape (Npoints,3)) – Corrdinates of the points.

  • mesh_size (float) – Mesh sizes at points (the default is 0.0).

  • surface (type) – If True, creates a plane surface (the default is True).

Returns:

The tag of the spline.

Return type:

int

build(interactive=False, generate_mesh=True, write_mesh=True, read_info=True, read_mesh=True, finalize=True, check_subdomains=True)#

Build the geometry.

Parameters:
  • interactive (bool) – Open gmsh GUI? (the default is False).

  • generate_mesh (type) – Mesh with gmsh? (the default is True).

  • write_mesh (type) – Write mesh to disk? (the default is True).

  • read_info (type) – Read subdomain markers information? (the default is True).

  • read_mesh (type) – Read mesh information? (the default is True).

  • finalize (type) – Finalize gmsh API? (the default is True).

  • check_subdomains (type) – Sanity check of subdomains names? (the default is True).

Returns:

A dictionary containing the mesh and markers.

Return type:

type

dimtag(idf, dim=None)#

Convert an integer or list of integer to gmsh DimTag notation.

Parameters:
  • idf (int or list of int) – Label or list of labels.

  • dim (type) – Dimension.

Returns:

A tuple (dim, tag) or list of such tuples (gmsh DimTag notation).

Return type:

int or list of int

Examples#