version 3.11-dev
boundaryface.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_DISCRETIZATION_BOUNDARY_FACE_HH
13#define DUMUX_DISCRETIZATION_BOUNDARY_FACE_HH
14
15#include <dune/common/fvector.hh>
16#include <dune/common/reservedvector.hh>
17#include <dune/geometry/multilineargeometry.hh>
18
21
22namespace Dumux::Experimental {
23
25template <class ct>
26struct BoundaryFaceMLGeometryTraits : public Dune::MultiLinearGeometryTraits<ct>
27{
28 // we use static vectors to store the corners as we know
29 // the maximum number of corners in advance
30 template< int mydim, int cdim >
32 {
33 using Type = Dune::ReservedVector< Dune::FieldVector< ct, cdim >, (1<<mydim)>;
34 };
35};
36
43template<class GridView>
45{
46 using Grid = typename GridView::Grid;
47 static constexpr int dim = Grid::dimension;
48 static constexpr int dimWorld = Grid::dimensionworld;
51 using Scalar = typename Grid::ctype;
53 using Geometry = Dune::MultiLinearGeometry<Scalar, dim-1, dimWorld, GeometryTraits>;
54 using CornerStorage = typename GeometryTraits::template CornerStorage<dim-1, dimWorld>::Type;
55 using GlobalPosition = typename Geometry::GlobalCoordinate;
57};
58
66template<class GV,
69{
70 using GridIndexType = typename T::GridIndexType;
71 using LocalIndexType = typename T::LocalIndexType;
72 using Scalar = typename T::Scalar;
73 using CornerStorage = typename T::CornerStorage;
74 using Geometry = typename T::Geometry;
75 using BoundaryFlag = typename T::BoundaryFlag;
76
77public:
79 using GlobalPosition = typename T::GlobalPosition;
81 using Traits = T;
82
84 BoundaryFace() = default;
85
88 const Scalar area,
90 const LocalIndexType localIdx,
91 const LocalIndexType intersectionIdx,
92 const BoundaryFlag& bFlag)
93 : center_(center)
94 , unitOuterNormal_(normal)
95 , area_(area)
96 , localIdx_(localIdx)
97 , intersectionIdx_(intersectionIdx)
98 , boundary_(true)
99 , boundaryFlag_(bFlag)
100 {}
101
103 const GlobalPosition& center() const
104 { return center_; }
105
107 Scalar area() const
108 { return area_; }
109
110 bool boundary() const
111 { return boundary_; }
112
115 { return unitOuterNormal_; }
116
118 LocalIndexType index() const
119 { return localIdx_; }
120
122 LocalIndexType intersectionIndex() const
123 { return intersectionIdx_; }
124
127 { return boundaryFlag_.get(); }
128
129private:
130 GlobalPosition center_;
131 GlobalPosition unitOuterNormal_;
132 Scalar area_;
133 LocalIndexType localIdx_;
134 LocalIndexType intersectionIdx_;
135 bool boundary_;
136 BoundaryFlag boundaryFlag_;
137};
138
139} // end namespace Dumux::Experimental
140
141#endif
Boundary flag to store e.g. in sub control volume faces.
Boundary flag to store e.g. in sub control volume faces.
Definition: boundaryflag.hh:58
std::size_t value_type
Definition: boundaryflag.hh:28
Class for a boundary face related to primary grid elements (dune intersections)
Definition: boundaryface.hh:69
LocalIndexType intersectionIndex() const
The index of the intersection this face corresponds to (intersection.indexInInside())
Definition: boundaryface.hh:122
T Traits
state the traits public and thus export all types
Definition: boundaryface.hh:81
Scalar area() const
The area of the face.
Definition: boundaryface.hh:107
LocalIndexType index() const
The local index of this face.
Definition: boundaryface.hh:118
BoundaryFace()=default
The default constructor.
BoundaryFlag::value_type boundaryFlag() const
Return the boundary flag.
Definition: boundaryface.hh:126
bool boundary() const
Definition: boundaryface.hh:110
BoundaryFace(const GlobalPosition &center, const Scalar area, const GlobalPosition &normal, const LocalIndexType localIdx, const LocalIndexType intersectionIdx, const BoundaryFlag &bFlag)
Constructor for boundary faces.
Definition: boundaryface.hh:87
const GlobalPosition unitOuterNormal() const
The unit outer normal.
Definition: boundaryface.hh:114
typename T::GlobalPosition GlobalPosition
export the type used for global coordinates
Definition: boundaryface.hh:79
const GlobalPosition & center() const
The center of the face.
Definition: boundaryface.hh:103
Vector normal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: normal.hh:26
Defines the index types used for grid and local indices.
Definition: assembly/assembler.hh:44
Dune::ReservedVector< Dune::FieldVector< ct, cdim >,(1<< mydim)> Type
Definition: boundaryface.hh:33
Traits for an efficient corner storage.
Definition: boundaryface.hh:27
Default traits class to be used for the boundary faces.
Definition: boundaryface.hh:45
static constexpr int dim
Definition: boundaryface.hh:47
typename IndexTraits< GridView >::LocalIndex LocalIndexType
Definition: boundaryface.hh:50
Dune::MultiLinearGeometry< Scalar, dim-1, dimWorld, GeometryTraits > Geometry
Definition: boundaryface.hh:53
static constexpr int dimWorld
Definition: boundaryface.hh:48
typename Grid::ctype Scalar
Definition: boundaryface.hh:51
typename Geometry::GlobalCoordinate GlobalPosition
Definition: boundaryface.hh:55
typename GridView::Grid Grid
Definition: boundaryface.hh:46
typename IndexTraits< GridView >::GridIndex GridIndexType
Definition: boundaryface.hh:49
typename GeometryTraits::template CornerStorage< dim-1, dimWorld >::Type CornerStorage
Definition: boundaryface.hh:54
typename GridView::IndexSet::IndexType GridIndex
Definition: indextraits.hh:27
unsigned int LocalIndex
Definition: indextraits.hh:28