From e567fbf2eea00216db61b65cd187c8349193b10d Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Fri, 16 Dec 2022 11:09:57 +0100
Subject: [PATCH] [diamond] For convenience, flag dofs on the boundary

---
 .../facecentered/diamond/fvgridgeometry.hh      | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/dumux/discretization/facecentered/diamond/fvgridgeometry.hh b/dumux/discretization/facecentered/diamond/fvgridgeometry.hh
index 378f0c4b39..3cc239b5e4 100644
--- a/dumux/discretization/facecentered/diamond/fvgridgeometry.hh
+++ b/dumux/discretization/facecentered/diamond/fvgridgeometry.hh
@@ -153,6 +153,10 @@ public:
     const FeCache& feCache() const
     { return feCache_; }
 
+    //! If a face / d.o.f. is on the boundary
+    bool dofOnBoundary(GridIndexType dofIdx) const
+    { return boundaryDofIndices_[dofIdx]; }
+
     //! Return a reference to the dof mapper
     const DofMapper& dofMapper() const
     { return dofMapper_; }
@@ -232,6 +236,8 @@ private:
         cache_.scvfs_.resize(numElements);
         cache_.hasBoundaryScvf_.resize(numElements, false);
 
+        boundaryDofIndices_.assign(numDofs(), false);
+
         numScv_ = 0;
         numScvf_ = 0;
         numBoundaryScvf_ = 0;
@@ -293,9 +299,15 @@ private:
             {
                 if (onDomainBoundary_(intersection))
                 {
+                    // store information that the face dof is on a boundary
+                    const LocalIndexType localFacetIndex = intersection.indexInInside();
+                    const auto dofIndex = dofMapper().subIndex(element, localFacetIndex, 1);
+                    boundaryDofIndices_[dofIndex] = true;
+
+                    // and that the element has a boundary face
                     cache_.hasBoundaryScvf_[eIdx] = true;
 
-                    const LocalIndexType localFacetIndex = intersection.indexInInside();
+                    // add boundary scvf
                     const auto geo = intersection.geometry();
                     cache_.scvfs_[eIdx].emplace_back(
                         geo.center(),
@@ -359,6 +371,9 @@ private:
         return intersection.boundary() && intersection.neighbor();
     }
 
+    // faces on the boundary
+    std::vector<bool> boundaryDofIndices_;
+
     DofMapper dofMapper_;
 
     std::size_t numScv_;
-- 
GitLab