version 3.8.0
Loading...
Searching...
No Matches
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// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_ELEMENT_BOUNDARY_TYPES_HH
13#define DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_ELEMENT_BOUNDARY_TYPES_HH
14
15#include <vector>
16
17namespace Dumux {
18
23template<class BTypes>
25{
26public:
27 using BoundaryTypes = BTypes;
28
37 template<class Problem, class FVElementGeometry>
38 void update(const Problem& problem,
39 const typename FVElementGeometry::Element& element,
40 const FVElementGeometry& fvGeometry)
41 {
42 if (!fvGeometry.hasBoundaryScvf())
43 return;
44
45 bcTypes_.resize(fvGeometry.numScvf());
46
47 hasDirichlet_ = false;
48 hasNeumann_ = false;
49
50 for (const auto& scvf : scvfs(fvGeometry))
51 {
52 if (scvf.boundary())
53 {
54 bcTypes_[scvf.localIndex()] = problem.boundaryTypes(element, scvf);
55 hasDirichlet_ = hasDirichlet_ || bcTypes_[scvf.localIndex()].hasDirichlet();
56 hasNeumann_ = hasNeumann_ || bcTypes_[scvf.localIndex()].hasNeumann();
57 }
58 }
59 }
60
65 bool hasDirichlet() const
66 { return hasDirichlet_; }
67
72 bool hasNeumann() const
73 { return hasNeumann_; }
74
75 /*
76 * \brief Access operator
77 * \return BoundaryTypes
78 */
79 const BoundaryTypes& operator[] (std::size_t i) const
80 {
81 assert(i < bcTypes_.size());
82 return bcTypes_[i];
83 }
84
85protected:
86 std::vector<BoundaryTypes> bcTypes_;
87 bool hasDirichlet_ = false;
88 bool hasNeumann_ = false;
89};
90
91} // end namespace Dumux
92
93#endif
This class stores an array of BoundaryTypes objects.
Definition facecentered/staggered/elementboundarytypes.hh:25
bool hasDirichlet_
Definition facecentered/staggered/elementboundarytypes.hh:87
std::vector< BoundaryTypes > bcTypes_
Definition facecentered/staggered/elementboundarytypes.hh:86
BTypes BoundaryTypes
Definition facecentered/staggered/elementboundarytypes.hh:27
bool hasNeumann() const
Returns whether the element potentially features a Neumann boundary segment.
Definition facecentered/staggered/elementboundarytypes.hh:72
bool hasDirichlet() const
Returns whether the element has a vertex which contains a Dirichlet value.
Definition facecentered/staggered/elementboundarytypes.hh:65
const BoundaryTypes & operator[](std::size_t i) const
Definition facecentered/staggered/elementboundarytypes.hh:79
bool hasNeumann_
Definition facecentered/staggered/elementboundarytypes.hh:88
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:38
Definition adapt.hh:17