12#ifndef DUMUX_DISCRETIZATION_ELEMENTS_CONTAINING_POINT_HH
13#define DUMUX_DISCRETIZATION_ELEMENTS_CONTAINING_POINT_HH
19#include <dune/common/reservedvector.hh>
20#include <dune/grid/common/capabilities.hh>
33template<
class Gr
idDiscretization>
44template<std::
size_t maxNumScvs,
class ElementDiscretization,
class GlobalPosition>
45Dune::ReservedVector<std::size_t, maxNumScvs>
scvsContainingPoint(
const ElementDiscretization& elemDisc,
46 const GlobalPosition& globalPos)
48 Dune::ReservedVector<std::size_t, maxNumScvs> scvIndices;
49 for (
const auto& scv :
scvs(elemDisc))
51 scvIndices.push_back(scv.indexInElement());
66template<
class Gr
idDiscretization,
class GlobalPosition>
68 const GlobalPosition& globalPos)
74 std::erase_if(elementIndices, [&](
const auto eIdx)
79 using Grid =
typename GridDiscretization::GridView::Grid;
80 using Geometry =
typename std::decay_t<
decltype(element)>::Geometry;
83 const auto geometry = element.geometry();
84 const auto& lower = geometry.corner(0);
85 const auto& upper = geometry.corner(geometry.corners() - 1);
87 for (
int i = 0; i < GlobalPosition::dimension; ++i)
88 inside = inside && lower[i] <= globalPos[i] && globalPos[i] <= upper[i];
93 elemDisc.bindElement(element);
94 for (
const auto& scv :
scvs(elemDisc))
96 if constexpr (
requires { scv.isOverlapping(); })
97 if (scv.isOverlapping())
106 return elementIndices;
Traits telling the bounding box tree algorithms about a leaf geometry.
std::vector< std::size_t > elementsContainingPoint(const GridDiscretization &gridDiscretization, const GlobalPosition &globalPos)
The indices of the elements that contain a point.
Definition elementscontainingpoint.hh:67
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition localview.hh:26
Dune::ReservedVector< std::size_t, maxNumScvs > scvsContainingPoint(const ElementDiscretization &elemDisc, const GlobalPosition &globalPos)
The local indices of the sub-control volumes of the bound element that contain a point.
Definition elementscontainingpoint.hh:45
bool intersectsPointGeometry(const Dune::FieldVector< ctype, dimworld > &point, const Geometry &g)
Find out whether a point is inside a three-dimensional geometry.
Definition intersectspointgeometry.hh:28
std::vector< std::pair< int, std::size_t > > intersectingEntities(const Dune::FieldVector< ctype, dimworld > &point, const DistributedBoundingBoxTree< EntitySet > &tree, bool isCartesianGrid=false, bool onlyOwned=true)
Compute all intersections between entities and a point on a distributed tree.
Definition distributedintersectingentities.hh:81
decltype(auto) gridDiscretization(const T &t, Args &&... args)
The grid discretization.
Definition griddiscretization.hh:98
Algorithms that find which geometric entities intersect.
Detect if a point intersects a geometry.
Free function to get the local view of a grid cache object.
The available discretization methods in Dumux.
Definition cvfelocalresidual.hh:25
constexpr bool locatesPointsInScvs
Whether the grid discretization locates points in the sub-control volumes of its elements.
Definition elementscontainingpoint.hh:34
constexpr bool isCVFE
Definition method.hh:67
Definition gridcapabilities.hh:19
std::ranges::range auto scvs(const FVElementGeometry &fvGeometry, const LocalDof &localDof)
Definition localdof.hh:82
static constexpr bool axisAligned
Definition geometrytraits.hh:31