version 3.8
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-FileCopyrightInfo: 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
17
18namespace Dumux {
19
26template<class GridView>
28{
29 using Geometry = typename GridView::template Codim<0>::Geometry;
32 using Scalar = typename GridView::ctype;
33 using Element = typename GridView::template Codim<0>::Entity;
34 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
35};
36
43template<class GV,
46: public SubControlVolumeBase<CCSubControlVolume<GV, T>, T>
47{
50 using GridIndexType = typename T::GridIndexType;
51 using LocalIndexType = typename T::LocalIndexType;
52 using Scalar = typename T::Scalar;
53public:
55 using GlobalPosition = typename T::GlobalPosition;
57 using Traits = T;
58
59 CCSubControlVolume() = default;
60
61 template<class Geometry>
62 CCSubControlVolume(Geometry&& geometry,
63 GridIndexType elementIndex)
64 : ParentType()
65 , volume_(geometry.volume())
66 , center_(geometry.center())
67 , elementIndex_(elementIndex)
68 {}
69
71 const GlobalPosition& center() const
72 {
73 return center_;
74 }
75
77 Scalar volume() const
78 {
79 return volume_;
80 }
81
83 GridIndexType dofIndex() const
84 {
85 return elementIndex();
86 }
87
89 LocalIndexType localDofIndex() const
90 {
91 return 0;
92 }
93
96 LocalIndexType indexInElement() const
97 {
98 return 0;
99 }
100
101 // The position of the dof this scv is embedded in
103 {
104 return center_;
105 }
106
108 GridIndexType elementIndex() const
109 {
110 return elementIndex_;
111 }
112
113private:
114 Scalar volume_;
115 GlobalPosition center_;
116 GridIndexType elementIndex_;
117};
118
119} // end namespace Dumux
120
121#endif
Sub control volumes for cell-centered discretization schemes.
Definition: discretization/cellcentered/subcontrolvolume.hh:47
GridIndexType elementIndex() const
The global index of the element this scv is embedded in.
Definition: discretization/cellcentered/subcontrolvolume.hh:108
Scalar volume() const
The volume of the sub control volume.
Definition: discretization/cellcentered/subcontrolvolume.hh:77
LocalIndexType localDofIndex() const
The element-local index of the dof this scv is embedded in.
Definition: discretization/cellcentered/subcontrolvolume.hh:89
LocalIndexType indexInElement() const
Definition: discretization/cellcentered/subcontrolvolume.hh:96
CCSubControlVolume(Geometry &&geometry, GridIndexType elementIndex)
Definition: discretization/cellcentered/subcontrolvolume.hh:62
T Traits
state the traits public and thus export all types
Definition: discretization/cellcentered/subcontrolvolume.hh:57
typename T::GlobalPosition GlobalPosition
export the type used for global coordinates
Definition: discretization/cellcentered/subcontrolvolume.hh:55
const GlobalPosition & dofPosition() const
Definition: discretization/cellcentered/subcontrolvolume.hh:102
GridIndexType dofIndex() const
The index of the dof this scv is embedded in (the global index of this scv)
Definition: discretization/cellcentered/subcontrolvolume.hh:83
const GlobalPosition & center() const
The center of the sub control volume.
Definition: discretization/cellcentered/subcontrolvolume.hh:71
Base class for a sub control volume, i.e a part of the control volume we are making the balance for....
Definition: subcontrolvolumebase.hh:26
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:28
typename IndexTraits< GridView >::GridIndex GridIndexType
Definition: discretization/cellcentered/subcontrolvolume.hh:30
typename GridView::template Codim< 0 >::Geometry Geometry
Definition: discretization/cellcentered/subcontrolvolume.hh:29
typename IndexTraits< GridView >::LocalIndex LocalIndexType
Definition: discretization/cellcentered/subcontrolvolume.hh:31
typename GridView::template Codim< 0 >::Entity Element
Definition: discretization/cellcentered/subcontrolvolume.hh:33
typename Element::Geometry::GlobalCoordinate GlobalPosition
Definition: discretization/cellcentered/subcontrolvolume.hh:34
typename GridView::ctype Scalar
Definition: discretization/cellcentered/subcontrolvolume.hh:32
typename GridView::IndexSet::IndexType GridIndex
Definition: indextraits.hh:27
unsigned int LocalIndex
Definition: indextraits.hh:28
Base class for a sub control volume.