24#ifndef DUMUX_DISCRETIZATION_BOX_SUBCONTROLVOLUME_HH
25#define DUMUX_DISCRETIZATION_BOX_SUBCONTROLVOLUME_HH
27#include <dune/geometry/multilineargeometry.hh>
42template<
class Gr
idView>
45 using Grid =
typename GridView::Grid;
47 static const int dim = Grid::dimension;
48 static const int dimWorld = Grid::dimensionworld;
55 template<
int mydim,
int cdim >
58 using Type = std::array< Dune::FieldVector< ct, cdim >, (1<<(
dim)) >;
65 static const bool v =
true;
66 static const unsigned int topologyId = Dune::Impl::CubeTopology< mydim >::type::id;
73 using Geometry = Dune::MultiLinearGeometry<Scalar, dim, dimWorld, ScvMLGTraits<Scalar>>;
91 using Geometry =
typename T::Geometry;
92 using GridIndexType =
typename T::GridIndexType;
93 using LocalIndexType =
typename T::LocalIndexType;
94 using Scalar =
typename T::Scalar;
95 using CornerStorage =
typename T::CornerStorage;
96 enum { dim = Geometry::mydimension };
108 template<
class GeometryHelper>
110 LocalIndexType scvIdx,
113 : corners_(geometryHelper.getScvCorners(scvIdx)),
115 volume_(geometryHelper.scvVolume(corners_)),
117 localDofIdx_(scvIdx),
121 for (
const auto&
corner : corners_)
123 center_ /= corners_.size();
142 return Geometry(Dune::GeometryTypes::cube(dim), corners_);
174 return elementIndex_;
180 assert(localIdx < corners_.size() &&
"provided index exceeds the number of corners");
181 return corners_[localIdx];
185 CornerStorage corners_;
188 GridIndexType elementIndex_;
189 LocalIndexType localDofIdx_;
190 GridIndexType dofIndex_;
Defines the index types used for grid and local indices.
Define some often used mathematical functions.
Helper class constructing the dual grid finite volume geometries for the box discretizazion method.
Base class for a sub control volume.
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
typename GridView::IndexSet::IndexType GridIndex
Definition: indextraits.hh:39
unsigned int LocalIndex
Definition: indextraits.hh:40
Default traits class to be used for the sub-control volumes for the box scheme.
Definition: discretization/box/subcontrolvolume.hh:44
typename GridView::Grid Grid
Definition: discretization/box/subcontrolvolume.hh:45
Dune::MultiLinearGeometry< Scalar, dim, dimWorld, ScvMLGTraits< Scalar > > Geometry
Definition: discretization/box/subcontrolvolume.hh:73
typename IndexTraits< GridView >::GridIndex GridIndexType
Definition: discretization/box/subcontrolvolume.hh:70
typename ScvMLGTraits< Scalar >::template CornerStorage< dim, dimWorld >::Type CornerStorage
Definition: discretization/box/subcontrolvolume.hh:74
typename IndexTraits< GridView >::LocalIndex LocalIndexType
Definition: discretization/box/subcontrolvolume.hh:71
static const int dim
Definition: discretization/box/subcontrolvolume.hh:47
static const int dimWorld
Definition: discretization/box/subcontrolvolume.hh:48
typename Grid::ctype Scalar
Definition: discretization/box/subcontrolvolume.hh:72
typename CornerStorage::value_type GlobalPosition
Definition: discretization/box/subcontrolvolume.hh:75
Definition: discretization/box/subcontrolvolume.hh:52
Definition: discretization/box/subcontrolvolume.hh:57
std::array< Dune::FieldVector< ct, cdim >,(1<<(dim)) > Type
Definition: discretization/box/subcontrolvolume.hh:58
Definition: discretization/box/subcontrolvolume.hh:64
static const bool v
Definition: discretization/box/subcontrolvolume.hh:65
static const unsigned int topologyId
Definition: discretization/box/subcontrolvolume.hh:66
the sub control volume for the box scheme
Definition: discretization/box/subcontrolvolume.hh:88
Geometry geometry() const
The geometry of the sub control volume.
Definition: discretization/box/subcontrolvolume.hh:140
const GlobalPosition & corner(LocalIndexType localIdx) const
Return the corner for the given local index.
Definition: discretization/box/subcontrolvolume.hh:178
T Traits
state the traits public and thus export all types
Definition: discretization/box/subcontrolvolume.hh:102
LocalIndexType localDofIndex() const
The element-local index of the dof this scv is embedded in.
Definition: discretization/box/subcontrolvolume.hh:146
const GlobalPosition & center() const
The center of the sub control volume.
Definition: discretization/box/subcontrolvolume.hh:127
BoxSubControlVolume()=default
The default constructor.
typename T::GlobalPosition GlobalPosition
export the type used for global coordinates
Definition: discretization/box/subcontrolvolume.hh:100
LocalIndexType indexInElement() const
Definition: discretization/box/subcontrolvolume.hh:153
GridIndexType elementIndex() const
The global index of the element this scv is embedded in.
Definition: discretization/box/subcontrolvolume.hh:172
GridIndexType dofIndex() const
The index of the dof this scv is embedded in.
Definition: discretization/box/subcontrolvolume.hh:159
Scalar volume() const
The volume of the sub control volume.
Definition: discretization/box/subcontrolvolume.hh:133
const GlobalPosition & dofPosition() const
Definition: discretization/box/subcontrolvolume.hh:165
BoxSubControlVolume(const GeometryHelper &geometryHelper, LocalIndexType scvIdx, GridIndexType elementIndex, GridIndexType dofIndex)
Definition: discretization/box/subcontrolvolume.hh:109
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