3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
facecentered/staggered/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_DISCRETIZATION_FACECENTERED_STAGGERED_ELEMENT_BOUNDARY_TYPES_HH
25#define DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_ELEMENT_BOUNDARY_TYPES_HH
26
27#include <vector>
28
29namespace Dumux {
30
35template<class BTypes>
37{
38public:
39 using BoundaryTypes = BTypes;
40
49 template<class Problem, class FVElementGeometry>
50 void update(const Problem& problem,
51 const typename FVElementGeometry::Element& element,
52 const FVElementGeometry& fvGeometry)
53 {
54 if (!fvGeometry.hasBoundaryScvf())
55 return;
56
57 bcTypes_.resize(fvGeometry.numScvf());
58
59 hasDirichlet_ = false;
60 hasNeumann_ = false;
61
62 for (const auto& scvf : scvfs(fvGeometry))
63 {
64 if (scvf.boundary())
65 {
66 bcTypes_[scvf.localIndex()] = problem.boundaryTypes(element, scvf);
67 hasDirichlet_ = hasDirichlet_ || bcTypes_[scvf.localIndex()].hasDirichlet();
68 hasNeumann_ = hasNeumann_ || bcTypes_[scvf.localIndex()].hasNeumann();
69 }
70 }
71 }
72
77 bool hasDirichlet() const
78 { return hasDirichlet_; }
79
84 bool hasNeumann() const
85 { return hasNeumann_; }
86
87 /*
88 * \brief Access operator
89 * \return BoundaryTypes
90 */
91 const BoundaryTypes& operator[] (std::size_t i) const
92 {
93 assert(i < bcTypes_.size());
94 return bcTypes_[i];
95 }
96
97protected:
98 std::vector<BoundaryTypes> bcTypes_;
99 bool hasDirichlet_ = false;
100 bool hasNeumann_ = false;
101};
102
103} // end namespace Dumux
104
105#endif
Definition: adapt.hh:29
This class stores an array of BoundaryTypes objects.
Definition: facecentered/staggered/elementboundarytypes.hh:37
bool hasDirichlet_
Definition: facecentered/staggered/elementboundarytypes.hh:99
std::vector< BoundaryTypes > bcTypes_
Definition: facecentered/staggered/elementboundarytypes.hh:98
BTypes BoundaryTypes
Definition: facecentered/staggered/elementboundarytypes.hh:39
bool hasNeumann() const
Returns whether the element potentially features a Neumann boundary segment.
Definition: facecentered/staggered/elementboundarytypes.hh:84
bool hasDirichlet() const
Returns whether the element has a vertex which contains a Dirichlet value.
Definition: facecentered/staggered/elementboundarytypes.hh:77
const BoundaryTypes & operator[](std::size_t i) const
Definition: facecentered/staggered/elementboundarytypes.hh:91
bool hasNeumann_
Definition: facecentered/staggered/elementboundarytypes.hh:100
void update(const Problem &problem, const typename FVElementGeometry::Element &element, const FVElementGeometry &fvGeometry)
Update the boundary types for all vertices of an element.
Definition: facecentered/staggered/elementboundarytypes.hh:50