23 "builder",
"SBMSurfaceMeshBuilder that provides KDTree, elem_id_map, and boundary elements.");
26 "Returns unsigned distance to a surface mesh using KDTree nearest neighbor search. "
27 "The gradient returns the unit vector pointing from boundary to query point.");
39 const auto builder = &getUserObject<SBMSurfaceMeshBuilder>(
"builder");
41 if (!builder->hasKDTree())
44 "' requires SBMSurfaceMeshBuilder '",
46 "' to be configured with 'build_kd_tree = true'.");
56 std::vector<std::size_t> ret_index(1);
79 const Real dist = dv.norm();
82 return RealGradient(0, 0, 0);
95 RealVectorValue n = elem.
normal();
96 const Real n_norm = n.norm();
registerMooseObject("ShiftedBoundaryMethodApp", UnsignedDistanceToSurfaceMesh)
static InputParameters validParams()
void neighborSearch(const Point &query_point, unsigned int patch_size, std::vector< std::size_t > &return_index)
const std::string & name() const
void mooseError(Args &&... args) const
const Point & normal() const
Computes the unsigned distance to a surface mesh using KDTree nearest neighbor lookup from SBMSurface...
KDTree * _kd_tree
Cached pointers for speed.
const std::vector< std::unique_ptr< SurfaceElement > > * _boundary_elements
RealVectorValue surfaceNormal(const Point &p) const
Return the true boundary surface normal evaluated at the closest point obtained by projecting the que...
virtual void initialSetup() override
static InputParameters validParams()
const SurfaceElement & closestBoundaryElem(const Point &p) const
find closest boundary element using KDTree
Real value(Real t, const Point &p) const override
Return unsigned distance value.
RealGradient gradient(Real t, const Point &p) const override
Return the spatial gradient of the unsigned distance function.
RealVectorValue distanceVectorToSurface(const Point &p) const
find closest boundary element and return its distance vector
UnsignedDistanceToSurfaceMesh(const InputParameters ¶meters)
libMesh::Point distanceFrom(const SurfaceElement &surface_elem, const libMesh::Point &pt)
Returns the vector from pt to the nearest point on the surface element: the normal projection if it f...
static constexpr Real TOLERANCE