version 3.11-dev
Loading...
Searching...
No Matches
boundaryflag.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-FileCopyrightText: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_BOUNDARY_FLAG_HH
13#define DUMUX_BOUNDARY_FLAG_HH
14
15#include <cstddef>
16#include <limits>
17
18namespace Dumux {
19
26{
27public:
28 using value_type = std::size_t;
29
31 : flag_(invalidFlag_) {}
32
33 template<class Intersection>
34 requires requires(const Intersection& i) { i.boundary(); i.boundarySegmentIndex(); }
35 BoundarySegmentIndexFlag(const Intersection& i)
36 : flag_(invalidFlag_)
37 {
38 if (i.boundary())
39 flag_ = i.boundarySegmentIndex();
40 }
41
44 : flag_(flag) {}
45
46 value_type get() const { return flag_; }
47
48 operator bool() const { return flag_ != invalidFlag_; }
49
50private:
51 static constexpr value_type invalidFlag_ = std::numeric_limits<value_type>::max();
52 value_type flag_;
53};
54
61template<class Grid>
62class BoundaryFlag : public BoundarySegmentIndexFlag
64
65} // end namespace Dumux
66
67#endif
Boundary flag to store e.g. in sub control volume faces.
Definition boundaryflag.hh:63
std::size_t value_type
Definition boundaryflag.hh:28
BoundarySegmentIndexFlag(const Intersection &i)
Definition boundaryflag.hh:35
BoundarySegmentIndexFlag(value_type flag)
Construct from a flag value, for faces derived from other faces rather than from an intersection.
Definition boundaryflag.hh:43
BoundarySegmentIndexFlag()
Definition boundaryflag.hh:30
value_type get() const
Definition boundaryflag.hh:46
Definition adapt.hh:17