diff --git a/dumux/discretization/box/fvelementgeometry.hh b/dumux/discretization/box/fvelementgeometry.hh index 926ef8c9ff2cc14c964afbdf95944d6399e866e9..3b06ab52300c9a3c9be04237a7ebe2067f52b025 100644 --- a/dumux/discretization/box/fvelementgeometry.hh +++ b/dumux/discretization/box/fvelementgeometry.hh @@ -148,6 +148,10 @@ public: const FVGridGeometry& fvGridGeometry() const { return *fvGridGeometryPtr_; } + //! Returns whether one of the geometry's scvfs lies on a boundary + bool hasBoundaryScvf() const + { return fvGridGeometry().hasBoundaryScvf(eIdx_); } + private: const Element* elementPtr_; const FVGridGeometry* fvGridGeometryPtr_; @@ -263,11 +267,16 @@ public: const FVGridGeometry& fvGridGeometry() const { return *fvGridGeometryPtr_; } + //! Returns whether one of the geometry's scvfs lies on a boundary + bool hasBoundaryScvf() const + { return hasBoundaryScvf_; } + private: void makeElementGeometries(const Element& element) { auto eIdx = fvGridGeometry().elementMapper().index(element); + hasBoundaryScvf_ = false; // get the element geometry auto elementGeometry = element.geometry(); @@ -316,6 +325,7 @@ private: if (intersection.boundary() && !intersection.neighbor()) { const auto isGeometry = intersection.geometry(); + hasBoundaryScvf_ = true; for (unsigned int isScvfLocalIdx = 0; isScvfLocalIdx < isGeometry.corners(); ++isScvfLocalIdx) { @@ -348,6 +358,8 @@ private: //! vectors to store the geometries locally after binding an element std::vector<SubControlVolume> scvs_; std::vector<SubControlVolumeFace> scvfs_; + + bool hasBoundaryScvf_ = false; }; } // end namespace Dumux diff --git a/dumux/discretization/box/fvgridgeometry.hh b/dumux/discretization/box/fvgridgeometry.hh index 98ea2b78ecadcc33839ea7337be24681d6d25636..b6d0a3b8034b4caec8cfe74429c8110a898e78aa 100644 --- a/dumux/discretization/box/fvgridgeometry.hh +++ b/dumux/discretization/box/fvgridgeometry.hh @@ -156,6 +156,7 @@ public: auto numElements = this->gridView().size(0); scvs_.resize(numElements); scvfs_.resize(numElements); + hasBoundaryScvf_.resize(numElements, false); boundaryDofIndices_.assign(numDofs(), false); @@ -215,6 +216,8 @@ public: if (intersection.boundary() && !intersection.neighbor()) { const auto isGeometry = intersection.geometry(); + hasBoundaryScvf_[eIdx] = true; + // count numScvf_ += isGeometry.corners(); numBoundaryScvf_ += isGeometry.corners(); @@ -317,6 +320,10 @@ public: const std::unordered_map<std::size_t, std::size_t>& periodicVertexMap() const { return periodicVertexMap_; } + //! Returns whether one of the geometry's scvfs lies on a boundary + bool hasBoundaryScvf(std::size_t eIdx) const + { return hasBoundaryScvf_[eIdx]; } + private: const FeCache feCache_; @@ -330,6 +337,7 @@ private: // vertices on the boudary std::vector<bool> boundaryDofIndices_; + std::vector<bool> hasBoundaryScvf_; // a map for periodic boundary vertices std::unordered_map<std::size_t, std::size_t> periodicVertexMap_;