From fce103963a8cb889151d93f9b4497e10b8524233 Mon Sep 17 00:00:00 2001 From: DennisGlaeser <dennis.glaeser@iws.uni-stuttgart.de> Date: Thu, 25 Feb 2016 18:23:55 +0100 Subject: [PATCH] [Implicit] Adjust CC and Box ElementBoundaryTypes to new structure --- dumux/implicit/box/elementboundarytypes.hh | 30 +++++++++++-------- .../cellcentered/elementboundarytypes.hh | 30 +++++++++++-------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/dumux/implicit/box/elementboundarytypes.hh b/dumux/implicit/box/elementboundarytypes.hh index 899ba1290d..50ddbef19a 100644 --- a/dumux/implicit/box/elementboundarytypes.hh +++ b/dumux/implicit/box/elementboundarytypes.hh @@ -75,9 +75,11 @@ public: * \param problem The problem object which needs to be simulated * \param element The DUNE Codim<0> entity for which the boundary * types should be collected + * \param fvGeometry The element's finite volume geometry */ void update(const Problem &problem, - const Element &element) + const Element &element, + const FVElementGeometry &fvGeometry) { int numVertices = element.subEntities(dim); @@ -87,15 +89,18 @@ public: hasNeumann_ = false; hasOutflow_ = false; - for (int i = 0; i < numVertices; ++i) { - (*this)[i].reset(); + for (auto&& scv : fvGeometry.scvs()) + { + int scvIdxLocal = scv.indexInElement(); + (*this)[scvIdxLocal].reset(); - if (problem.model().onBoundary(element, i)) { - problem.boundaryTypes((*this)[i], element.template subEntity<dim>(i)); + if (problem.model().onBoundary(scv)) + { + (*this)[scvIdxLocal] = problem.boundaryTypes(element, scv); - hasDirichlet_ = hasDirichlet_ || (*this)[i].hasDirichlet(); - hasNeumann_ = hasNeumann_ || (*this)[i].hasNeumann(); - hasOutflow_ = hasOutflow_ || (*this)[i].hasOutflow(); + hasDirichlet_ = hasDirichlet_ || (*this)[scvIdxLocal].hasDirichlet(); + hasNeumann_ = hasNeumann_ || (*this)[scvIdxLocal].hasNeumann(); + hasOutflow_ = hasOutflow_ || (*this)[scvIdxLocal].hasOutflow(); } } } @@ -106,12 +111,13 @@ public: * \param problem The problem object which needs to be simulated * \param element The DUNE Codim<0> entity for which the boundary * types should be collected - * \param fvGeometry The element's finite volume geometry */ void update(const Problem &problem, - const Element &element, - const FVElementGeometry &fvGeometry) - { update(problem, element); } + const Element &element) + { + const auto& fvGeometry = problem.model().fvGeometries(element); + update(problem, element, fvGeometry); + } /*! * \brief Returns whether the element has a vertex which contains diff --git a/dumux/implicit/cellcentered/elementboundarytypes.hh b/dumux/implicit/cellcentered/elementboundarytypes.hh index 474e52a6fa..ca003f96e3 100644 --- a/dumux/implicit/cellcentered/elementboundarytypes.hh +++ b/dumux/implicit/cellcentered/elementboundarytypes.hh @@ -76,7 +76,8 @@ public: * types should be collected */ void update(const Problem &problem, - const Element &element) + const Element &element, + const FVElementGeometry &fvGeometry) { this->resize(1); @@ -86,26 +87,29 @@ public: (*this)[0].reset(); - if (problem.model().onBoundary(element)) + for (auto&& scv : fvGeometry.scvs()) { - for (const auto& intersection : intersections(problem.gridView(), element)) + if (!problem.model().onBoundary(scv)) + return; + + for (const auto&& scvFace : fvGeometry.scvfs()) { - if (intersection.boundary()) - { - problem.boundaryTypes((*this)[0], intersection); - - hasDirichlet_ = hasDirichlet_ || (*this)[0].hasDirichlet(); - hasNeumann_ = hasNeumann_ || (*this)[0].hasNeumann(); - hasOutflow_ = hasOutflow_ || (*this)[0].hasOutflow(); - } + if (!scvFace.boundary()) + continue; + + (*this)[0] = problem.boundaryTypes(element, scvFace); + + hasDirichlet_ = hasDirichlet_ || (*this)[0].hasDirichlet(); + hasNeumann_ = hasNeumann_ || (*this)[0].hasNeumann(); + hasOutflow_ = hasOutflow_ || (*this)[0].hasOutflow(); } } } void update(const Problem &problem, - const Element &element, - const FVElementGeometry &fvGeometry) + const Element &element) { + const auto& fvGeometry = problem.model().fvGeometries(element); update(problem, element); } -- GitLab