From ed79f28279967f214e7fc94d4f4209c9c112d325 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de> Date: Thu, 15 Nov 2018 10:50:54 +0100 Subject: [PATCH] [box] Add hasBoundaryScvf() to fvGeometry --- dumux/discretization/box/fvelementgeometry.hh | 12 ++++++++++++ dumux/discretization/box/fvgridgeometry.hh | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/dumux/discretization/box/fvelementgeometry.hh b/dumux/discretization/box/fvelementgeometry.hh index 926ef8c9ff..3b06ab5230 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 98ea2b78ec..b6d0a3b803 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_; -- GitLab