scimba_torch.domain.meshless_domain.domain_nd

nD domains.

Classes

BallND(center, radius[, is_main_domain])

n-dimensional ball domain.

CartesianProduct(domains[, is_main_domain])

Cartesian product of multiple domains.

HypercubeND(bounds[, is_main_domain])

Hypercube n-dimensional domain.

HypersquareND(origin, basis)

Hypersquare n-dimensional surfacic domain: a hyperplane patch.

class HypersquareND(origin, basis)[source]

Bases: SurfacicDomain

Hypersquare n-dimensional surfacic domain: a hyperplane patch.

Parameters:
  • origin (Tensor) – an edge of the patch, shape (dim,).

  • basis (Tensor) – an orthogonal family spanning the patch, shape (dim - 1, dim).

get_sdf()[source]

Return the SDF of the hypersquare.

Raises:

NotImplementedError – A hyperplane patch has no signed distance function.

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

Bases: VolumetricDomain

Hypercube n-dimensional domain.

Parameters:
  • bounds (list[tuple[float, float]] | Tensor) – A list of tuples representing the bounds of the cube in each dimension.

  • is_main_domain (bool) – A flag to indicate if the domain can have subdomains and holes.

full_bc_domain()[source]

Returns the full boundary condition domain for the HypercubeND.

Return type:

list[SurfacicDomain]

Returns:

The 2 * dim boundary facets (a HypersquareND for the low and the high side of each axis), or the 2 Point1D endpoints if dim == 1.

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

Bases: VolumetricDomain

n-dimensional ball domain.

Parameters:
  • center (tuple[float] | Tensor) – A list of tuples representing the center of the ball in each dimension.

  • radius (float) – The radius of the ball.

  • is_main_domain (bool) – A flag to indicate if the domain can have subdomains and holes.

full_bc_domain()[source]

Returns the full boundary condition domain for the BallND.

Raises:

NotImplementedError – BallND does not have a full boundary condition domain implemented.

class CartesianProduct(domains, is_main_domain=False)[source]

Bases: VolumetricDomain

Cartesian product of multiple domains.

Parameters:
  • domains (list[VolumetricDomain]) – list of domains to be combined

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

Raises:

ValueError – If any of the domains have non-invertible mappings

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.

full_bc_domain()[source]

Returns the full boundary condition domain for the CartesianProduct.

Raises:

NotImplementedError – CartesianProduct does not have a full boundary condition domain implemented.