hp-FEM
Adaptive hp-FEM suite for nano-optics
Loading...
Searching...
No Matches
Public Member Functions | List of all members
hpfem::mesh::PointLocator< Dim > Class Template Reference

#include <point_location.hpp>

Public Member Functions

 PointLocator (const Mesh< Dim > &mesh, Real tolerance=1e-10)
 
std::optional< LocatedPoint< Dim > > locate (const Point< Dim > &x) const
 
std::optional< LocatedPoint< Dim > > locate (const Point< Dim > &x, Index hint) const
 
std::optional< Point< Dim > > reference_coordinates (Index c, const Point< Dim > &x) const
 
const Mesh< Dim > & mesh () const noexcept
 
Real tolerance () const noexcept
 
const std::array< Index, static_cast< std::size_t >(Dim)> & grid_divisions () const noexcept
 Grid buckets per axis (for diagnostics and tests).
 

Detailed Description

template<int Dim>
class hpfem::mesh::PointLocator< Dim >

Locates physical points in a mesh with a uniform background grid over the mesh's bounding box: every grid bucket lists the cells whose bounding box meets it (curved cells use the Bézier control points of the quadratic map, which enclose the cell). A query tests the candidate cells of the point's bucket in ascending cell order and returns the first cell containing the point, so points on shared facets are assigned to the lowest adjacent cell id. Build O(#cells), query O(candidates per bucket), about one cell per bucket on quasi-uniform meshes.

Constructor & Destructor Documentation

◆ PointLocator()

template<int Dim>
hpfem::mesh::PointLocator< Dim >::PointLocator ( const Mesh< Dim > &  mesh,
Real  tolerance = 1e-10 
)
explicit
Parameters
tolerancea point counts as inside a cell if all barycentric coordinates are \( \ge -\text{tolerance} \) (dimensionless, in reference coordinates), so boundary points and rounding noise are resolved. Must be \( \ge 0 \).
Exceptions
InvalidArgumentfor a negative tolerance.

Member Function Documentation

◆ grid_divisions()

template<int Dim>
const std::array< Index, static_cast< std::size_t >(Dim)> & hpfem::mesh::PointLocator< Dim >::grid_divisions ( ) const
inlinenoexcept

Grid buckets per axis (for diagnostics and tests).

◆ locate() [1/2]

template<int Dim>
std::optional< LocatedPoint< Dim > > hpfem::mesh::PointLocator< Dim >::locate ( const Point< Dim > &  x) const

Cell containing \( x \) and its reference coordinates, or nothing if \( x \) lies outside the mesh (beyond the tolerance).

◆ locate() [2/2]

template<int Dim>
std::optional< LocatedPoint< Dim > > hpfem::mesh::PointLocator< Dim >::locate ( const Point< Dim > &  x,
Index  hint 
) const

As locate(x), but first tries hint and its facet neighbours; falls back to the grid search. Fast for sequences of nearby points (line scans, particle tracks).

◆ mesh()

template<int Dim>
const Mesh< Dim > & hpfem::mesh::PointLocator< Dim >::mesh ( ) const
inlinenoexcept

◆ reference_coordinates()

template<int Dim>
std::optional< Point< Dim > > hpfem::mesh::PointLocator< Dim >::reference_coordinates ( Index  c,
const Point< Dim > &  x 
) const

Reference coordinates of \( x \) in cell c if the cell contains it (within tolerance). Curved cells invert the map by Newton iteration; a failed iteration means "outside".

◆ tolerance()

template<int Dim>
Real hpfem::mesh::PointLocator< Dim >::tolerance ( ) const
inlinenoexcept

The documentation for this class was generated from the following file: