scimba_torch.domain.meshless_domain.domain_2d

Basic Volumetric and Surfacic domains in 2D.

Classes

ArcCircle2D(center, radius, theta1, theta2)

ArcCircle2D domain.

Circle2D(center, radius)

Circle2D domain.

Disk2D(center, radius[, is_main_domain])

Disk2D domain.

Polygon2D(vertices[, threshold, is_main_domain])

Polygon2D domain.

Segment2D(pt1, pt2)

Segment2D domain.

Square2D(bounds[, is_main_domain])

Square2D domain.

class Segment2D(pt1, pt2)[source]

Bases: SurfacicDomain

Segment2D domain.

Parameters:
  • pt1 (tuple[float, float] | Tensor) – First point of the segment.

  • pt2 (tuple[float, float] | Tensor) – Second point of the segment.

get_sdf()[source]

Get the signed distance function of the segment.

Return type:

Callable[[Tensor], Tensor]

Returns:

The signed distance function of the segment.

class Circle2D(center, radius)[source]

Bases: SurfacicDomain

Circle2D domain.

Parameters:
  • center (tuple[float, float] | Tensor) – Center of the circle.

  • radius (float) – Radius of the circle.

get_sdf()[source]

Get the signed distance function of the circle.

Return type:

Callable[[Tensor], Tensor]

Returns:

The signed distance function of the circle.

class ArcCircle2D(center, radius, theta1, theta2)[source]

Bases: SurfacicDomain

ArcCircle2D domain.

Parameters:
  • center (tuple[float, float] | Tensor) – Center of the circle.

  • radius (float) – Radius of the circle.

  • theta1 (float) – Start angle of the arc in radians.

  • theta2 (float) – End angle of the arc in radians.

get_sdf()[source]

Get the signed distance function of the arc.

Returns:

The signed distance function of the arc.

class Square2D(bounds, is_main_domain=False)[source]

Bases: VolumetricDomain

Square2D domain.

Parameters:
  • bounds (list[tuple[float, float]]) – Bounds of the square in the form [(min_x, max_x), (min_y, max_y)].

  • is_main_domain (bool) – Whether this domain is the main domain.

Raises:

ValueError – If bounds is not of shape (2, 2).

full_bc_domain()[source]

Return the full boundary domain of the Square2D.

Return type:

list[Segment2D]

Returns:

A list containing the four boundary Segment2D domains.

class Polygon2D(vertices, threshold=0.01, is_main_domain=False)[source]

Bases: VolumetricDomain

Polygon2D domain.

The vertices must be given in counter-clockwise order.

Parameters:
  • vertices (list[tuple[float, float]]) – Vertices of the polygon.

  • threshold (float) – Threshold for the polygonal approximation.

  • is_main_domain (bool) – Whether this domain is the main domain.

full_bc_domain()[source]

Return the full boundary domain of the Polygon2D.

Return type:

list[SurfacicDomain]

Returns:

A list containing the boundary Segment2D domains.

class Disk2D(center, radius, is_main_domain=False)[source]

Bases: VolumetricDomain

Disk2D domain.

Parameters:
  • center (Tensor) – Center of the disk.

  • radius (float) – Radius of the disk.

  • is_main_domain (bool) – Whether this domain is the main domain.

full_bc_domain()[source]

Return the full boundary domain of the Disk2D.

Return type:

list[SurfacicDomain]

Returns:

A list containing the boundary Circle2D domain.