version 3.8
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// 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_SUBCONTROLVOLUME_HH
13#define DUMUX_SUBCONTROLVOLUME_HH
14
15namespace Dumux {
16
24template<class Imp, class ScvGeometryTraits>
26{
27 using Implementation = Imp;
28 using GridIndexType = typename ScvGeometryTraits::GridIndexType;
29 using LocalIndexType = typename ScvGeometryTraits::LocalIndexType;
30 using Scalar = typename ScvGeometryTraits::Scalar;
31
32public:
34 using GlobalPosition = typename ScvGeometryTraits::GlobalPosition;
36 using Traits = ScvGeometryTraits;
37
40 {
41 return asImp_().center();
42 }
43
45 Scalar volume() const
46 {
47 return asImp_().volume();
48 }
49
51 GridIndexType dofIndex() const
52 {
53 return asImp_().dofIndex();
54 }
55
57 LocalIndexType localDofIndex() const
58 {
59 return asImp_().localDofIndex();
60 }
61
62 // The position of the dof this scv is embedded in
64 {
65 return asImp_().dofPosition();
66 }
67
69 GridIndexType elementIndex() const
70 {
71 return asImp_().elementIndex();
72 }
73
74private:
75 const Implementation& asImp_() const
76 { return *static_cast<const Implementation*>(this);}
77
78 Implementation& asImp_()
79 { return *static_cast<Implementation*>(this);}
80};
81
82} // end namespace Dumux
83
84#endif
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
GridIndexType dofIndex() const
The index of the dof this scv is embedded in (ccfv)
Definition: subcontrolvolumebase.hh:51
ScvGeometryTraits Traits
state the traits public and thus export all types
Definition: subcontrolvolumebase.hh:36
typename ScvGeometryTraits::GlobalPosition GlobalPosition
export the type used for global coordinates
Definition: subcontrolvolumebase.hh:34
Scalar volume() const
The volume of the sub control volume.
Definition: subcontrolvolumebase.hh:45
LocalIndexType localDofIndex() const
The index of the dof this scv is embedded in (box)
Definition: subcontrolvolumebase.hh:57
GlobalPosition dofPosition() const
Definition: subcontrolvolumebase.hh:63
GlobalPosition center() const
The center of the sub control volume.
Definition: subcontrolvolumebase.hh:39
GridIndexType elementIndex() const
The global index of the element this scv is embedded in.
Definition: subcontrolvolumebase.hh:69
Definition: adapt.hh:17