Merge pull request #638 from totto82/fixBoundaryContextIncrement

fix incrementer in boundarycontext
This commit is contained in:
Tor Harald Sandve 2021-01-18 13:45:51 +01:00 committed by GitHub
commit 2f4131232c
2 changed files with 13 additions and 3 deletions

View File

@ -77,8 +77,15 @@ public:
void increment() void increment()
{ {
const auto& iend = gridView().iend(element()); const auto& iend = gridView().iend(element());
while (intersectionIt_ != iend && !intersectionIt_->boundary())
if(intersectionIt_ == iend)
return;
++intersectionIt_; ++intersectionIt_;
// iterate to the next boundary intersection
while (intersectionIt_ != iend && !intersectionIt_->boundary()) {
++intersectionIt_;
}
} }
/*! /*!
@ -245,7 +252,7 @@ public:
* *
* \param boundaryFaceIdx The local index of the boundary segment * \param boundaryFaceIdx The local index of the boundary segment
*/ */
const Intersection& intersection(unsigned boundaryFaceIdx OPM_UNUSED) const const Intersection intersection(unsigned boundaryFaceIdx OPM_UNUSED) const
{ return *intersectionIt_; } { return *intersectionIt_; }
/*! /*!

View File

@ -425,6 +425,9 @@ protected:
return; return;
BoundaryContext boundaryCtx(elemCtx); BoundaryContext boundaryCtx(elemCtx);
// move the iterator to the first boundary
if(!boundaryCtx.intersection(0).boundary())
boundaryCtx.increment();
// evaluate the boundary for all boundary faces of the current context // evaluate the boundary for all boundary faces of the current context
size_t numBoundaryFaces = boundaryCtx.numBoundaryFaces(/*timeIdx=*/0); size_t numBoundaryFaces = boundaryCtx.numBoundaryFaces(/*timeIdx=*/0);