3.4
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
porousmediumflow/sequential/boundarytypes.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_SEQUENTIAL_BOUNDARY_TYPES_HH
25#define DUMUX_SEQUENTIAL_BOUNDARY_TYPES_HH
26
27#include <algorithm>
28#include <array>
29
31
32namespace Dumux {
33
38template <int numEq>
40{
41public:
43 : BoundaryTypes<numEq>()
44 { reset(); }
45
49 void resetEq(int eqIdx)
50 {
52 seqBoundaryInfo_[eqIdx].isOutflow = false;
53 }
54
62 void reset()
63 {
64 for (int eqIdx=0; eqIdx < numEq; ++eqIdx)
65 resetEq(eqIdx);
66 }
67
72 {
73 for (int eqIdx = 0; eqIdx < numEq; ++eqIdx)
74 setOutflow(eqIdx);
75 }
76
82 void setOutflow(int eqIdx)
83 {
84 resetEq(eqIdx);
85 this->boundaryInfo_[eqIdx].visited = true;
86 seqBoundaryInfo_[eqIdx].isOutflow = true;
87 }
88
95 bool isOutflow(unsigned eqIdx) const
96 { return seqBoundaryInfo_[eqIdx].isOutflow; }
97
102 bool hasOutflow() const
103 {
104 return std::any_of(seqBoundaryInfo_.begin(),
105 seqBoundaryInfo_.end(),
106 [](const BoundaryInfo& b){ return b.isOutflow; }
107 );
108 }
109
110protected:
113 bool isOutflow : 1;
114 };
115
116 std::array<BoundaryInfo, numEq> seqBoundaryInfo_;
117};
118
119} // end namespace Dumux
120
121#endif
Definition: adapt.hh:29
Class to specify the type of a boundary.
Definition: common/boundarytypes.hh:38
void resetEq(int eqIdx)
Reset the boundary types for one equation.
Definition: common/boundarytypes.hh:63
std::array< BoundaryInfo, numEq > boundaryInfo_
Definition: common/boundarytypes.hh:427
Class to specify the type of a boundary.
Definition: porousmediumflow/sequential/boundarytypes.hh:40
void resetEq(int eqIdx)
Reset the boundary types for one equation.
Definition: porousmediumflow/sequential/boundarytypes.hh:49
void setOutflow(int eqIdx)
Set a Neumann boundary condition for a single equation.
Definition: porousmediumflow/sequential/boundarytypes.hh:82
bool isOutflow(unsigned eqIdx) const
Returns true if an equation is used to specify an outflow condition.
Definition: porousmediumflow/sequential/boundarytypes.hh:95
void setAllOutflow()
Set all boundary conditions to Neumann.
Definition: porousmediumflow/sequential/boundarytypes.hh:71
void reset()
Reset the boundary types for all equations.
Definition: porousmediumflow/sequential/boundarytypes.hh:62
bool hasOutflow() const
Returns true if some equation is used to specify an outflow condition.
Definition: porousmediumflow/sequential/boundarytypes.hh:102
SequentialBoundaryTypes()
Definition: porousmediumflow/sequential/boundarytypes.hh:42
std::array< BoundaryInfo, numEq > seqBoundaryInfo_
Definition: porousmediumflow/sequential/boundarytypes.hh:116
use bitfields to minimize the size
Definition: porousmediumflow/sequential/boundarytypes.hh:112
bool isOutflow
Definition: porousmediumflow/sequential/boundarytypes.hh:113
Class to specify the type of a boundary.