scimba_torch.geometry.regularized_sdf_projectors

A module for learning regularized signed distance functions.

Functions

learn_regularized_sdf([points_file, ...])

Learn a SDF from either a file of points or a parametric hypersurface.

Classes

RegularizedSdfAnagram([points_file, ...])

The class for Regularized SDF projectors with Anagram.

RegularizedSdfEnergyNaturalGradient([...])

The class for Regularized SDF projectors with Energy Natural Gradient.

RegularizedSdfPinnsElliptic([points_file, ...])

The class for Regularized SDF projectors without preconditioning.

RegularizedSdfProjector([points_file, ...])

The abstract class for Regularized SDF projectors.

class RegularizedSdfProjector(points_file=None, parametric_hyper_surface=None, bounding_domain=None, **kwargs)[source]

Bases: ABC

The abstract class for Regularized SDF projectors.

SDF = Signed Distance Function

Parameters:
  • points_file (str | None) – A .txt file of points on the curve, default to None.

  • parametric_hyper_surface (ParametricHyperSurface | None) – a parametric HyperSurface, default to None. One among points_file, parametric_hyper_surface must be provided.

  • bounding_domain (VolumetricDomain | list[tuple[float, float]] | Tensor | None) – a bounding domain for the surface. Mandatory if parametric_hyper_surface is given.

  • **kwargs – arbitrary keyword arguments

Keyword Arguments:
  • architecture – the architecture of the NN to be used (default: GenericMLP).

  • layer_sizes – the size of the hidden layers (default: [10] * 4).

  • activation_type – the activation function (default: “sine”).

  • ...

class RegularizedSdfPinnsElliptic(points_file=None, parametric_hyper_surface=None, bounding_domain=None, **kwargs)[source]

Bases: RegularizedSdfProjector, PinnsElliptic

The class for Regularized SDF projectors without preconditioning.

SDF = Signed Distance Function

Parameters:
  • points_file (str | None) – A .txt file of points on the curve, default to None.

  • parametric_hyper_surface (ParametricHyperSurface | None) – a parametric HyperSurface, default to None. One among points_file, parametric_hyper_surface must be provided.

  • bounding_domain (VolumetricDomain | list[tuple[float, float]] | Tensor | None) – a bounding domain for the surface. Mandatory if parametric_hyper_surface is given.

  • **kwargs – arbitrary keyword arguments

Keyword Arguments:
  • architecture – the architecture of the NN to be used (default: GenericMLP).

  • layer_sizes – the size of the hidden layers (default: [10] * 4).

  • activation_type – the activation function (default: “sine”).

  • ...

class RegularizedSdfEnergyNaturalGradient(points_file=None, parametric_hyper_surface=None, bounding_domain=None, **kwargs)[source]

Bases: RegularizedSdfProjector, NaturalGradientPinnsElliptic

The class for Regularized SDF projectors with Energy Natural Gradient.

SDF = Signed Distance Function

Parameters:
  • points_file (str | None) – A .txt file of points on the curve, default to None.

  • parametric_hyper_surface (ParametricHyperSurface | None) – a parametric HyperSurface, default to None. One among points_file, parametric_hyper_surface must be provided.

  • bounding_domain (VolumetricDomain | list[tuple[float, float]] | Tensor | None) – a bounding domain for the surface. Mandatory if parametric_hyper_surface is given.

  • **kwargs – arbitrary keyword arguments

Keyword Arguments:
  • architecture – the architecture of the NN to be used (default: GenericMLP).

  • layer_sizes – the size of the hidden layers (default: [10] * 4).

  • activation_type – the activation function (default: “sine”).

  • ...

class RegularizedSdfAnagram(points_file=None, parametric_hyper_surface=None, bounding_domain=None, **kwargs)[source]

Bases: RegularizedSdfProjector, AnagramPinnsElliptic

The class for Regularized SDF projectors with Anagram.

SDF = Signed Distance Function

Parameters:
  • points_file (str | None) – A .txt file of points on the curve, default to None.

  • parametric_hyper_surface (ParametricHyperSurface | None) – a parametric HyperSurface, default to None. One among points_file, parametric_hyper_surface must be provided.

  • bounding_domain (VolumetricDomain | list[tuple[float, float]] | Tensor | None) – a bounding domain for the surface. Mandatory if parametric_hyper_surface is given.

  • **kwargs – arbitrary keyword arguments

Keyword Arguments:
  • architecture – the architecture of the NN to be used (default: GenericMLP).

  • layer_sizes – the size of the hidden layers (default: [10] * 4).

  • activation_type – the activation function (default: “sine”).

  • ...

learn_regularized_sdf(points_file=None, parametric_hyper_surface=None, bounding_domain=None, mode='new', load_from=None, save_to=None, **kwargs)[source]

Learn a SDF from either a file of points or a parametric hypersurface.

SDF = Signed Distance Function

Parameters:
  • points_file (str | None) – A .txt file of points on the curve, default to None.

  • parametric_hyper_surface (ParametricHyperSurface | None) – a parametric HyperSurface, default to None. One among points_file, parametric_hyper_surface must be provided.

  • bounding_domain (VolumetricDomain | list[tuple[float, float]] | Tensor | None) – a bounding domain for the surface. Mandatory if parametric_hyper_surface is given.

  • mode (str) – either “new” for new solving, “load” for loading from a file or “resume” for loading from a file and continue solving.

  • load_from (str | None) – the file from which loading the model.

  • save_to (str | None) – the file where saving the model.

  • **kwargs – arbitrary keyword arguments

Keyword Arguments:
  • architecture – the architecture of the NN to be used (default: GenericMLP).

  • layer_sizes – the size of the hidden layers (default: [10] * 4).

  • activation_type – the activation function (default: “sine”).

  • epochs – the number of optimization steps

  • n_collocation – the number of collocation points in the domain

  • n_bc_collocation – the number of collocation points on the contour

  • ...

Return type:

PinnsElliptic

Returns:

the PINN approximating the SDF

Raises:
  • NotImplementedError – the preconditioner is not known

  • ValueError – when loading file is not provided