seamsh.geometry module

class seamsh.geometry.CurveType(value)

Bases: Enum

Determine how curves control points are interpolated.

BSPLINE = 4

cubic b-spline interpolation (smoother than spline)

POLYLINE = 1

linear interpolation

SPLINE = 3

cubic spline interpolation

STRICTPOLYLINE = 2

linear interpolation with a mesh point forced on each curve point

class seamsh.geometry.Domain(projection)

Bases: object

List the domain boundaries, forced mesh points and forced mesh lines.

Parameters:

projection (SpatialReference) – coordinate system of the geometry and mesh

add_boundary_curve(points, physical_tag, projection, curve_type=CurveType.POLYLINE)

Add a tagged curve to the domain boundary.

Parameters:
  • points (ndarray) – the curve control points [n,2]

  • physical_tag (str) – the curve physical tag

  • projection (SpatialReference) – the points coordinate system

  • curve_type (CurveType) – curve interpolation

Return type:

None

add_boundary_curves_shp(filename, physical_name_field=None, curve_type=CurveType.POLYLINE)

Adds all lines, polylines and polygons of a shapefile as domain boundaries

Parameters:
  • filename (str) – path to a shapefile.

  • physical_name_field (Optional[str]) – name of an attribute string field containing the curves physical tags

  • curve_type (CurveType) – curves interpolation

Return type:

None

add_interior_curve(points, physical_tag, projection, curve_type=CurveType.POLYLINE)

Adds a tagged curve inside the domain. The curve is not part of the domain boundary and will be meshed on both sides.

Parameters:
  • points (ndarray) – the curve control points [n,2]

  • physical_tag (str) – the curve physical tag

  • projection (SpatialReference) – the points coordinate system

  • curve_type (CurveType) – curve interpolation

Return type:

None

add_interior_curves_shp(filename, physical_name_field=None, curve_type=CurveType.POLYLINE)

Adds all lines, polylines and polygons of a shape file as forced interior mesh lines

Parameters:
  • filename (str) – path to a shapefile.

  • physical_name_field (Optional[str]) – name of and attribute string field with the curves physical tags

  • curve_type (CurveType) – curves interpolation

Return type:

None

add_interior_points(points, physical_tag, projection)

Add forced interior mesh points

Parameters:
  • x – the points [n,2]

  • physical_tag (str) – the points physical tag

  • projection (SpatialReference) – the points coordinate system

Return type:

None

add_interior_points_shp(filename, physical_name_field=None)

Adds all points of a shape file as forced mesh points.

Parameters:
  • filename (str) – path to a shapefile.

  • physical_name_field (Optional[str]) – name of an attribute string field with the curves physical tags

Return type:

None

seamsh.geometry.coarsen_boundaries(domain, x0, x0_projection, mesh_size)

Creates a new Domain with the same projection and coarsened boundaries.

Parameters:
  • domain (Domain) – the domain to coarsen

  • x0 (Tuple[float, float]) – the coordinates of one point inside the domain.

  • x0_projection (SpatialReference) – the coordinates system of x0.

  • mesh_size (Callable[[ndarray, SpatialReference], ndarray]) – a function returning the desired mesh element size for given coordinates

Return type:

Domain