version 3.11-dev
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 BoundarySegmentIndexFlag(const Intersection& i)
35 : flag_(invalidFlag_)
36 {
37 if (i.boundary())
38 flag_ = i.boundarySegmentIndex();
39 }
40
41 value_type get() const { return flag_; }
42
43 operator bool() const { return flag_ != invalidFlag_; }
44
45private:
46 static constexpr value_type invalidFlag_ = std::numeric_limits<value_type>::max();
47 value_type flag_;
48};
49
56template<class Grid>
59
60} // end namespace Dumux
61
62#endif
Boundary flag to store e.g. in sub control volume faces.
Definition: boundaryflag.hh:58
Class for accessing boundary flags.
Definition: boundaryflag.hh:26
std::size_t value_type
Definition: boundaryflag.hh:28
BoundarySegmentIndexFlag(const Intersection &i)
Definition: boundaryflag.hh:34
BoundarySegmentIndexFlag()
Definition: boundaryflag.hh:30
value_type get() const
Definition: boundaryflag.hh:41
Definition: adapt.hh:17