13#ifndef BOUNDARYLOCATOR_HH
14#define BOUNDARYLOCATOR_HH
20#include "dune/common/fmatrix.hh"
21#include "dune/common/fvector.hh"
22#include "dune/geometry/type.hh"
33 template <
class Gr
idView,
class Function,
int dimw>
43 template <
class Cell,
class B>
46 template <
class Cell,
class B>
76 template <
class GridView,
77 class Function=BoundaryLocatorDetail::ZeroDisplacement,
78 int dimw=GridView::Grid::dimension>
82 using Grid =
typename GridView::Grid;
85 static int const dimension = GridView::Grid::dimension;
87 using ctype =
typename GridView::ctype;
91 typename GridView::Intersection,
92 typename GridView::template Codim<0>::Entity>;
120 template <
class... Args>
124 f = std::make_unique<Function>(std::forward<Args>(args)...);
141 template <
class Update>
148 timer.start(
"boundary faces from rtree");
150 timer.stop(
"boundary faces from rtree");
155 f = std::make_unique<Function>(update);
178 std::optional<std::tuple<typename BoundaryLocator<GridView,Function,dimw>::DisplacedFace,
180 typename GridView::ctype>>
199 std::optional<std::tuple<typename BoundaryLocator<GridView,Function,dimw>::DisplacedFace,
201 typename GridView::ctype>>
204 return byLineSegment(from,from+(diam/direction.two_norm())*direction, minAngle);
258 std::unique_ptr<BoundaryLocatorDetail::SpatialIndex<GridView,Function,dimension_world>> spatialIndex;
259 std::unique_ptr<Function> f;
262 using IntersectionSet = std::vector<std::tuple<BoundaryFace<Grid,Face,Function>,
265 void init(
GridView const& gridView, std::vector<bool>
const& boundarySegments);
272 IntersectionSet getIntersectingFaces(
Position const& from,
Position const& to,
ctype minAngle)
const;
279 void enterFaces(std::vector<Face>
const& fs);
Function is the interface for evaluatable functions .
A class for representing displaced/deformed boundary faces.
BoundaryFace< Grid, Face, Function, dimw > DisplacedFace
the type of boundary faces in the (optionally displaced) grid, used for returning found intersections...
BoundaryLocator(GridView const &gridView)
Constructs a locator, optionally providing a displacement.
Dune::FieldVector< ctype, dimension_world-1 > LocalPosition
Function const * displacement() const
Returns the current displacement of the mesh.
typename GridView::ctype ctype
std::vector< DisplacedFace > displacedFaces() const
Returns a sequence of all deformed faces.
std::conditional_t< dimension==dimension_world, typename GridView::Intersection, typename GridView::template Codim< 0 >::Entity > Face
std::optional< std::tuple< typename BoundaryLocator< GridView, Function, dimw >::DisplacedFace, typename BoundaryLocator< GridView, Function, dimw >::LocalPosition, typename GridView::ctype > > byRay(Position const &from, Position const &direction, ctype minAngle=-0.5) const
Finds the first boundary face that is intersected by the given ray from outside towards inside.
Dune::FieldVector< ctype, dimension_world > Position
Position unitOuterNormal(Face const &face, LocalPosition const &xi) const
DEPRECATED use BoundaryFace::unitOuterNormal() instead.
ctype diameter() const
The diagonal length of the grid's cartesian bounding box.
std::optional< std::tuple< typename BoundaryLocator< GridView, Function, dimw >::DisplacedFace, typename BoundaryLocator< GridView, Function, dimw >::LocalPosition, typename GridView::ctype > > byLineSegment(Position const &from, Position const &to, ctype minAngle=-0.5) const
Finds the first boundary face that is intersected by the given line segment from outside towards insi...
Position global(Face const &face, LocalPosition const &xi) const
Returns the global position of a boundary point.
BoundaryLocator(GridView const &gridView, Args &&... args)
Constructs a locator, constructing the displacement function with the given argument.
static int const dimension_world
void updateDisplacement(Update const &update)
Creates or updates the displacement function.
static int const dimension
std::vector< Face > faces() const
Returns a sequence of all faces.
BoundaryLocator(GridView const &gridView, std::vector< bool > const &boundarySegments)
Constructor.
static Timings & instance()
Returns a reference to a single default instance.
typename GridView::template Codim< 0 >::Entity Cell
The type of cells (entities of codimension 0) in the grid view.
Dune::FieldMatrix< typename B::field_type, B::dimension, B::dimension > derivative(Cell, B) const
int order(Cell const &) const