3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
box/elementboundarytypes.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*****************************************************************************
4 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_BOX_ELEMENT_BOUNDARY_TYPES_HH
25#define DUMUX_BOX_ELEMENT_BOUNDARY_TYPES_HH
26
27#include <cassert>
28#include <vector>
29
30namespace Dumux {
31
36template<class BTypes>
38{
39public:
40 using BoundaryTypes = BTypes;
41
50 template<class Problem, class Element, class FVElementGeometry>
51 void update(const Problem &problem,
52 const Element &element,
53 const FVElementGeometry &fvGeometry)
54 {
55 using GridGeometry = typename FVElementGeometry::GridGeometry;
56 using GridView = typename GridGeometry::GridView;
57
58 vertexBCTypes_.resize( element.subEntities(GridView::dimension) );
59
60 hasDirichlet_ = false;
61 hasNeumann_ = false;
62 hasOutflow_ = false;
63
64 for (const auto& scv : scvs(fvGeometry))
65 {
66 int scvIdxLocal = scv.localDofIndex();
67 vertexBCTypes_[scvIdxLocal].reset();
68
69 if (fvGeometry.gridGeometry().dofOnBoundary(scv.dofIndex()))
70 {
71 vertexBCTypes_[scvIdxLocal] = problem.boundaryTypes(element, scv);
72
73 hasDirichlet_ = hasDirichlet_ || vertexBCTypes_[scvIdxLocal].hasDirichlet();
74 hasNeumann_ = hasNeumann_ || vertexBCTypes_[scvIdxLocal].hasNeumann();
75 }
76 }
77 }
78
83 bool hasDirichlet() const
84 { return hasDirichlet_; }
85
90 bool hasNeumann() const
91 { return hasNeumann_; }
92
93 /*
94 * \brief Access operator
95 * \return BoundaryTypes
96 */
97 const BoundaryTypes& operator[] (std::size_t i) const
98 {
99 assert(i < vertexBCTypes_.size());
100 return vertexBCTypes_[i];
101 }
102
103protected:
104 std::vector< BoundaryTypes > vertexBCTypes_;
105 bool hasDirichlet_ = false;
106 bool hasNeumann_ = false;
107 bool hasOutflow_ = false;
108};
109
110} // namespace Dumux
111
112#endif
Definition: adapt.hh:29
This class stores an array of BoundaryTypes objects.
Definition: box/elementboundarytypes.hh:38
std::vector< BoundaryTypes > vertexBCTypes_
Definition: box/elementboundarytypes.hh:104
BTypes BoundaryTypes
Definition: box/elementboundarytypes.hh:40
bool hasDirichlet_
Definition: box/elementboundarytypes.hh:105
void update(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry)
Update the boundary types for all vertices of an element.
Definition: box/elementboundarytypes.hh:51
const BoundaryTypes & operator[](std::size_t i) const
Definition: box/elementboundarytypes.hh:97
bool hasDirichlet() const
Returns whether the element has a vertex which contains a Dirichlet value.
Definition: box/elementboundarytypes.hh:83
bool hasNeumann_
Definition: box/elementboundarytypes.hh:106
bool hasNeumann() const
Returns whether the element potentially features a Neumann boundary segment.
Definition: box/elementboundarytypes.hh:90
bool hasOutflow_
Definition: box/elementboundarytypes.hh:107