version 3.11-dev
discretization/cellcentered/subcontrolvolume.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_CC_SUBCONTROLVOLUME_HH
13#define DUMUX_DISCRETIZATION_CC_SUBCONTROLVOLUME_HH
14
16
17namespace Dumux {
18
25template<class GridView>
27{
28 using Geometry = typename GridView::template Codim<0>::Geometry;
31 using Scalar = typename GridView::ctype;
32 using Element = typename GridView::template Codim<0>::Entity;
33 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
34};
35
42template<class GV,
45{
47 using GridIndexType = typename T::GridIndexType;
48 using LocalIndexType = typename T::LocalIndexType;
49 using Scalar = typename T::Scalar;
50public:
52 using GlobalPosition = typename T::GlobalPosition;
54 using Traits = T;
55
56 CCSubControlVolume() = default;
57
58 template<class Geometry>
59 CCSubControlVolume(Geometry&& geometry,
60 GridIndexType elementIndex)
61 : volume_(geometry.volume())
62 , center_(geometry.center())
63 , elementIndex_(elementIndex)
64 {}
65
67 const GlobalPosition& center() const
68 {
69 return center_;
70 }
71
73 Scalar volume() const
74 {
75 return volume_;
76 }
77
79 GridIndexType dofIndex() const
80 {
81 return elementIndex();
82 }
83
85 LocalIndexType localDofIndex() const
86 {
87 return 0;
88 }
89
92 LocalIndexType indexInElement() const
93 {
94 return 0;
95 }
96
97 // The position of the dof this scv is embedded in
99 {
100 return center_;
101 }
102
104 GridIndexType elementIndex() const
105 {
106 return elementIndex_;
107 }
108
109private:
110 Scalar volume_;
111 GlobalPosition center_;
112 GridIndexType elementIndex_;
113};
114
115} // end namespace Dumux
116
117#endif
Sub control volumes for cell-centered discretization schemes.
Definition: discretization/cellcentered/subcontrolvolume.hh:45
GridIndexType elementIndex() const
The global index of the element this scv is embedded in.
Definition: discretization/cellcentered/subcontrolvolume.hh:104
Scalar volume() const
The volume of the sub control volume.
Definition: discretization/cellcentered/subcontrolvolume.hh:73
LocalIndexType localDofIndex() const
The element-local index of the dof this scv is embedded in.
Definition: discretization/cellcentered/subcontrolvolume.hh:85
LocalIndexType indexInElement() const
Definition: discretization/cellcentered/subcontrolvolume.hh:92
CCSubControlVolume(Geometry &&geometry, GridIndexType elementIndex)
Definition: discretization/cellcentered/subcontrolvolume.hh:59
T Traits
state the traits public and thus export all types
Definition: discretization/cellcentered/subcontrolvolume.hh:54
typename T::GlobalPosition GlobalPosition
export the type used for global coordinates
Definition: discretization/cellcentered/subcontrolvolume.hh:52
const GlobalPosition & dofPosition() const
Definition: discretization/cellcentered/subcontrolvolume.hh:98
GridIndexType dofIndex() const
The index of the dof this scv is embedded in (the global index of this scv)
Definition: discretization/cellcentered/subcontrolvolume.hh:79
const GlobalPosition & center() const
The center of the sub control volume.
Definition: discretization/cellcentered/subcontrolvolume.hh:67
Defines the index types used for grid and local indices.
Definition: adapt.hh:17
Default traits class to be used for the sub-control volumes for the cell-centered finite volume schem...
Definition: discretization/cellcentered/subcontrolvolume.hh:27
typename IndexTraits< GridView >::GridIndex GridIndexType
Definition: discretization/cellcentered/subcontrolvolume.hh:29
typename GridView::template Codim< 0 >::Geometry Geometry
Definition: discretization/cellcentered/subcontrolvolume.hh:28
typename IndexTraits< GridView >::LocalIndex LocalIndexType
Definition: discretization/cellcentered/subcontrolvolume.hh:30
typename GridView::template Codim< 0 >::Entity Element
Definition: discretization/cellcentered/subcontrolvolume.hh:32
typename Element::Geometry::GlobalCoordinate GlobalPosition
Definition: discretization/cellcentered/subcontrolvolume.hh:33
typename GridView::ctype Scalar
Definition: discretization/cellcentered/subcontrolvolume.hh:31
typename GridView::IndexSet::IndexType GridIndex
Definition: indextraits.hh:27
unsigned int LocalIndex
Definition: indextraits.hh:28