Rodin::Distance module

Distance propagation and Poisson-based level-set approximations.

The unsigned distance to a geometric set $\Gamma$ is

\[ d(x,\Gamma)=\inf_{y\in\Gamma}\lVert x-y\rVert. \]

Rodin provides fast-marching propagation, auxiliary Poisson fields and algebraic normalization. Their outputs and boundary data have distinct meanings; select and check the construction required by the application.

Propagation from an attributed interface

Eikonal wraps unit-speed fast marching. Facets carrying the configured interface attributes supply zero-time seed vertices. solve() propagates nonnegative arrival values. sign() subsequently negates values at vertices belonging to cells with the interior attributes. The interface should separate those regions consistently.

P1 space(mesh);
GridFunction distance(space);
Distance::Eikonal eikonal(distance);
eikonal.setInterface(interfaceAttr)
       .setInterior(interiorAttr)
       .solve()
       .sign();

Prepare vertex adjacency and vertex/cell incidence before solving. The underlying local FMM uses scalar P1 storage. Its discrete arrival times approximate distance; geometry and stencil error require assessment. Computing arrival times with fast marching supplies an analytic point-source comparison.

Auxiliary Poisson fields

Poisson solves $-\Delta u=1$ with zero data on the exterior boundary. Its scalar output is a Poisson potential. It is often used as input to a distance normalization.

SignedPoisson has two call forms. The full-domain overload solves $-\Delta u=-1$ with zero exterior data. The attributed overload uses an interior cell region $\Omega_-$ and an interface $\Gamma$ .

\[ -\Delta u=1-2\chi_{\Omega_-},\qquad u|_\Gamma=0. \]

Thus the forcing is negative inside and positive outside. Remaining exterior boundary portions have the natural condition of the weak problem. These classes take a finite element space when invoked.

auto positivePotential = Distance::Poisson()(space);
auto negativePotential = Distance::SignedPoisson()(space);
auto signedPotential = Distance::SignedPoisson()(interfaceAttr, interiorAttr, space);

The attributed overload also accepts sets of attributes. The mesh must resolve and label the interface before the solve. The convenience operators use CG internally; application-level convergence diagnostics may require explicitly constructing the corresponding variational problem.

Algebraic normalization

Rvachev and SpaldingTucker evaluate, respectively,

\[ d_R=\frac{u}{\sqrt{u^2+\lVert\nabla u\rVert^2}},\qquad d_{ST}=\frac{2u}{\lVert\nabla u\rVert+ \sqrt{\lVert\nabla u\rVert^2+2|u|}}. \]

The operators interpolate these expressions into a grid function on the input space. A nonzero denominator preserves the sign pointwise before interpolation. Both expressions are undefined where the field and gradient vanish together. An approximate distance interpretation requires suitable scaling of the input and comparison against the geometry of interest. Neither formula by itself establishes unit gradient throughout the domain.

auto normalized = Distance::SpaldingTucker()(signedPotential);

Gradients of piecewise fields need a consistent one-sided interpretation at interfaces. See Interfaces, traces, and discontinuous Galerkin for traces, and Shape and topology optimization for the role of redistancing in transport.

Classes

template<class Derived>
class Base
Base class for distance function computation models using CRTP.
template<class FES, class Data>
class Eikonal
Distance function computation using the Eikonal equation.
class Poisson
Poisson approximation to the distance function.
class Rvachev
Rvachev normalization for a level set function.
class SignedPoisson
Poisson approximation to the signed distance function.
class SpaldingTucker
Spalding-Tucker normalization for a level set function.