version 3.11-dev
Loading...
Searching...
No Matches
boundingboxgeometry.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_GEOMETRY_BOUNDINGBOX_GEOMETRY_HH
13#define DUMUX_GEOMETRY_BOUNDINGBOX_GEOMETRY_HH
14
15#include <dune/common/fvector.hh>
16#include <dune/geometry/type.hh>
17
19
20namespace Dumux {
21
32template<class ct, int dimworld>
34{
35public:
36 static constexpr int mydimension = dimworld;
37 static constexpr int coorddimension = dimworld;
38 using ctype = ct;
39 using GlobalCoordinate = Dune::FieldVector<ct, dimworld>;
40
42
46
48 int corners() const { return 1 << dimworld; }
49
52 {
54 for (int d = 0; d < dimworld; ++d)
55 c[d] = (i & (1 << d)) ? upper_[d] : lower_[d];
56 return c;
57 }
58
60 Dune::GeometryType type() const { return Dune::GeometryTypes::cube(dimworld); }
61
63 const GlobalCoordinate& lower() const { return lower_; }
65 const GlobalCoordinate& upper() const { return upper_; }
66
67private:
68 GlobalCoordinate lower_, upper_;
69};
70
72template<class ct, int dimworld>
74{ static constexpr bool axisAligned = true; };
75
76} // end namespace Dumux
77
78#endif
A thin axis-aligned box geometry.
Definition boundingboxgeometry.hh:34
const GlobalCoordinate & lower() const
Definition boundingboxgeometry.hh:63
GlobalCoordinate corner(int i) const
the i-th corner in Dune reference-cube ordering
Definition boundingboxgeometry.hh:51
Dune::FieldVector< ct, dimworld > GlobalCoordinate
Definition boundingboxgeometry.hh:39
Dune::GeometryType type() const
the geometry type (an axis-aligned cube)
Definition boundingboxgeometry.hh:60
const GlobalCoordinate & upper() const
Definition boundingboxgeometry.hh:65
int corners() const
the number of corners of the box
Definition boundingboxgeometry.hh:48
static constexpr int mydimension
Definition boundingboxgeometry.hh:36
static constexpr int coorddimension
Definition boundingboxgeometry.hh:37
ct ctype
Definition boundingboxgeometry.hh:38
BoundingBoxGeometry(const GlobalCoordinate &lower, const GlobalCoordinate &upper)
Construct from the lower and upper corner of the box.
Definition boundingboxgeometry.hh:44
Traits telling the bounding box tree algorithms about a leaf geometry.
Definition adapt.hh:17
static constexpr bool axisAligned
Definition boundingboxgeometry.hh:74
Traits telling the bounding box tree algorithms about a leaf geometry.
Definition geometrytraits.hh:31