|
Wildmeshing Toolkit
|
The offset potential: the scalar field on space whose level set the front is placed on. More...
#include <OffsetPotential.hpp>
Public Types | |
| using | VecD = Eigen::Matrix< double, DIM, 1 > |
| using | MatD = Eigen::Matrix< double, DIM, DIM > |
Public Member Functions | |
| virtual | ~OffsetPotential () |
| double | target_level () const |
| The level value the offset boundary is placed on. | |
| double | delta () const |
| The offset distance the field is calibrated to. | |
| double | dhat () const |
| double | level_set_slope () const |
| |d(field)/d(distance)| at the level set on a flat stretch of input. | |
| virtual double | value (const VecD &p) const =0 |
| virtual bool | is_euclidean () const |
| The Euclidean field: value() is the distance, so a distance residual is the plain one. | |
| virtual VecD | gradient (const VecD &p) const =0 |
| virtual MatD | hessian (const VecD &p) const =0 |
| virtual double | residual_length (const VecD &p) const =0 |
Distance from p to the level set, in length units. | |
| virtual bool | within_support (const VecD &p) const =0 |
Whether p is somewhere the field can give a direction to the level set at all. | |
| virtual bool | is_inside_offset (const VecD &p) const =0 |
Whether p lies inside the offset region – on the complex's side of the level set. | |
| virtual std::string | describe_active (const VecD &p) const =0 |
Diagnostic: what the field is made of at p, one contribution per line. | |
Protected Member Functions | |
| OffsetPotential (const double delta, const double dhat) | |
Protected Attributes | |
| double | m_delta = 0. |
| double | m_dhat = 0. |
| double | m_c = 0. |
| double | m_grad_ref = 1. |
The offset potential: the scalar field on space whose level set the front is placed on.
Two implementations, chosen by the offset_field JSON option: SmoothOffsetPotential (a C^2 barrier with analytic derivatives, level set Phi = c, a smoothed offset) and EuclideanOffsetPotential (the distance d to the input complex, level set d = delta, the exact offset). Each is documented at its own declaration below.
The two are monotone in opposite directions, which is the one thing a caller must not get wrong: the barrier is huge on the complex and decays to 0 at dhat, so inside the offset region means Phi >= c, while the distance increases outward, so inside means d <= delta. Never compare value() against target_level() outside this file – ask is_inside_offset(), which each implementation answers with its own sense.
The rest of the interface is identical, so the optimization, the criterion, the sizing field and OffsetEnergy are written once against this base and never learn which field they have.
|
virtualdefault |
Must stay out of line: it is this class's key function, so exactly one vtable is emitted, beside the explicit instantiations in OffsetPotential.cpp. Defaulted inline, there is no key function and the vtable goes weakly into every translation unit that sees the header.
|
inlineprotected |
Subclasses set delta and the support here; m_c is theirs to fill in, because one calibrates it and the other simply knows it.
|
pure virtual |
Diagnostic: what the field is made of at p, one contribution per line.
Implemented in wmtk::components::topological_offset::SmoothOffsetPotential< DIM >, and wmtk::components::topological_offset::EuclideanOffsetPotential< DIM >.
|
inline |
Support radius, beyond which the field and its derivatives vanish. Infinite for a field with no compact support, which makes within_support() vacuously true.
|
inlinevirtual |
The Euclidean field: value() is the distance, so a distance residual is the plain one.
Reimplemented in wmtk::components::topological_offset::EuclideanOffsetPotential< DIM >.
|
pure virtual |
Whether p lies inside the offset region – on the complex's side of the level set.
Ask this, never value(p) >= target_level(): the two fields are monotone in opposite directions, so the literal comparison is right for one and silently inverted for the other.
Implemented in wmtk::components::topological_offset::SmoothOffsetPotential< DIM >, and wmtk::components::topological_offset::EuclideanOffsetPotential< DIM >.
|
inline |
|d(field)/d(distance)| at the level set on a flat stretch of input.
The factor that turns a field difference into a length, so a criterion stated on the field's gradient is not by itself field-independent. The smoothing objective is E = (Phi - c)^2, so |grad E| ~ 2 * slope^2 * residual_length near the level set: a bound on |grad E| bounds a length only after dividing by slope^2. It is 1 for a distance field, where the two coincide, and 1/delta-ish for a barrier. The |grad Phi| ~ slope step is local to the level set on a flat stretch, not an identity.
See TopoOffsetTetMesh::offset_gradient_tolerance(), which is the only consumer.
|
pure virtual |
Distance from p to the level set, in length units.
What the convergence criterion measures: comparable to target_distance, while the field value need not be.
Implemented in wmtk::components::topological_offset::SmoothOffsetPotential< DIM >, and wmtk::components::topological_offset::EuclideanOffsetPotential< DIM >.
|
pure virtual |
Whether p is somewhere the field can give a direction to the level set at all.
Implemented in wmtk::components::topological_offset::SmoothOffsetPotential< DIM >, and wmtk::components::topological_offset::EuclideanOffsetPotential< DIM >.
|
protected |
1 unless a subclass calibrates otherwise – see level_set_slope(). Leaving it alone is what makes the gradient criterion mean the same thing on both fields.