# Common

Common functions shared between the geo and the occ kernels.

## Geometry

class pygmsh.common.geometry.CommonGeometry(env, init_argv=None)

  Bases: `object`

  Geometry base class containing all methods that can be shared between built-in and occ.

  add_bezier(*args, **kwargs)
  add_boundary_layer(*args, **kwargs)
  add_bspline(*args, **kwargs)
  add_circle_arc(*args, **kwargs)
  add_curve_loop(*args, **kwargs)
  add_ellipse_arc(*args, **kwargs)
  add_line(*args, **kwargs)
  add_physical(entities, label=None)
  add_plane_surface(*args, **kwargs)
  add_point(*args, **kwargs)
  add_polygon(*args, **kwargs)
  add_spline(*args, **kwargs)
  add_surface(*args, **kwargs)
  add_surface_loop(*args, **kwargs)
  add_volume(*args, **kwargs)
  copy(obj)
  dilate(obj, x0, abc)
  extrude(input_entity, translation_axis, num_layers=None, heights=None, recombine=False)

    Extrusion of any entity along a given translation_axis.

  generate_mesh(dim=3, order=None, algorithm=None, verbose=False)

    Return a meshio.Mesh, storing the mesh points, cells, and data, generated by Gmsh from the self.

  in_surface(input_entity, surface)

    Embed the point(s) or curve(s) in the given surface. The surface mesh will conform to the mesh of the point(s) or curves(s).

  in_volume(input_entity, volume)

    Embed the point(s)/curve(s)/surface(s) in the given volume. The volume mesh will conform to the mesh of the input entities.

  mirror(obj, abcd)
  remove(obj, recursive=False)
  rotate(obj, point, angle, axis)
    Rotate input_entity around a given point with a given angle.

      Rotation axis has to be specified.

    Changes the input object.

  save_geometry(filename)
  set_background_mesh(*args, **kwargs)
  set_mesh_size_callback(fun, ignore_other_mesh_sizes=True)
  set_recombined_surfaces(surfaces)
  set_transfinite_curve(curve, num_nodes, mesh_type, coeff)
  set_transfinite_surface(surface, arrangement, corner_pts)
  set_transfinite_volume(volume, corner_pts)
  symmetrize(obj, coefficients)

    Transforms all elementary entities symmetrically to a plane. The vector should contain four expressions giving the coefficients of the plane’s equation.

  synchronize()
  translate(obj, vector)

    Translates input_entity itself by vector.

    Changes the input object.

## Bspline

class pygmsh.common.bspline.BSpline(env, control_points)

  Bases: `pygmsh.common.line_base.LineBase`

  Creates a B-spline.

  Parameters

    control_points (Contains the identification numbers of the control points.) –

## CircleArc

class pygmsh.common.circle_arc.CircleArc(env, start, center, end)

  Bases: `pygmsh.common.line_base.LineBase`

  Creates a circle arc.

  Parameters

    - start (Coordinates of start point needed to construct circle-arc.) –

    - center (Coordinates of center point needed to construct circle-arc.) –

    - end (Coordinates of end point needed to construct circle-arc.) –

## EllipseArc

class pygmsh.common.ellipse_arc.EllipseArc(env, start, center, point_on_major_axis, end)

  Bases: `pygmsh.common.line_base.LineBase`

  Creates an ellipse arc.

  Parameters

    - start (Coordinates of start point needed to construct elliptic arc.) –

    - center (Coordinates of center point needed to construct elliptic arc.) –

    - point_on_major_axis (Point on the center axis of ellipse.) –

    - end (Coordinates of end point needed to construct elliptic arc.) –

## LineBase

class pygmsh.common.line_base.LineBase(id0, points)

  Bases: `object`

  dim = 1

## CurveLoop

class pygmsh.common.curve_loop.CurveLoop(env, curves)

  Bases: `object`

  Increments the Line ID every time a new object is created that inherits from LineBase.

  Parameters

    curves (Containing the lines defining the shape.) –

  Notes

  A line loop must be a closed loop, and the elementary lines should be ordered and oriented (negating to specify reverse orientation). If the orientation is correct, but the ordering is wrong, Gmsh will actually reorder the list internally to create a consistent loop.

  dim = 1

## Line

class pygmsh.common.line.Line(env, p0, p1)

  Bases: `pygmsh.common.line_base.LineBase`

  Creates a straight line segment.

  Parameters

    - p0 (Point object that represents the start of the line.) –

    - p1 (Point object that represents the end of the line.) –

  Variables

    points (array-like[1][2]) – List containing the begin and end points of the line.

  dim = 1

## Point

class pygmsh.common.point.Point(env, x, mesh_size=None)

  Bases: `object`

  Creates an elementary point.

  Parameters

    - x (Give the coordinates X, Y (and Z) of the point in the three-dimensional) – Euclidean space.

    - mesh_size (The prescribed mesh element size at this point.) –

  Variables

    x (array-like) – Point coordinates.

  dim = 0

## Spline

class pygmsh.common.spline.Spline(env, points)

  Bases: `pygmsh.common.line_base.LineBase`

  With the built-in geometry kernel this constructs a Catmull-Rom spline.

  Parameters

    points (List containing Point objects) –

## SurfaceLoop

class pygmsh.common.surface_loop.SurfaceLoop(env, surfaces)

  Bases: `object`

  Creates a surface loop (a shell).

  Parameters

    surfaces (list) – Contain the identification numbers of all the elementary surfaces that constitute the surface loop.

  Notes

  A surface loop must always represent a closed shell, and the elementary surfaces should be oriented consistently (using negative identification numbers to specify reverse orientation).

  dim = 2

## Surface

class pygmsh.common.surface.Surface(env, curve_loop)

  Bases: `object`

  Generates a Surface from a CurveLoop.

  Parameters

    curve_loop (Object) – CurveLoop object that contains all the Line objects for the loop construction.

  Notes

  With the built-in kernel, the first line loop should be composed of either three or four elementary lines.

  With the built-in kernel, the optional In Sphere argument forces the surface to be a spherical patch (the extra parameter gives the identification number of the center of the sphere).

  dim = 2

## Volume

class pygmsh.common.volume.Volume(env, surface_loop, holes=None)

  Bases: `object`

  Creates a volume.

  Parameters

    - surface_loop (list) – Contain the identification numbers of all the surface loops defining the volume.

    - holes (list) – List containing surface loop objects that represents polygon holes.

  Notes

  The first surface loop defines the exterior boundary of the volume; all other surface loops define holes in the volume.

  A surface loop defining a hole should not have any surfaces in common with the exterior surface loop (in which case it is not a hole, and the two volumes should be defined separately).

  Likewise, a surface loop defining a hole should not have any surfaces in common with another surface loop defining a hole in the same volume (in which case the two surface loops should be combined).

  dim = 3