13#ifndef BOUNDARYLOCATOR_HH
14#define BOUNDARYLOCATOR_HH
20#include "dune/common/fvector.hh"
21#include "dune/geometry/type.hh"
30 namespace BoundaryLocatorDetail
32 template <
class Gr
idView,
class Function,
int dimw>
42 template <
class Cell,
class B>
45 template <
class Cell,
class B>
74 template <
class Gr
idView,
class Function=BoundaryLocatorDetail::ZeroDisplacement,
int dimw=Gr
idView::Gr
id::dimension>
78 using Grid =
typename GridView::Grid;
81 static int const dimension = GridView::Grid::dimension;
83 using ctype =
typename GridView::ctype;
87 typename GridView::Intersection,
88 typename GridView::template Codim<0>::Entity>;
110 template <
class... Args>
114 f = std::make_unique<Function>(std::forward<Args>(args)...);
129 template <
class Update>
136 timer.start(
"boundary faces from rtree");
138 timer.stop(
"boundary faces from rtree");
143 f = std::make_unique<Function>(update);
164 std::optional<std::tuple<typename BoundaryLocator<GridView,Function,dimw>::DisplacedFace,
166 typename GridView::ctype>>
184 std::optional<std::tuple<typename BoundaryLocator<GridView,Function,dimw>::DisplacedFace,
186 typename GridView::ctype>>
189 return byLineSegment(from,from+(diam/direction.two_norm())*direction, minAngle);
243 std::unique_ptr<BoundaryLocatorDetail::SpatialIndex<GridView,Function,dimension_world>> spatialIndex;
244 std::unique_ptr<Function> f;
247 using IntersectionSet = std::vector<std::tuple<BoundaryFace<Grid,Face,Function>,
250 void init(GridView
const& gridView, std::vector<bool>
const& boundarySegments);
257 IntersectionSet getIntersectingFaces(
Position const& from,
Position const& to,
ctype minAngle)
const;
264 void enterFaces(std::vector<Face>
const& fs);
Function is the interface for evaluatable functions .
A class for representing displaced/deformed boundary faces.
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::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.
std::conditional_t< dimension==dimension_world, typename GridView::Intersection, typename GridView::template Codim< 0 >::Entity > Face
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