scimba_torch.domain.meshless_domain.domain_3d

Basic Volumetric and Surfacic domains in 3D.

Classes

Cube3D(bounds[, is_main_domain])

Cube3D domain.

Cylinder3D(radius, length[, is_main_domain])

A Cylinder3D domain around \(z\) axis.

Disk3D(center, radius[, is_main_domain])

Disk3D domain.

Sphere3D(center, radius)

3D sphere domain.

Square3D(origin, x_dir, y_dir)

Square3D domain.

SurfaceTorus3D(radius, tube_radius[, center])

SurfaceTorus3D domain around :math: z axis.

SurfaceTorusFrom2DSurface(radius, base_surface)

Surface Torus from 2D surface domain.

Torus3D(radius, tube_radius[, center, ...])

Torus3D domain around :math: z axis.

TorusFrom2DVolume(base_volume, radius[, ...])

Torus from 2D volume domain.

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

Bases: VolumetricDomain

Cube3D domain.

Parameters:
  • bounds (list[tuple[float, float]] | Tensor) – Bounds of the cube in the form [(min_x, max_x), (min_y, max_y), (min_z, max_z)]

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

full_bc_domain()[source]

Return the full boundary domain of the Cube3D.

Returns:

(bottom, front, left, top, back, right).

Return type:

A list containing the six boundary Square3D domains

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

Bases: VolumetricDomain

Disk3D domain.

Parameters:
  • center (tuple[float, float, float] | 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 Disk3D.

Return type:

list[SurfacicDomain]

Returns:

A list containing the boundary Sphere3D domain.

class Cylinder3D(radius, length, is_main_domain=False)[source]

Bases: VolumetricDomain

A Cylinder3D domain around \(z\) axis.

Parameters:
  • radius (float) – Radius of the cylinder

  • length (float) – Length of the cylinder

  • is_main_domain (bool) – Whether the domain is the main domain or not

full_bc_domain()[source]

Return the full boundary domain of the Cylinder3D.

Returns:

(lower disk, body, upper disk).

Return type:

A list containing the three boundary domains

class Torus3D(radius, tube_radius, center=(0, 0, 0), is_main_domain=True)[source]

Bases: VolumetricDomain

Torus3D domain around :math: z axis.

Parameters:
  • radius (float) – Radius of the torus (distance from the center to the center of the tube

  • tube_radius (float) – Radius of the tube.

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

  • is_main_domain (bool) – Whether the domain is the main domain or not

full_bc_domain()[source]

Returns the boundary condition domain of the torus.

Return type:

list[SurfacicDomain]

Returns:

A list with a single SurfaceTorus3D domain.

class TorusFrom2DVolume(base_volume, radius, is_main_domain=True)[source]

Bases: VolumetricDomain

Torus from 2D volume domain.

Creates a Torus by revolving a 2D VolumetricDomain around the \(z\) axis.

Parameters:
  • base_volume (VolumetricDomain) – A 2D VolumetricDomain to be revolved around the \(z\) axis.

  • radius (float) – Radius of the torus.

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

Raises:
  • TypeError – If base_volume is not a VolumetricDomain instance.

  • ValueError – If base_volume is not a 2D domain. If base_volume does not have an invertible mapping.

is_inside(x)[source]

Test if N points x are inside the domain (before mapping if any).

Parameters:

x (Tensor) – Tensor of shape (N, dim) representing the points to test.

Return type:

Tensor

Returns:

Boolean tensor of shape (N,) indicating if the points are inside the domain.

is_outside(x)[source]

Test if N points x are outside the domain (before mapping if any).

Parameters:

x – Tensor of shape (N, dim) representing the points to test.

Returns:

Boolean tensor of shape (N,) indicating if the points are outside

the domain.

is_on_boundary(x, tol=0.0001)[source]

Test if N points x are on the boundary of the domain (before mapping if any).

Parameters:
  • x – Tensor of shape (N, dim) representing the points to test.

  • tol – Tolerance for the test (Default value = 1e-4).

Returns:

Boolean tensor of shape (N,) indicating if the points are on the boundary.

full_bc_domain()[source]

Return the full boundary domain of the Torus_from2DVolume.

Return type:

list[SurfacicDomain]

Returns:

A list with a SurfaceTorus_from2DSurface domain for each boundary of the base_volume.

class SurfaceTorus3D(radius, tube_radius, center=(0, 0, 0))[source]

Bases: SurfacicDomain

SurfaceTorus3D domain around :math: z axis.

Parameters:
  • radius (float) – Radius of the torus (distance from the center to the center of the tube).

  • tube_radius (float) – Radius of the tube.

  • center (Tensor) – Center of the torus.

class SurfaceTorusFrom2DSurface(radius, base_surface)[source]

Bases: SurfacicDomain

Surface Torus from 2D surface domain.

Creates a Torus Surface by revolving a 2D SurfacicDomain around the \(z\) axis.

Parameters:
  • radius (float) – Radius of the torus.

  • base_surface (SurfacicDomain) – A 2D SurfacicDomain to be revolved around the \(z\) axis.

Raises:
  • TypeError – If base_surface is not a SurfacicDomain instance.

  • ValueError – If base_surface is not a 2D domain.

class Sphere3D(center, radius)[source]

Bases: SurfacicDomain

3D sphere domain.

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

  • radius (float) – Radius of the sphere.

get_sdf()[source]

Returns the signed distance function (SDF) for the sphere.

Return type:

Callable[[Tensor], Tensor]

Returns:

A function that computes the signed distance from the sphere surface.

class Square3D(origin, x_dir, y_dir)[source]

Bases: SurfacicDomain

Square3D domain.

Parameters:
  • origin (tuple[float, float, float] | Tensor) – Vector defining the origin of the square

  • x_dir (tuple[float, float, float] | Tensor) – Vector defining the x direction

  • y_dir (tuple[float, float, float] | Tensor) – Vector defining the y direction