scimba_torch.domain.sdf

Defines the signed distance function.

Classes

PolygonalApproxSignedDistance(dim, points[, ...])

Describe the approximate signed Distance function as described in [Sukumar2022].

SignedDistance(dim[, threshold])

Describe the signed Distance function.

class SignedDistance(dim, threshold=0.0)[source]

Bases: ABC

Describe the signed Distance function.

Approximative or exact Signed distance function.

Parameters:
  • dim (int) – dimension of the domain

  • threshold (float) – threshold to determinate how we sample inside the domain. We use signedDistance(x) < threshold

class PolygonalApproxSignedDistance(dim, points, threshold=0.01)[source]

Bases: SignedDistance

Describe the approximate signed Distance function as described in [Sukumar2022].

Parameters:
  • dim (int) – dimension of the domain

  • points (Union[List[Tuple[float, float]], Tensor]) – coordinates of the vertices of the polygon

  • threshold (float) – threshold to determinate how we sample inside the domain. We use signedDistance(x) < threshold

[Sukumar2022] (1,2)

N. Sukumar, Ankit Srivastava. Exact imposition of boundary conditions with distance functions in physics-informed deep neural networks. Computer Methods in Applied Mechanics and Engineering, Volume 389, 2022, 114333.

vectorial_product(x, y)[source]

Returns the vectorial product between two batched vectors.

Parameters:
  • x (Tensor) – left tensor

  • y (Tensor) – right tensor

Return type:

Tensor

Returns:

the vectorial product between x and y

dot_product(x, y)[source]

Returns the scalar product between two batched vectors.

Parameters:
  • x (Tensor) – left tensor

  • y (Tensor) – right tensor

Return type:

Tensor

Returns:

the dot product between x and y

vect_x_to_xi(x, i)[source]

Returns the batched vector x-xi with xi vertices of the polygonal.

Parameters:
  • x (Tensor) – left tensor

  • i (int) – the number of the polygonal point

Returns:

the batched vector x-xi

dist(y)[source]

Returns the batched distance of a batched tensor of vector.

Parameters:

y (Tensor) – the tensor

Return type:

Tensor

Returns:

the batched norm of y

phi(x)[source]

Returns the batched function phi for a polygonal.

Parameters:

x (Tensor) – the tensor

Return type:

Tensor

Returns:

the value of phi at the point x