12#ifndef DUMUX_ELEMENT_BOUNDARY_TYPES_HH
13#define DUMUX_ELEMENT_BOUNDARY_TYPES_HH
18#include <dune/geometry/referenceelements.hh>
42 template<
class Problem,
class FVElementGeometry>
44 const typename FVElementGeometry::Element& element,
45 const FVElementGeometry& fvGeometry)
47 static constexpr int dim = FVElementGeometry::GridGeometry::GridView::dimension;
48 using Scalar =
typename FVElementGeometry::GridGeometry::GlobalCoordinate::value_type;
50 bcTypes_.resize(Dune::referenceElement<Scalar, dim>(element.type()).size(dim-1));
52 hasDirichlet_ =
false;
55 for (
const auto& intersection : intersections(fvGeometry.gridGeometry().gridView(), element))
57 const auto localIdx = intersection.indexInInside();
58 bcTypes_[localIdx].reset();
60 if (intersection.boundary() && !intersection.neighbor())
62 bcTypes_[localIdx] = problem.boundaryTypes(fvGeometry, intersection);
63 hasDirichlet_ = hasDirichlet_ || bcTypes_[localIdx].hasDirichlet();
64 hasNeumann_ = hasNeumann_ || bcTypes_[localIdx].hasNeumann();
74 {
return hasDirichlet_; }
81 {
return hasNeumann_; }
88 template<
class FVElementGeometry>
89 const BoundaryTypes&
get(
const FVElementGeometry& fvGeometry,
const typename FVElementGeometry::SubControlVolumeFace& scvf)
const
91 assert(scvf.boundary());
92 const auto localIdx = fvGeometry.intersectionIndex(scvf);
93 assert(localIdx < bcTypes_.size());
94 return bcTypes_[localIdx];
102 template<
class FVElementGeometry>
103 const BoundaryTypes&
get(
const FVElementGeometry&,
const typename FVElementGeometry::GridGeometry::GridView::Intersection& intersection)
const
105 assert(intersection.boundary());
106 const auto localIdx = intersection.indexInInside();
107 assert(localIdx < bcTypes_.size());
108 return bcTypes_[localIdx];
112 std::vector<BoundaryTypes> bcTypes_;
113 bool hasDirichlet_ =
false;
114 bool hasNeumann_ =
false;
This class stores an array of BoundaryTypes objects. This class is not dependent on the used discreti...
Definition: elementboundarytypes.hh:30
bool hasNeumann() const
Returns whether the element potentially features a Neumann boundary segment.
Definition: elementboundarytypes.hh:80
const BoundaryTypes & get(const FVElementGeometry &, const typename FVElementGeometry::GridGeometry::GridView::Intersection &intersection) const
Definition: elementboundarytypes.hh:103
BTypes BoundaryTypes
Definition: elementboundarytypes.hh:32
const BoundaryTypes & get(const FVElementGeometry &fvGeometry, const typename FVElementGeometry::SubControlVolumeFace &scvf) const
Definition: elementboundarytypes.hh:89
void update(const Problem &problem, const typename FVElementGeometry::Element &element, const FVElementGeometry &fvGeometry)
Update the boundary types for all element intersections.
Definition: elementboundarytypes.hh:43
bool hasDirichlet() const
Returns whether the element has an intersection with Dirichlet conditions.
Definition: elementboundarytypes.hh:73