3.2-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
subcontrolvolumebase.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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_SUBCONTROLVOLUME_HH
25#define DUMUX_SUBCONTROLVOLUME_HH
26
27namespace Dumux {
28
36template<class Imp, class ScvGeometryTraits>
38{
39 using Implementation = Imp;
40 using GridIndexType = typename ScvGeometryTraits::GridIndexType;
41 using LocalIndexType = typename ScvGeometryTraits::LocalIndexType;
42 using Scalar = typename ScvGeometryTraits::Scalar;
43
44public:
46 using GlobalPosition = typename ScvGeometryTraits::GlobalPosition;
48 using Traits = ScvGeometryTraits;
49
52 {
53 return asImp_().center();
54 }
55
57 Scalar volume() const
58 {
59 return asImp_().volume();
60 }
61
63 GridIndexType dofIndex() const
64 {
65 return asImp_().dofIndex();
66 }
67
69 LocalIndexType localDofIndex() const
70 {
71 return asImp_().localDofIndex();
72 }
73
74 // The position of the dof this scv is embedded in
76 {
77 return asImp_().dofPosition();
78 }
79
81 GridIndexType elementIndex() const
82 {
83 return asImp_().elementIndex();
84 }
85
86private:
87 const Implementation& asImp_() const
88 { return *static_cast<const Implementation*>(this);}
89
90 Implementation& asImp_()
91 { return *static_cast<Implementation*>(this);}
92};
93
94} // end namespace Dumux
95
96#endif
Definition: adapt.hh:29
Base class for a sub control volume, i.e a part of the control volume we are making the balance for....
Definition: subcontrolvolumebase.hh:38
GridIndexType dofIndex() const
The index of the dof this scv is embedded in (ccfv)
Definition: subcontrolvolumebase.hh:63
ScvGeometryTraits Traits
state the traits public and thus export all types
Definition: subcontrolvolumebase.hh:48
typename ScvGeometryTraits::GlobalPosition GlobalPosition
export the type used for global coordinates
Definition: subcontrolvolumebase.hh:46
Scalar volume() const
The volume of the sub control volume.
Definition: subcontrolvolumebase.hh:57
LocalIndexType localDofIndex() const
The index of the dof this scv is embedded in (box)
Definition: subcontrolvolumebase.hh:69
GlobalPosition dofPosition() const
Definition: subcontrolvolumebase.hh:75
GlobalPosition center() const
The center of the sub control volume.
Definition: subcontrolvolumebase.hh:51
GridIndexType elementIndex() const
The global index of the element this scv is embedded in.
Definition: subcontrolvolumebase.hh:81