Template Class GridPointSearch

Inheritance Relationships

Base Type

Class Documentation

template<int Dim>
class GridPointSearch : public pcms::localization::PointLocalizationSearch<Dim>

Public Types

using Result = typename PointLocalizationSearch<Dim>::Result

Public Functions

GridPointSearch(Kokkos::View<const Real*> coords, Kokkos::View<const LO*> elem_verts, Kokkos::Array<Kokkos::View<const LO*>, Dim> down, Kokkos::Array<Kokkos::View<const LO*>, Dim> down_verts, Kokkos::Array<Kokkos::Array<unsigned, 6>, Dim> entity_vertex_masks, Kokkos::View<const LO*> dual_offsets, Kokkos::View<const LO*> dual_neighbors, const UniformGrid<Dim> &grid, Real tolerance = 1E-12)
Parameters:
  • coords – vertex coordinates, Dim per vertex

  • elem_verts – the Dim + 1 vertices of each element

  • down – per entity dimension 1..Dim-1, the entities of each element

  • down_verts – per entity dimension 1..Dim-1, the vertices of each entity

  • entity_vertex_masks – per entity dimension 1..Dim-1 and local entity j of an element (the order of down), its local vertices as a bitmask

  • dual_offsets, dual_neighbors – the elements across each element’s facets: those of element e are dual_neighbors(dual_offsets(e)..dual_offsets(e + 1))

  • grid – the grid of candidate cells, covering the mesh

  • tolerance – as for PointLocalizationSearch

virtual Kokkos::View<Result*> Locate(Kokkos::View<const Real*[Dim]> points) const override

Given points in global coordinates, returns for each the entity (vertex, edge, face or region) it lies on and the point’s position on that entity, see PointLocalizationSearch::Result. With lambda the barycentric coordinates of the point in a candidate simplex and ||grad lambda_i|| their gradient norms, the point is within Cartesian distance tolerance of the plane of facet i iff |lambda_i| <= tolerance ||grad lambda_i||. The facets whose band contains the point decide the entity: the sub-simplex spanned by the vertices of the other facets (a vertex if the point is in the bands of all facets but one, an edge if of all but two, …, the simplex itself if of none). The entity of lowest dimension over all candidates wins, then the lowest id. Its reduced coordinates are the barycentric coordinates of those vertices renormalized to sum 1, in the entity’s vertex order.

The tolerance region of an entity is therefore the intersection of facet bands, not a Euclidean ball around it or a segment projection; near a corner of angle alpha it reaches about tolerance / sin(alpha / 2) from the vertex along the bisector. A point beyond the bands of every candidate is outside: the result names, with Result::OutsideId, the entity the nearest candidate (largest signed plane distance) puts it on, treating every facet it is beyond as one it lies on; this is an approximate nearest entity. A grid cell without candidates gives NO_INTERSECT with id -1.

void Locate(Kokkos::View<const Real*[Dim]> points, Kokkos::View<const LO*> guesses, Kokkos::View<Result*> results) const

As Locate(points), into results (one per point), starting from a guess per point: the element the point is believed to lie in, or -1 for none. A guess is verified, never trusted. A point whose guessed element, or else an element sharing a facet with it (the mesh’s dual graph), contains it within tolerance of its facets (the closure band above) is classified in that element alone: its entity and reduced coordinates are the ones the entity-of-simplex rule gives there, without a grid search. Every other point (no guess, a wrong one, a point outside the mesh) is searched for on the grid exactly as Locate(points) does, compacted so that only those points pay for it. guesses empty means no guesses.

The result equals Locate(points) in the dimensionality, the id and the reduced coordinates (up to rounding) wherever the entity of lowest dimension within the tolerance of the point is a sub-simplex of the guessed element or its neighbour; it can differ only within about tolerance / sin(alpha / 2) of a vertex or edge of sharp angle alpha, where a simplex that does not share a facet with the guess has the point in the band of a lower-dimensional entity.